Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qvPzr-0053qA-09 for pgsql-committers@arkaria.postgresql.org; Tue, 24 Oct 2023 22:35:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qvPzo-00DzeH-V2 for pgsql-committers@arkaria.postgresql.org; Tue, 24 Oct 2023 22:35:32 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qvPzo-00Dze9-Nm for pgsql-committers@lists.postgresql.org; Tue, 24 Oct 2023 22:35:32 +0000 Received: from momjian.us ([72.94.173.45]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qvPzl-002XYG-Cz for pgsql-committers@lists.postgresql.org; Tue, 24 Oct 2023 22:35:32 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=momjian.us; s=2023062407; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description; bh=m9bDle6gqQyrcmmT+4aBLrPD5B630MCenX3xB8Y+liE=; b=jYSGU 8guLyAQV/g0B6ns3N+a2uiInpr/4NhKckey/cZCTbBpMpxVlnk9SzmIV2BwPEG/CTp0HeXbtYPXhD H/C9Yp/JiB+APWRhcXRlYKNSWUEgHCqY0+/ErOUghdKsbY2kztw2sIT5Js60FEzO3fgc1lQ0iiFMv 5txkRzGMl16HBlCQAoXhLE9d5r5k/8U9wi9HuxmYvzyIdWk0+1oMpyE2MWj+7/3XsPEiyovdkaxAQ KSfawNMIvF0pJpxP31P+x2Q0lrkGCKBDD5tj9XJ7bNnNa88MAS95BsKP73HLtyAUsKpBnx26DEZFZ kz6RzLwye21I+9cYg/5fzgq/iwB8Q==; Received: from bruce by momjian.us with local (Exim 4.96) (envelope-from ) id 1qvPzj-00BEgw-1Q; Tue, 24 Oct 2023 18:35:27 -0400 Date: Tue, 24 Oct 2023 18:35:27 -0400 From: Bruce Momjian To: Jeff Davis Cc: Tom Lane , pgsql-committers@lists.postgresql.org Subject: Re: pgsql: Doc: document bpchar, clarify relationship of text and varchar. Message-ID: References: <32a9b8357e8e29b04f395f92c53b64e015a4caf1.camel@j-davis.com> <2129300.1670012806@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="cOJfN+6f+BAgvsbX" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --cOJfN+6f+BAgvsbX Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 https://momjian.us EDB https://enterprisedb.com Only you can decide what is important to you. --cOJfN+6f+BAgvsbX Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="bpchar.diff" diff --git a/doc/src/sgml/datatype.sgml b/doc/src/sgml/datatype.sgml index 5d23765705..dcb44716f5 100644 --- a/doc/src/sgml/datatype.sgml +++ b/doc/src/sgml/datatype.sgml @@ -1174,7 +1174,11 @@ SELECT '52093.89'::money::numeric::float8; character(n), char(n), bpchar(n) - fixed-length, blank padded + fixed-length, blank-padded + + + bpchar + variable unlimited length, blank-trimmed text @@ -1230,19 +1234,22 @@ SELECT '52093.89'::money::numeric::float8; The type name varchar is an alias for character - varying, while char and bpchar are - aliases for character. - The varchar and char aliases are defined in - the SQL standard, but bpchar is - a PostgreSQL extension. + varying, while bpchar (with length specifier) and + char are aliases for character. The + varchar and char aliases are defined in the + SQL standard; bpchar is a + PostgreSQL extension. If specified, the length n must be greater - than zero and cannot exceed 10485760. - character without length specifier is equivalent to - character(1). If character varying is used - without length specifier, the type accepts strings of any size. + than zero and cannot exceed 10485760. If character + varying (or varchar) is used without + length specifier, the type accepts strings of any length. If + bpchar lacks a length specifier, it also accepts strings + of any length, but trailing spaces are semantically insignificant. + If character (or char) lacks a specifier, + it is equivalent to character(1). --cOJfN+6f+BAgvsbX--