pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jim C. Nasby <jim@nasby.net>
To: Jerry Sievers <jerry@jerrysievers.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: Manual sys catalog constraint setup to avoid downtime?
Date: Mon, 13 Nov 2006 10:53:19 -0600
Message-ID: <20061113165318.GS90133@nasby.net> (raw)
In-Reply-To: <m3slgsbum5.fsf@homie.jerrysievers.com>
References: <m3lkmnfdil.fsf@homie.jerrysievers.com>
	<20061109071118.GF90133@nasby.net>
	<m3slgsbum5.fsf@homie.jerrysievers.com>

On Thu, Nov 09, 2006 at 08:46:42AM -0500, Jerry Sievers wrote:
> 2. Create new NOT NULL, CHECK and/or FK constraints by inserting them
>    into the catalogs directly.  NOT NULL is the simplest and requires
>    only an update to pg_attribute table.  CHECK constraints a bit more
>    tricky and requires figuring out what goes in the conbin field of
>    pg_constraint table.  FK the most difficult as it requires adding
>    recs to all of pg_constraint, pg_trigger and pg_depend.  The
>    trigger I guess can be created using standard CREATE TRIGGER
>    operation.
> 
> Having done this, we are NOT absolutely guaranteed that the new
> constraints are expressed in the DB due to possible client activity
> that ran during or after our bulk delete or updates in step #1.  We
> are however insured that new activity as of the constraint additions
> is conforming.
> 
> 3. Let the DB age beyond any transactions that may have been open
>    during our initial cleanup pass and repeat cleanup steps again.
>    Now, we should be up to snuff and fine going forward.

You should check into whether other backends will pick those catalog
changes up automagically or not... you may have to restart all
connections for those changes to take effect.

BTW, it'd probably be worthwhile looking at the code that creates the
different constraints to see exactly what it's doing.

And you're right... this is not something the community supports. :)
-- 
Jim Nasby                                            jim@nasby.net
EnterpriseDB      http://enterprisedb.com      512.569.9461 (cell)



view thread (4+ messages)

Message-ID: <20061113165318.GS90133@nasby.net>
Permalink:  ../20061113165318.GS90133@nasby.net/
Also on:    postgresql.org/message-id/20061113165318.GS90133@nasby.net

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: jim@nasby.net, jerry@jerrysievers.com
  Subject: Re: Manual sys catalog constraint setup to avoid downtime?
  In-Reply-To: <20061113165318.GS90133@nasby.net>
  References: <m3lkmnfdil.fsf@homie.jerrysievers.com> <20061109071118.GF90133@nasby.net> <m3slgsbum5.fsf@homie.jerrysievers.com> <20061113165318.GS90133@nasby.net>

* 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