| From: | Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> |
|---|---|
| To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Jeff Davis <pgsql(at)j-davis(dot)com> |
| Cc: | skatkovsky(at)gmail(dot)com, pgsql-docs(at)lists(dot)postgresql(dot)org |
| Subject: | Re: BPCHAR description in 8.3. Character Types is misleading and incomplete |
| Date: | 2025-10-17 12:49:12 |
| Message-ID: | 92151c4debb48bbbaed4db81c79d73c36f619858.camel@cybertec.at |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-docs |
On Wed, 2025-10-15 at 15:29 -0400, Tom Lane wrote:
> Jeff Davis <pgsql(at)j-davis(dot)com> 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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | David G. Johnston | 2025-10-17 13:14:51 | Re: BPCHAR description in 8.3. Character Types is misleading and incomplete |
| Previous Message | Sergei Katkovsky | 2025-10-17 07:37:40 | Re: BPCHAR description in 8.3. Character Types is misleading and incomplete |