pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stephan Szabo <sszabo@megazone23.bigpanda.com>
To: Tomasz Myrta <jasiek@klaster.net>
Cc: pgsql-sql@postgresql.org
Subject: Re: recreating table and foreign keys
Date: Tue, 3 Dec 2002 11:55:58 -0800 (PST)
Message-ID: <20021203115400.X73093-100000@megazone23.bigpanda.com> (raw)
In-Reply-To: <20021203202954.M11351@klaster.net>


On Tue, 3 Dec 2002, Tomasz Myrta wrote:

> > You'll probably end up using ALTER TABLE ADD CONSTRAINT to add the
> > constraints to the new master_table.  It's possible that you might
> > be able to hack something with the system tables, but that sounds
> > dangerous.  Or you can upgrade to 7.3 which lets you run alter table
> > drop column. :)
> If it is the only way, I can create >20 "alter table add constraint...", but
> is rather a boring finish :-(
> I found, I can dump database - data only. After this I can create all tables
> and restore data.

Yeah, dump and restore is generally a pretty big thing though.

> Any other solution?

You might be able to write a function that would duplicate constraints
from the table you want to dispose of to the new table, but it might be
hairy.  If you do this alot, you might want to upgrade to 7.3 (which
requires one dump and reload).




view thread (4+ messages)

Message-ID: <20021203115400.X73093-100000@megazone23.bigpanda.com>
Permalink:  ../20021203115400.X73093-100000@megazone23.bigpanda.com/
Also on:    postgresql.org/message-id/20021203115400.X73093-100000@megazone23.bigpanda.com

 · 

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: sszabo@megazone23.bigpanda.com, jasiek@klaster.net
  Subject: Re: recreating table and foreign keys
  In-Reply-To: <20021203115400.X73093-100000@megazone23.bigpanda.com>

* 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