How to Rename a Table in PostgreSQL

Last updated July 24, 2026 · By the SaturnSQL team

Use ALTER TABLE ... RENAME TO. Postgres updates views, foreign keys, and sequences that reference the table automatically, but application queries using the old name will break.

Postgres tracks dependencies by internal object ID rather than by name, so views, foreign keys, sequences, and indexes follow the rename automatically and keep working. What does not follow is anything outside the database: application code, saved queries, dashboards, and dbt models still using the old name will fail.

ALTER TABLE orders RENAME TO customer_orders;

Move to another schema

SET SCHEMA moves the table without copying data, which is the usual way to retire something: park it in an archive schema, leave it a while, then drop it. Users need USAGE on the target schema to reach it there, and any query relying on search_path rather than a qualified name stops resolving it.

ALTER TABLE public.orders SET SCHEMA archive;

Run this in SaturnSQL

SaturnSQL is a browser-based SQL editor for teams: shared query library, schema-aware autocomplete, and scheduled exports to Google Sheets and Slack.

Try it free

Related PostgreSQL guides