@@ -1154,6 +1154,10 @@ SELECT '52093.89'::money::numeric::float8;
1154
1154
<primary>varchar</primary>
1155
1155
</indexterm>
1156
1156
1157
+ <indexterm zone="datatype-character">
1158
+ <primary>bpchar</primary>
1159
+ </indexterm>
1160
+
1157
1161
<table id="datatype-character-table">
1158
1162
<title>Character Types</title>
1159
1163
<tgroup cols="2">
@@ -1169,7 +1173,7 @@ SELECT '52093.89'::money::numeric::float8;
1169
1173
<entry>variable-length with limit</entry>
1170
1174
</row>
1171
1175
<row>
1172
- <entry><type>character(<replaceable>n</replaceable>)</type>, <type>char(<replaceable>n</replaceable>)</type></entry>
1176
+ <entry><type>character(<replaceable>n</replaceable>)</type>, <type>char(<replaceable>n</replaceable>)</type>, <type>bpchar(<replaceable>n</replaceable>)</type> </entry>
1173
1177
<entry>fixed-length, blank padded</entry>
1174
1178
</row>
1175
1179
<row>
@@ -1196,41 +1200,50 @@ SELECT '52093.89'::money::numeric::float8;
1196
1200
error, unless the excess characters are all spaces, in which case
1197
1201
the string will be truncated to the maximum length. (This somewhat
1198
1202
bizarre exception is required by the <acronym>SQL</acronym>
1199
- standard.) If the string to be stored is shorter than the declared
1203
+ standard.)
1204
+ However, if one explicitly casts a value to <type>character
1205
+ varying(<replaceable>n</replaceable>)</type> or
1206
+ <type>character(<replaceable>n</replaceable>)</type>, then an over-length
1207
+ value will be truncated to <replaceable>n</replaceable> characters without
1208
+ raising an error. (This too is required by the
1209
+ <acronym>SQL</acronym> standard.)
1210
+ If the string to be stored is shorter than the declared
1200
1211
length, values of type <type>character</type> will be space-padded;
1201
1212
values of type <type>character varying</type> will simply store the
1202
1213
shorter
1203
1214
string.
1204
1215
</para>
1205
1216
1206
1217
<para>
1207
- If one explicitly casts a value to <type>character
1208
- varying(<replaceable>n</replaceable>)</type> or
1209
- <type>character(<replaceable>n</replaceable>)</type>, then an over-length
1210
- value will be truncated to <replaceable>n</replaceable> characters without
1211
- raising an error. (This too is required by the
1212
- <acronym>SQL</acronym> standard.)
1218
+ In addition, <productname>PostgreSQL</productname> provides the
1219
+ <type>text</type> type, which stores strings of any length.
1220
+ Although the <type>text</type> type is not in the
1221
+ <acronym>SQL</acronym> standard, several other SQL database
1222
+ management systems have it as well.
1223
+ <type>text</type> is <productname>PostgreSQL</productname>'s native
1224
+ string data type, in that most built-in functions operating on strings
1225
+ are declared to take or return <type>text</type> not <type>character
1226
+ varying</type>. For many purposes, <type>character varying</type>
1227
+ acts as though it were a <link linkend="domains">domain</link>
1228
+ over <type>text</type>.
1213
1229
</para>
1214
1230
1215
1231
<para>
1216
- The notations <type>varchar(<replaceable>n</replaceable>)</type> and
1217
- <type>char(<replaceable>n</replaceable>)</type> are aliases for <type>character
1218
- varying(<replaceable>n</replaceable>)</type> and
1219
- <type>character(<replaceable>n</replaceable>)</type>, respectively.
1220
- If specified, the length must be greater than zero and cannot exceed
1221
- 10485760.
1222
- <type>character</type> without length specifier is equivalent to
1223
- <type>character(1)</type>. If <type>character varying</type> is used
1224
- without length specifier, the type accepts strings of any size. The
1225
- latter is a <productname>PostgreSQL</productname> extension.
1232
+ 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.
1226
1238
</para>
1227
1239
1228
1240
<para>
1229
- In addition, <productname>PostgreSQL</productname> provides the
1230
- <type>text</type> type, which stores strings of any length.
1231
- Although the type <type>text</type> is not in the
1232
- <acronym>SQL</acronym> standard, several other SQL database
1233
- management systems have it as well.
1241
+ 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. The
1246
+ latter behavior is a <productname>PostgreSQL</productname> extension.
1234
1247
</para>
1235
1248
1236
1249
<para>