By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,834 Members | 2,240 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,834 IT Pros & Developers. It's quick & easy.

Rule is using wrong values

P: n/a
I have a rule defined on a table, to log rows from that table (which
tend to get read elsewhere and quickly deleted) into another table for
audit. It 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, ...)

The table on which the rule is defined looks something like this:

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

The problem is that rows appearing in job_queue_trace (the shadow audit
table) end up with a value of job_id that is off by one (one higher)
than the actual row; it's as though the sequence was being evaluated
again, instead of taking the value from the "new.job_id" expression.

Nov 23 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.