Re: Re: I think I know what I'm doing wrong, but....

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Eric Nielsen" <ericnielsen(at)earthlink(dot)net>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Re: I think I know what I'm doing wrong, but....
Date: 2001-01-06 17:04:18
Message-ID: 17336.978800658@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

"Eric Nielsen" <ericnielsen(at)earthlink(dot)net> writes:
>> However the insert fails, with a referential integrity problem. I _think_
>> this is because it tries to do the rule's trigger before actually doing
>> the original select, so the key does not exist.

I think you are right. Non-INSTEAD rule actions are executed before the
original query is carried out. I have argued in the past that this is
stupid for ON INSERT rules, which would be better done after the
original query, but I haven't had any luck getting agreement to change
it.

>> Is there a solution using rules,

Only if you can use a delayed referential integrity check that isn't
checked till end of transaction. I don't know offhand if we even
implement such a feature, let alone whether it'd be OK for your
application logic.

regards, tom lane

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Eric Nielsen 2001-01-06 21:35:44 Re: Create Table Scripts
Previous Message Chuck Kimber 2001-01-06 15:46:50 Re: Create Table Scripts