tags:

views:

53

answers:

1

I'm using postgresql 9.0 beta 4.

After inserting a lot of data into a partitioned table, i found a weird thing. When I query the table, i can see an empty row with null-like values in 'not-null' fields.

That weird query result is like below.

alt text

689th row is empty. The first 3 fields, (stid, d, ticker), are composing primary key. So they should not be null. The query i used is this.

select * from st_daily2 where stid=267408 order by d

I can even do the group by on this data.

select stid, date_trunc('month', d) ym, count(*) from st_daily2 
where stid=267408 group by stid, date_trunc('month', d)

The 'group by' results still has the empty row.

alt text

The 1st row is empty. But if i query where 'stid' or 'd' is null, then it returns nothing.

Is this a bug of postgresql 9b4? Or some data corruption?

EDIT :

  1. I added my table definition.

    CREATE TABLE st_daily
    (
    stid integer NOT NULL,
    d date NOT NULL,
    ticker character varying(15) NOT NULL,
    mp integer NOT NULL,
    settlep double precision NOT NULL,
    prft integer NOT NULL,
    atr20 double precision NOT NULL,
    upd timestamp with time zone,
    ntrds double precision
    )
    WITH (
    OIDS=FALSE
    );
    
    
    CREATE TABLE st_daily2
    (
    CONSTRAINT st_daily2_pk PRIMARY KEY (stid, d, ticker),
    CONSTRAINT st_daily2_strgs_fk FOREIGN KEY (stid)
        REFERENCES strgs (stid) MATCH SIMPLE
        ON UPDATE CASCADE ON DELETE CASCADE,
    CONSTRAINT st_daily2_ck CHECK (stid >= 200000 AND stid < 300000)
    )
    INHERITS (st_daily)
    WITH (
    OIDS=FALSE
    );
    
  2. The data in this table is simulation results. Multithreaded multiple simulation engines written in c# insert data into the database using Npgsql.

  3. psql also shows the empty row.

alt text

A: 

You'd better leave a posting at http://www.postgresql.org/support/submitbug

Some questions:

  1. Could you show use the table definitions and constraints for the partions?
  2. How did you load your data?
  3. You get the same result when using another tool, like psql?
Frank Heikens
Thanks for your answer. I added answers for your questions on my post.
tk
I submitted a bug report to the postgresql.org and got the reply that it requires the approval of the moderators.
tk