From: | "Josh Berkus" <josh(at)agliodbs(dot)com> |
---|---|
To: | Charles Hauser <chauser(at)acpub(dot)duke(dot)edu> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: psql question |
Date: | 2002-03-07 20:30:15 |
Message-ID: | web-820536@davinci.ethosmedia.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew G. Hammond | 2002-03-07 20:40:59 | Re: How to grant a privilege on all tables or views or both of a database to someone? |
Previous Message | Stephan Szabo | 2002-03-07 20:27:49 | Re: 7.0.3 pg_dump -> segmentation fault! |