From b5a833ddec47d90f63fc386bedbac5b78356b74e Mon Sep 17 00:00:00 2001 From: "Chao Li (Evan)" Date: Thu, 26 Feb 2026 13:43:24 +0800 Subject: [PATCH v2] 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. Author: Chao Li Reviewed-by: Fujii Masao Reviewed-by: Ashutosh Bapat Reviewed-by: David G. Johnston Reviewed-by: Shengbin Zhao Reviewed-by: Jim Jones Discussion: https://postgr.es/m/26476097-B1C1-4BA8-AA92-0AD0B8EC7190@gmail.com --- doc/src/sgml/ref/comment.sgml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/doc/src/sgml/ref/comment.sgml b/doc/src/sgml/ref/comment.sgml index 8d81244910b..6157fdf934c 100644 --- a/doc/src/sgml/ref/comment.sgml +++ b/doc/src/sgml/ref/comment.sgml @@ -80,13 +80,14 @@ COMMENT ON Description - COMMENT stores a comment about a database object. + COMMENT stores, replaces, or removes the comment on a + database object. Only one comment string is stored for each object, so to modify a comment, issue a new COMMENT command for the same object. To remove a - comment, write NULL in place of the text string. + comment, use NULL or an empty string (''). Comments are automatically dropped when their object is dropped. @@ -266,7 +267,8 @@ COMMENT ON string_literal - The new comment contents, written as a string literal. + The new comment contents, written as a string literal. An empty string + ('') removes the comment. @@ -275,7 +277,7 @@ COMMENT ON NULL - Write NULL to drop the comment. + Write NULL to remove the comment. @@ -362,6 +364,7 @@ COMMENT ON TRANSFORM FOR hstore LANGUAGE plpython3u IS 'Transform between hstore COMMENT ON TRIGGER my_trigger ON my_table IS 'Used for RI'; COMMENT ON TYPE complex IS 'Complex number data type'; COMMENT ON VIEW my_view IS 'View of departmental costs'; +COMMENT ON VIEW my_view IS NULL; -- 2.50.1 (Apple Git-155)