mirror of
https://github.com/postgres/postgres.git
synced 2025-06-13 07:41:39 +03: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:
@ -265,7 +265,8 @@
|
||||
|
||||
<para>
|
||||
Numeric types consist of two- and four-byte integers and four- and eight-byte
|
||||
floating point numbers.</para>
|
||||
floating point numbers.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<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.
|
||||
</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>
|
||||
The <type>serial</type> type is a special-case type constructed by
|
||||
<productname>Postgres</productname> from other existing components.
|
||||
@ -350,8 +359,14 @@ CREATE UNIQUE INDEX <replaceable class="parameter">tablename</replaceable>_<repl
|
||||
<caution>
|
||||
<para>
|
||||
The implicit sequence created for the <type>serial</type> type will
|
||||
<emphasis>not</emphasis> be automatically removed when the table is dropped.
|
||||
So, the following commands executed in order will likely fail:
|
||||
<emphasis>not</emphasis> be automatically removed when the
|
||||
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>
|
||||
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>
|
||||
|
||||
The sequence will remain in the database until explicitly dropped using
|
||||
<command>DROP SEQUENCE</command>.</para>
|
||||
</caution>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The <type>int8</type> type may not be available on all platforms since
|
||||
it relies on compiler support for this.
|
||||
<command>DROP SEQUENCE</command>.
|
||||
</para>
|
||||
</sect2>
|
||||
|
||||
</sect1>
|
||||
|
||||
<sect1>
|
||||
<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>
|
||||
The <type>money</type> type supports US-style currency with
|
||||
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">
|
||||
<listitem>
|
||||
<para>
|
||||
The PGDATESTYLE environment variable used by the backend directly
|
||||
The <envar>PGDATESTYLE</envar> environment variable used by the backend directly
|
||||
on postmaster startup.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
The PGDATESTYLE environment variable used by the frontend libpq
|
||||
The <envar>PGDATESTYLE</envar> environment variable used by the frontend libpq
|
||||
on session startup.
|
||||
</para>
|
||||
</listitem>
|
||||
@ -834,7 +852,7 @@ on session startup.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
For <productname>Postgres</productname> v6.4 (and earlier)
|
||||
For <productname>Postgres</productname> v6.5 (and earlier)
|
||||
the default date/time style is
|
||||
"non-European traditional Postgres".
|
||||
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.
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist></para>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
If an invalid time zone is specified,
|
||||
@ -1291,7 +1310,7 @@ on session startup.
|
||||
</sect2>
|
||||
|
||||
<sect2>
|
||||
<title>datetime</title>
|
||||
<title><type>datetime</type></title>
|
||||
|
||||
<para>
|
||||
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).
|
||||
Dates are stored internally in Greenwich Mean Time. Input and output routines
|
||||
translate time to the local time zone of the server.
|
||||
</para></sect2>
|
||||
</para>
|
||||
</sect2>
|
||||
|
||||
<sect2>
|
||||
<title><type>timespan</type></title>
|
||||
@ -1364,7 +1384,7 @@ where
|
||||
</sect2>
|
||||
|
||||
<sect2>
|
||||
<title>abstime</title>
|
||||
<title><type>abstime</type></title>
|
||||
|
||||
<para>
|
||||
Absolute time (<type>abstime</type>) is a limited-range (+/- 68 years) and
|
||||
@ -1407,7 +1427,7 @@ allowed for "absolute time".
|
||||
</sect2>
|
||||
|
||||
<sect2>
|
||||
<title>reltime</title>
|
||||
<title><type>reltime</type></title>
|
||||
|
||||
<para>
|
||||
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
|
||||
must force months to be exactly 30 days, so time arithmetic does not
|
||||
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
|
||||
now, but rather a date 360 days from today.
|
||||
</para>
|
||||
@ -1461,7 +1482,7 @@ currently mapped to the <type>timespan</type>
|
||||
</sect2>
|
||||
|
||||
<sect2>
|
||||
<title>tinterval</title>
|
||||
<title><type>tinterval</type></title>
|
||||
|
||||
<para>
|
||||
Time ranges are specified as:
|
||||
@ -1473,8 +1494,10 @@ where
|
||||
</programlisting>
|
||||
|
||||
Special abstime values such as
|
||||
<literal>current', <literal>infinity' and <literal>-infinity' can be used.</literal></literal></literal>
|
||||
</para></sect2>
|
||||
<literal>current</literal>, <literal>infinity</literal> and
|
||||
<literal>-infinity</literal> can be used.
|
||||
</para>
|
||||
</sect2>
|
||||
|
||||
</sect1>
|
||||
|
||||
@ -1631,7 +1654,7 @@ where
|
||||
<title>Line Segment</title>
|
||||
|
||||
<para>
|
||||
Line segments (lseg) are represented by pairs of points.
|
||||
Line segments (<type>lseg</type>) are represented by pairs of points.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
@ -1691,7 +1714,7 @@ are supplied to select either type in a query.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
path is specified using the following syntax:
|
||||
<type>path</type> is specified using the following syntax:
|
||||
|
||||
<programlisting>
|
||||
( ( x1 , y1 ) , ... , ( xn , yn ) )
|
||||
@ -1704,6 +1727,7 @@ where
|
||||
a leading "[" indicates an open path
|
||||
a leading "(" indicates a closed path
|
||||
</programlisting>
|
||||
|
||||
Paths are output using the first syntax.
|
||||
Note that <productname>Postgres</productname> versions prior to
|
||||
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>
|
||||
circle is specified using the following syntax:
|
||||
<type>circle</type> is specified using the following syntax:
|
||||
|
||||
<programlisting>
|
||||
< ( x , y ) , r >
|
||||
@ -1818,10 +1842,13 @@ variation in representation to represent simple host TCP/IP addresses.
|
||||
|
||||
<para>
|
||||
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
|
||||
network and <replaceable class="parameter">/y</replaceable> is the number of bits in the netmask.
|
||||
If <replaceable class="parameter">/y</replaceable> omitted, it is calculated using assumptions from
|
||||
network and <replaceable class="parameter">/y</replaceable> is
|
||||
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
|
||||
all of the octets in the input.
|
||||
</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.
|
||||
Note that if you want to store proper CIDR networks,
|
||||
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.
|
||||
Functions exist to extract the various elements of the field.
|
||||
</para>
|
||||
@ -1902,7 +1930,8 @@ On output, the <replaceable class="parameter">/y</replaceable> part is not print
|
||||
if it is <literal>/32</literal>.
|
||||
This allows the type to be used as a straight host type by just leaving off
|
||||
the bits part.
|
||||
</para></sect2>
|
||||
</para>
|
||||
</sect2>
|
||||
</sect1>
|
||||
|
||||
</chapter>
|
||||
|
Reference in New Issue
Block a user