Re: referential integrity constraints not checked inside PL/pgSQL functions? - Mailing list pgsql-general

From Patrick Welche
Subject Re: referential integrity constraints not checked inside PL/pgSQL functions?
Date
Msg-id 20040513102634.GE20725@quartz.newn.cam.ac.uk
Whole thread Raw
In response to referential integrity constraints not checked inside PL/pgSQL functions?  (Christian Rank <christian.rank@rz.uni-passau.de>)
Responses Re: referential integrity constraints not checked inside
List pgsql-general
On Thu, May 13, 2004 at 11:41:24AM +0200, Christian Rank wrote:
>     create function f () returns void as '
>     begin
>       delete from a;
>       delete from b;
>       return;
>     end;
>     ' language plpgsql;
>
> I would expect that
>
>     select f();
>
> yields an error message about constraint violation when executing
> 'delete from a;'.

Off the top of my head, the constraints would be checked when the
transaction ends, i.e., after both the "delete from a" and "delete from b"
happened. Split into 2 transactions?

Cheers,

Patrick

pgsql-general by date:

Previous
From: Christian Rank
Date:
Subject: referential integrity constraints not checked inside PL/pgSQL functions?
Next
From: Andrew Sullivan
Date:
Subject: Re: dbmirror