11<!--
2- $Header: /cvsroot/pgsql/doc/src/sgml/datatype.sgml,v 1.110 2002/12/06 05:17:42 momjian Exp $
2+ $Header: /cvsroot/pgsql/doc/src/sgml/datatype.sgml,v 1.111 2003/01/15 18:01:04 momjian Exp $
33-->
44
55 <chapter id="datatype">
@@ -86,18 +86,18 @@ $Header: /cvsroot/pgsql/doc/src/sgml/datatype.sgml,v 1.110 2002/12/06 05:17:42 m
8686 <entry>binary data</entry>
8787 </row>
8888
89- <row>
90- <entry><type>character(<replaceable>n</replaceable>)</type></entry>
91- <entry><type>char(<replaceable>n</replaceable>)</type></entry>
92- <entry>fixed-length character string</entry>
93- </row>
94-
9589 <row>
9690 <entry><type>character varying(<replaceable>n</replaceable>)</type></entry>
9791 <entry><type>varchar(<replaceable>n</replaceable>)</type></entry>
9892 <entry>variable-length character string</entry>
9993 </row>
10094
95+ <row>
96+ <entry><type>character(<replaceable>n</replaceable>)</type></entry>
97+ <entry><type>char(<replaceable>n</replaceable>)</type></entry>
98+ <entry>fixed-length character string</entry>
99+ </row>
100+
101101 <row>
102102 <entry><type>cidr</type></entry>
103103 <entry></entry>
@@ -248,7 +248,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/datatype.sgml,v 1.110 2002/12/06 05:17:42 m
248248 The following types (or spellings thereof) are specified by
249249 <acronym>SQL</acronym>: <type>bit</type>, <type>bit
250250 varying</type>, <type>boolean</type>, <type>char</type>,
251- <type>character</type>, <type>character varying </type>,
251+ <type>character varying </type>, <type>character</type>,
252252 <type>varchar</type>, <type>date</type>, <type>double
253253 precision</type>, <type>integer</type>, <type>interval</type>,
254254 <type>numeric</type>, <type>decimal</type>, <type>real</type>,
@@ -811,14 +811,14 @@ CREATE TABLE <replaceable class="parameter">tablename</replaceable> (
811811 </row>
812812 </thead>
813813 <tbody>
814- <row>
815- <entry><type>character(<replaceable>n</>)</type>, <type>char(<replaceable>n</>)</type></entry>
816- <entry>fixed-length, blank padded</entry>
817- </row>
818814 <row>
819815<entry><type>character varying(<replaceable>n</>)</type>, <type>varchar(<replaceable>n</>)</type></entry>
820816<entry>variable-length with limit</entry>
821817 </row>
818+ <row>
819+ <entry><type>character(<replaceable>n</>)</type>, <type>char(<replaceable>n</>)</type></entry>
820+ <entry>fixed-length, blank padded</entry>
821+ </row>
822822 <row>
823823<entry><type>text</type></entry>
824824<entry>variable unlimited length</entry>
@@ -835,29 +835,29 @@ CREATE TABLE <replaceable class="parameter">tablename</replaceable> (
835835
836836 <para>
837837 <acronym>SQL</acronym> defines two primary character types:
838- <type>character(<replaceable>n</>)</type> and <type>character
839- varying (<replaceable>n</>)</type>, where <replaceable>n</> is a
840- positive integer. Both of these types can store strings up to
838+ <type>character varying (<replaceable>n</>)</type> and
839+ <type>character (<replaceable>n</>)</type>, where <replaceable>n</>
840+ is a positive integer. Both of these types can store strings up to
841841 <replaceable>n</> characters in length. An attempt to store a
842842 longer string into a column of these types will result in an
843843 error, unless the excess characters are all spaces, in which case
844- the string will be truncated to the maximum length. (This
845- somewhat bizarre exception is required by the
846- <acronym>SQL</acronym> standard.) If the string to be stored is
847- shorter than the declared length, values of type
848- <type>character</type> willbe space-padded; values of type
849- <type>character varying</type> will simply store the shorter
844+ the string will be truncated to the maximum length. (This somewhat
845+ bizarre exception is required by the <acronym>SQL</acronym>
846+ standard.) If the string to be stored is shorter than the declared
847+ length, values of type <type>character</type> will be space-padded;
848+ values of type <type>character varying </type> willsimply store the
849+ shorter
850850 string.
851851 </para>
852852
853853 <note>
854854 <para>
855- If one explicitly casts a value to
856- <type>character (<replaceable>n</>)</type> or <type>character
857- varying (<replaceable>n</>)</type>, then anoverlength value will
858- be truncated to <replaceable>n</> characters without raising an
859- error. (This too is required by the <acronym>SQL</acronym>
860- standard.)
855+ If one explicitly casts a value to <type>character
856+ varying (<replaceable>n</>)</type> or
857+ <type>character (<replaceable>n</>)</type>, then anover-length
858+ value will be truncated to <replaceable>n</> characters without
859+ raising an error. (This too is required by the
860+ <acronym>SQL</acronym> standard.)
861861 </para>
862862 </note>
863863
@@ -870,14 +870,14 @@ CREATE TABLE <replaceable class="parameter">tablename</replaceable> (
870870 </note>
871871
872872 <para>
873- The notations <type>char (<replaceable>n</>)</type> and
874- <type>varchar (<replaceable>n</>)</type> are aliases for
875- <type>character (<replaceable>n</>)</type> and <type>character
876- varying (<replaceable>n</>)</type>,
877- respectively. <type>character</type> without length specifier is
878- equivalent to <type>character(1)</type>; if <type>character
879- varying</type> is used without length specifier, the type accepts
880- strings of any size. The latter is a <productname>PostgreSQL</> extension.
873+ The notations <type>varchar (<replaceable>n</>)</type> and
874+ <type>char (<replaceable>n</>)</type> are aliases for <type>character
875+ varying (<replaceable>n</>)</type> and
876+ <type>character (<replaceable>n</>)</type>, respectively.
877+ <type>character</type> without length specifier is equivalent to
878+ <type>character(1)</type>; if <type>character varying</type> is used
879+ without length specifier, the type accepts strings of any size. The
880+ latter is a <productname>PostgreSQL</> extension.
881881 </para>
882882
883883 <para>
@@ -961,19 +961,18 @@ SELECT b, char_length(b) FROM test2;
961961
962962 <para>
963963 There are two other fixed-length character types in
964- <productname>PostgreSQL</productname>, shown in <xref linkend="datatype-character-special-table">.
965- The <type>name</type> type
966- exists <emphasis>only</emphasis> for storage of internal catalog
967- names and is not intended for use by the general user. Its length
968- is currently defined as 64 bytes (63 usable characters plus terminator)
969- but should be referenced using the constant
970- <symbol>NAMEDATALEN</symbol>. The length is set at compile time
971- (and is therefore adjustable for special uses); the default
972- maximum length may change in a future release. The type
973- <type>"char"</type> (note the quotes) is different from
974- <type>char(1)</type> in that it only uses one byte of storage. It
975- is internally used in the system catalogs as a poor-man's
976- enumeration type.
964+ <productname>PostgreSQL</productname>, shown in <xref
965+ linkend="datatype-character-special-table">. The <type>name</type>
966+ type exists <emphasis>only</emphasis> for storage of internal
967+ catalog names and is not intended for use by the general user. Its
968+ length is currently defined as 64 bytes (63 usable characters plus
969+ terminator) but should be referenced using the constant
970+ <symbol>NAMEDATALEN</symbol>. The length is set at compile time (and
971+ is therefore adjustable for special uses); the default maximum
972+ length may change in a future release. The type <type>"char"</type>
973+ (note the quotes) is different from <type>char(1)</type> in that it
974+ only uses one byte of storage. It is internally used in the system
975+ catalogs as a poor-man's enumeration type.
977976 </para>
978977
979978 <table id="datatype-character-special-table">