Re: DEFERABLE vs. NOT DEFERABLE constraints

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: Claude Chaloux <claude(dot)chaloux(at)abovesecurity(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: DEFERABLE vs. NOT DEFERABLE constraints
Date: 2007-07-24 19:12:46
Message-ID: 20070724120346.V52611@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Tue, 24 Jul 2007, Claude Chaloux wrote:

> I will be switching from PostgreSQL 7.4 to 8.2 operationally. So far,
> the transition goes smoothly but one thing is giving me headache when
> trying to make some pieces of code work on my newer version of PSQL,
> especially the code of one very simple function.
>
> Basically, the function inserts a row in a table (in the database I'm
> testing with) that has a reference (foreign key set) to another table.
> Under 7.4, I have no problem inserting the rows in the two tables even
> when inserting in the table which column is being referenced first. On
> 8.2 however, I get an error message "constraint violation".

In 7.4, a not deferred trigger caused by a statement in a function was
still delayed until the end of the statement that called the function. As
of 8.0, a not deferred trigger is called at the end of the statement in
the function.

I think the beginning of the following thread describes part of the
reasoning:
http://archives.postgresql.org/pgsql-hackers/2004-09/msg00140.php

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lane 2007-07-24 19:47:00 Re: DEFERABLE vs. NOT DEFERABLE constraints
Previous Message Claude Chaloux 2007-07-24 18:15:53 DEFERABLE vs. NOT DEFERABLE constraints