On Fri, 2022-12-02 at 15:26 -0500, Tom Lane wrote:
> Perhaps; you got specific wording in mind?

Here's what I came up with. It's kind of its own thing, because it
can't be described as blank-padded.


-- 
Jeff Davis
PostgreSQL Contributor Team - AWS


From 3fbe9c3a6acc95d67c468f1406ab816d89c601bb Mon Sep 17 00:00:00 2001
From: Jeff Davis <[email protected]>
Date: Fri, 2 Dec 2022 13:39:13 -0800
Subject: [PATCH v1] Document type BPCHAR without length specifier.

The BPCHAR datatype with no length specifier has its own semantics; it
cannot be considered "padded" as it has no length to which it should
be padded, but trailing spaces are still ignored.
---
 doc/src/sgml/datatype.sgml | 31 +++++++++++++++++++------------
 1 file changed, 19 insertions(+), 12 deletions(-)

diff --git a/doc/src/sgml/datatype.sgml b/doc/src/sgml/datatype.sgml
index fdffba4442..824e2a3022 100644
--- a/doc/src/sgml/datatype.sgml
+++ b/doc/src/sgml/datatype.sgml
@@ -1174,7 +1174,11 @@ SELECT '52093.89'::money::numeric::float8;
        </row>
        <row>
         <entry><type>character(<replaceable>n</replaceable>)</type>, <type>char(<replaceable>n</replaceable>)</type>, <type>bpchar(<replaceable>n</replaceable>)</type></entry>
-        <entry>fixed-length, blank padded</entry>
+        <entry>fixed-length, blank-padded</entry>
+       </row>
+       <row>
+        <entry><type>bpchar</type></entry>
+        <entry>variable unlimited length, blank-trimmed</entry>
        </row>
        <row>
         <entry><type>text</type></entry>
@@ -1230,20 +1234,23 @@ SELECT '52093.89'::money::numeric::float8;
 
    <para>
     The type name <type>varchar</type> is an alias for <type>character
-    varying</type>, while <type>char</type> and <type>bpchar</type> are
-    aliases for <type>character</type>.
-    The <type>varchar</type> and <type>char</type> aliases are defined in
-    the <acronym>SQL</acronym> standard, but <type>bpchar</type> is
-    a <productname>PostgreSQL</productname> extension.
+    varying</type>, while <type>bpchar</type> (with length specifier) and
+    <type>char</type> are aliases for <type>character</type>.  The
+    <type>varchar</type> and <type>char</type> aliases are defined in the
+    <acronym>SQL</acronym> standard, but <type>bpchar</type> is a
+    <productname>PostgreSQL</productname> extension.
    </para>
 
    <para>
-    If specified, the length <replaceable>n</replaceable> must be greater
-    than zero and cannot exceed 10485760.
-    <type>character</type> without length specifier is equivalent to
-    <type>character(1)</type>. If <type>character varying</type> is used
-    without length specifier, the type accepts strings of any size. The
-    latter behavior is a <productname>PostgreSQL</productname> extension.
+    If specified, the length <replaceable>n</replaceable> must be greater than
+    zero and cannot exceed 10485760.  <type>character</type> or
+    <type>char</type> without length specifier are equivalent to
+    <type>character(1)</type>. If <type>character varying</type> or
+    <type>varchar</type> are used without length specifier, the type accepts
+    strings of any size. The latter behavior is a
+    <productname>PostgreSQL</productname> extension. If <type>bpchar</type> is
+    used without length specifier, it accepts strings of any size, but
+    trailing spaces are semantically insignificant.
    </para>
 
    <para>
-- 
2.34.1

Reply via email to