-- -- With Postgres version 8.0.1 -- -- Renaming a column which is attached to a sequence is bogus -- when that sequence had some specific granted rights -- -- Commands: -- -- [ONCE:] -- bash> psql template1 -- psql> CREATE DATABASE rename_bug; -- psql> \q -- -- [REPEAT AS REQUIRED:] -- bash> psql -f rename-bug.sql -- bash> pg_dump rename_bug -- -- IMPORTANT NOTE: -- The psql -f rename-bug.sql command will generate two errors -- the first time since the my_table table and rename_bug group -- do not exist yet. -- -- The problem: the pg_dump will print out the sequence as -- my_table_unique_id_seq in the list of REVOKE/GRANT, whereas -- in the SELECT ... setvalue() ...; the renamed column appears -- properly as my_table_serial_id_seq -- We would either need both to be renamed or neither. -- [or, as Tom pointed out in Release Notes 8.1.0 : we should use -- an oid and not the actual name] -- -- Note that the renamed column works properly in the original -- database, only pg_dump gets it wrong... it seems. -- -- IMPORTANT: it seems this is a problem with the index files too. -- (i.e. with column setup as 'unique') -- DROP TABLE my_table; CREATE TABLE my_table ( unique_id serial, name text ); -- INSERT INTO my_table (name) VALUES ('Rename Bug'); DROP GROUP rename_bug; CREATE GROUP rename_bug; GRANT SELECT ON TABLE my_table TO GROUP rename_bug; GRANT SELECT ON TABLE my_table_unique_id_seq TO GROUP rename_bug; ALTER TABLE my_table RENAME COLUMN unique_id TO serial_id;