Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id AE7229FB250 for ; Sun, 21 Jan 2007 23:36:56 -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 89512-07 for ; Sun, 21 Jan 2007 23:36:47 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 1275A9FB56C for ; Sun, 21 Jan 2007 23:36:52 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id l0M3amrN001894; Sun, 21 Jan 2007 22:36:48 -0500 (EST) To: "Simon Kinsella" cc: pgsql-sql@postgresql.org Subject: Re: Possible to emulate pre-8.2 behaviour of SET CONSTRAINTS? In-reply-to: <20070121235235.BADE3197346@smtp06l.fasthosts.co.uk> References: <20070121235235.BADE3197346@smtp06l.fasthosts.co.uk> Comments: In-reply-to "Simon Kinsella" message dated "Sun, 21 Jan 2007 23:52:28 +0000" Date: Sun, 21 Jan 2007 22:36:48 -0500 Message-ID: <1893.1169437008@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200701/95 X-Sequence-Number: 27247 "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