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

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Re: I think I know what I'm doing wrong, but....
Дата
Msg-id 17336.978800658@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: I think I know what I'm doing wrong, but....  ("Eric Nielsen" <ericnielsen@earthlink.net>)
Ответы Re: Re: I think I know what I'm doing wrong, but....  ("Robert B. Easter" <reaster@comptechnews.com>)
Список pgsql-novice
"Eric Nielsen" <ericnielsen@earthlink.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

В списке pgsql-novice по дате отправления:

Предыдущее
От: "Eric Nielsen"
Дата:
Сообщение: Re: I think I know what I'm doing wrong, but....
Следующее
От: "Fernando M. Maresca"
Дата:
Сообщение: Re: well, this is a newbie list...