Reorder VARCHAR() to appear before CHAR() in docs.
This commit is contained in:
parent
d14c64c4a3
commit
0eed62f34d
doc/src/sgml
@ -1,5 +1,5 @@
|
|||||||
<!--
|
<!--
|
||||||
$Header: /cvsroot/pgsql/doc/src/sgml/datatype.sgml,v 1.110 2002/12/06 05:17:42 momjian Exp $
|
$Header: /cvsroot/pgsql/doc/src/sgml/datatype.sgml,v 1.111 2003/01/15 18:01:04 momjian Exp $
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<chapter id="datatype">
|
<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
|
|||||||
<entry>binary data</entry>
|
<entry>binary data</entry>
|
||||||
</row>
|
</row>
|
||||||
|
|
||||||
<row>
|
|
||||||
<entry><type>character(<replaceable>n</replaceable>)</type></entry>
|
|
||||||
<entry><type>char(<replaceable>n</replaceable>)</type></entry>
|
|
||||||
<entry>fixed-length character string</entry>
|
|
||||||
</row>
|
|
||||||
|
|
||||||
<row>
|
<row>
|
||||||
<entry><type>character varying(<replaceable>n</replaceable>)</type></entry>
|
<entry><type>character varying(<replaceable>n</replaceable>)</type></entry>
|
||||||
<entry><type>varchar(<replaceable>n</replaceable>)</type></entry>
|
<entry><type>varchar(<replaceable>n</replaceable>)</type></entry>
|
||||||
<entry>variable-length character string</entry>
|
<entry>variable-length character string</entry>
|
||||||
</row>
|
</row>
|
||||||
|
|
||||||
|
<row>
|
||||||
|
<entry><type>character(<replaceable>n</replaceable>)</type></entry>
|
||||||
|
<entry><type>char(<replaceable>n</replaceable>)</type></entry>
|
||||||
|
<entry>fixed-length character string</entry>
|
||||||
|
</row>
|
||||||
|
|
||||||
<row>
|
<row>
|
||||||
<entry><type>cidr</type></entry>
|
<entry><type>cidr</type></entry>
|
||||||
<entry></entry>
|
<entry></entry>
|
||||||
@ -248,7 +248,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/datatype.sgml,v 1.110 2002/12/06 05:17:42 m
|
|||||||
The following types (or spellings thereof) are specified by
|
The following types (or spellings thereof) are specified by
|
||||||
<acronym>SQL</acronym>: <type>bit</type>, <type>bit
|
<acronym>SQL</acronym>: <type>bit</type>, <type>bit
|
||||||
varying</type>, <type>boolean</type>, <type>char</type>,
|
varying</type>, <type>boolean</type>, <type>char</type>,
|
||||||
<type>character</type>, <type>character varying</type>,
|
<type>character varying</type>, <type>character</type>,
|
||||||
<type>varchar</type>, <type>date</type>, <type>double
|
<type>varchar</type>, <type>date</type>, <type>double
|
||||||
precision</type>, <type>integer</type>, <type>interval</type>,
|
precision</type>, <type>integer</type>, <type>interval</type>,
|
||||||
<type>numeric</type>, <type>decimal</type>, <type>real</type>,
|
<type>numeric</type>, <type>decimal</type>, <type>real</type>,
|
||||||
@ -811,14 +811,14 @@ CREATE TABLE <replaceable class="parameter">tablename</replaceable> (
|
|||||||
</row>
|
</row>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<row>
|
|
||||||
<entry><type>character(<replaceable>n</>)</type>, <type>char(<replaceable>n</>)</type></entry>
|
|
||||||
<entry>fixed-length, blank padded</entry>
|
|
||||||
</row>
|
|
||||||
<row>
|
<row>
|
||||||
<entry><type>character varying(<replaceable>n</>)</type>, <type>varchar(<replaceable>n</>)</type></entry>
|
<entry><type>character varying(<replaceable>n</>)</type>, <type>varchar(<replaceable>n</>)</type></entry>
|
||||||
<entry>variable-length with limit</entry>
|
<entry>variable-length with limit</entry>
|
||||||
</row>
|
</row>
|
||||||
|
<row>
|
||||||
|
<entry><type>character(<replaceable>n</>)</type>, <type>char(<replaceable>n</>)</type></entry>
|
||||||
|
<entry>fixed-length, blank padded</entry>
|
||||||
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry><type>text</type></entry>
|
<entry><type>text</type></entry>
|
||||||
<entry>variable unlimited length</entry>
|
<entry>variable unlimited length</entry>
|
||||||
@ -835,29 +835,29 @@ CREATE TABLE <replaceable class="parameter">tablename</replaceable> (
|
|||||||
|
|
||||||
<para>
|
<para>
|
||||||
<acronym>SQL</acronym> defines two primary character types:
|
<acronym>SQL</acronym> defines two primary character types:
|
||||||
<type>character(<replaceable>n</>)</type> and <type>character
|
<type>character varying(<replaceable>n</>)</type> and
|
||||||
varying(<replaceable>n</>)</type>, where <replaceable>n</> is a
|
<type>character(<replaceable>n</>)</type>, where <replaceable>n</>
|
||||||
positive integer. Both of these types can store strings up to
|
is a positive integer. Both of these types can store strings up to
|
||||||
<replaceable>n</> characters in length. An attempt to store a
|
<replaceable>n</> characters in length. An attempt to store a
|
||||||
longer string into a column of these types will result in an
|
longer string into a column of these types will result in an
|
||||||
error, unless the excess characters are all spaces, in which case
|
error, unless the excess characters are all spaces, in which case
|
||||||
the string will be truncated to the maximum length. (This
|
the string will be truncated to the maximum length. (This somewhat
|
||||||
somewhat bizarre exception is required by the
|
bizarre exception is required by the <acronym>SQL</acronym>
|
||||||
<acronym>SQL</acronym> standard.) If the string to be stored is
|
standard.) If the string to be stored is shorter than the declared
|
||||||
shorter than the declared length, values of type
|
length, values of type <type>character</type> will be space-padded;
|
||||||
<type>character</type> will be space-padded; values of type
|
values of type <type>character varying</type> will simply store the
|
||||||
<type>character varying</type> will simply store the shorter
|
shorter
|
||||||
string.
|
string.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<note>
|
<note>
|
||||||
<para>
|
<para>
|
||||||
If one explicitly casts a value to
|
If one explicitly casts a value to <type>character
|
||||||
<type>character(<replaceable>n</>)</type> or <type>character
|
varying(<replaceable>n</>)</type> or
|
||||||
varying(<replaceable>n</>)</type>, then an overlength value will
|
<type>character(<replaceable>n</>)</type>, then an over-length
|
||||||
be truncated to <replaceable>n</> characters without raising an
|
value will be truncated to <replaceable>n</> characters without
|
||||||
error. (This too is required by the <acronym>SQL</acronym>
|
raising an error. (This too is required by the
|
||||||
standard.)
|
<acronym>SQL</acronym> standard.)
|
||||||
</para>
|
</para>
|
||||||
</note>
|
</note>
|
||||||
|
|
||||||
@ -870,14 +870,14 @@ CREATE TABLE <replaceable class="parameter">tablename</replaceable> (
|
|||||||
</note>
|
</note>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
The notations <type>char(<replaceable>n</>)</type> and
|
The notations <type>varchar(<replaceable>n</>)</type> and
|
||||||
<type>varchar(<replaceable>n</>)</type> are aliases for
|
<type>char(<replaceable>n</>)</type> are aliases for <type>character
|
||||||
<type>character(<replaceable>n</>)</type> and <type>character
|
varying(<replaceable>n</>)</type> and
|
||||||
varying(<replaceable>n</>)</type>,
|
<type>character(<replaceable>n</>)</type>, respectively.
|
||||||
respectively. <type>character</type> without length specifier is
|
<type>character</type> without length specifier is equivalent to
|
||||||
equivalent to <type>character(1)</type>; if <type>character
|
<type>character(1)</type>; if <type>character varying</type> is used
|
||||||
varying</type> is used without length specifier, the type accepts
|
without length specifier, the type accepts strings of any size. The
|
||||||
strings of any size. The latter is a <productname>PostgreSQL</> extension.
|
latter is a <productname>PostgreSQL</> extension.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
@ -961,19 +961,18 @@ SELECT b, char_length(b) FROM test2;
|
|||||||
|
|
||||||
<para>
|
<para>
|
||||||
There are two other fixed-length character types in
|
There are two other fixed-length character types in
|
||||||
<productname>PostgreSQL</productname>, shown in <xref linkend="datatype-character-special-table">.
|
<productname>PostgreSQL</productname>, shown in <xref
|
||||||
The <type>name</type> type
|
linkend="datatype-character-special-table">. The <type>name</type>
|
||||||
exists <emphasis>only</emphasis> for storage of internal catalog
|
type exists <emphasis>only</emphasis> for storage of internal
|
||||||
names and is not intended for use by the general user. Its length
|
catalog names and is not intended for use by the general user. Its
|
||||||
is currently defined as 64 bytes (63 usable characters plus terminator)
|
length is currently defined as 64 bytes (63 usable characters plus
|
||||||
but should be referenced using the constant
|
terminator) but should be referenced using the constant
|
||||||
<symbol>NAMEDATALEN</symbol>. The length is set at compile time
|
<symbol>NAMEDATALEN</symbol>. The length is set at compile time (and
|
||||||
(and is therefore adjustable for special uses); the default
|
is therefore adjustable for special uses); the default maximum
|
||||||
maximum length may change in a future release. The type
|
length may change in a future release. The type <type>"char"</type>
|
||||||
<type>"char"</type> (note the quotes) is different from
|
(note the quotes) is different from <type>char(1)</type> in that it
|
||||||
<type>char(1)</type> in that it only uses one byte of storage. It
|
only uses one byte of storage. It is internally used in the system
|
||||||
is internally used in the system catalogs as a poor-man's
|
catalogs as a poor-man's enumeration type.
|
||||||
enumeration type.
|
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<table id="datatype-character-special-table">
|
<table id="datatype-character-special-table">
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<!--
|
<!--
|
||||||
$Header: /cvsroot/pgsql/doc/src/sgml/sql.sgml,v 1.27 2002/08/28 14:35:36 momjian Exp $
|
$Header: /cvsroot/pgsql/doc/src/sgml/sql.sgml,v 1.28 2003/01/15 18:01:05 momjian Exp $
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<chapter id="sql">
|
<chapter id="sql">
|
||||||
@ -1749,19 +1749,20 @@ CREATE TABLE SELLS
|
|||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>
|
<para>
|
||||||
CHAR(<replaceable class="parameter">n</replaceable>):
|
VARCHAR(<replaceable class="parameter">n</replaceable>):
|
||||||
fixed length character string of length
|
varying length character string of maximum length
|
||||||
<replaceable class="parameter">n</replaceable>.
|
<replaceable class="parameter">n</replaceable>.
|
||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>
|
<para>
|
||||||
VARCHAR(<replaceable class="parameter">n</replaceable>):
|
CHAR(<replaceable class="parameter">n</replaceable>):
|
||||||
varying length character string of maximum length
|
fixed length character string of length
|
||||||
<replaceable class="parameter">n</replaceable>.
|
<replaceable class="parameter">n</replaceable>.
|
||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
|
|
||||||
</itemizedlist>
|
</itemizedlist>
|
||||||
</para>
|
</para>
|
||||||
</sect3>
|
</sect3>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user