mirror of
https://github.com/postgres/postgres.git
synced 2025-06-07 00:02:00 -04:00
Try to clarify characteristics of the SERIAL type.
Fix source indenting, which does not affect output. Note: still need docs on NUMERIC and DECIMAL (and let's not talk about regression tests :()
This commit is contained in:
parent
e1fad50a5d
commit
4f1766f1ea
@ -265,7 +265,8 @@
|
|||||||
|
|
||||||
<para>
|
<para>
|
||||||
Numeric types consist of two- and four-byte integers and four- and eight-byte
|
Numeric types consist of two- and four-byte integers and four- and eight-byte
|
||||||
floating point numbers.</para>
|
floating point numbers.
|
||||||
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
<table tocentry="1">
|
<table tocentry="1">
|
||||||
@ -328,6 +329,14 @@ functions. Refer to <xref endterm="math-opers" linkend="math-opers">
|
|||||||
and <xref endterm="math-funcs" linkend="math-funcs"> for more information.
|
and <xref endterm="math-funcs" linkend="math-funcs"> for more information.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
The <type>int8</type> type may not be available on all platforms since
|
||||||
|
it relies on compiler support for this.
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<sect2>
|
||||||
|
<title>The Serial Type</title>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
The <type>serial</type> type is a special-case type constructed by
|
The <type>serial</type> type is a special-case type constructed by
|
||||||
<productname>Postgres</productname> from other existing components.
|
<productname>Postgres</productname> from other existing components.
|
||||||
@ -350,8 +359,14 @@ CREATE UNIQUE INDEX <replaceable class="parameter">tablename</replaceable>_<repl
|
|||||||
<caution>
|
<caution>
|
||||||
<para>
|
<para>
|
||||||
The implicit sequence created for the <type>serial</type> type will
|
The implicit sequence created for the <type>serial</type> type will
|
||||||
<emphasis>not</emphasis> be automatically removed when the table is dropped.
|
<emphasis>not</emphasis> be automatically removed when the
|
||||||
So, the following commands executed in order will likely fail:
|
table is dropped.
|
||||||
|
</para>
|
||||||
|
</caution>
|
||||||
|
|
||||||
|
Implicit sequences supporting the <type>serial</type> are
|
||||||
|
not automatically dropped when a table containing a serial type
|
||||||
|
is dropped. So, the following commands executed in order will likely fail:
|
||||||
|
|
||||||
<programlisting>
|
<programlisting>
|
||||||
CREATE TABLE <replaceable class="parameter">tablename</replaceable> (<replaceable class="parameter">colname</replaceable> SERIAL);
|
CREATE TABLE <replaceable class="parameter">tablename</replaceable> (<replaceable class="parameter">colname</replaceable> SERIAL);
|
||||||
@ -360,20 +375,23 @@ CREATE TABLE <replaceable class="parameter">tablename</replaceable> (<replaceabl
|
|||||||
</programlisting>
|
</programlisting>
|
||||||
|
|
||||||
The sequence will remain in the database until explicitly dropped using
|
The sequence will remain in the database until explicitly dropped using
|
||||||
<command>DROP SEQUENCE</command>.</para>
|
<command>DROP SEQUENCE</command>.
|
||||||
</caution>
|
|
||||||
</para>
|
|
||||||
|
|
||||||
<para>
|
|
||||||
The <type>int8</type> type may not be available on all platforms since
|
|
||||||
it relies on compiler support for this.
|
|
||||||
</para>
|
</para>
|
||||||
|
</sect2>
|
||||||
|
|
||||||
</sect1>
|
</sect1>
|
||||||
|
|
||||||
<sect1>
|
<sect1>
|
||||||
<title>Monetary Type</title>
|
<title>Monetary Type</title>
|
||||||
|
|
||||||
|
<note>
|
||||||
|
<title>Obsolete Type</title>
|
||||||
|
<para>
|
||||||
|
The <type>money</type> is now obsolete. Use <type>numeric</type>
|
||||||
|
or <type>decimal</type> instead.
|
||||||
|
</para>
|
||||||
|
</note>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
The <type>money</type> type supports US-style currency with
|
The <type>money</type> type supports US-style currency with
|
||||||
fixed decimal point representation.
|
fixed decimal point representation.
|
||||||
@ -815,13 +833,13 @@ There are several ways to affect the appearance of date/time types:
|
|||||||
<itemizedlist spacing="compact" mark="bullet">
|
<itemizedlist spacing="compact" mark="bullet">
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>
|
<para>
|
||||||
The PGDATESTYLE environment variable used by the backend directly
|
The <envar>PGDATESTYLE</envar> environment variable used by the backend directly
|
||||||
on postmaster startup.
|
on postmaster startup.
|
||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>
|
<para>
|
||||||
The PGDATESTYLE environment variable used by the frontend libpq
|
The <envar>PGDATESTYLE</envar> environment variable used by the frontend libpq
|
||||||
on session startup.
|
on session startup.
|
||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
@ -834,7 +852,7 @@ on session startup.
|
|||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
For <productname>Postgres</productname> v6.4 (and earlier)
|
For <productname>Postgres</productname> v6.5 (and earlier)
|
||||||
the default date/time style is
|
the default date/time style is
|
||||||
"non-European traditional Postgres".
|
"non-European traditional Postgres".
|
||||||
In future releases, the default may become "ISO" (compatible with ISO-8601),
|
In future releases, the default may become "ISO" (compatible with ISO-8601),
|
||||||
@ -901,7 +919,8 @@ on session startup.
|
|||||||
sets the time zone for the session.
|
sets the time zone for the session.
|
||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</itemizedlist></para>
|
</itemizedlist>
|
||||||
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
If an invalid time zone is specified,
|
If an invalid time zone is specified,
|
||||||
@ -1291,7 +1310,7 @@ on session startup.
|
|||||||
</sect2>
|
</sect2>
|
||||||
|
|
||||||
<sect2>
|
<sect2>
|
||||||
<title>datetime</title>
|
<title><type>datetime</type></title>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
General-use date and time is input using a wide range of
|
General-use date and time is input using a wide range of
|
||||||
@ -1327,7 +1346,8 @@ Timezones are either three characters (e.g. "GMT" or "PST") or ISO-compatible
|
|||||||
offsets to GMT (e.g. "-08" or "-08:00" when in Pacific Standard Time).
|
offsets to GMT (e.g. "-08" or "-08:00" when in Pacific Standard Time).
|
||||||
Dates are stored internally in Greenwich Mean Time. Input and output routines
|
Dates are stored internally in Greenwich Mean Time. Input and output routines
|
||||||
translate time to the local time zone of the server.
|
translate time to the local time zone of the server.
|
||||||
</para></sect2>
|
</para>
|
||||||
|
</sect2>
|
||||||
|
|
||||||
<sect2>
|
<sect2>
|
||||||
<title><type>timespan</type></title>
|
<title><type>timespan</type></title>
|
||||||
@ -1364,7 +1384,7 @@ where
|
|||||||
</sect2>
|
</sect2>
|
||||||
|
|
||||||
<sect2>
|
<sect2>
|
||||||
<title>abstime</title>
|
<title><type>abstime</type></title>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
Absolute time (<type>abstime</type>) is a limited-range (+/- 68 years) and
|
Absolute time (<type>abstime</type>) is a limited-range (+/- 68 years) and
|
||||||
@ -1407,7 +1427,7 @@ allowed for "absolute time".
|
|||||||
</sect2>
|
</sect2>
|
||||||
|
|
||||||
<sect2>
|
<sect2>
|
||||||
<title>reltime</title>
|
<title><type>reltime</type></title>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
Relative time <type>reltime</type> is a limited-range (+/- 68 years)
|
Relative time <type>reltime</type> is a limited-range (+/- 68 years)
|
||||||
@ -1419,7 +1439,8 @@ relative units (months and years) and quantitative units (days, hours, etc).
|
|||||||
Instead, reltime
|
Instead, reltime
|
||||||
must force months to be exactly 30 days, so time arithmetic does not
|
must force months to be exactly 30 days, so time arithmetic does not
|
||||||
always work as expected.
|
always work as expected.
|
||||||
For example, adding one reltime <literal>year</literal> to abstime <literal>today</literal> does not
|
For example, adding one reltime <literal>year</literal> to
|
||||||
|
abstime <literal>today</literal> does not
|
||||||
produce today's date one year from
|
produce today's date one year from
|
||||||
now, but rather a date 360 days from today.
|
now, but rather a date 360 days from today.
|
||||||
</para>
|
</para>
|
||||||
@ -1461,7 +1482,7 @@ currently mapped to the <type>timespan</type>
|
|||||||
</sect2>
|
</sect2>
|
||||||
|
|
||||||
<sect2>
|
<sect2>
|
||||||
<title>tinterval</title>
|
<title><type>tinterval</type></title>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
Time ranges are specified as:
|
Time ranges are specified as:
|
||||||
@ -1473,8 +1494,10 @@ where
|
|||||||
</programlisting>
|
</programlisting>
|
||||||
|
|
||||||
Special abstime values such as
|
Special abstime values such as
|
||||||
<literal>current', <literal>infinity' and <literal>-infinity' can be used.</literal></literal></literal>
|
<literal>current</literal>, <literal>infinity</literal> and
|
||||||
</para></sect2>
|
<literal>-infinity</literal> can be used.
|
||||||
|
</para>
|
||||||
|
</sect2>
|
||||||
|
|
||||||
</sect1>
|
</sect1>
|
||||||
|
|
||||||
@ -1631,7 +1654,7 @@ where
|
|||||||
<title>Line Segment</title>
|
<title>Line Segment</title>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
Line segments (lseg) are represented by pairs of points.
|
Line segments (<type>lseg</type>) are represented by pairs of points.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
@ -1691,7 +1714,7 @@ are supplied to select either type in a query.
|
|||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
path is specified using the following syntax:
|
<type>path</type> is specified using the following syntax:
|
||||||
|
|
||||||
<programlisting>
|
<programlisting>
|
||||||
( ( x1 , y1 ) , ... , ( xn , yn ) )
|
( ( x1 , y1 ) , ... , ( xn , yn ) )
|
||||||
@ -1704,6 +1727,7 @@ where
|
|||||||
a leading "[" indicates an open path
|
a leading "[" indicates an open path
|
||||||
a leading "(" indicates a closed path
|
a leading "(" indicates a closed path
|
||||||
</programlisting>
|
</programlisting>
|
||||||
|
|
||||||
Paths are output using the first syntax.
|
Paths are output using the first syntax.
|
||||||
Note that <productname>Postgres</productname> versions prior to
|
Note that <productname>Postgres</productname> versions prior to
|
||||||
v6.1 used a format for paths which had a single leading parenthesis,
|
v6.1 used a format for paths which had a single leading parenthesis,
|
||||||
@ -1754,7 +1778,7 @@ Circles are represented by a center point and a radius.
|
|||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
circle is specified using the following syntax:
|
<type>circle</type> is specified using the following syntax:
|
||||||
|
|
||||||
<programlisting>
|
<programlisting>
|
||||||
< ( x , y ) , r >
|
< ( x , y ) , r >
|
||||||
@ -1818,10 +1842,13 @@ variation in representation to represent simple host TCP/IP addresses.
|
|||||||
|
|
||||||
<para>
|
<para>
|
||||||
The <type>cidr</type> type holds a CIDR network.
|
The <type>cidr</type> type holds a CIDR network.
|
||||||
The format for specifying classless networks is <replaceable class="parameter">x.x.x.x/y</replaceable>
|
The format for specifying classless networks is
|
||||||
|
<replaceable class="parameter">x.x.x.x/y</replaceable>
|
||||||
where <replaceable class="parameter">x.x.x.x</replaceable> is the
|
where <replaceable class="parameter">x.x.x.x</replaceable> is the
|
||||||
network and <replaceable class="parameter">/y</replaceable> is the number of bits in the netmask.
|
network and <replaceable class="parameter">/y</replaceable> is
|
||||||
If <replaceable class="parameter">/y</replaceable> omitted, it is calculated using assumptions from
|
the number of bits in the netmask.
|
||||||
|
If <replaceable class="parameter">/y</replaceable> omitted, it is
|
||||||
|
calculated using assumptions from
|
||||||
the older classfull naming system except that it is extended to include at least
|
the older classfull naming system except that it is extended to include at least
|
||||||
all of the octets in the input.
|
all of the octets in the input.
|
||||||
</para>
|
</para>
|
||||||
@ -1885,7 +1912,8 @@ The <type>inet</type> type is designed to hold, in one field, all of the informa
|
|||||||
about a host including the CIDR-style subnet that it is in.
|
about a host including the CIDR-style subnet that it is in.
|
||||||
Note that if you want to store proper CIDR networks,
|
Note that if you want to store proper CIDR networks,
|
||||||
you should use the <type>cidr</type> type.
|
you should use the <type>cidr</type> type.
|
||||||
The <type>inet</type> type is similar to the <type>cidr</type> type except that the bits in the
|
The <type>inet</type> type is similar to the <type>cidr</type>
|
||||||
|
type except that the bits in the
|
||||||
host part can be non-zero.
|
host part can be non-zero.
|
||||||
Functions exist to extract the various elements of the field.
|
Functions exist to extract the various elements of the field.
|
||||||
</para>
|
</para>
|
||||||
@ -1902,7 +1930,8 @@ On output, the <replaceable class="parameter">/y</replaceable> part is not print
|
|||||||
if it is <literal>/32</literal>.
|
if it is <literal>/32</literal>.
|
||||||
This allows the type to be used as a straight host type by just leaving off
|
This allows the type to be used as a straight host type by just leaving off
|
||||||
the bits part.
|
the bits part.
|
||||||
</para></sect2>
|
</para>
|
||||||
|
</sect2>
|
||||||
</sect1>
|
</sect1>
|
||||||
|
|
||||||
</chapter>
|
</chapter>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user