2 Ways to Rename a Table in PostgreSQL
( 49 Articles)

This short article shows you 2 different ways to rename a table in a PostgreSQL database. The first approach is to execute the ALTER TABLE statement with the RENAME keyword and the second one is to make use of the graphical user interface of pgAdmin.
Using ALTER TABLE statement
You can change the name of an existing table in Postgres as shown below:
ALTER TABLE <current name>
RENAME TO <new name>;
This example renames a table named members to users:
ALTER TABLE members
RENAME TO users;
Via pgAdmin
If you’re new to Postgres, you’re likely to frequently make use of pgAdmin to manage your databases.
1. Log yourself into your pgAdmin.
2. From the left-hand sidebar, navigate to Servers > [your server name] > Databases > [your database] > Schemas > Public > Tables. If you get confused, see the screenshot below:

3. Right-click on the table that you want to change the name then select Properties… from the popup menu:

4. A dialog will show up. Enter the name you like into the text field labeled with Name the hit the Save button to apply your change:

Now right-click on Databases and select Refresh to see the new name.
Conclusion
You’ve learned more than one way to rename a table in PostgreSQL. If you’d like to sharpen your skills and gain more experience with PostgreSQL then take a look at the following articles:
- 2 Ways to Get the Size of a Database in PostgreSQL
- 2 Ways to Get the Size of a Database in PostgreSQL
- How to select a Database to use in PostgreSQL
- PostgreSQL: Create Tables with Auto-Increment IDs
- Best open-source ORM and ODM libraries for Node.js
You can also check out our database topic page for the latest tutorials and examples.