pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Problem with SET CONSTRAINTS ALL DEFERRED;
2+ messages / 2 participants
[nested] [flat]

* Problem with SET CONSTRAINTS ALL DEFERRED;
@ 2006-05-19 11:30 Kaloyan Iliev <news1@faith.digsys.bg>
  2006-05-19 16:41 ` Re: Problem with SET CONSTRAINTS ALL DEFERRED; Stephan Szabo <sszabo@megazone.bigpanda.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Kaloyan Iliev @ 2006-05-19 11:30 UTC (permalink / raw)
  To: pgsql-sql

Hi Friends,

I am trying to postpone the foreign key constraint check till the end of 
transaction but it doesn't work.
Can anyone help me with a tip what I am doing wrong.

Thanks in advance.

Kaloyan Iliev

test=#  BEGIN;
BEGIN
test=#
test=# SET CONSTRAINTS ALL DEFERRED;
SET CONSTRAINTS
test=# DELETE FROM picture
test-#                                                          USING 
element_picture
test-#                                                          WHERE 
picture.id = element_picture.picture_id
test-#                                                                
AND element_picture.element_id = 8;
ERROR:  update or delete on "picture" violates foreign key constraint 
"picture_id" on "element_picture"
DETAIL:  Key (id)=(223) is still referenced from table "element_picture".


 select version();
                                            version
------------------------------------------------------------------------------------------------
 PostgreSQL 8.1.2 on i386-portbld-freebsd6.0, compiled by GCC cc (GCC) 
3.4.4 [FreeBSD] 20050518
(1 row)




^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Problem with SET CONSTRAINTS ALL DEFERRED;
  2006-05-19 11:30 Problem with SET CONSTRAINTS ALL DEFERRED; Kaloyan Iliev <news1@faith.digsys.bg>
@ 2006-05-19 16:41 ` Stephan Szabo <sszabo@megazone.bigpanda.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Stephan Szabo @ 2006-05-19 16:41 UTC (permalink / raw)
  To: Kaloyan Iliev <news1@faith.digsys.bg>; +Cc: pgsql-sql

On Fri, 19 May 2006, Kaloyan Iliev wrote:

> Hi Friends,
>
> I am trying to postpone the foreign key constraint check till the end of
> transaction but it doesn't work.
> Can anyone help me with a tip what I am doing wrong.

Was the constraint created as deferrable (which is not the default)?
ALL DEFERRED actually only applies to deferrable constraints.

>
> Thanks in advance.
>
> Kaloyan Iliev
>
> test=#  BEGIN;
> BEGIN
> test=#
> test=# SET CONSTRAINTS ALL DEFERRED;
> SET CONSTRAINTS
> test=# DELETE FROM picture
> test-#                                                          USING
> element_picture
> test-#                                                          WHERE
> picture.id = element_picture.picture_id
> test-#
> AND element_picture.element_id = 8;
> ERROR:  update or delete on "picture" violates foreign key constraint
> "picture_id" on "element_picture"
> DETAIL:  Key (id)=(223) is still referenced from table "element_picture".
>
>
>  select version();
>                                             version
> ------------------------------------------------------------------------------------------------
>  PostgreSQL 8.1.2 on i386-portbld-freebsd6.0, compiled by GCC cc (GCC)
> 3.4.4 [FreeBSD] 20050518
> (1 row)
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: if posting/reading through Usenet, please send an appropriate
>        subscribe-nomail command to majordomo@postgresql.org so that your
>        message can get through to the mailing list cleanly
>



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2006-05-19 16:41 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-05-19 11:30 Problem with SET CONSTRAINTS ALL DEFERRED; Kaloyan Iliev <news1@faith.digsys.bg>
2006-05-19 16:41 ` Stephan Szabo <sszabo@megazone.bigpanda.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox