Search Postgresql Archives

Re: bug or not? Trigger preventing delete causes circumvention of FK

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

 



Luca Pireddu <luca@xxxxxxxxxxxxxx> writes:
> 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.

[ shrug... ] So don't do that.  Triggers can break FK constraints in any
number of ways beside this one (eg, changing the data in the record).
If we tried to prevent that I think we'd either waste a lot of cycles or
cripple the trigger feature ... quite possibly both.

			regards, tom lane


[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