PostgreSQL - Rename Table Last Updated : 15 Jul, 2025 Comments Improve Suggest changes Like Article Like Report Renaming a table in PostgreSQL is a common task that can be quickly done using the RENAME clause in combination with the ALTER TABLE statement. This article will walk you through the process of renaming an existing table in PostgreSQL, explaining the syntax, and providing a detailed example.SyntaxALTER TABLE table_name RENAME TO new_table_name; In the above syntax: 'ALTER TABLE table_name': This specifies the current name of the table that you want to rename.'RENAME TO new_table_name': This specifies the new name you want to assign to the table.PostgreSQL Rename Table ExamplesFor the purpose of example let’s first create a table using the below statements and then we will attempt to rename it: PostgreSQL CREATE TABLE vendors ( id serial PRIMARY KEY, name VARCHAR NOT NULL ); SELECT * FROM vendors; Now that our table is ready, let's jump into an example. Example: Renaming the TableIn this we will rename the 'vendors' table to 'suppliers', using the following ALTER TABLE RENAME TO statement: ALTER TABLE vendors RENAME TO suppliers;After executing the above command, the table name will be updated. You can verify the change by running a query to select data from the newly renamed table:SELECT * FROM suppliers;Output:If the renaming process was successful, you should see the same data and structure under the new table name, 'suppliers'.Important Points About PostgreSQL Rename TableIf you attempt to rename a table that doesn’t exist, PostgreSQL will raise an error, so ensure the table name is correct before executing the command.To rename multiple tables, you must execute multiple ALTER TABLE RENAME TO statements; it is not possible to rename multiple tables in a single command.After renaming a table, make sure to update any application code, scripts, or queries that reference the old table name to prevent errors.When renaming a table, choose a name that accurately reflects the data it contains. This improves the readability and maintainability of your database. Comment More info R rajukumar19 Follow Improve Article Tags : PostgreSQL postgreSQL-managing-table Explore BasicsPostgreSQL Tutorial8 min readWhat is PostgreSQL - Introduction2 min readInstall PostgreSQL on Windows2 min readInstall PostgreSQL on Mac3 min readDatabase OperationsPostgreSQL - Create Database5 min readPostgreSQL - Loading a Database3 min readPostgreSQL ALTER DATABASE3 min readPostgreSQL - Rename Database4 min readPostgreSQL - Show Databases3 min readData TypesPostgreSQL - Data Types5 min readPostgreSQL - Boolean Data Type4 min readPostgreSQL - CHAR Data Type5 min readPostgreSQL - VARCHAR Data Type3 min readPostgreSQL - NUMERIC Data Type5 min readPostgreSQL - Date Data Type4 min readPostgreSQL - TIME Data Type4 min readPostgreSQL - JSON Data Type4 min readPostgreSQL - CREATE DOMAIN3 min readQuerying TablesPostgreSQL - SELECT3 min readPostgreSQL - ORDER BY clause2 min readPostgreSQL - WHERE clause6 min readPostgreSQL FETCH Clause4 min readPostgreSQL - IN operator4 min readPostgreSQL - HAVING clause4 min readPostgreSQL - GROUP BY clause4 min readPostgreSQL - LIKE operator5 min readPostgreSQL - BETWEEN Operator3 min readTable OperationsPostgreSQL - CREATE TABLE5 min readPostgreSQL - SELECT INTO4 min readPostgreSQL - CREATE SEQUENCE4 min readPostgreSQL - ALTER TABLE6 min readPostgreSQL - ADD COLUMN4 min readPostgreSQL - DROP COLUMN2 min readPostgreSQL - Rename Table2 min readPostgreSQL - DROP TABLE5 min readPostgreSQL - TRUNCATE TABLE4 min readPostgreSQL - Copy a Table3 min readPostgreSQL - Comparing Tables3 min readPostgreSQL - Show Tables4 min readModifying DataPostgreSQL - INSERT4 min readPostgreSQL - Insert Multiple Values in Various Rows3 min readPostgreSQL UPDATE Statement5 min readPostgreSQL - DELETE4 min readPostgreSQL - Upsert4 min readConditionalsPostgreSQL - CASE3 min readPostgreSQL COALESCE5 min readPostgreSQL - NULLIF() Function4 min readPostgreSQL - CAST3 min readControl FlowPostgreSQL - IF Statement5 min readPostgreSQL - CASE Statement4 min readPostgreSQL - Loop Statement3 min readPostgreSQL - While Loops4 min readPostgreSQL - Exit Statement3 min readPostgreSQL - Continue3 min readTransactions & ConstraintsPostgreSQL - Transactions4 min readPostgreSQL - COMMIT4 min readPostgreSQL - Primary Key4 min readPostgreSQL - Foreign Key5 min readPostgreSQL - CHECK Constraint2 min readPostgreSQL - UNIQUE Constraint3 min readPostgreSQL - NOT NULL Constraint3 min readJOINS & SchemasPostgreSQL - Joins5 min readPostgreSQL - LEFT JOIN5 min readPostgreSQL - INNER JOIN2 min readPostgreSQL - FULL OUTER JOIN4 min readPostgreSQL - SELF JOIN4 min readPostgreSQL - Schema5 min readPostgreSQL - CREATE SCHEMA5 min readPostgreSQL - DROP SCHEMA4 min readPostgreSQL - ALTER SCHEMA3 min read Like