Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

This is essentially the same question as How do I rename a column in a database table using SQL?.

So, I want to rename a column in a table. This column is part of a set of tables that lives inside a PostgreSQL schema, which is itself in a PostgreSQL database.

However, I also have constraints like foreign keys involving this column. It is not clear to me whether this command will also take care of constraints. If not, how should I handle this?

Alternatively, I also have this database available as a dump file. Would it make sense to edit the dump file, and if so, how?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

You could try it yourself as well, but no: renaming a column won't break your foreign keys.

Try this:


CREATE TABLE b (a_id integer REFERENCES a (a_id));


and have a look at b's definition.

Imagine the world if it weren't so: every single column renaming (in my experience happening a lot in the first phases of development) would involve modifying constraints here and there. Wouldn't make much sense, would it?

Doing this in a dump is rather error-prone, I would not do that.

share|improve this answer
Thanks for the confirmation. I did try it, and it seemed to work, but I wasn't sure if this was a reliable procedure in general. –  Faheem Mitha Sep 6 '13 at 10:23

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.