Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id DEF4C9FB4EB for ; Mon, 22 Jan 2007 06:50:35 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-new, port 10024) with ESMTP id 87442-01 for ; Mon, 22 Jan 2007 06:50:28 -0400 (AST) X-Greylist: delayed 10:57:54.031676 by SQLgrey-1.7.4 Received: from smtp07l.fasthosts.co.uk (smtp.fasthosts.co.uk [213.171.216.50]) by postgresql.org (Postfix) with ESMTP id 101B49FB25E for ; Mon, 22 Jan 2007 06:50:32 -0400 (AST) Received: from aurora (unknown [82.153.22.114]) by smtp07l.fasthosts.co.uk (Postfix) with ESMTP id 805CA19F306 for ; Mon, 22 Jan 2007 10:50:38 +0000 (GMT) From: "Simon Kinsella" To: Subject: FW: Possible to emulate pre-8.2 behaviour of SET CONSTRAINTS? Date: Mon, 22 Jan 2007 10:50:15 -0000 Organization: Bluefire Systems Ltd MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Thread-Index: Acc91o4erYN7B1RXQR6GEAlUUrVcyQAMPR4gAALjjnA= X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028 Message-Id: <20070122105038.805CA19F306@smtp07l.fasthosts.co.uk> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200701/98 X-Sequence-Number: 27250 That sounds like a plan - will give it a go. Thanks! simon -----Original Message----- From: Tom Lane [mailto:tgl@sss.pgh.pa.us] Sent: Monday, January 22, 2007 3:37 AM To: Simon Kinsella Cc: pgsql-sql@postgresql.org Subject: Re: [SQL] Possible to emulate pre-8.2 behaviour of SET CONSTRAINTS? "Simon Kinsella" writes: > My system currently runs on PostgreSQL 8.1 and makes use of the old > behaviour of SET CONSTRAINTS, namely that the command is applied to > all constraints that match the specified name. Unfortunately that was pretty far away from what the SQL spec says :-( > This makes it very easy to write > a general-case function that can change the DEFERRED mode on a given > constraint that is present in several similar schemas (sounds odd > maybe but it works very well in my case!). I think you could do it fairly easily still, eg for rec in select nspname from pg_namespace n join pg_constraint c on n.oid = c.connamespace where conname = $1 loop execute 'set constraints ' || quote_ident(rec.nspname) || '.' || quote_ident($1) || ' immediate'; end loop; Exceedingly untested, but something close to this seems like it'd solve your problem. regards, tom lane