Possible to emulate pre-8.2 behaviour of SET CONSTRAINTS? - Mailing list pgsql-sql

From Simon Kinsella
Subject Possible to emulate pre-8.2 behaviour of SET CONSTRAINTS?
Date
Msg-id 20070121235235.BADE3197346@smtp06l.fasthosts.co.uk
Whole thread Raw
Responses Re: Possible to emulate pre-8.2 behaviour of SET CONSTRAINTS?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-sql
Hi

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.  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 understand that SET CONSTRAINTS in 8.2 no longer behaves like this. It's
looking like my general function will need to do something like:

SET CONSTRAINTS schema1.foo IMMEDIATE;
SET CONSTRAINTS schema2.foo IMMEDIATE;
SET CONSTRAINTS schema3.foo IMMEDIATE;
...
SET CONSTRAINTS schemaX.foo IMMEDIATE;

instead of 

SET CONSTRAINTS foo IMMEDIATE;

and hope that I remember to add new clauses to this function when new
schemas are added in the future.

Or can I do something with pg_contraints, or some other technique?  I'm
relunctant to use SET CONSTRAINTS' 'ALL' clause in case it messes with other
constraints in the system.

Hope this makes sense,

Simon

---
Simon Kinsella
Technical Director - Bluefire Systems Ltd This message has been scanned for
viruses.




pgsql-sql by date:

Previous
From: Andreas Kretschmer
Date:
Subject: Re: Changing point for commas and commas for point
Next
From: Tom Lane
Date:
Subject: Re: Possible to emulate pre-8.2 behaviour of SET CONSTRAINTS?