(I thought I posted this yesterday from Google Groups, but it doesn't appear to have "taken".)

I'm having a problem with a rule designed to log new rows inserted into one table. The base table is very volatile; rows are inserted from various places, including both application code and triggers. Then they are read out by another application (the table is used as a job queue) and deleted. My rule attempts to re-record the rows in another table for audit and debug purposes.

Here's the important bits of the base table:

Table "public.job_queue"
Column |Type |Modifiers


--------+--------+------------------
job_id  |integer |not null default
                  nextval('"job_queue_job_id_seq"'::text)
...

The rule looks like this:

rul_job_queue_trace_log AS
ON INSERT TO job_queue
DO INSERT INTO job_queue_trace (job_id, ...)
VALUES (new.job_id, ...)

It appears that the rule is inserting the row copies into job_queue_trace with a job_id value that is one higher than the job_id from the original row. Almost as though it was re-evaluating the sequence ...


-- (Posted from an account used as a SPAM dump. If you really want to get in touch with me, dump the 'jboes' and substitute 'mur'.) ________ Jeffery Boes <>< [EMAIL PROTECTED]

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Reply via email to