Re: Updating another table using a trigger

Поиск
Список
Период
Сортировка
От Stephan Szabo
Тема Re: Updating another table using a trigger
Дата
Msg-id 20040915081551.L58656@megazone.bigpanda.com
обсуждение исходный текст
Ответ на Updating another table using a trigger  (Robert Fitzpatrick <robert@webtent.com>)
Список pgsql-general
On Wed, 15 Sep 2004, Robert Fitzpatrick wrote:

> I am running PostgreSQL 7.4.5 and have a trigger on a table called
> tblriskassessors which inserts, updates or delete a corresponding record
> in tblinspectors by lookup of a contact id and license number match. The
> INSERT and DELETE work fine. The UPDATE works good unless I update the
> license number. The error, at the bottom of this message, suggests the
> primary key violation. But my UPDATE in no way alters the primary key,
> which is inspector_contact_id. A manual update on tblinspectors using
> the same values works fine. There is a foreign key on tblriskassessors
> assessor_contact_id field to the primary key above. The structures of
> the two tables can be found below as well.

Are you sure that you're going in the update path and not the insert path
inside the function? Could the select/if not found be taking effect at
which point the insert occurs rather than the else block?
RAISE NOTICE might be useful to determine thise.

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

Предыдущее
От: "Leonardo Francalanci"
Дата:
Сообщение: what is flushed?
Следующее
От: David Fetter
Дата:
Сообщение: Re: Spacing in output