RefLib

Reference library for AI

Back

postgresql_16:3.2.6.2 Removing a Column

PostgreSQL 16 > The SQL Language > Data Definition > Modifying Tables > Removing a Column

To remove a column, use a command like: ALTER TABLE products DROP COLUMN description; Whatever data was in the column disappears. Table constraints involving the column are dropped, too. However, if the column is referenced by a foreign key constraint of another table, PostgreSQL will not silently drop that constraint. You can authorize dropping everything that depends on the column by adding CASCADE: ALTER TABLE products DROP COLUMN description CASCADE; See (see postgresql_16:3.2.14) for a description of the general mechanism behind this.

Back