Re: SELECT returning too many rows (?) - Mailing list pgsql-bugs

From Stephan Szabo
Subject Re: SELECT returning too many rows (?)
Date
Msg-id 20050208064347.V50261@megazone.bigpanda.com
Whole thread Raw
In response to SELECT returning too many rows (?)  (rob <rob@dsvr.net>)
Responses Re: SELECT returning too many rows (?)  (rob <rob@dsvr.net>)
List pgsql-bugs
On Tue, 8 Feb 2005, rob wrote:

> We appear to have some kind of problem on one of our internal production
> systems and I can't think were first to look.
>
> What follows is some selects. Note the OID. The column 'id' is primary
> key. The production system makes selects based on status. As you can see
> the same row is apparently returned when selecting on any column except
> the primary key, however the EXPLAIN seems correct.
>
> Could this be an INDEX corruption or a fixed bug in postgres ?
>
> processing=#  select oid, id, aid, status from q_certs where id = '224';
>    oid    | id  |  aid  | status
> ----------+-----+-------+--------
>  15282219 | 224 | 23604 | 1
> (1 row)
>
>
> processing=#  select oid, id, aid, status from q_certs where oid =
> 15282219 ;
>    oid    | id  |  aid  | status
> ----------+-----+-------+--------
>  15282219 | 224 | 23604 | 1
>  15282219 | 224 | 23604 | 1
>  15282219 | 224 | 23604 | 1

Hmm, could you run the above including the system-columns ctid, xmin,
cmin, xmax, cmax?

It doesn't look like plain index corruption to me since it looks like that
was from a seq scan of the table.

>  id        | integer                  | not null default nextval
> ('"q_certs_id_seq"'::text)
>  aid       | integer                  | not null
>  intcode   | text                     | not null
>  seqid     | integer                  | not null
>  objid     | integer                  | not null
>  type      | text                     | not null
>  status    | text                     | not null
>  lastevent | text                     |
>  date      | timestamp with time zone | not null
>  data      | text                     | not null
> Indexes:
>     "q_certs_pkey" primary key, btree (id)
> Triggers:
>     tr_trans BEFORE INSERT OR UPDATE ON q_certs FOR EACH ROW EXECUTE
> PROCEDURE tr_trans()
> Inherits: _q

Just for completeness sake, what is _q and what does the trigger do?

pgsql-bugs by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: BUG #1469: ECPG : Can't delete an item pointed by a cursor
Next
From: rob
Date:
Subject: Re: SELECT returning too many rows (?)