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

Started by Tom Laneover 3 years ago7 messagescomitters
Jump to latest
#1Tom Lane
tgl@sss.pgh.pa.us

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: /messages/by-id/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(-)

#2Jeff Davis
pgsql@j-davis.com
In reply to: Tom Lane (#1)
Re: pgsql: Doc: document bpchar, clarify relationship of text and varchar.

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]/messages/by-id/7692740d4736e79032a5dac689cf2e304c03fa78.camel@j-davis.com that seems
to be visible with BPCHAR but not CHARACTER.

[1]: /messages/by-id/7692740d4736e79032a5dac689cf2e304c03fa78.camel@j-davis.com
/messages/by-id/7692740d4736e79032a5dac689cf2e304c03fa78.camel@j-davis.com

--
Jeff Davis
PostgreSQL Contributor Team - AWS

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Jeff Davis (#2)
Re: pgsql: Doc: document bpchar, clarify relationship of text and varchar.

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

#4Jeff Davis
pgsql@j-davis.com
In reply to: Tom Lane (#3)
Re: pgsql: Doc: document bpchar, clarify relationship of text and varchar.

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.patchtext/x-patch; charset=UTF-8; name=v1-0001-Document-type-BPCHAR-without-length-specifier.patchDownload+19-13
#5Bruce Momjian
bruce@momjian.us
In reply to: Jeff Davis (#4)
Re: pgsql: Doc: document bpchar, clarify relationship of text and varchar.

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.

Attachments:

bpchar.difftext/x-diff; charset=us-asciiDownload+17-10
#6Jeff Davis
pgsql@j-davis.com
In reply to: Bruce Momjian (#5)
Re: pgsql: Doc: document bpchar, clarify relationship of text and varchar.

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

#7Bruce Momjian
bruce@momjian.us
In reply to: Jeff Davis (#6)
Re: pgsql: Doc: document bpchar, clarify relationship of text and varchar.

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.