From: Bruce Momjian Date: Tue, 31 Oct 2023 14:13:11 +0000 (-0400) Subject: doc: improve bpchar and character type length details X-Git-Tag: REL_17_BETA1~1569 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b69db5173678223686e4669ab07d5ea907da2535;p=thirdparty%2Fpostgresql.git doc: improve bpchar and character type length details Reported-by: Jeff Davis Discussion: https://postgr.es/m/32a9b8357e8e29b04f395f92c53b64e015a4caf1.camel@j-davis.com Author: Jeff Davis, adjustments by me Backpatch-through: 16 --- diff --git a/doc/src/sgml/datatype.sgml b/doc/src/sgml/datatype.sgml index 5d237657059..5a6cfbd94d8 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 10,485,760. 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).