public inbox for [email protected]  
help / color / mirror / Atom feed
From: Laurenz Albe <[email protected]>
To: Tom Lane <[email protected]>
To: Jeff Davis <[email protected]>
Cc: [email protected]
Cc: [email protected]
Subject: Re: BPCHAR description in 8.3. Character Types is misleading and incomplete
Date: Fri, 17 Oct 2025 14:49:12 +0200
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
	<[email protected]>
	<[email protected]>

On Wed, 2025-10-15 at 15:29 -0400, Tom Lane wrote:
> Jeff Davis <[email protected]> writes:
> > Please take a look at the attached patch. If you'd like your name
> > included in the commit, please send it as you'd like it to appear.
> 
> I don't understand why any of these variants are better than the
> original wording "blank-padded".  That has the non-negligible
> advantage of corresponding to the type name, and furthermore
> appears in many other places in our docs and source code.
> 
> There may be some other wording improvements we could make here,
> but I think b69db5173 was fundamentally misguided in this respect.

My suggestion is to just remove the "blank-trimmed" from the documentation.

"bpchar" and "varchar", when used without type modifier, are actually
identical:

SELECT octet_length(BPCHAR 'x   '),
       octet_length(VARCHAR 'x   '),
       octet_length(TEXT 'x   ');

 octet_length │ octet_length │ octet_length 
══════════════╪══════════════╪══════════════
            4 │            4 │            4

The blank-trimming only occurs when a "bpchar" is converted to "text",
for example when used with the concatenation operator.

I suggest the following simplification:

diff --git a/doc/src/sgml/datatype.sgml b/doc/src/sgml/datatype.sgml
index b81d89e2608..05edab3bd33 100644
--- a/doc/src/sgml/datatype.sgml
+++ b/doc/src/sgml/datatype.sgml
@@ -1177,11 +1177,7 @@ SELECT '52093.89'::money::numeric::float8;
         <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>
+        <entry><type>text</type>, <type>varchar</type>, <type>bpchar</type></entry>
         <entry>variable unlimited length</entry>
        </row>
      </tbody>

Yours,
Laurenz Albe





reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: BPCHAR description in 8.3. Character Types is misleading and incomplete
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox