Include mention of CASE, COALESCE, and IFNULL.
Add date/time parsing procedure (perhaps should be in appendix). Add time zone information (ditto). Update keyword list.
This commit is contained in:
parent
5dd715b592
commit
95e3cec621
@ -1,13 +1,16 @@
|
|||||||
<!--
|
<!--
|
||||||
$Header: /cvsroot/pgsql/doc/src/sgml/Attic/admin.sgml,v 1.11 1999/05/04 02:16:57 thomas Exp $
|
$Header: /cvsroot/pgsql/doc/src/sgml/Attic/admin.sgml,v 1.12 1999/05/12 07:32:42 thomas Exp $
|
||||||
|
|
||||||
Postgres Administrator's Guide.
|
Postgres Administrator's Guide.
|
||||||
Derived from postgres.sgml.
|
Derived from postgres.sgml.
|
||||||
- thomas 1998-10-27
|
- thomas 1998-10-27
|
||||||
|
|
||||||
$Log: admin.sgml,v $
|
$Log: admin.sgml,v $
|
||||||
Revision 1.11 1999/05/04 02:16:57 thomas
|
Revision 1.12 1999/05/12 07:32:42 thomas
|
||||||
Include chapter on security.
|
Include mention of CASE, COALESCE, and IFNULL.
|
||||||
|
Add date/time parsing procedure (perhaps should be in appendix).
|
||||||
|
Add time zone information (ditto).
|
||||||
|
Update keyword list.
|
||||||
|
|
||||||
Revision 1.10 1999/01/19 16:06:25 thomas
|
Revision 1.10 1999/01/19 16:06:25 thomas
|
||||||
Merge current.sgml into release.sgml so all release notes are in the same
|
Merge current.sgml into release.sgml so all release notes are in the same
|
||||||
@ -59,23 +62,23 @@ Bigger updates to the installation instructions (install and config).
|
|||||||
|
|
||||||
<!-- Title information -->
|
<!-- Title information -->
|
||||||
|
|
||||||
<Title>PostgreSQL Administrator's Guide</Title>
|
<Title>PostgreSQL Administrator's Guide</Title>
|
||||||
<BookInfo>
|
<BookInfo>
|
||||||
<ReleaseInfo>Covering v6.4 for general release</ReleaseInfo>
|
<ReleaseInfo>Covering v6.4 for general release</ReleaseInfo>
|
||||||
<BookBiblio>
|
<BookBiblio>
|
||||||
<AuthorGroup>
|
<AuthorGroup>
|
||||||
<CorpAuthor>The PostgreSQL Development Team</CorpAuthor>
|
<CorpAuthor>The PostgreSQL Development Team</CorpAuthor>
|
||||||
</AuthorGroup>
|
</AuthorGroup>
|
||||||
<!-- editor in authorgroup is not supported
|
<!-- editor in authorgroup is not supported
|
||||||
<AuthorGroup>
|
<AuthorGroup>
|
||||||
-->
|
-->
|
||||||
<Editor>
|
<Editor>
|
||||||
<FirstName>Thomas</FirstName>
|
<FirstName>Thomas</FirstName>
|
||||||
<SurName>Lockhart</SurName>
|
<SurName>Lockhart</SurName>
|
||||||
<Affiliation>
|
<Affiliation>
|
||||||
<OrgName>Caltech/JPL</OrgName>
|
<OrgName>Caltech/JPL</OrgName>
|
||||||
</Affiliation>
|
</Affiliation>
|
||||||
</Editor>
|
</Editor>
|
||||||
<!--
|
<!--
|
||||||
</AuthorGroup>
|
</AuthorGroup>
|
||||||
-->
|
-->
|
||||||
@ -84,17 +87,17 @@ Bigger updates to the installation instructions (install and config).
|
|||||||
<AuthorInitials>TGL</AuthorInitials>
|
<AuthorInitials>TGL</AuthorInitials>
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<Date>(last updated 1998-10-27)</Date>
|
<Date>(last updated 1999-04-08)</Date>
|
||||||
</BookBiblio>
|
</BookBiblio>
|
||||||
|
|
||||||
<LegalNotice>
|
<LegalNotice>
|
||||||
<Para>
|
<Para>
|
||||||
<ProductName>PostgreSQL</ProductName> is copyright (C) 1998
|
<ProductName>PostgreSQL</ProductName> is copyright (C) 1998-9
|
||||||
by the Postgres Global Development Group.
|
by the Postgres Global Development Group.
|
||||||
</Para>
|
</Para>
|
||||||
</LegalNotice>
|
</LegalNotice>
|
||||||
|
|
||||||
</BookInfo>
|
</BookInfo>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
<TOC> </TOC>
|
<TOC> </TOC>
|
||||||
@ -109,36 +112,36 @@ Your name here...
|
|||||||
</Dedication>
|
</Dedication>
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<Preface id="preface">
|
<Preface id="preface">
|
||||||
<Title>Summary</Title>
|
<Title>Summary</Title>
|
||||||
|
|
||||||
<Para>
|
<Para>
|
||||||
<ProductName>Postgres</ProductName>,
|
<ProductName>Postgres</ProductName>,
|
||||||
developed originally in the UC Berkeley Computer Science Department,
|
developed originally in the UC Berkeley Computer Science Department,
|
||||||
pioneered many of the object-relational concepts
|
pioneered many of the object-relational concepts
|
||||||
now becoming available in some commercial databases.
|
now becoming available in some commercial databases.
|
||||||
It provides SQL92/SQL3 language support,
|
It provides SQL92/SQL3 language support,
|
||||||
transaction integrity, and type extensibility.
|
transaction integrity, and type extensibility.
|
||||||
<ProductName>PostgreSQL</ProductName> is a public-domain, open source descendant
|
<ProductName>PostgreSQL</ProductName> is a public-domain, open source descendant
|
||||||
of this original Berkeley code.
|
of this original Berkeley code.
|
||||||
</Para>
|
</Para>
|
||||||
</Preface>
|
</Preface>
|
||||||
|
|
||||||
&intro-ag;
|
&intro-ag;
|
||||||
|
|
||||||
&ports;
|
&ports;
|
||||||
&config;
|
&config;
|
||||||
&install;
|
&install;
|
||||||
&installw;
|
&installw;
|
||||||
&runtime;
|
&runtime;
|
||||||
&security;
|
&security;
|
||||||
&options;
|
&options;
|
||||||
&start-ag;
|
&start-ag;
|
||||||
&recovery;
|
&recovery;
|
||||||
®ress;
|
®ress;
|
||||||
&release;
|
&release;
|
||||||
|
|
||||||
&biblio;
|
&biblio;
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Don't bother with an index until we get some index entries.
|
Don't bother with an index until we get some index entries.
|
||||||
|
@ -2,7 +2,8 @@
|
|||||||
<title>Bibliography</title>
|
<title>Bibliography</title>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
Selected references and readings for <acronym>SQL</acronym> and <productname>Postgres</productname>.
|
Selected references and readings for <acronym>SQL</acronym>
|
||||||
|
and <productname>Postgres</productname>.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<bibliodiv>
|
<bibliodiv>
|
||||||
|
@ -1,271 +1,271 @@
|
|||||||
<chapter id="datatype">
|
<chapter id="datatype">
|
||||||
<title>Data Types</title>
|
<title>Data Types</title>
|
||||||
|
|
||||||
<abstract>
|
<abstract>
|
||||||
<para>
|
<para>
|
||||||
Describes the built-in data types available in
|
Describes the built-in data types available in
|
||||||
<productname>Postgres</productname>.
|
<productname>Postgres</productname>.
|
||||||
</para>
|
</para>
|
||||||
</abstract>
|
</abstract>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
<productname>Postgres</productname> has a rich set of native data
|
<productname>Postgres</productname> has a rich set of native data
|
||||||
types available to users.
|
types available to users.
|
||||||
Users may add new types to <productname>Postgres</productname> using the
|
Users may add new types to <productname>Postgres</productname> using the
|
||||||
<command>DEFINE TYPE</command>
|
<command>DEFINE TYPE</command>
|
||||||
command described elsewhere.
|
command described elsewhere.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
In the context of data types, the following sections will discuss
|
In the context of data types, the following sections will discuss
|
||||||
<acronym>SQL</acronym> standards compliance, porting issues, and usage.
|
<acronym>SQL</acronym> standards compliance, porting issues, and usage.
|
||||||
|
|
||||||
Some <productname>Postgres</productname> types correspond directly to
|
Some <productname>Postgres</productname> types correspond directly to
|
||||||
<acronym>SQL92</acronym>-compatible types. In other
|
<acronym>SQL92</acronym>-compatible types. In other
|
||||||
cases, data types defined by <acronym>SQL92</acronym> syntax are mapped directly
|
cases, data types defined by <acronym>SQL92</acronym> syntax are mapped directly
|
||||||
into native <productname>Postgres</productname> types.
|
into native <productname>Postgres</productname> types.
|
||||||
|
|
||||||
Many of the built-in types have obvious external formats. However, several
|
Many of the built-in types have obvious external formats. However, several
|
||||||
types are either unique to <productname>Postgres</productname>,
|
types are either unique to <productname>Postgres</productname>,
|
||||||
such as open and closed paths, or have
|
such as open and closed paths, or have
|
||||||
several possibilities for formats, such as the date and time types.
|
several possibilities for formats, such as the date and time types.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
<table tocentry="1">
|
<table tocentry="1">
|
||||||
<title><productname>Postgres</productname> Data Types</title>
|
<title><productname>Postgres</productname> Data Types</title>
|
||||||
<titleabbrev>Data Types</titleabbrev>
|
<titleabbrev>Data Types</titleabbrev>
|
||||||
<tgroup cols="3">
|
<tgroup cols="3">
|
||||||
<thead>
|
<thead>
|
||||||
<row>
|
<row>
|
||||||
<entry><productname>Postgres</productname> Type</entry>
|
<entry><productname>Postgres</productname> Type</entry>
|
||||||
<entry><acronym>SQL92</acronym> or <acronym>SQL3</acronym> Type</entry>
|
<entry><acronym>SQL92</acronym> or <acronym>SQL3</acronym> Type</entry>
|
||||||
<entry>Description</entry>
|
<entry>Description</entry>
|
||||||
</row>
|
</row>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<row>
|
<row>
|
||||||
<entry>bool</entry>
|
<entry>bool</entry>
|
||||||
<entry>boolean</entry>
|
<entry>boolean</entry>
|
||||||
<entry>logical boolean (true/false)</entry>
|
<entry>logical boolean (true/false)</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>box</entry>
|
<entry>box</entry>
|
||||||
<entry></entry>
|
<entry></entry>
|
||||||
<entry>rectangular box in 2D plane</entry>
|
<entry>rectangular box in 2D plane</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>char(n)</entry>
|
<entry>char(n)</entry>
|
||||||
<entry>character(n)</entry>
|
<entry>character(n)</entry>
|
||||||
<entry>fixed-length character string</entry>
|
<entry>fixed-length character string</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>cidr</entry>
|
<entry>cidr</entry>
|
||||||
<entry></entry>
|
<entry></entry>
|
||||||
<entry>IP version 4 network or host address</entry>
|
<entry>IP version 4 network or host address</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>circle</entry>
|
<entry>circle</entry>
|
||||||
<entry></entry>
|
<entry></entry>
|
||||||
<entry>circle in 2D plane</entry>
|
<entry>circle in 2D plane</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>date</entry>
|
<entry>date</entry>
|
||||||
<entry>date</entry>
|
<entry>date</entry>
|
||||||
<entry>calendar date without time of day</entry>
|
<entry>calendar date without time of day</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>float4/8</entry>
|
<entry>float4/8</entry>
|
||||||
<entry>float(p)</entry>
|
<entry>float(p)</entry>
|
||||||
<entry>floating-point number with precision p</entry>
|
<entry>floating-point number with precision p</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>float8</entry>
|
<entry>float8</entry>
|
||||||
<entry>real, double precision</entry>
|
<entry>real, double precision</entry>
|
||||||
<entry>double-precision floating-point number</entry>
|
<entry>double-precision floating-point number</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>inet</entry>
|
<entry>inet</entry>
|
||||||
<entry></entry>
|
<entry></entry>
|
||||||
<entry>IP version 4 network or host address</entry>
|
<entry>IP version 4 network or host address</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>int2</entry>
|
<entry>int2</entry>
|
||||||
<entry>smallint</entry>
|
<entry>smallint</entry>
|
||||||
<entry>signed two-byte integer</entry>
|
<entry>signed two-byte integer</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>int4</entry>
|
<entry>int4</entry>
|
||||||
<entry>int, integer</entry>
|
<entry>int, integer</entry>
|
||||||
<entry>signed 4-byte integer</entry>
|
<entry>signed 4-byte integer</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>int4</entry>
|
<entry>int4</entry>
|
||||||
<entry>decimal(p,s)</entry>
|
<entry>decimal(p,s)</entry>
|
||||||
<entry>exact numeric for p <= 9, s = 0</entry>
|
<entry>exact numeric for p <= 9, s = 0</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>int4</entry>
|
<entry>int4</entry>
|
||||||
<entry>numeric(p,s)</entry>
|
<entry>numeric(p,s)</entry>
|
||||||
<entry>exact numeric for p == 9, s = 0</entry>
|
<entry>exact numeric for p == 9, s = 0</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>int8</entry>
|
<entry>int8</entry>
|
||||||
<entry></entry>
|
<entry></entry>
|
||||||
<entry>signed 8-byte integer</entry>
|
<entry>signed 8-byte integer</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>line</entry>
|
<entry>line</entry>
|
||||||
<entry></entry>
|
<entry></entry>
|
||||||
<entry>infinite line in 2D plane</entry>
|
<entry>infinite line in 2D plane</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>lseg</entry>
|
<entry>lseg</entry>
|
||||||
<entry></entry>
|
<entry></entry>
|
||||||
<entry>line segment in 2D plane</entry>
|
<entry>line segment in 2D plane</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>money</entry>
|
<entry>money</entry>
|
||||||
<entry>decimal(9,2)</entry>
|
<entry>decimal(9,2)</entry>
|
||||||
<entry>US-style currency</entry>
|
<entry>US-style currency</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>path</entry>
|
<entry>path</entry>
|
||||||
<entry></entry>
|
<entry></entry>
|
||||||
<entry>open and closed geometric path in 2D plane</entry>
|
<entry>open and closed geometric path in 2D plane</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>point</entry>
|
<entry>point</entry>
|
||||||
<entry></entry>
|
<entry></entry>
|
||||||
<entry>geometric point in 2D plane</entry>
|
<entry>geometric point in 2D plane</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>polygon</entry>
|
<entry>polygon</entry>
|
||||||
<entry></entry>
|
<entry></entry>
|
||||||
<entry>closed geometric path in 2D plane</entry>
|
<entry>closed geometric path in 2D plane</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>serial</entry>
|
<entry>serial</entry>
|
||||||
<entry></entry>
|
<entry></entry>
|
||||||
<entry>unique id for indexing and cross-reference</entry>
|
<entry>unique id for indexing and cross-reference</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>time</entry>
|
<entry>time</entry>
|
||||||
<entry>time</entry>
|
<entry>time</entry>
|
||||||
<entry>time of day</entry>
|
<entry>time of day</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>timespan</entry>
|
<entry>timespan</entry>
|
||||||
<entry>interval</entry>
|
<entry>interval</entry>
|
||||||
<entry>general-use time span</entry>
|
<entry>general-use time span</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>timestamp</entry>
|
<entry>timestamp</entry>
|
||||||
<entry>timestamp with time zone</entry>
|
<entry>timestamp with time zone</entry>
|
||||||
<entry>date/time</entry>
|
<entry>date/time</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>varchar(n)</entry>
|
<entry>varchar(n)</entry>
|
||||||
<entry>character varying(n)</entry>
|
<entry>character varying(n)</entry>
|
||||||
<entry>variable-length character string</entry>
|
<entry>variable-length character string</entry>
|
||||||
</row>
|
</row>
|
||||||
</tbody>
|
</tbody>
|
||||||
</tgroup>
|
</tgroup>
|
||||||
</table>
|
</table>
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
<note>
|
<note>
|
||||||
<para>
|
<para>
|
||||||
The <type>cidr</type> and <type>inet</type> types are designed to handle any IP type
|
The <type>cidr</type> and <type>inet</type> types are designed to handle any IP type
|
||||||
but only ipv4 is handled in the current implementation.
|
but only ipv4 is handled in the current implementation.
|
||||||
Everything here that talks about ipv4 will apply to ipv6 in a future release.</para>
|
Everything here that talks about ipv4 will apply to ipv6 in a future release.</para>
|
||||||
</note></para>
|
</note></para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
<table tocentry="1">
|
<table tocentry="1">
|
||||||
<title><productname>Postgres</productname> Function Constants</title>
|
<title><productname>Postgres</productname> Function Constants</title>
|
||||||
<titleabbrev>Constants</titleabbrev>
|
<titleabbrev>Constants</titleabbrev>
|
||||||
<tgroup cols="3">
|
<tgroup cols="3">
|
||||||
<thead>
|
<thead>
|
||||||
<row>
|
<row>
|
||||||
<entry><productname>Postgres</productname> Function</entry>
|
<entry><productname>Postgres</productname> Function</entry>
|
||||||
<entry><acronym>SQL92</acronym> Constant</entry>
|
<entry><acronym>SQL92</acronym> Constant</entry>
|
||||||
<entry>Description</entry>
|
<entry>Description</entry>
|
||||||
</row>
|
</row>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<row>
|
<row>
|
||||||
<entry>getpgusername()</entry>
|
<entry>getpgusername()</entry>
|
||||||
<entry>current_user</entry>
|
<entry>current_user</entry>
|
||||||
<entry>user name in current session</entry>
|
<entry>user name in current session</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>date('now')</entry>
|
<entry>date('now')</entry>
|
||||||
<entry>current_date</entry>
|
<entry>current_date</entry>
|
||||||
<entry>date of current transaction</entry>
|
<entry>date of current transaction</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>time('now')</entry>
|
<entry>time('now')</entry>
|
||||||
<entry>current_time</entry>
|
<entry>current_time</entry>
|
||||||
<entry>time of current transaction</entry>
|
<entry>time of current transaction</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>timestamp('now')</entry>
|
<entry>timestamp('now')</entry>
|
||||||
<entry>current_timestamp</entry>
|
<entry>current_timestamp</entry>
|
||||||
<entry>date and time of current transaction</entry>
|
<entry>date and time of current transaction</entry>
|
||||||
</row>
|
</row>
|
||||||
</tbody>
|
</tbody>
|
||||||
</tgroup>
|
</tgroup>
|
||||||
</table>
|
</table>
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
<productname>Postgres</productname> has features at the forefront of
|
<productname>Postgres</productname> has features at the forefront of
|
||||||
<acronym>ORDBMS</acronym> development. In addition to
|
<acronym>ORDBMS</acronym> development. In addition to
|
||||||
<acronym>SQL3</acronym> conformance, substantial portions
|
<acronym>SQL3</acronym> conformance, substantial portions
|
||||||
of <acronym>SQL92</acronym> are also supported.
|
of <acronym>SQL92</acronym> are also supported.
|
||||||
Although we strive for <acronym>SQL92</acronym> compliance,
|
Although we strive for <acronym>SQL92</acronym> compliance,
|
||||||
there are some aspects of the standard
|
there are some aspects of the standard
|
||||||
which are ill considered and which should not live through subsequent standards.
|
which are ill considered and which should not live through subsequent standards.
|
||||||
<productname>Postgres</productname> will not make great efforts to
|
<productname>Postgres</productname> will not make great efforts to
|
||||||
conform to these features; however, these tend to apply in little-used
|
conform to these features; however, these tend to apply in little-used
|
||||||
or obsure cases, and a typical user is not likely to run into them.</para>
|
or obsure cases, and a typical user is not likely to run into them.</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
Most of the input and output functions corresponding to the
|
Most of the input and output functions corresponding to the
|
||||||
base types (e.g., integers and floating point numbers) do some
|
base types (e.g., integers and floating point numbers) do some
|
||||||
error-checking.
|
error-checking.
|
||||||
Some of the operators and functions (e.g.,
|
Some of the operators and functions (e.g.,
|
||||||
addition and multiplication) do not perform run-time error-checking in the
|
addition and multiplication) do not perform run-time error-checking in the
|
||||||
interests of improving execution speed.
|
interests of improving execution speed.
|
||||||
On some systems, for example, the numeric operators for some data types may
|
On some systems, for example, the numeric operators for some data types may
|
||||||
silently underflow or overflow.
|
silently underflow or overflow.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
Note that some of the input and output functions are not invertible. That is,
|
Note that some of the input and output functions are not invertible. That is,
|
||||||
the result of an output function may lose precision when compared to
|
the result of an output function may lose precision when compared to
|
||||||
the original input.
|
the original input.
|
||||||
|
|
||||||
<note>
|
<note>
|
||||||
<para>
|
<para>
|
||||||
The original <productname>Postgres</productname> v4.2 code received from
|
The original <productname>Postgres</productname> v4.2 code received from
|
||||||
Berkeley rounded all double precision floating point results to six digits for
|
Berkeley rounded all double precision floating point results to six digits for
|
||||||
output. Starting with v6.1, floating point numbers are allowed to retain
|
output. Starting with v6.1, floating point numbers are allowed to retain
|
||||||
most of the intrinsic precision of the type (typically 15 digits for doubles,
|
most of the intrinsic precision of the type (typically 15 digits for doubles,
|
||||||
6 digits for 4-byte floats).
|
6 digits for 4-byte floats).
|
||||||
Other types with underlying floating point fields (e.g. geometric
|
Other types with underlying floating point fields (e.g. geometric
|
||||||
types) carry similar precision.</para>
|
types) carry similar precision.</para>
|
||||||
</note>
|
</note>
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<sect1>
|
<sect1>
|
||||||
<title>Numeric Types</title>
|
<title>Numeric Types</title>
|
||||||
|
|
||||||
<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">
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,62 +1,73 @@
|
|||||||
<chapter>
|
<chapter>
|
||||||
<title>SQL Syntax</title>
|
<title>SQL Syntax</title>
|
||||||
|
|
||||||
<sect1>
|
<abstract>
|
||||||
<title>Key Words</title>
|
<para>
|
||||||
|
<acronym>SQL</acronym> manipulates sets of data. The language is
|
||||||
|
composed of various <firstterm>key words</firstterm>. Arithmetic
|
||||||
|
and procedural expressions are allowed. We will cover these topics
|
||||||
|
in this chapter; subsequent chapters will include details on data
|
||||||
|
types, functions, and operators.
|
||||||
|
</para>
|
||||||
|
</abstract>
|
||||||
|
|
||||||
<para>
|
<sect1>
|
||||||
<acronym>SQL92</acronym> defines <firstterm>key words</firstterm>
|
<title>Key Words</title>
|
||||||
for the language
|
|
||||||
which have specific meaning. Some key words are
|
|
||||||
<firstterm>reserved</firstterm>, which indicates that they are
|
|
||||||
restricted to appear in only certain contexts. Other key words are
|
|
||||||
<firstterm>not restricted</firstterm>, which indicates that in certain
|
|
||||||
contexts they
|
|
||||||
have a specific meaning but are not otherwise constrained.
|
|
||||||
</para>
|
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
<productname>Postgres</productname> implements an extended subset of the
|
<acronym>SQL92</acronym> defines <firstterm>key words</firstterm>
|
||||||
<acronym>SQL92</acronym> and <acronym>SQL3</acronym> languages. Some language
|
for the language
|
||||||
elements are not as restricted in this implementation as is
|
which have specific meaning. Some key words are
|
||||||
called for in the language standards, in part due
|
<firstterm>reserved</firstterm>, which indicates that they are
|
||||||
to the extensibility features of <productname>Postgres</productname>.
|
restricted to appear in only certain contexts. Other key words are
|
||||||
</para>
|
<firstterm>not restricted</firstterm>, which indicates that in certain
|
||||||
|
contexts they
|
||||||
|
have a specific meaning but are not otherwise constrained.
|
||||||
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
Information on <acronym>SQL92</acronym> and <acronym>SQL3</acronym> key words
|
<productname>Postgres</productname> implements an extended subset of the
|
||||||
is derived from <xref linkend="DATE97" endterm="DATE97">.
|
<acronym>SQL92</acronym> and <acronym>SQL3</acronym> languages. Some language
|
||||||
</para>
|
elements are not as restricted in this implementation as is
|
||||||
|
called for in the language standards, in part due
|
||||||
|
to the extensibility features of <productname>Postgres</productname>.
|
||||||
|
</para>
|
||||||
|
|
||||||
<sect2>
|
<para>
|
||||||
<title>Reserved Key Words</title>
|
Information on <acronym>SQL92</acronym> and <acronym>SQL3</acronym> key words
|
||||||
|
is derived from <xref linkend="DATE97" endterm="DATE97">.
|
||||||
|
</para>
|
||||||
|
|
||||||
<para>
|
<sect2>
|
||||||
<acronym>SQL92</acronym> and <acronym>SQL3</acronym> have
|
<title>Reserved Key Words</title>
|
||||||
<firstterm>reserved key words</firstterm> which are not allowed
|
|
||||||
as identifiers and not allowed in any usage other than as fundamental
|
|
||||||
tokens in <acronym>SQL</acronym> statements.
|
|
||||||
<productname>Postgres</productname> has additional key words
|
|
||||||
which have similar restrictions. In particular, these key words
|
|
||||||
are not allowed as column or table names, though in some cases
|
|
||||||
they are allowed to be column labels (i.e. in AS clauses).
|
|
||||||
</para>
|
|
||||||
|
|
||||||
<tip>
|
<para>
|
||||||
<para>
|
<acronym>SQL92</acronym> and <acronym>SQL3</acronym> have
|
||||||
Any string can be specified as an identifier if surrounded by
|
<firstterm>reserved key words</firstterm> which are not allowed
|
||||||
double quotes (<quote>like this!</quote>). Some care is required since
|
as identifiers and not allowed in any usage other than as fundamental
|
||||||
such an identifier will be case sensitive
|
tokens in <acronym>SQL</acronym> statements.
|
||||||
and will retain embedded whitespace other special characters.</para>
|
<productname>Postgres</productname> has additional key words
|
||||||
</tip>
|
which have similar restrictions. In particular, these key words
|
||||||
|
are not allowed as column or table names, though in some cases
|
||||||
|
they are allowed to be column labels (i.e. in AS clauses).
|
||||||
|
</para>
|
||||||
|
|
||||||
<para>
|
<tip>
|
||||||
The following are <productname>Postgres</productname>
|
<para>
|
||||||
reserved words which are neither <acronym>SQL92</acronym>
|
Any string can be specified as an identifier if surrounded by
|
||||||
nor <acronym>SQL3</acronym> reserved words. These are allowed
|
double quotes (<quote>like this!</quote>). Some care is required since
|
||||||
to be present as column labels, but not as identifiers:
|
such an identifier will be case sensitive
|
||||||
|
and will retain embedded whitespace other special characters.
|
||||||
|
</para>
|
||||||
|
</tip>
|
||||||
|
|
||||||
<programlisting>
|
<para>
|
||||||
|
The following are <productname>Postgres</productname>
|
||||||
|
reserved words which are neither <acronym>SQL92</acronym>
|
||||||
|
nor <acronym>SQL3</acronym> reserved words. These are allowed
|
||||||
|
to be present as column labels, but not as identifiers:
|
||||||
|
|
||||||
|
<programlisting>
|
||||||
ABORT ANALYZE
|
ABORT ANALYZE
|
||||||
BINARY
|
BINARY
|
||||||
CLUSTER CONSTRAINT COPY
|
CLUSTER CONSTRAINT COPY
|
||||||
@ -69,32 +80,33 @@ RESET
|
|||||||
SETOF SHOW
|
SETOF SHOW
|
||||||
UNLISTEN UNTIL
|
UNLISTEN UNTIL
|
||||||
VACUUM VERBOSE
|
VACUUM VERBOSE
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
The following are <productname>Postgres</productname>
|
The following are <productname>Postgres</productname>
|
||||||
reserved words which are also <acronym>SQL92</acronym>
|
reserved words which are also <acronym>SQL92</acronym>
|
||||||
or <acronym>SQL3</acronym> reserved words, and which
|
or <acronym>SQL3</acronym> reserved words, and which
|
||||||
are allowed to be present as column labels, but not as identifiers:
|
are allowed to be present as column labels, but not as identifiers:
|
||||||
|
|
||||||
<programlisting>
|
<programlisting>
|
||||||
CASE COALESCE CROSS CURRENT
|
CASE COALESCE CROSS CURRENT
|
||||||
ELSE END
|
ELSE END
|
||||||
FALSE FOREIGN
|
FALSE FOREIGN
|
||||||
GROUP
|
GLOBAL GROUP
|
||||||
|
LOCAL
|
||||||
NULLIF
|
NULLIF
|
||||||
ORDER
|
ORDER
|
||||||
POSITION PRECISION
|
POSITION PRECISION
|
||||||
TABLE THEN TRANSACTION TRUE
|
TABLE THEN TRANSACTION TRUE
|
||||||
WHEN
|
WHEN
|
||||||
</programlisting>
|
</programlisting>
|
||||||
|
|
||||||
The following are <productname>Postgres</productname>
|
The following are <productname>Postgres</productname>
|
||||||
reserved words which are also <acronym>SQL92</acronym>
|
reserved words which are also <acronym>SQL92</acronym>
|
||||||
or <acronym>SQL3</acronym> reserved words:
|
or <acronym>SQL3</acronym> reserved words:
|
||||||
|
|
||||||
<programlisting>
|
<programlisting>
|
||||||
ADD ALL ALTER AND ANY AS ASC
|
ADD ALL ALTER AND ANY AS ASC
|
||||||
BEGIN BETWEEN BOTH BY
|
BEGIN BETWEEN BOTH BY
|
||||||
CASCADE CAST CHAR CHARACTER CHECK CLOSE
|
CASCADE CAST CHAR CHARACTER CHECK CLOSE
|
||||||
@ -118,49 +130,49 @@ TO TRAILING TRIM
|
|||||||
UNION UNIQUE UPDATE USER USING
|
UNION UNIQUE UPDATE USER USING
|
||||||
VALUES VARCHAR VARYING VIEW
|
VALUES VARCHAR VARYING VIEW
|
||||||
WHERE WITH WORK
|
WHERE WITH WORK
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
The following are <acronym>SQL92</acronym> reserved key words which
|
The following are <acronym>SQL92</acronym> reserved key words which
|
||||||
are not <productname>Postgres</productname> reserved key words, but which
|
are not <productname>Postgres</productname> reserved key words, but which
|
||||||
if used as function names are always translated into the function
|
if used as function names are always translated into the function
|
||||||
<function>length</function>:
|
<function>length</function>:
|
||||||
|
|
||||||
<programlisting>
|
<programlisting>
|
||||||
CHAR_LENGTH CHARACTER_LENGTH
|
CHAR_LENGTH CHARACTER_LENGTH
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
The following are <acronym>SQL92</acronym> or <acronym>SQL3</acronym>
|
The following are <acronym>SQL92</acronym> or <acronym>SQL3</acronym>
|
||||||
reserved key words which
|
reserved key words which
|
||||||
are not <productname>Postgres</productname> reserved key words, but
|
are not <productname>Postgres</productname> reserved key words, but
|
||||||
if used as type names are always translated into an alternate, native type:
|
if used as type names are always translated into an alternate, native type:
|
||||||
|
|
||||||
<programlisting>
|
<programlisting>
|
||||||
BOOLEAN DOUBLE FLOAT INT INTEGER INTERVAL REAL SMALLINT
|
BOOLEAN DOUBLE FLOAT INT INTEGER INTERVAL REAL SMALLINT
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
The following are either <acronym>SQL92</acronym>
|
The following are either <acronym>SQL92</acronym>
|
||||||
or <acronym>SQL3</acronym> reserved key words
|
or <acronym>SQL3</acronym> reserved key words
|
||||||
which are not key words in <productname>Postgres</productname>.
|
which are not key words in <productname>Postgres</productname>.
|
||||||
These have no proscribed usage in <productname>Postgres</productname>
|
These have no proscribed usage in <productname>Postgres</productname>
|
||||||
at the time of writing (v6.4) but may become reserved key words in the
|
at the time of writing (v6.5) but may become reserved key words in the
|
||||||
future:
|
future:
|
||||||
|
|
||||||
<note>
|
<note>
|
||||||
<para>
|
<para>
|
||||||
Some of these key words represent functions in <acronym>SQL92</acronym>.
|
Some of these key words represent functions in <acronym>SQL92</acronym>.
|
||||||
These functions are defined in <productname>Postgres</productname>,
|
These functions are defined in <productname>Postgres</productname>,
|
||||||
but the parser does not consider the names to be key words and they are allowed
|
but the parser does not consider the names to be key words and they are allowed
|
||||||
in other contexts.
|
in other contexts.
|
||||||
</para>
|
</para>
|
||||||
</note>
|
</note>
|
||||||
|
|
||||||
<programlisting>
|
<programlisting>
|
||||||
ALLOCATE ARE ASSERTION AT AUTHORIZATION AVG
|
ALLOCATE ARE ASSERTION AT AUTHORIZATION AVG
|
||||||
BIT BIT_LENGTH
|
BIT BIT_LENGTH
|
||||||
CASCADED CATALOG COLLATION CONNECT CONNECTION
|
CASCADED CATALOG COLLATION CONNECT CONNECTION
|
||||||
@ -168,7 +180,7 @@ CASCADED CATALOG COLLATION CONNECT CONNECTION
|
|||||||
DATE DEALLOCATE DEC DESCRIBE DESCRIPTOR DIAGNOSTICS DISCONNECT DOMAIN
|
DATE DEALLOCATE DEC DESCRIBE DESCRIPTOR DIAGNOSTICS DISCONNECT DOMAIN
|
||||||
END-EXEC ESCAPE EXCEPT EXCEPTION EXEC EXTERNAL
|
END-EXEC ESCAPE EXCEPT EXCEPTION EXEC EXTERNAL
|
||||||
FIRST FOUND
|
FIRST FOUND
|
||||||
GET GLOBAL GO GOTO
|
GET GO GOTO
|
||||||
IDENTITY IMMEDIATE INDICATOR INITIALLY INPUT INTERSECT ISOLATION
|
IDENTITY IMMEDIATE INDICATOR INITIALLY INPUT INTERSECT ISOLATION
|
||||||
LAST LEVEL LOWER
|
LAST LEVEL LOWER
|
||||||
MAX MIN MODULE
|
MAX MIN MODULE
|
||||||
@ -181,56 +193,56 @@ TEMPORARY TRANSLATE TRANSLATION
|
|||||||
UNKNOWN UPPER USAGE
|
UNKNOWN UPPER USAGE
|
||||||
VALUE
|
VALUE
|
||||||
WHENEVER WRITE
|
WHENEVER WRITE
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</para>
|
</para>
|
||||||
</sect2>
|
</sect2>
|
||||||
|
|
||||||
<sect2>
|
<sect2>
|
||||||
<title>Non-reserved Keywords</title>
|
<title>Non-reserved Keywords</title>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
<acronym>SQL92</acronym> and <acronym>SQL3</acronym> have
|
<acronym>SQL92</acronym> and <acronym>SQL3</acronym> have
|
||||||
<firstterm>non-reserved keywords</firstterm> which have
|
<firstterm>non-reserved keywords</firstterm> which have
|
||||||
a proscribed meaning in the language but which are also allowed
|
a proscribed meaning in the language but which are also allowed
|
||||||
as identifiers.
|
as identifiers.
|
||||||
<productname>Postgres</productname> has additional keywords
|
<productname>Postgres</productname> has additional keywords
|
||||||
which allow similar unrestricted usage.
|
which allow similar unrestricted usage.
|
||||||
In particular, these keywords
|
In particular, these keywords
|
||||||
are allowed as column or table names.
|
are allowed as column or table names.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
The following are <productname>Postgres</productname>
|
The following are <productname>Postgres</productname>
|
||||||
non-reserved key words which are neither <acronym>SQL92</acronym>
|
non-reserved key words which are neither <acronym>SQL92</acronym>
|
||||||
nor <acronym>SQL3</acronym> non-reserved key words:
|
nor <acronym>SQL3</acronym> non-reserved key words:
|
||||||
|
|
||||||
<programlisting>
|
<programlisting>
|
||||||
AFTER AGGREGATE
|
ACCESS AFTER AGGREGATE
|
||||||
BACKWARD BEFORE
|
BACKWARD BEFORE
|
||||||
CACHE CREATEDB CREATEUSER CYCLE
|
CACHE CREATEDB CREATEUSER CYCLE
|
||||||
DATABASE DELIMITERS
|
DATABASE DELIMITERS
|
||||||
EACH ENCODING
|
EACH ENCODING EXCLUSIVE
|
||||||
FORWARD FUNCTION
|
FORWARD FUNCTION
|
||||||
HANDLER
|
HANDLER
|
||||||
INCREMENT INDEX INHERITS INSENSITIVE INSTEAD ISNULL
|
INCREMENT INDEX INHERITS INSENSITIVE INSTEAD ISNULL
|
||||||
LANCOMPILER LOCATION
|
LANCOMPILER LOCATION
|
||||||
MAXVALUE MINVALUE
|
MAXVALUE MINVALUE MODE
|
||||||
NOCREATEDB NOCREATEUSER NOTHING NOTNULL
|
NOCREATEDB NOCREATEUSER NOTHING NOTNULL
|
||||||
OIDS OPERATOR
|
OIDS OPERATOR
|
||||||
PASSWORD PROCEDURAL
|
PASSWORD PROCEDURAL
|
||||||
RECIPE RENAME RETURNS ROW RULE
|
RECIPE RENAME RETURNS ROW RULE
|
||||||
SEQUENCE SERIAL START STATEMENT STDIN STDOUT
|
SEQUENCE SERIAL SHARE START STATEMENT STDIN STDOUT
|
||||||
TRUSTED
|
TRUSTED
|
||||||
VALID VERSION
|
VALID VERSION
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
The following are <productname>Postgres</productname>
|
The following are <productname>Postgres</productname>
|
||||||
non-reserved key words which are <acronym>SQL92</acronym>
|
non-reserved key words which are <acronym>SQL92</acronym>
|
||||||
or <acronym>SQL3</acronym> reserved key words:
|
or <acronym>SQL3</acronym> reserved key words:
|
||||||
|
|
||||||
<programlisting>
|
<programlisting>
|
||||||
ABSOLUTE ACTION
|
ABSOLUTE ACTION
|
||||||
DAY
|
DAY
|
||||||
HOUR
|
HOUR
|
||||||
@ -246,30 +258,30 @@ SCROLL SECOND
|
|||||||
TIME TIMESTAMP TIMEZONE_HOUR TIMEZONE_MINUTE TRIGGER
|
TIME TIMESTAMP TIMEZONE_HOUR TIMEZONE_MINUTE TRIGGER
|
||||||
YEAR
|
YEAR
|
||||||
ZONE
|
ZONE
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
The following are <productname>Postgres</productname>
|
The following are <productname>Postgres</productname>
|
||||||
non-reserved key words which are also either <acronym>SQL92</acronym>
|
non-reserved key words which are also either <acronym>SQL92</acronym>
|
||||||
or <acronym>SQL3</acronym> non-reserved key words:
|
or <acronym>SQL3</acronym> non-reserved key words:
|
||||||
|
|
||||||
<programlisting>
|
<programlisting>
|
||||||
TYPE
|
COMMITTED SERIALIZABLE TYPE
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
The following are either <acronym>SQL92</acronym>
|
The following are either <acronym>SQL92</acronym>
|
||||||
or <acronym>SQL3</acronym> non-reserved key words which are not
|
or <acronym>SQL3</acronym> non-reserved key words which are not
|
||||||
key words of any kind in <productname>Postgres</productname>:
|
key words of any kind in <productname>Postgres</productname>:
|
||||||
|
|
||||||
<programlisting>
|
<programlisting>
|
||||||
ADA
|
ADA
|
||||||
C CATALOG_NAME CHARACTER_SET_CATALOG CHARACTER_SET_NAME
|
C CATALOG_NAME CHARACTER_SET_CATALOG CHARACTER_SET_NAME
|
||||||
CHARACTER_SET_SCHEMA CLASS_ORIGIN COBOL COLLATION_CATALOG
|
CHARACTER_SET_SCHEMA CLASS_ORIGIN COBOL COLLATION_CATALOG
|
||||||
COLLATION_NAME COLLATION_SCHEMA COLUMN_NAME
|
COLLATION_NAME COLLATION_SCHEMA COLUMN_NAME
|
||||||
COMMAND_FUNCTION COMMITTED CONDITION_NUMBER
|
COMMAND_FUNCTION CONDITION_NUMBER
|
||||||
CONNECTION_NAME CONSTRAINT_CATALOG CONSTRAINT_NAME
|
CONNECTION_NAME CONSTRAINT_CATALOG CONSTRAINT_NAME
|
||||||
CONSTRAINT_SCHEMA CURSOR_NAME
|
CONSTRAINT_SCHEMA CURSOR_NAME
|
||||||
DATA DATE_TIME_INTERVAL_CODE DATE_TIME_INTERVAL_PRECISION
|
DATA DATE_TIME_INTERVAL_CODE DATE_TIME_INTERVAL_PRECISION
|
||||||
@ -281,15 +293,29 @@ NAME NULLABLE NUMBER
|
|||||||
PAD PASCAL PLI
|
PAD PASCAL PLI
|
||||||
REPEATABLE RETURNED_LENGTH RETURNED_OCTET_LENGTH
|
REPEATABLE RETURNED_LENGTH RETURNED_OCTET_LENGTH
|
||||||
RETURNED_SQLSTATE ROW_COUNT
|
RETURNED_SQLSTATE ROW_COUNT
|
||||||
SCALE SCHEMA_NAME SERIALIZABLE SERVER_NAME SPACE
|
SCALE SCHEMA_NAME SERVER_NAME SPACE
|
||||||
SUBCLASS_ORIGIN
|
SUBCLASS_ORIGIN
|
||||||
TABLE_NAME
|
TABLE_NAME
|
||||||
UNCOMMITTED UNNAMED
|
UNCOMMITTED UNNAMED
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</para>
|
</para>
|
||||||
</sect2>
|
</sect2>
|
||||||
</sect1>
|
</sect1>
|
||||||
</chapter>
|
|
||||||
|
<sect1>
|
||||||
|
<title>Expressions</title>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
<acronym>SQL92</acronym> allows <firstterm>expressions</firstterm>
|
||||||
|
to transform data in expressions. Expressions may contain operators
|
||||||
|
(see <xref linkend="operators-title" endterm="operators-title">
|
||||||
|
for more details) and functions
|
||||||
|
(<xref linkend="functions-title" endterm="functions-title"> has
|
||||||
|
more information).
|
||||||
|
|
||||||
|
</para>
|
||||||
|
</sect1>
|
||||||
|
</chapter>
|
||||||
|
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
Local variables:
|
Local variables:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user