Hi, On 2013-11-13 08:52:27 +0100, Luca Ferrari wrote: > when you drop a column on a table the pg_attribute is updated and the > name of the column is changed with an almost fixed identifier that > reports only the original column position: > > /* > * Change the column name to something that isn't likely to conflict > */ > snprintf(newattname, sizeof(newattname), > "........pg.dropped.%d........", attnum); > namestrcpy(&(attStruct->attname), newattname); > > I'm wondering what is the problem in placing the old/original name > after the "pg.dropped" prefix. I know that the tuple in pg_attribute > is temporary, but what are the possible conflicts the comment talks > about?
The old name might not fit there, attribute names have a relatively low maximum length (64 by default), so we cannot always fit the entire old name there. Also, think about: CREATE TABLE foo(cola int); ALTER TABLE foo DROP COLUMN cola; ALTER TABLE foo ADD COLUMN cola; ALTER TABLE foo DROP COLUMN cola; -- should not error out I don't really see much need for anything better than the current solution, why is the old name interesting? Greetings, Andres Freund -- Andres Freund http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers