From: Jeff Davis <pgsql@j-davis.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Doc: document bpchar, clarify relationship of text and varchar.
Date: Fri, 02 Dec 2022 13:55:41 -0800
Message-ID: <bde2067c71ba19c2d57e02fa13ae450eea322db3.camel@j-davis.com> (raw)
In-Reply-To: <2129300.1670012806@sss.pgh.pa.us>
References: <E1odZyZ-0000g2-AE@gemulon.postgresql.org>
<32a9b8357e8e29b04f395f92c53b64e015a4caf1.camel@j-davis.com>
<2129300.1670012806@sss.pgh.pa.us>
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
Attachments:v1-0001-Document-type-BPCHAR-without-length-specifier.patch (text/x-patch, 3.1K) download
From 3fbe9c3a6acc95d67c468f1406ab816d89c601bb Mon Sep 17 00:00:00 2001
From: Jeff Davis <jeff@j-davis.com>
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.sgmlindex 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 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: pgsql-committers@postgresql.org
Cc: pgsql@j-davis.com, tgl@sss.pgh.pa.us, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Doc: document bpchar, clarify relationship of text and varchar.
In-Reply-To: <bde2067c71ba19c2d57e02fa13ae450eea322db3.camel@j-davis.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox