Martijn van Oosterhout <kleptog@svana.org> writes:
> On Thu, Jan 11, 2007 at 07:26:32PM +0100, Rafal Pietrak wrote:
>> So may be "SET CONSTRAINTS .... DEFERRED " should be used somehow
>> differently? I've never had any use for that construct, may be I miss
>> something?
> Only at the beginning of a transaction and it only works on foreign
> keys marked deferrable.
No, you can do it mid-transaction. I think the problem is the second
part: the FK constraint has to be marked deferrable, which is not the
default I believe. Also, you could forget the SET CONSTRAINTS entirely
if you made the constraint INITIALLY DEFERRED ... then it'd always act
as a deferred check.
regards, tom lane