Re: SELECT returning too many rows (?)

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: rob <rob(at)dsvr(dot)net>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: SELECT returning too many rows (?)
Date: 2005-02-08 14:47:25
Message-ID: 20050208064347.V50261@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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?

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message rob 2005-02-08 14:59:07 Re: SELECT returning too many rows (?)
Previous Message Peter Eisentraut 2005-02-08 14:13:11 Re: BUG #1469: ECPG : Can't delete an item pointed by a cursor