pgsql: doc: Clarify that COLUMN is optional in ALTER TABLE ... ADD/DROP

From: Fujii Masao <fujii(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: doc: Clarify that COLUMN is optional in ALTER TABLE ... ADD/DROP
Date: 2026-03-05 04:00:27
Message-ID: E1vxzsx-002SP1-0e@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

doc: Clarify that COLUMN is optional in ALTER TABLE ... ADD/DROP COLUMN.

In ALTER TABLE ... ADD/DROP COLUMN, the COLUMN keyword is optional. However,
part of the documentation could be read as if COLUMN were required, which may
mislead users about the command syntax.

This commit updates the ALTER TABLE documentation to clearly state that
COLUMN is optional for ADD and DROP.

Also this commit adds regression tests covering ALTER TABLE ... ADD/DROP
without the COLUMN keyword.

Backpatch to all supported versions.

Author: Chao Li <lic(at)highgo(dot)com>
Reviewed-by: Robert Treat <rob(at)xzilla(dot)net>
Reviewed-by: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Discussion: https://postgr.es/m/CAEoWx2n6ShLMOnjOtf63TjjgGbgiTVT5OMsSOFmbjGb6Xue1Bw@mail.gmail.com
Backpatch-through: 14

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/921f4a15c10f9791d6d57de7a4e714ef2d3a5fa9

Modified Files
--------------
doc/src/sgml/ref/alter_table.sgml | 4 ++--
src/test/regress/expected/alter_table.out | 10 ++++++++++
src/test/regress/sql/alter_table.sql | 8 ++++++++
3 files changed, 20 insertions(+), 2 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Fujii Masao 2026-03-05 12:41:25 pgsql: Improve validation of recovery_target_xid GUC values.
Previous Message Fujii Masao 2026-03-05 04:00:17 pgsql: doc: Clarify that COLUMN is optional in ALTER TABLE ... ADD/DROP