Re: referential integrity constraints not checked inside - Mailing list pgsql-general

From Christian Rank
Subject Re: referential integrity constraints not checked inside
Date
Msg-id 40A35A70.3000803@rz.uni-passau.de
Whole thread Raw
In response to Re: referential integrity constraints not checked inside PL/pgSQL functions?  (Patrick Welche <prlw1@newn.cam.ac.uk>)
Responses Re: referential integrity constraints not checked inside  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Patrick Welche wrote:

> 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?

Thanks for this suggestion, but I think this does not solve the issue,
since according to the docs, the validity of a constraint should be
checked after each statement unless this behaviour is altered with a SET
CONSTRAINTS statement.

Anyway, the select f(); is in my case not executed in transactional
context (not embraced by START TRANSACTION; ... COMMIT;).

Regards,
    Christian

--
Dr. Christian Rank
Rechenzentrum Universität Passau
Innstr. 33
D-94032 Passau
GERMANY
Tel.: 0851/509-1838
Fax:  0851/509-1802
PGP public key see http://www.rz.uni-passau.de/mitarbeiter/rank


pgsql-general by date:

Previous
From: Andrew Sullivan
Date:
Subject: Re: dbmirror
Next
From: Tom Lane
Date:
Subject: Re: pg_xlog becomes extremely large during CREATE INDEX