pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Simon Kinsella <simon@bluefiresystems.co.uk>
Cc: pgsql-sql@postgresql.org
Subject: Re: Possible to emulate pre-8.2 behaviour of SET CONSTRAINTS?
Date: Sun, 21 Jan 2007 22:36:48 -0500
Message-ID: <1893.1169437008@sss.pgh.pa.us> (raw)
In-Reply-To: <20070121235235.BADE3197346@smtp06l.fasthosts.co.uk>
References: <20070121235235.BADE3197346@smtp06l.fasthosts.co.uk>

"Simon Kinsella" <simon@bluefiresystems.co.uk> 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



view thread (3+ messages)  latest in thread

Message-ID: <1893.1169437008@sss.pgh.pa.us>
Permalink:  ../1893.1169437008@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1893.1169437008@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, simon@bluefiresystems.co.uk
  Subject: Re: Possible to emulate pre-8.2 behaviour of SET CONSTRAINTS?
  In-Reply-To: <1893.1169437008@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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