Re: BUG #4913: Row missing from primary key index - Mailing list pgsql-bugs

From Mathieu De Zutter
Subject Re: BUG #4913: Row missing from primary key index
Date
Msg-id d4468d970907100649g609702c6kb032ab8ef99173d3@mail.gmail.com
Whole thread Raw
In response to Re: BUG #4913: Row missing from primary key index  (Alvaro Herrera <alvherre@commandprompt.com>)
Responses Re: BUG #4913: Row missing from primary key index  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
On Fri, Jul 10, 2009 at 2:02 AM, Alvaro Herrera
<alvherre@commandprompt.com>wrote:

> What do the INSERT lines look like?  Is it a trigger, an insert called
> directly by the application?  How is the sequence involved -- lastval(),
> nextval(), does the code just leave the column out for the default to fire?
>
>

* This is the INSERT query, called from PHP/Apache

INSERT INTO log_event (user_id, ip, action_id, object1_id, object2_id,
event_timestamp)
VALUES ($1, $2, $3, $4, $5, NOW())

So the timestamp is generated by NOW(), and the pkey is generated by using
the default value (nextval).

* There are no UPDATE queries.

* There a few DELETE queries that are lauched daily (called from PHP/cron)

DELETE FROM log_event WHERE action_id = $1 AND event_timestamp < NOW() - '1
month'::interval

(some events are not worthy of archiving individually, we just keep totals)


Regards,
Mathieu

pgsql-bugs by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: BUG #4907: stored procedures and changed tables
Next
From: Tom Lane
Date:
Subject: Re: BUG #4913: Row missing from primary key index