On Mon, 18 Aug 2008 15:16:01 -0400
Tom Lane <[EMAIL PROTECTED]> wrote:
> Ivan Sergio Borgonovo <[EMAIL PROTECTED]> writes:
> > I'm not sure what's really happening but why apparently the
> > delete statements get executed before the 2 inserts even if
> > constraints are deferred?
>
> You didn't m
Ivan Sergio Borgonovo <[EMAIL PROTECTED]> writes:
> I'm not sure what's really happening but why apparently the delete
> statements get executed before the 2 inserts even if constraints are
> deferred?
You didn't mark the FK constraints as deferrable --- I'm pretty sure
the default is NOT DEFERRAB
I've something like
create table p (
pid int primary key
-- other stuff
);
create table s1 (
s1id int primary key,
pid int references p (pid) on delete cascade
-- other stuff
);
begin;
set constraints all deferred;
delete from p;
-- insert into p (pid) select * atable;
-- insert into