Re: [SQL] Trigger triggered from a foreign key

2012-10-22 Thread Jasen Betts
On 2012-10-19, Victor Sterpu wrote: > 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? perhaps you have to use a rule instead of a trigger? -

Re: [SQL] Trigger triggered from a foreign key

2012-10-19 Thread David Johnston
> -Original Message- > From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql- > ow...@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 > >

[SQL] Trigger triggered from a foreign key

2012-10-19 Thread Victor Sterpu
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? This is the fk ALTER TABLE focgdepartment ADD CONSTRAINT fk_focgdep_idfocg FOREIGN KEY (idfocg)