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 <[EMAIL PROTECTED]>

PGP Key: http://www.rbt.ca/rbtpub.asc

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to