From: Josh Berkus <josh@agliodbs.com>
To: Charles Hauser <chauser@acpub.duke.edu>
Cc: pgsql-sql@postgresql.org
Subject: Re: psql question
Date: Thu, 07 Mar 2002 12:30:15 -0800
Message-ID: <web-820536@davinci.ethosmedia.com> (raw)
In-Reply-To: <a05010403b8ad6913e3fa@[152.3.11.193]>
CHarles,
> When I created TABLE clone I initially defined a column:
>
> gb_accessions_id INTEGER REFERENCES gb_accessions(gb_accessions_id)
> NULL
>
> I have renamed TABLE gb_accessions to TABLE gb, and its column
> gb_accessions_id to gb_id.
>
> I next renamed the column 'gb_accessions_id' in TABLE clone to
> 'gb_id'.
> In renaming this column in TABLE clone I appear to have lost the
> reference to TABLE gb (see below).
>
> Questions:
>
> 1. During which step in my renaming did this occur?
> 2. How should I have carried this out?
> 3. Can I add back REFERENCES gb(gb_id)?
I generally find that it is much easier, over all, to dump the database
to a pgdump sql-text file, and do my editing there whenever I need to
make significant exits to important database tables. Otherwise, it is
difficult to make sure that all of your constraints, rules, triggers,
and FKs update correctly.
You can add back the REFERENCES constraints. First, check the table
definitions of the child tables to see if they still have orphaned
constraints pointing to gb_accessions. (do this through psql's \d
table_name) If so, drop those constraints.
Unfortunately, I do not know the syntax for ALTER CONSTRAINT ...
FORIEGN KEY .... Post it as a question to the list.
-Josh
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: josh@agliodbs.com, chauser@acpub.duke.edu
Subject: Re: psql question
In-Reply-To: <web-820536@davinci.ethosmedia.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