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.94.2) (envelope-from ) id 1v9TV6-0015Pn-P4 for pgsql-docs@arkaria.postgresql.org; Thu, 16 Oct 2025 19:19:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1v9TV5-00F4HJ-5J for pgsql-docs@arkaria.postgresql.org; Thu, 16 Oct 2025 19:18:58 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1v9TV4-00F4HB-SY for pgsql-docs@lists.postgresql.org; Thu, 16 Oct 2025 19:18:57 +0000 Received: from mail-ot1-x333.google.com ([2607:f8b0:4864:20::333]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1v9TV1-002a7l-2O for pgsql-docs@lists.postgresql.org; Thu, 16 Oct 2025 19:18:57 +0000 Received: by mail-ot1-x333.google.com with SMTP id 46e09a7af769-7bb79ad6857so588124a34.0 for ; Thu, 16 Oct 2025 12:18:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1760642334; x=1761247134; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=kFyXCzM3b2YBQO9B4B3XJJp5tpxOTEUI2G/XuNuXxqI=; b=L1AH40CeY9qAFa6TsJhKUoIVXHxX3iqdAFgXYwqXz9HXDXog2KmIfymppgeCyG/8h2 i/DK2xTYGgUqzXN+muthcKeVj7b/walLqIHN44nFSQA05DZYbC7ASOnxFY/C29TzttEI e8Ac11eb/O3JpZgvm8+cmKqxGHN4Bw6jKFw/LbEPOgIbT0wiV/M/JEQywIMm6jSJ0/FU NnzGjyueQt8mJxvN4h1K77tP8YIv5mofNz2BKHwnngSkP03hpoQtpf9rL3RcU3NQAdMh 8DRvTu0fUh2+MYvKemRqUaFBGdqIOlm044F/Go/ruPzLcFxNCU44w8XFt+Y54JwFyNf+ Vt4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760642334; x=1761247134; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=kFyXCzM3b2YBQO9B4B3XJJp5tpxOTEUI2G/XuNuXxqI=; b=Yb4rY+gDR9M04c1Bcf2lcGsFYL+RiCuGVVfM/yu8iequuWgETUd/4WAXlgVVM8euit FgNs6AZwa56JMTexEjrSgYaEbIJgzsu6MJqiZ5LK2WxGJMHurqgzDUHL+eJDZmPVmeWO E8NG9lhioTk4E25Tuho5eilPQPnxQjhcCDT4LcqK+ZCZZKN33ev8OBCZPcGZmwSorrIn 0ZGlldr10DUbMeVgGJnKF+SPeWFjU1kk9Kg9YL9VY2fsaLe0KjPh+y1YCMYZsaKYdtEr 3Xs5dMf1s90SIf1HZlrtlL69XO4vczW8bHSqLJiSsMDxx2Gsc4tmZmL2brujEhvjtMKQ JMTw== X-Forwarded-Encrypted: i=1; AJvYcCXjLXSR/O28KsjNfRWw+xFer/JdXCcdh/muWYQxOjCHY9mgrUWA/ZZMAGDoNzTSm2iyhQNHXEPGOoQ4@lists.postgresql.org X-Gm-Message-State: AOJu0Yxj2sPuzzMdTt3CUMscamWeMTRl4qPasQoPt/Eo3VbpiKciyrjt 8LpQeUb1NZEPe1Ks0+mkHCMJKquyv2oiwfAjIqymFug620BLDYTaevfxaeQ5Fvfyp0aJnGSuaHD dXW0yhhfR3rm4JhgWs2xlwnxpX3ncKvfdEA== X-Gm-Gg: ASbGnctU06Ws+If/1ScOTMjbqxw7SvZio0/MFXrXOlNfXbYwFBUs1ydE127hPPDgHrw fiburC4UFk+fS+65RcfDyK2jGkDTat6S6Ww+n470OsKcznFSgGpYdoM5TcOUuVv6w6ZCMlOuvuh kXxstMh+X1VSW/qwx2S5lbOC6cjC+8Qu0WSpoGtb7OUeI1cjASNorJrGBjfC4K/dYf8Ebm8fT/o RlS7+1zdabnvRy1rmnTt1bplvOlUF9GXTpZ5BY6U1zUc5hsZdBigoW6sfQLEQ== X-Google-Smtp-Source: AGHT+IH3cPvoEkb3f9neo9NEyrbxOrTVmw/eBigv+3Vep5YRvgA6AMj5xpDsZr/I7YhYHGQKDbrfVcYIAKCRJhTakU4= X-Received: by 2002:a05:6808:13c8:b0:43f:4995:bb7d with SMTP id 5614622812f47-443a2dfa119mr571490b6e.7.1760642333723; Thu, 16 Oct 2025 12:18:53 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:ac9:7444:0:b0:5f3:5bf6:6b0b with HTTP; Thu, 16 Oct 2025 12:18:52 -0700 (PDT) In-Reply-To: References: <176044409338.770.16064383081308443747@wrigleys.postgresql.org> <1307875.1760556576@sss.pgh.pa.us> From: "David G. Johnston" Date: Thu, 16 Oct 2025 15:18:52 -0400 X-Gm-Features: AS18NWDlcrL56EWvoIK-7VW1DpjasONFRUxmlG5zzNyCvE1IGBl3qi3OwosNczM Message-ID: Subject: Re: BPCHAR description in 8.3. Character Types is misleading and incomplete To: Sergei Katkovsky Cc: Tom Lane , Jeff Davis , "pgsql-docs@lists.postgresql.org" Content-Type: multipart/alternative; boundary="000000000000e0d42206414b7c85" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000e0d42206414b7c85 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thursday, October 16, 2025, Sergei Katkovsky wrote: > On Thu, Oct 16, 2025 at 10:11=E2=80=AFPM David G. Johnston > wrote: > > > The spaces added to the end of a bpchar manually can and are considered > =E2=80=9Cpadding=E2=80=9D - or =E2=80=9Cpresent but lack semantic/value s= ignificance=E2=80=9D. The reason > they are not padding for varchar is that such spaces are considered part = of > the stored value from a semantic perspective. > > > > Think of padding as a noun, not a verb. =E2=80=9CThe value contains pa= dding=E2=80=9D. > Not, =E2=80=9C I am padding the value=E2=80=9D. > > The value may sometimes contain padding. And sometimes not. But we are > talking about the type, not value. We are talking about the properties of values stored within the type and the behavior during their construction and use. For bpchar those values have no length limitation and any trailing spaces present are considered padding. > And, the proposal is not to change the name of the type. The proposal > is to change the wording 'blank-trimming' to something more > appropriate. I=E2=80=99m on board with that. Blank-padded is IMO the best =E2=80=9Cmore= appropriate=E2=80=9D choice. In PostgreSQL the behavior and stored contents/representation of a value are not influenced by a type modifier. It is only used during input to perform some either or both a validation or transformation. Here, when present, it performs a padding transform. But present or absent, trailing spaces, if any, are considered padding. The prose for the section talk about the two key pieces: (n) imposes a length limit while also transforming an input by adding padding spaces. The non-n case has unlimited length and no transformation. Post-construction, all trailing spaces are treated as padding. David J. --000000000000e0d42206414b7c85 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thursday, October 16, 2025, Sergei Katkovsky <skatkovsky@gmail.com> wrote:
On Thu, Oct 16, 2025 at 10:11=E2=80=AFPM David G. Johnston <david.g.johnston@gmail.co= m> wrote:

> The spaces added to the end of a bpchar manually can and are considere= d =E2=80=9Cpadding=E2=80=9D - or =E2=80=9Cpresent but lack semantic/value s= ignificance=E2=80=9D. The reason they are not padding for varchar is that s= uch spaces are considered part of the stored value from a semantic perspect= ive.
>
> Think of padding as a noun, not a verb.=C2=A0 =E2=80=9CThe value conta= ins padding=E2=80=9D.=C2=A0 Not, =E2=80=9C I am padding the value=E2=80=9D.=

The value may sometimes contain padding. And sometimes not.=C2=A0
But we are
talking about the type, not value.

We are t= alking about the properties of values stored within the type and the behavi= or during their construction and use.=C2=A0 For bpchar those values have no= length limitation and any trailing spaces present are considered padding.<= /div>
=C2=A0


And, the proposal is not to change the name of the type. The proposal
is to change the wording 'blank-trimming' to something more
appropriate.

I=E2=80=99m on board with that= .=C2=A0 Blank-padded is IMO the best =E2=80=9Cmore appropriate=E2=80=9D cho= ice.

In PostgreSQL the behavior and stored content= s/representation of a value are not influenced by a type modifier.=C2=A0 It= is only used during input to perform some either or both a validation or t= ransformation.=C2=A0 Here, when present, it performs a padding transform.= =C2=A0 But present or absent, trailing spaces, if any, are considered paddi= ng.=C2=A0 The prose for the section talk about the two key pieces: (n) impo= ses a length limit while also transforming an input by adding padding space= s.=C2=A0 The non-n case has unlimited length and no transformation.=C2=A0 P= ost-construction, all trailing spaces are treated as padding.
David J.

--000000000000e0d42206414b7c85--