Re: referential integrity constraints not checked inside PL/pgSQL functions?

From: Patrick Welche <prlw1(at)newn(dot)cam(dot)ac(dot)uk>
To: Christian Rank <christian(dot)rank(at)rz(dot)uni-passau(dot)de>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: referential integrity constraints not checked inside PL/pgSQL functions?
Date: 2004-05-13 10:26:34
Message-ID: 20040513102634.GE20725@quartz.newn.cam.ac.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andrew Sullivan 2004-05-13 11:04:41 Re: dbmirror
Previous Message Christian Rank 2004-05-13 09:41:24 referential integrity constraints not checked inside PL/pgSQL functions?