From: | Rod Taylor <rbt(at)rbt(dot)ca> |
---|---|
To: | PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Problems with renaming a column |
Date: | 2003-06-02 16:54:35 |
Message-ID: | 1054572874.79386.13.camel@jester |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
As you can see below, after a rename the check constraint still refers
to 'col' and not 'newname' as pg_constraint.consrc is not updated.
Of course, this functions fine (conbin is still valid) but when it comes
time to do a pg_dump, the database is dumped using the old column name.
It seems this is a problem in 7.3 as well. I believe the solution is to
outright remove consrc, and enable the interface to request a text
version of conbin on the fly.
test=# CREATE TABLE test (col integer check(col > 2));
CREATE TABLE
test=#
test=# ALTER TABLE test RENAME COLUMN col TO newname;
ALTER TABLE
test=#
test=# \d test
Table "public.test"
Column | Type | Modifiers
---------+---------+-----------
newname | integer |
Check Constraints:
"test_col" CHECK (col > 2)
--
Rod Taylor <rbt(at)rbt(dot)ca>
PGP Key: http://www.rbt.ca/rbtpub.asc
From | Date | Subject | |
---|---|---|---|
Next Message | Josh Berkus | 2003-06-02 17:01:31 | Proposal for Re-ordering CONF (was: Re: GUC and postgresql.conf docs) |
Previous Message | Bruce Momjian | 2003-06-02 16:18:05 | Re: Linux startup script |