Re: Trigger triggered from a foreign key

Поиск
Список
Период
Сортировка
От David Johnston
Тема Re: Trigger triggered from a foreign key
Дата
Msg-id 032401cdae27$0199b2e0$04cd18a0$@yahoo.com
обсуждение исходный текст
Ответ на Trigger triggered from a foreign key  (Victor Sterpu <victor@caido.ro>)
Список pgsql-sql
> -----Original Message-----
> From: pgsql-sql-owner@postgresql.org [mailto:pgsql-sql-
> owner@postgresql.org] On Behalf Of Victor Sterpu
> Sent: Friday, October 19, 2012 2:15 PM
> To: pgsql-sql@postgresql.org
> Subject: [SQL] Trigger triggered from a foreign key
> 
> I have this trigger that works fine. The trigger prevents the deletion of
the
> last record.
> But I want skip this trigger execution when the delete is done from a
external
> key.
> How can I do this?
> 

I do not think this is possible; there is no "stack" context to examine to
determine how a DELETE was issued.

The trigger itself would seem to be possibly exhibit concurrency issues,
meaning that in certain circumstances the last record could be deleted.  You
may want to add explicit locking to avoid that possibility.  That or figure
out a better way to accomplish whatever it is you are trying to do.

David J.





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

Предыдущее
От: Victor Sterpu
Дата:
Сообщение: Trigger triggered from a foreign key
Следующее
От: lmagnell
Дата:
Сообщение: Insert strings that contain colons into a table