PostgreSQL: How to Rename a Column of a Table

Updated: February 25, 2022 By: A Goodman Post a comment

In PostgreSQL, you can change the name of a column in a table by using the ALTER TABLE statement, like so:

ALTER TABLE table_name
   RENAME COLUMN <old_column_name> TO <new_column_name>;

For example, I have a table called users and I want to change the name of the password column to pwd:

   RENAME COLUMN password TO pwd;

It is possible to rename a column of a table via pgAdmin. What you need to do is to right-click on your table then select Properties from the menu:

A modal dialog will show up. Focus on the Columns tab and now you can modify the name of every column you want:

Finally, press the Save button and refresh your database to see your change.

Further reading:

You can also check out our database topic page for the latest tutorials and examples.

Notify of
Inline Feedbacks
View all comments

Related Articles