Drop Column

Learn how to use ALTER TABLE DROP COLUMN to remove one or more columns from a PostgreSQL table, including handling dependent objects.

4 min read · Last updated: March 2026 · Back to overview

Quick Answer

Use ALTER TABLE table_name DROP COLUMN column_name to remove a column. PostgreSQL automatically removes indexes and constraints on the dropped column. Use CASCADE to also drop dependent views, triggers, and other objects. Use IF EXISTS to avoid errors when the column may not exist.

Spin up a Postgres database in 20 seconds with Vela.

Try Vela Sandbox

The ALTER TABLE ... DROP COLUMN statement removes one or more columns from an existing table. PostgreSQL automatically removes any indexes and constraints that were defined on the dropped column. If other database objects such as views, triggers, or stored functions reference the column, you must either update those objects first or use the CASCADE option to drop them along with the column.

DROP COLUMN syntax

-- Drop a single column
ALTER TABLE table_name DROP COLUMN column_name;

-- Drop only if it exists (no error if missing)
ALTER TABLE table_name DROP COLUMN IF EXISTS column_name;

-- Drop and cascade to dependent objects
ALTER TABLE table_name DROP COLUMN column_name CASCADE;

-- Drop multiple columns at once
ALTER TABLE table_name
  DROP COLUMN col1,
  DROP COLUMN col2;

DROP COLUMN examples

Set up demo tables and a view:

CREATE TABLE publishers (
  publisher_id SERIAL PRIMARY KEY,
  name         VARCHAR(255) NOT NULL
);

CREATE TABLE categories (
  category_id SERIAL PRIMARY KEY,
  name        VARCHAR(255) NOT NULL
);

CREATE TABLE books (
  book_id        SERIAL PRIMARY KEY,
  title          VARCHAR(255) NOT NULL,
  isbn           VARCHAR(255) NOT NULL,
  published_date DATE NOT NULL,
  description    VARCHAR,
  category_id    INT NOT NULL REFERENCES categories (category_id),
  publisher_id   INT NOT NULL REFERENCES publishers (publisher_id)
);

CREATE VIEW book_info AS
  SELECT book_id, title, isbn, published_date, name
  FROM books b
  INNER JOIN publishers USING (publisher_id)
  ORDER BY title;

Drop a column with a foreign key constraint:

ALTER TABLE books DROP COLUMN category_id;

This automatically removes the foreign key constraint on category_id.

Attempt to drop a column used by a view (fails without CASCADE):

ALTER TABLE books DROP COLUMN publisher_id;
-- ERROR: cannot drop table books column publisher_id because other objects depend on it
-- DETAIL: view book_info depends on table books column publisher_id
-- HINT: Use DROP ... CASCADE to drop the dependent objects too.

Drop with CASCADE to remove the dependent view as well:

ALTER TABLE books DROP COLUMN publisher_id CASCADE;
-- NOTICE: drop cascades to view book_info

Drop multiple columns simultaneously:

ALTER TABLE books
  DROP COLUMN isbn,
  DROP COLUMN description;

DROP COLUMN tips

  • Dropping a column marks it as invisible but may not immediately reclaim disk space on large tables. Run VACUUM FULL or CLUSTER to physically reclaim the space (both rewrite the table and require an exclusive lock).
  • Use IF EXISTS in deployment scripts to make them idempotent — the statement becomes a no-op if the column was already dropped.
  • Be careful with CASCADE — it drops all dependent views, rules, triggers, and functions. Review dependencies with d+ table_name in psql before proceeding.
  • Drop multiple columns in one ALTER TABLE statement to minimize locking: each statement acquires ACCESS EXCLUSIVE.

Reference: PostgreSQL documentation — ALTER TABLE.

Continue in Managing Tables: Rename Column.

Related in this section: PostgreSQL Data Types · Create Table · Select Into

Frequently Asked Questions

Does DROP COLUMN immediately free disk space?

No. PostgreSQL marks the column as dropped in the system catalog but the data remains in existing rows until the table is vacuumed and rewritten. Run VACUUM FULL table_name or CLUSTER table_name to physically reclaim the space, but note both operations rewrite the table and require an ACCESS EXCLUSIVE lock.

What happens to indexes and constraints when I drop a column?

PostgreSQL automatically removes any index or constraint that involves only the dropped column. Multi-column indexes or constraints that include the dropped column are also removed automatically.

How do I drop a column that is referenced by a view?

Use CASCADE: ALTER TABLE table_name DROP COLUMN column_name CASCADE. This drops the column and all dependent objects (views, rules, triggers) that reference it. Review what will be dropped first with \d+ table_name or pg_depend.

Can I drop a column that does not exist without an error?

Yes. Use IF EXISTS: ALTER TABLE table_name DROP COLUMN IF EXISTS column_name. If the column does not exist, PostgreSQL issues a NOTICE rather than an error. This is useful in deployment scripts.

Can a PostgreSQL table have zero columns?

PostgreSQL technically allows it — you can drop all columns from a table. However, a zero-column table violates standard SQL and is not practically useful. Most table-level operations will still work, but inserting rows becomes impossible.