pgsql: doc: Clarify that empty COMMENT string removes the comment.

From: Fujii Masao <fujii(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: doc: Clarify that empty COMMENT string removes the comment.
Date: 2026-03-03 05:49:34
Message-ID: E1vxIdS-0027RQ-1D@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

doc: Clarify that empty COMMENT string removes the comment.

Clarify the documentation of COMMENT ON to state that specifying an empty
string is treated as NULL, meaning that the comment is removed.

This makes the behavior explicit and avoids possible confusion about how
empty strings are handled.

Also adds regress test cases that use empty string to remove a comment.

Backpatch to all supported versions.

Author: Chao Li <lic(at)highgo(dot)com>
Reviewed-by: Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>
Reviewed-by: David G. Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>
Reviewed-by: Shengbin Zhao <zshengbin91(at)gmail(dot)com>
Reviewed-by: Jim Jones <jim(dot)jones(at)uni-muenster(dot)de>
Reviewed-by: zhangqiang <zhang_qiang81(at)163(dot)com>
Reviewed-by: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Discussion: https://postgr.es/m/26476097-B1C1-4BA8-AA92-0AD0B8EC7190@gmail.com
Backpatch-through: 14

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/47ad672a76d30110254561960f1fe33e453cf8fe

Modified Files
--------------
doc/src/sgml/ref/comment.sgml | 18 +++++++++++-------
src/test/regress/expected/create_index.out | 14 ++++++++++++++
src/test/regress/expected/create_role.out | 27 +++++++++++++++++++++++++++
src/test/regress/sql/create_index.sql | 4 ++++
src/test/regress/sql/create_role.sql | 7 +++++++
5 files changed, 63 insertions(+), 7 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Fujii Masao 2026-03-03 05:49:44 pgsql: doc: Clarify that empty COMMENT string removes the comment.
Previous Message Fujii Masao 2026-03-03 05:49:19 pgsql: doc: Clarify that empty COMMENT string removes the comment.