Skip site navigation (1) Skip section navigation (2)

Re: insert or update violates foreign key constraint.why?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Oleg Mayevskiy <oleg(dot)mayevskiy(at)s2002(dot)tu-chemnitz(dot)de>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: insert or update violates foreign key constraint.why?
Date: 2004-06-01 02:05:11
Message-ID: 14140.1086055511@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-sql
Oleg Mayevskiy <oleg(dot)mayevskiy(at)s2002(dot)tu-chemnitz(dot)de> writes:
> it seems to be a simple problem, but it is not.

Yes it is ... you're expecting the RI triggers to fire during the
plpgsql function, but in fact they fire at completion of the outer
statement that called the plpgsql function.

There's been some debate about whether this is really the most
desirable behavior, but that's how it is at the moment.

			regards, tom lane

In response to

pgsql-sql by date

Next:From: email listsDate: 2004-06-01 12:29:04
Subject: assistance on self join pls
Previous:From: Jaime CasanovaDate: 2004-05-31 14:19:49
Subject: joining a table with a function

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group