From: | Jeff Boes <jboes(at)nexcerpt(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Rule uses wrong value |
Date: | 2004-10-12 15:08:54 |
Message-ID: | 416BF386.2060904@nexcerpt.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Tom Lane wrote:
>Jeff Boes <jboes(at)qtm(dot)net> writes:
>
>
>>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 ...
>>
>>
>
>No kidding. A rule is a macro and therefore has the usual risks of
>multiple evaluations of arguments.
>
>The only way to do what you want is with a trigger.
>
> regards, tom lane
>
>
But shouldn't "new.job_id" use the value that was already recorded in
the original row? I'm not using --
INSERT INTO job_queue_trace (job_id) VALUES (nextval(...))
but
INSERT INTO job_queue_trace (job_id) VALUES (new.job_id)
Why is the sequence involved?
--
Jeff Boes vox 269.226.9550 ext 24
Database Engineer fax 269.349.9076
Nexcerpt, Inc. http://www.nexcerpt.com
...Nexcerpt... Extend your Expertise
From | Date | Subject | |
---|---|---|---|
Next Message | Csaba Nagy | 2004-10-12 15:11:45 | Re: Message-ID as unique key? |
Previous Message | Jerry LeVan | 2004-10-12 15:01:08 | Message-ID as unique key? |