Search Postgresql Archives

Re: bug or not? Trigger preventing delete causes circumvention

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Friday 09 December 2005 09:22, Jan Wieck wrote:
> On 12/8/2005 9:12 PM, Luca Pireddu wrote:
> > I wrote a trigger function with the intent of preventing the deletion of
> > a parent record when a referencing record would not allow it.  However,
> > the result is that the referencing record stays, but the referenced one
> > is gone, so that my foreign key constraint is not respected.  The
> > behaviour can be replicated with the following:
>
> You did something else than intended. You prevented deletion of the
> referencing (dependent) record. That is where you defined the trigger,
> and that is what renders the foreign key constraints DELETE operation
> from dependent into a NOP.
>
> I guess that counts more as a pilot error.
>
>
> Jan
>

Thanks for the clarification.  I was working under the assumption that 
preventing the deletion would cause an error to be raised by the FK check.  
On a related note, I can achieve my intended behaviour by raising an 
exception in the trigger, rather than returning null.

Luca


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux