1
1
<!--
2
- $PostgreSQL: pgsql/doc/src/sgml/datatype.sgml,v 1.140 2004/01/20 22:46:06 tgl Exp $
2
+ $PostgreSQL: pgsql/doc/src/sgml/datatype.sgml,v 1.141 2004/02/01 06:27:48 tgl Exp $
3
3
-->
4
4
5
5
<chapter id="datatype">
@@ -901,6 +901,18 @@ CREATE TABLE <replaceable class="parameter">tablename</replaceable> (
901
901
management systems have it as well.
902
902
</para>
903
903
904
+ <para>
905
+ Values of type <type>character</type> are physically padded
906
+ with spaces to the specified width <replaceable>n</>, and are
907
+ stored and displayed that way. However, the padding spaces are
908
+ treated as semantically insignificant. Trailing spaces are
909
+ disregarded when comparing two values of type <type>character</type>,
910
+ and they will be removed when converting a <type>character</type> value
911
+ to one of the other string types. Note that trailing spaces
912
+ <emphasis>are</> semantically significant in
913
+ <type>character varying</type> and <type>text</type> values.
914
+ </para>
915
+
904
916
<para>
905
917
The storage requirement for data of these types is 4 bytes plus the
906
918
actual string, and in case of <type>character</type> plus the
@@ -922,7 +934,11 @@ CREATE TABLE <replaceable class="parameter">tablename</replaceable> (
922
934
<para>
923
935
There are no performance differences between these three types,
924
936
apart from the increased storage size when using the blank-padded
925
- type.
937
+ type. While <type>character(<replaceable>n</>)</type> has performance
938
+ advantages in some other database systems, it has no such advantages in
939
+ <productname>PostgreSQL</productname>. In most situations
940
+ <type>text</type> or <type>character varying</type> should be used
941
+ instead.
926
942
</para>
927
943
</tip>
928
944
0 commit comments