BUG #4913: Row missing from primary key index

From: "Mathieu De Zutter" <mathieu(at)dezutter(dot)org>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #4913: Row missing from primary key index
Date: 2009-07-09 21:53:06
Message-ID: 200907092153.n69Lr6vV022999@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 4913
Logged by: Mathieu De Zutter
Email address: mathieu(at)dezutter(dot)org
PostgreSQL version: 8.3.7
Operating system: Debian Lenny
Description: Row missing from primary key index
Details:

I have a table log_event with a primary key on an integer 'id', called
log_event_pkey.

The tables contains a duplicate for id = 15723018. The duplicate (note that
besides the id, all data differs) doesn't seem to be known by the index at
all.

Example:

shs=# select id, event_timestamp from log_event where id = 15723018;
id | event_timestamp
----------+----------------------------
15723018 | 2009-05-09 13:47:33.441668
(1 row)

But with indexscan and bitmapscan off, I get:

shs=# select id, event_timestamp from log_event where id = 15723018;
id | event_timestamp
----------+----------------------------
15723018 | 2009-05-09 13:47:48.68558
15723018 | 2009-05-09 13:47:33.441668
(2 rows)

Table definition:
shs=# \d log_event
Table "public.log_event"
Column | Type |
Modifiers
-----------------+-----------------------------+----------------------------
----------------------------
id | bigint | not null default
nextval('log_event_id_seq'::regclass)
user_id | integer |
ip | inet | not null
action_id | integer | not null
object1_id | integer |
object2_id | integer |
event_timestamp | timestamp without time zone | not null
Indexes:
"log_event_pkey" PRIMARY KEY, btree (id)
"log_event_action_id_idx" btree (action_id)
"log_event_timestamp_idx" btree (event_timestamp)
"log_event_user_id_idx" btree (user_id)
Foreign-key constraints:
"log_event_action_id_fkey" FOREIGN KEY (action_id) REFERENCES
config.log_action(id)

In this table definition you can also see that 'id' is generated by a
sequence, which makes it even stranger to contain a dupe.

I have made a copy of the complete pg cluster, so I can debug without
interfering with my production db.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Andrew Gierth 2009-07-09 22:29:56 Re: BUG #4913: Row missing from primary key index
Previous Message Tom Bowden 2009-07-09 21:05:39 BUG #4912: server core dumps on xslt_process with empty param string