Skip to content

Commit b69db51

Browse files
committed
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
1 parent 4a6286f commit b69db51

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

doc/src/sgml/datatype.sgml

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1174,7 +1174,11 @@ SELECT '52093.89'::money::numeric::float8;
11741174
</row>
11751175
<row>
11761176
<entry><type>character(<replaceable>n</replaceable>)</type>, <type>char(<replaceable>n</replaceable>)</type>, <type>bpchar(<replaceable>n</replaceable>)</type></entry>
1177-
<entry>fixed-length, blank padded</entry>
1177+
<entry>fixed-length, blank-padded</entry>
1178+
</row>
1179+
<row>
1180+
<entry><type>bpchar</type></entry>
1181+
<entry>variable unlimited length, blank-trimmed</entry>
11781182
</row>
11791183
<row>
11801184
<entry><type>text</type></entry>
@@ -1230,19 +1234,22 @@ SELECT '52093.89'::money::numeric::float8;
12301234

12311235
<para>
12321236
The type name <type>varchar</type> is an alias for <type>character
1233-
varying</type>, while <type>char</type> and <type>bpchar</type> are
1234-
aliases for <type>character</type>.
1235-
The <type>varchar</type> and <type>char</type> aliases are defined in
1236-
the <acronym>SQL</acronym> standard, but <type>bpchar</type> is
1237-
a <productname>PostgreSQL</productname> extension.
1237+
varying</type>, while <type>bpchar</type> (with length specifier) and
1238+
<type>char</type> are aliases for <type>character</type>. The
1239+
<type>varchar</type> and <type>char</type> aliases are defined in the
1240+
<acronym>SQL</acronym> standard; <type>bpchar</type> is a
1241+
<productname>PostgreSQL</productname> extension.
12381242
</para>
12391243

12401244
<para>
12411245
If specified, the length <replaceable>n</replaceable> must be greater
1242-
than zero and cannot exceed 10485760.
1243-
<type>character</type> without length specifier is equivalent to
1244-
<type>character(1)</type>. If <type>character varying</type> is used
1245-
without length specifier, the type accepts strings of any size.
1246+
than zero and cannot exceed 10,485,760. If <type>character
1247+
varying</type> (or <type>varchar</type>) is used without
1248+
length specifier, the type accepts strings of any length. If
1249+
<type>bpchar</type> lacks a length specifier, it also accepts strings
1250+
of any length, but trailing spaces are semantically insignificant.
1251+
If <type>character</type> (or <type>char</type>) lacks a specifier,
1252+
it is equivalent to <type>character(1)</type>.
12461253
</para>
12471254

12481255
<para>

0 commit comments

Comments
 (0)