Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vvUXS-004dvE-1B for pgsql-hackers@arkaria.postgresql.org; Thu, 26 Feb 2026 06:07:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vvUXR-00ABwC-0Y for pgsql-hackers@arkaria.postgresql.org; Thu, 26 Feb 2026 06:07:53 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vvUXQ-00ABw3-2V for pgsql-hackers@lists.postgresql.org; Thu, 26 Feb 2026 06:07:52 +0000 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1vvUXN-00000001FBd-1o52 for pgsql-hackers@lists.postgresql.org; Thu, 26 Feb 2026 06:07:51 +0000 Received: by mail-pj1-x102c.google.com with SMTP id 98e67ed59e1d1-3590042fa8eso190319a91.1 for ; Wed, 25 Feb 2026 22:07:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1772086069; x=1772690869; darn=lists.postgresql.org; h=to:date:message-id:subject:mime-version:from:from:to:cc:subject :date:message-id:reply-to; bh=qA25wq8zbacRLEEiJlCuH2s3VSQzLzKryugKe45onXQ=; b=OttM3dW1Hoo+aI9qyHRusb7XmHIvzuyUIMGr6CmYF13XAlV/FmOQgTpnPa2RF44xw1 XmpYPPF4gGlNG/kCEI4KfafnHKlRzwppN1o1EJFqMM44coUye3LYiKdJXaUu0bcibI1m m94b+A2jB4BgTNad7kB3YWnoQ4YoYhCa5uLeeqR3hrWcuGkIiCWAQQSDjMbO9YHixX4A u9W6pgNjvQwt9Iilg6fK67wfhlxUiox8LChdnSjcxi1N0U1y6qedx86iP0oay3iqR9Ly p1GyOj68oDLAKEwzk4c7SNnxB+pXRXfXqDEwlWa+cHXfUgYqNJB2xgKTS1uw7zgTMT5c sspQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772086069; x=1772690869; h=to:date:message-id:subject:mime-version:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=qA25wq8zbacRLEEiJlCuH2s3VSQzLzKryugKe45onXQ=; b=lFRYSslhGjXRneH0aZGSq7GBTQ4LiEJf6iNxG8WDeLfgp+CkOLXBNNxuK72E8tSMyU +gJb2H7iShdLg/4+kiINHdtLy9Ek4YFMcdNdQ9YAdLn83BFs/p5oRyBxTRzRQbotr8rk xzJI7cbcqVMDZE6XhfGueIh6jn5ueL/RuifevmXeJfCunHvBXyOuGONj4f3yirZR+UeK pad5TUF7JR80Yjz0g28r3lB1IqdFq3E55oHOVmFYz67OpOZ/M2RcmvIBiQRNI1hnZyk6 8ipMFRRzBohMY4LBj/s5T8f1s38ge4xEeW///pRqc1FVzTVRIlmcvT5TyB7KFwhLVq/m 7pQA== X-Gm-Message-State: AOJu0YwMj0o87XYDiBysiI1e+98ug231hhrjnmd/huQx98JS9WItiA8m NjyX1iHY4q7ionJAFUzW3tpOAquzY/61z2ATBqfLPMMXmqCMWQc69gfZhFtJfQ== X-Gm-Gg: ATEYQzz4wGNxi4KIaUfoSRXlUmzItCFTYrLP6x7TKaD70XcCZrVHGClMEr8NwsrWxag V9n30CJE2JizMw8ANPsX4ucm5wP4TfNjrC/ROZjAaP9T+nCKTor1XgbMFeKrcGD3wYA3h7mjUG3 7yBBEcskuCMI+R5bdjJRhu93eEjymn2AzVH+rjlanriQZ5OiMiF7pdVD9rEMQQ3MCzKfh8BWwfB jr9appkH76nrgmp7QdpjDllvkg4MwQ29s9dxMPEUOIrNonSXqc72s9qIVuYouSdbsS2++sMvGGQ 1Lqod0QtL7yXz/J4EdeLEIBfkHgrZ/KWY07BQFIi1U6qv8mwKDfx+H7voroCUcEknD63ViIgZbN Th7U0NPmN3HvrfhIVB2OhDE6ttiVsohk7ZJCe1WHkG4qC6us0A73sc8RsMjtZaslD30mdxmrBrK Umg0rJG3G/Ec5VKm/vuK5mfbquaTr4XQ== X-Received: by 2002:a17:90b:5883:b0:34a:e9b:26b1 with SMTP id 98e67ed59e1d1-358ae8c3852mr15375285a91.26.1772086069118; Wed, 25 Feb 2026 22:07:49 -0800 (PST) Received: from smtpclient.apple ([203.10.98.27]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3590158f91esm4694845a91.4.2026.02.25.22.07.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Feb 2026 22:07:48 -0800 (PST) From: Chao Li Content-Type: multipart/mixed; boundary="Apple-Mail=_084C9B93-2813-4F13-8F83-37F806DAEBC0" Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3864.400.21\)) Subject: doc: Clarify that empty COMMENT string removes the comment Message-Id: <26476097-B1C1-4BA8-AA92-0AD0B8EC7190@gmail.com> Date: Thu, 26 Feb 2026 14:07:14 +0800 To: PostgreSQL Hackers X-Mailer: Apple Mail (2.3864.400.21) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --Apple-Mail=_084C9B93-2813-4F13-8F83-37F806DAEBC0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Hi, While reviewing patch [1] before the holiday vacation, I noticed that = the COMMENT ON command treats an empty string as NULL, which effectively = removes the comment from the object. Today I also saw discussion [2], = which mentioned the same problem. =46rom the code, it seems the behavior is intentional: ``` /* Reduce empty-string to NULL case */ if (comment !=3D NULL && strlen(comment) =3D=3D 0) comment =3D NULL; ``` However, the documentation does not explain this behavior. It currently = only says: ``` string_literal The new comment contents, written as a string literal. ``` Is it a common pattern that an empty string is treated as NULL, so that = the documentation does not need to mention it explicitly? I don=E2=80=99t = think so. For example, a similar command, SECURITY LABEL ON, treats an = empty string as just an empty string. This tiny patch enhances the documentation of COMMENT ON to clarify that = an empty string is treated as NULL. [1] = https://postgr.es/m/e08cb97f-0364-4002-9cda-3c16b42e4136@uni-muenster.de [2] = https://postgr.es/m/CAHGQGwFJKg-aT5vajSU1v_B4K129u_SjZ3EGGHFSBhW967gcMA@ma= il.gmail.com Best regards, -- Chao Li (Evan) HighGo Software Co., Ltd. https://www.highgo.com/ --Apple-Mail=_084C9B93-2813-4F13-8F83-37F806DAEBC0 Content-Disposition: attachment; filename=v1-0001-doc-Clarify-that-empty-COMMENT-string-removes-the.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="v1-0001-doc-Clarify-that-empty-COMMENT-string-removes-the.patch" Content-Transfer-Encoding: quoted-printable =46rom=20469348fb023b127002dca977e93191ddf8981243=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20"Chao=20Li=20(Evan)"=20=0A= Date:=20Thu,=2026=20Feb=202026=2013:43:24=20+0800=0ASubject:=20[PATCH=20= v1]=20doc:=20Clarify=20that=20empty=20COMMENT=20string=20removes=20the=20= comment=0A=0AClarify=20the=20documentation=20of=20COMMENT=20ON=20to=20= state=20that=20specifying=20an=20empty=0Astring=20is=20treated=20as=20= NULL,=20meaning=20that=20the=20comment=20is=20removed.=0A=0AThis=20makes=20= the=20behavior=20explicit=20and=20avoids=20possible=20confusion=20about=20= how=0Aempty=20strings=20are=20handled.=0A=0AAuthor:=20Chao=20Li=20= =0AReviewed-by:=0ADiscussion:=20https://postgr.es/m/=0A= ---=0A=20doc/src/sgml/ref/comment.sgml=20|=203=20++-=0A=201=20file=20= changed,=202=20insertions(+),=201=20deletion(-)=0A=0Adiff=20--git=20= a/doc/src/sgml/ref/comment.sgml=20b/doc/src/sgml/ref/comment.sgml=0A= index=208d81244910b..e30c7c2917e=20100644=0A---=20= a/doc/src/sgml/ref/comment.sgml=0A+++=20b/doc/src/sgml/ref/comment.sgml=0A= @@=20-266,7=20+266,8=20@@=20COMMENT=20ON=0A=20=20=20=20=20= string_literal=0A=20=20=20=20=20= =0A=20=20=20=20=20=20=0A-=20=20=20=20=20=20The=20new=20= comment=20contents,=20written=20as=20a=20string=20literal.=0A+=20=20=20=20= =20=20The=20new=20comment=20contents,=20written=20as=20a=20string=20= literal.=20An=20empty=20string=0A+=20=20=20=20=20=20is=20treated=20as=20= NULL=20(that=20is,=20it=20drops=20the=20comment).=0A=20= =20=20=20=20=20=0A=20=20=20=20=20=0A=20=20=20=20= =0A--=20=0A2.50.1=20(Apple=20Git-155)=0A=0A= --Apple-Mail=_084C9B93-2813-4F13-8F83-37F806DAEBC0--