Thread: pgsql: Doc: document bpchar, clarify relationship of text and varchar.

pgsql: Doc: document bpchar, clarify relationship of text and varchar.

From
Tom Lane
Date:
Doc: document bpchar, clarify relationship of text and varchar.

For some reason the "bpchar" type name was defined nowhere in
our SGML docs, although several places refer to it in passing.
Give it a proper mention under Character Types.

While here, also provide an explanation of how the text and varchar
types relate.  The previous wording seemed to be doing its best
to sweep text under the rug, which doesn't seem very appropriate
given its prominence in other parts of the docs.

Minor rearrangements and word-smithing for clarity, too.

Laurenz Albe and Tom Lane, per gripe from Yanliang Lei

Discussion: https://postgr.es/m/120b3084.56b6.1833b5ffe4b.Coremail.msdnchina@163.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/0937f6d172921202e1b432e206e4c30775d564d8

Modified Files
--------------
doc/src/sgml/datatype.sgml | 59 ++++++++++++++++++++++++++++------------------
1 file changed, 36 insertions(+), 23 deletions(-)


Re: pgsql: Doc: document bpchar, clarify relationship of text and varchar.

From
Jeff Davis
Date:
On Wed, 2022-09-28 at 16:31 +0000, Tom Lane wrote:
> Doc: document bpchar, clarify relationship of text and varchar.

BPCHAR is documented as an alias to CHARACTER, but the former can end
up with no typmod at all whereas the latter defaults to CHARACTER(1).

Should we document the case of using BPCHAR with no length?

I noticed this because there exists a hash function bug[1] that seems
to be visible with BPCHAR but not CHARACTER.

[1]
https://www.postgresql.org/message-id/7692740d4736e79032a5dac689cf2e304c03fa78.camel@j-davis.com

--
Jeff Davis
PostgreSQL Contributor Team - AWS





Re: pgsql: Doc: document bpchar, clarify relationship of text and varchar.

From
Tom Lane
Date:
Jeff Davis <pgsql@j-davis.com> writes:
> BPCHAR is documented as an alias to CHARACTER, but the former can end
> up with no typmod at all whereas the latter defaults to CHARACTER(1).

> Should we document the case of using BPCHAR with no length?

Perhaps; you got specific wording in mind?

(I think that that difference is in fact documented somewhere,
but maybe not where you looked.)

            regards, tom lane



Re: pgsql: Doc: document bpchar, clarify relationship of text and varchar.

From
Jeff Davis
Date:
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



Attachment

Re: pgsql: Doc: document bpchar, clarify relationship of text and varchar.

From
Bruce Momjian
Date:
On Fri, Dec  2, 2022 at 01:55:41PM -0800, Jeff Davis wrote:
> 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.

I liked this patch and adjusted it;  patch attached.  I would like to
apply it to all branches since it provides useful information.

-- 
  Bruce Momjian  <bruce@momjian.us>        https://momjian.us
  EDB                                      https://enterprisedb.com

  Only you can decide what is important to you.

Attachment

Re: pgsql: Doc: document bpchar, clarify relationship of text and varchar.

From
Jeff Davis
Date:
On Tue, 2023-10-24 at 18:35 -0400, Bruce Momjian wrote:
> I liked this patch and adjusted it;  patch attached.  I would like to
> apply it to all branches since it provides useful information.

Looks good to me.

Regards,
    Jeff Davis




Re: pgsql: Doc: document bpchar, clarify relationship of text and varchar.

From
Bruce Momjian
Date:
On Tue, Oct 24, 2023 at 04:00:08PM -0700, Jeff Davis wrote:
> On Tue, 2023-10-24 at 18:35 -0400, Bruce Momjian wrote:
> > I liked this patch and adjusted it;  patch attached.  I would like to
> > apply it to all branches since it provides useful information.
> 
> Looks good to me.

Patch applied back to PG 16.

-- 
  Bruce Momjian  <bruce@momjian.us>        https://momjian.us
  EDB                                      https://enterprisedb.com

  Only you can decide what is important to you.