diff options
| author | Thomas G. Lockhart <lockhart@fourpalms.org> | 1999-05-12 07:32:47 +0000 | 
|---|---|---|
| committer | Thomas G. Lockhart <lockhart@fourpalms.org> | 1999-05-12 07:32:47 +0000 | 
| commit | 95e3cec621e497902ef711d1ab3fd639c55302ff (patch) | |
| tree | 515007bfe7d55412f154907d9115f89bfd858e9a /doc/src | |
| parent | 5dd715b592a030102dace83eae0528dcab904eac (diff) | |
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.
Diffstat (limited to 'doc/src')
| -rw-r--r-- | doc/src/sgml/admin.sgml | 115 | ||||
| -rw-r--r-- | doc/src/sgml/biblio.sgml | 3 | ||||
| -rw-r--r-- | doc/src/sgml/datatype.sgml | 530 | ||||
| -rw-r--r-- | doc/src/sgml/func.sgml | 1269 | ||||
| -rw-r--r-- | doc/src/sgml/oper.sgml | 1195 | ||||
| -rw-r--r-- | doc/src/sgml/syntax.sgml | 362 | 
6 files changed, 1785 insertions, 1689 deletions
| diff --git a/doc/src/sgml/admin.sgml b/doc/src/sgml/admin.sgml index dd00a55bdac..7850f4f85cd 100644 --- a/doc/src/sgml/admin.sgml +++ b/doc/src/sgml/admin.sgml @@ -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.  Derived from postgres.sgml.  - thomas 1998-10-27  $Log: admin.sgml,v $ -Revision 1.11  1999/05/04 02:16:57  thomas -Include chapter on security. +Revision 1.12  1999/05/12 07:32:42  thomas +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  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>PostgreSQL Administrator's Guide</Title> -<BookInfo> -    <ReleaseInfo>Covering v6.4 for general release</ReleaseInfo> -    <BookBiblio> -    <AuthorGroup> -      <CorpAuthor>The PostgreSQL Development Team</CorpAuthor> -    </AuthorGroup> + <Title>PostgreSQL Administrator's Guide</Title> + <BookInfo> +  <ReleaseInfo>Covering v6.4 for general release</ReleaseInfo> +  <BookBiblio> +   <AuthorGroup> +    <CorpAuthor>The PostgreSQL Development Team</CorpAuthor> +   </AuthorGroup>  <!-- editor in authorgroup is not supported      <AuthorGroup>  --> -      <Editor> -        <FirstName>Thomas</FirstName> -        <SurName>Lockhart</SurName> -        <Affiliation> -          <OrgName>Caltech/JPL</OrgName> -        </Affiliation> -      </Editor> +   <Editor> +    <FirstName>Thomas</FirstName> +    <SurName>Lockhart</SurName> +    <Affiliation> +     <OrgName>Caltech/JPL</OrgName> +    </Affiliation> +   </Editor>  <!--      </AuthorGroup>  --> @@ -84,17 +87,17 @@ Bigger updates to the installation instructions (install and config).      <AuthorInitials>TGL</AuthorInitials>  --> -    <Date>(last updated 1998-10-27)</Date> -    </BookBiblio> +   <Date>(last updated 1999-04-08)</Date> +  </BookBiblio> -<LegalNotice> -<Para> -<ProductName>PostgreSQL</ProductName> is copyright (C) 1998  -by the Postgres Global Development Group. -</Para> -</LegalNotice> +  <LegalNotice> +   <Para> +    <ProductName>PostgreSQL</ProductName> is copyright (C) 1998-9 +    by the Postgres Global Development Group. +   </Para> +  </LegalNotice> -</BookInfo> + </BookInfo>  <!--  <TOC> </TOC> @@ -109,36 +112,36 @@ Your name here...  </Dedication>  --> -<Preface id="preface"> -<Title>Summary</Title> - -<Para> -<ProductName>Postgres</ProductName>,  - developed originally in the UC Berkeley Computer Science Department, - pioneered many of the object-relational concepts - now becoming available in some commercial databases. -It provides SQL92/SQL3 language support, - transaction integrity, and type extensibility. - <ProductName>PostgreSQL</ProductName> is a public-domain, open source descendant - of this original Berkeley code. -</Para> -</Preface> - -&intro-ag; - -&ports; -&config; -&install; -&installw; -&runtime; -&security; -&options; -&start-ag; -&recovery; -®ress; -&release; - -&biblio; + <Preface id="preface"> +  <Title>Summary</Title> + +  <Para> +   <ProductName>Postgres</ProductName>,  +   developed originally in the UC Berkeley Computer Science Department, +   pioneered many of the object-relational concepts +   now becoming available in some commercial databases. +   It provides SQL92/SQL3 language support, +   transaction integrity, and type extensibility. +   <ProductName>PostgreSQL</ProductName> is a public-domain, open source descendant +   of this original Berkeley code. +  </Para> + </Preface> + +  &intro-ag; + +  &ports; +  &config; +  &install; +  &installw; +  &runtime; +  &security; +  &options; +  &start-ag; +  &recovery; +  ®ress; +  &release; + +  &biblio;  <!--  Don't bother with an index until we get some index entries. diff --git a/doc/src/sgml/biblio.sgml b/doc/src/sgml/biblio.sgml index 412f613d55b..2e747ecbb21 100644 --- a/doc/src/sgml/biblio.sgml +++ b/doc/src/sgml/biblio.sgml @@ -2,7 +2,8 @@    <title>Bibliography</title>    <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>    <bibliodiv> diff --git a/doc/src/sgml/datatype.sgml b/doc/src/sgml/datatype.sgml index 245fd1d4a08..5cf23ee7d73 100644 --- a/doc/src/sgml/datatype.sgml +++ b/doc/src/sgml/datatype.sgml @@ -1,271 +1,271 @@ -<chapter id="datatype"> -<title>Data Types</title> + <chapter id="datatype"> +  <title>Data Types</title> -<abstract> -<para> -Describes the built-in data types available in  -<productname>Postgres</productname>. -</para> -</abstract> - -<para> -<productname>Postgres</productname> has a rich set of native data  -types available to users. -Users may add new types to <productname>Postgres</productname> using the -<command>DEFINE TYPE</command> -command described elsewhere. -</para> - -<para> -In the context of data types, the following sections will discuss  -<acronym>SQL</acronym> standards compliance, porting issues, and usage. - -Some <productname>Postgres</productname> types correspond directly to  -<acronym>SQL92</acronym>-compatible types. In other -cases, data types defined by <acronym>SQL92</acronym> syntax are mapped directly -into native <productname>Postgres</productname> types.  - -Many of the built-in types have obvious external formats. However, several -types are either unique to <productname>Postgres</productname>,  -such as open and closed paths, or have -several possibilities for formats, such as the date and time types. -</para> - -<para> -<table tocentry="1"> -<title><productname>Postgres</productname> Data Types</title> -<titleabbrev>Data Types</titleabbrev> -<tgroup cols="3"> -<thead> -  <row> -    <entry><productname>Postgres</productname> Type</entry> -    <entry><acronym>SQL92</acronym> or <acronym>SQL3</acronym> Type</entry> -    <entry>Description</entry> -  </row> -</thead> -<tbody> -  <row> -    <entry>bool</entry> -    <entry>boolean</entry> -    <entry>logical boolean (true/false)</entry> -  </row> -  <row> -    <entry>box</entry> -    <entry></entry> -    <entry>rectangular box in 2D plane</entry> -  </row> -  <row> -    <entry>char(n)</entry> -    <entry>character(n)</entry> -    <entry>fixed-length character string</entry> -  </row> -  <row> -    <entry>cidr</entry> -    <entry></entry> -    <entry>IP version 4 network or host address</entry> -  </row> -  <row> -    <entry>circle</entry> -    <entry></entry> -    <entry>circle in 2D plane</entry> -  </row> -  <row> -    <entry>date</entry> -    <entry>date</entry> -    <entry>calendar date without time of day</entry> -  </row> -  <row> -    <entry>float4/8</entry> -    <entry>float(p)</entry> -    <entry>floating-point number with precision p</entry> -  </row> -  <row> -    <entry>float8</entry> -    <entry>real, double precision</entry> -    <entry>double-precision floating-point number</entry> -  </row> -  <row> -    <entry>inet</entry> -    <entry></entry> -    <entry>IP version 4 network or host address</entry> -  </row> -  <row> -    <entry>int2</entry> -    <entry>smallint</entry> -    <entry>signed two-byte integer</entry> -  </row> -  <row> -    <entry>int4</entry> -    <entry>int, integer</entry> -    <entry>signed 4-byte integer</entry> -  </row> -  <row> -    <entry>int4</entry> -    <entry>decimal(p,s)</entry> -    <entry>exact numeric for p <= 9, s = 0</entry> -  </row> -  <row> -    <entry>int4</entry> -    <entry>numeric(p,s)</entry> -    <entry>exact numeric for p == 9, s = 0</entry> -  </row> -  <row> -    <entry>int8</entry> -    <entry></entry> -    <entry>signed 8-byte integer</entry> -  </row> -  <row> -    <entry>line</entry> -    <entry></entry> -    <entry>infinite line in 2D plane</entry> -  </row> -  <row> -    <entry>lseg</entry> -    <entry></entry> -    <entry>line segment in 2D plane</entry> -  </row> -  <row> -    <entry>money</entry> -    <entry>decimal(9,2)</entry> -    <entry>US-style currency</entry> -  </row> -  <row> -    <entry>path</entry> -    <entry></entry> -    <entry>open and closed geometric path in 2D plane</entry> -  </row> -  <row> -    <entry>point</entry> -    <entry></entry> -    <entry>geometric point in 2D plane</entry> -  </row> -  <row> -    <entry>polygon</entry> -    <entry></entry> -    <entry>closed geometric path in 2D plane</entry> -  </row> -  <row> -    <entry>serial</entry> -    <entry></entry> -    <entry>unique id for indexing and cross-reference</entry> -  </row> -  <row> -    <entry>time</entry> -    <entry>time</entry> -    <entry>time of day</entry> -  </row> -  <row> -    <entry>timespan</entry> -    <entry>interval</entry> -    <entry>general-use time span</entry> -  </row> -  <row> -    <entry>timestamp</entry> -    <entry>timestamp with time zone</entry> -    <entry>date/time</entry> -  </row> -  <row> -    <entry>varchar(n)</entry> -    <entry>character varying(n)</entry> -    <entry>variable-length character string</entry> -  </row> -</tbody> -</tgroup> -</table> -</para> - -<para> -<note> -<para> -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.   -Everything here that talks about ipv4 will apply to ipv6 in a future release.</para> -</note></para> - -<para> -<table tocentry="1"> -<title><productname>Postgres</productname> Function Constants</title> -<titleabbrev>Constants</titleabbrev> -<tgroup cols="3"> -<thead> -  <row> -    <entry><productname>Postgres</productname> Function</entry> -    <entry><acronym>SQL92</acronym> Constant</entry> -    <entry>Description</entry> -  </row> -</thead> -<tbody> -  <row> -    <entry>getpgusername()</entry> -    <entry>current_user</entry> -    <entry>user name in current session</entry> -  </row> -  <row> -    <entry>date('now')</entry> -    <entry>current_date</entry> -    <entry>date of current transaction</entry> -  </row> -  <row> -    <entry>time('now')</entry> -    <entry>current_time</entry> -    <entry>time of current transaction</entry> -  </row> -  <row> -    <entry>timestamp('now')</entry> -    <entry>current_timestamp</entry> -    <entry>date and time of current transaction</entry> -  </row> -</tbody> -</tgroup> -</table> -</para> - -<para> -<productname>Postgres</productname> has features at the forefront of  -<acronym>ORDBMS</acronym> development. In addition to -<acronym>SQL3</acronym> conformance, substantial portions  -of <acronym>SQL92</acronym> are also supported. -Although we strive for <acronym>SQL92</acronym> compliance,  -there are some aspects of the standard -which are ill considered and which should not live through subsequent standards. -<productname>Postgres</productname> will not make great efforts to  -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> - -<para> -Most of the input and output functions corresponding to the -base types (e.g., integers and floating point numbers) do some -error-checking. -Some of the operators and functions (e.g., -addition and multiplication) do not perform run-time error-checking in the -interests of improving execution speed. -On some systems, for example, the numeric operators for some data types may -silently underflow or overflow. -</para> - -<para> -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 original input. - -<note> -<para> -The original <productname>Postgres</productname> v4.2 code received from -Berkeley rounded all double precision floating point results to six digits for -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,  -6 digits for 4-byte floats).  -Other types with underlying floating point fields (e.g. geometric -types) carry similar precision.</para> -</note> -</para> +  <abstract> +   <para> +    Describes the built-in data types available in  +    <productname>Postgres</productname>. +   </para> +  </abstract> + +  <para> +   <productname>Postgres</productname> has a rich set of native data  +   types available to users. +   Users may add new types to <productname>Postgres</productname> using the +   <command>DEFINE TYPE</command> +   command described elsewhere. +  </para> + +  <para> +   In the context of data types, the following sections will discuss  +   <acronym>SQL</acronym> standards compliance, porting issues, and usage. + +   Some <productname>Postgres</productname> types correspond directly to  +   <acronym>SQL92</acronym>-compatible types. In other +   cases, data types defined by <acronym>SQL92</acronym> syntax are mapped directly +   into native <productname>Postgres</productname> types.  + +   Many of the built-in types have obvious external formats. However, several +   types are either unique to <productname>Postgres</productname>,  +   such as open and closed paths, or have +   several possibilities for formats, such as the date and time types. +  </para> + +  <para> +   <table tocentry="1"> +    <title><productname>Postgres</productname> Data Types</title> +    <titleabbrev>Data Types</titleabbrev> +    <tgroup cols="3"> +     <thead> +      <row> +       <entry><productname>Postgres</productname> Type</entry> +       <entry><acronym>SQL92</acronym> or <acronym>SQL3</acronym> Type</entry> +       <entry>Description</entry> +      </row> +     </thead> +     <tbody> +      <row> +       <entry>bool</entry> +       <entry>boolean</entry> +       <entry>logical boolean (true/false)</entry> +      </row> +      <row> +       <entry>box</entry> +       <entry></entry> +       <entry>rectangular box in 2D plane</entry> +      </row> +      <row> +       <entry>char(n)</entry> +       <entry>character(n)</entry> +       <entry>fixed-length character string</entry> +      </row> +      <row> +       <entry>cidr</entry> +       <entry></entry> +       <entry>IP version 4 network or host address</entry> +      </row> +      <row> +       <entry>circle</entry> +       <entry></entry> +       <entry>circle in 2D plane</entry> +      </row> +      <row> +       <entry>date</entry> +       <entry>date</entry> +       <entry>calendar date without time of day</entry> +      </row> +      <row> +       <entry>float4/8</entry> +       <entry>float(p)</entry> +       <entry>floating-point number with precision p</entry> +      </row> +      <row> +       <entry>float8</entry> +       <entry>real, double precision</entry> +       <entry>double-precision floating-point number</entry> +      </row> +      <row> +       <entry>inet</entry> +       <entry></entry> +       <entry>IP version 4 network or host address</entry> +      </row> +      <row> +       <entry>int2</entry> +       <entry>smallint</entry> +       <entry>signed two-byte integer</entry> +      </row> +      <row> +       <entry>int4</entry> +       <entry>int, integer</entry> +       <entry>signed 4-byte integer</entry> +      </row> +      <row> +       <entry>int4</entry> +       <entry>decimal(p,s)</entry> +       <entry>exact numeric for p <= 9, s = 0</entry> +      </row> +      <row> +       <entry>int4</entry> +       <entry>numeric(p,s)</entry> +       <entry>exact numeric for p == 9, s = 0</entry> +      </row> +      <row> +       <entry>int8</entry> +       <entry></entry> +       <entry>signed 8-byte integer</entry> +      </row> +      <row> +       <entry>line</entry> +       <entry></entry> +       <entry>infinite line in 2D plane</entry> +      </row> +      <row> +       <entry>lseg</entry> +       <entry></entry> +       <entry>line segment in 2D plane</entry> +      </row> +      <row> +       <entry>money</entry> +       <entry>decimal(9,2)</entry> +       <entry>US-style currency</entry> +      </row> +      <row> +       <entry>path</entry> +       <entry></entry> +       <entry>open and closed geometric path in 2D plane</entry> +      </row> +      <row> +       <entry>point</entry> +       <entry></entry> +       <entry>geometric point in 2D plane</entry> +      </row> +      <row> +       <entry>polygon</entry> +       <entry></entry> +       <entry>closed geometric path in 2D plane</entry> +      </row> +      <row> +       <entry>serial</entry> +       <entry></entry> +       <entry>unique id for indexing and cross-reference</entry> +      </row> +      <row> +       <entry>time</entry> +       <entry>time</entry> +       <entry>time of day</entry> +      </row> +      <row> +       <entry>timespan</entry> +       <entry>interval</entry> +       <entry>general-use time span</entry> +      </row> +      <row> +       <entry>timestamp</entry> +       <entry>timestamp with time zone</entry> +       <entry>date/time</entry> +      </row> +      <row> +       <entry>varchar(n)</entry> +       <entry>character varying(n)</entry> +       <entry>variable-length character string</entry> +      </row> +     </tbody> +    </tgroup> +   </table> +  </para> + +  <para> +   <note> +    <para> +     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.   +     Everything here that talks about ipv4 will apply to ipv6 in a future release.</para> +   </note></para> + +  <para> +   <table tocentry="1"> +    <title><productname>Postgres</productname> Function Constants</title> +    <titleabbrev>Constants</titleabbrev> +    <tgroup cols="3"> +     <thead> +      <row> +       <entry><productname>Postgres</productname> Function</entry> +       <entry><acronym>SQL92</acronym> Constant</entry> +       <entry>Description</entry> +      </row> +     </thead> +     <tbody> +      <row> +       <entry>getpgusername()</entry> +       <entry>current_user</entry> +       <entry>user name in current session</entry> +      </row> +      <row> +       <entry>date('now')</entry> +       <entry>current_date</entry> +       <entry>date of current transaction</entry> +      </row> +      <row> +       <entry>time('now')</entry> +       <entry>current_time</entry> +       <entry>time of current transaction</entry> +      </row> +      <row> +       <entry>timestamp('now')</entry> +       <entry>current_timestamp</entry> +       <entry>date and time of current transaction</entry> +      </row> +     </tbody> +    </tgroup> +   </table> +  </para> + +  <para> +   <productname>Postgres</productname> has features at the forefront of  +   <acronym>ORDBMS</acronym> development. In addition to +   <acronym>SQL3</acronym> conformance, substantial portions  +   of <acronym>SQL92</acronym> are also supported. +   Although we strive for <acronym>SQL92</acronym> compliance,  +   there are some aspects of the standard +   which are ill considered and which should not live through subsequent standards. +   <productname>Postgres</productname> will not make great efforts to  +   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> + +  <para> +   Most of the input and output functions corresponding to the +   base types (e.g., integers and floating point numbers) do some +   error-checking. +   Some of the operators and functions (e.g., +   addition and multiplication) do not perform run-time error-checking in the +   interests of improving execution speed. +   On some systems, for example, the numeric operators for some data types may +   silently underflow or overflow. +  </para> + +  <para> +   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 original input. + +   <note> +    <para> +     The original <productname>Postgres</productname> v4.2 code received from +     Berkeley rounded all double precision floating point results to six digits for +     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,  +     6 digits for 4-byte floats).  +     Other types with underlying floating point fields (e.g. geometric +     types) carry similar precision.</para> +   </note> +  </para> -<sect1> -<title>Numeric Types</title> +  <sect1> +   <title>Numeric Types</title> -<para> -Numeric types consist of two- and four-byte integers and four- and eight-byte -floating point numbers.</para> +   <para> +    Numeric types consist of two- and four-byte integers and four- and eight-byte +    floating point numbers.</para>  <para>  <table tocentry="1"> diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index f6b640c1b86..0c27254c220 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -1,69 +1,117 @@ -<Chapter Id="functions"> -<Title>Functions</Title> + <Chapter Id="functions"> +  <Title id="functions-title">Functions</Title> -<Abstract> -<Para> -Describes the built-in functions available in <ProductName>Postgres</ProductName>. -</Para> -</Abstract> +  <Abstract> +   <Para> +    Describes the built-in functions available in <ProductName>Postgres</ProductName>. +   </Para> +  </Abstract> -<Para> -Many data types have functions available for conversion to other related types. -In addition, there are some type-specific functions. Some functions are also -available through operators and may be documented as operators only. -</Para> +  <Para> +   Many data types have functions available for conversion to other related types. +   In addition, there are some type-specific functions. Some functions are also +   available through operators and may be documented as operators only. +  </Para> -<sect1> -<title id="math-funcs">Mathematical Functions</title> +  <sect1> +   <title id="sql-funcs">SQL Functions</title> -<Para> -<TABLE TOCENTRY="1"> -<TITLE>Mathematical Functions</TITLE> -<TGROUP COLS="4"> -<THEAD> -  <ROW> -    <ENTRY>Function</ENTRY> -    <ENTRY>Returns</ENTRY> -    <ENTRY>Description</ENTRY> -    <ENTRY>Example</ENTRY> -  </ROW> -</THEAD> -<TBODY> -  <ROW> -<ENTRY> dexp(float8) </ENTRY> -<ENTRY> float8 </ENTRY> -<ENTRY> raise e to the specified exponent </ENTRY> -<ENTRY> dexp(2.0) </ENTRY> -  </ROW> -  <ROW> -<ENTRY> dpow(float8,float8) </ENTRY> -<ENTRY> float8 </ENTRY> -<ENTRY> raise a number to the specified exponent </ENTRY> -<ENTRY> dpow(2.0, 16.0) </ENTRY> -  </ROW> -  <ROW> -<ENTRY> float(int) </ENTRY> -<ENTRY> float8 </ENTRY> -<ENTRY> convert integer to floating point </ENTRY> -<ENTRY> float(2) </ENTRY> -  </ROW> -  <ROW> -<ENTRY> float4(int) </ENTRY> -<ENTRY> float4 </ENTRY> -<ENTRY> convert integer to floating point </ENTRY> -<ENTRY> float4(2) </ENTRY> -  </ROW> -  <ROW> -<ENTRY> integer(float) </ENTRY> -<ENTRY> int </ENTRY> -<ENTRY> convert floating point to integer </ENTRY> -<ENTRY> integer(2.0) </ENTRY> -  </ROW> -</TBODY> -</TGROUP> -</TABLE> -</Para> -</sect1> +   <para> +    <quote><acronym>SQL</acronym> functions</quote> are constructs +    defined by the <acronym>SQL92</acronym> standard which have +    function-like syntax but which can not be implemented as simple +    functions.  +   </para> + +   <para> +    <TABLE TOCENTRY="1"> +     <TITLE>SQL Functions</TITLE> +     <TGROUP COLS="4"> +      <THEAD> +       <ROW> +	<ENTRY>Function</ENTRY> +	<ENTRY>Returns</ENTRY> +	<ENTRY>Description</ENTRY> +	<ENTRY>Example</ENTRY> +       </ROW> +      </THEAD> +      <TBODY> +       <ROW> +	<ENTRY> COALESCE(<replaceable class="parameter">list</replaceable>) </ENTRY> +	<ENTRY> non-NULL </ENTRY> +	<ENTRY> return first non-NULL value in list </ENTRY> +	<ENTRY> COALESCE(<replaceable class="parameter">c1</replaceable>, <replaceable class="parameter">c2</replaceable> + 5, 0) </ENTRY> +       </ROW> +       <ROW> +	<ENTRY> IFNULL(<replaceable +	  class="parameter">input</replaceable>,<replaceable> class="parameter">non-NULL substitute</replaceable>) </ENTRY> +	<ENTRY> non-NULL </ENTRY> +	<ENTRY> return second argument if first is NULL </ENTRY> +	<ENTRY> IFNULL(<replaceable class="parameter">c1</replaceable>, 'N/A')</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> CASE(WHEN <replaceable class="parameter">expr</replaceable> THEN <replaceable class="parameter">expr</replaceable> [...] ELSE <replaceable class="parameter">expr</replaceable> ) </ENTRY> +	<ENTRY> <replaceable class="parameter">expr</replaceable> </ENTRY> +	<ENTRY> return expression for first true clause </ENTRY> +	<ENTRY> CASE(WHEN <replaceable class="parameter">c1</replaceable> = 1 THEN 'match' ELSE 'no match') </ENTRY> +       </ROW> +      </tbody> +     </tgroup> +    </table> +   </para> +  </sect1> + +  <sect1> +   <title id="math-funcs">Mathematical Functions</title> + +   <Para> +    <TABLE TOCENTRY="1"> +     <TITLE>Mathematical Functions</TITLE> +     <TGROUP COLS="4"> +      <THEAD> +       <ROW> +	<ENTRY>Function</ENTRY> +	<ENTRY>Returns</ENTRY> +	<ENTRY>Description</ENTRY> +	<ENTRY>Example</ENTRY> +       </ROW> +      </THEAD> +      <TBODY> +       <ROW> +	<ENTRY> dexp(float8) </ENTRY> +	<ENTRY> float8 </ENTRY> +	<ENTRY> raise e to the specified exponent </ENTRY> +	<ENTRY> dexp(2.0) </ENTRY> +       </ROW> +       <ROW> +	<ENTRY> dpow(float8,float8) </ENTRY> +	<ENTRY> float8 </ENTRY> +	<ENTRY> raise a number to the specified exponent </ENTRY> +	<ENTRY> dpow(2.0, 16.0) </ENTRY> +       </ROW> +       <ROW> +	<ENTRY> float(int) </ENTRY> +	<ENTRY> float8 </ENTRY> +	<ENTRY> convert integer to floating point </ENTRY> +	<ENTRY> float(2) </ENTRY> +       </ROW> +       <ROW> +	<ENTRY> float4(int) </ENTRY> +	<ENTRY> float4 </ENTRY> +	<ENTRY> convert integer to floating point </ENTRY> +	<ENTRY> float4(2) </ENTRY> +       </ROW> +       <ROW> +	<ENTRY> integer(float) </ENTRY> +	<ENTRY> int </ENTRY> +	<ENTRY> convert floating point to integer </ENTRY> +	<ENTRY> integer(2.0) </ENTRY> +       </ROW> +      </TBODY> +     </TGROUP> +    </TABLE> +   </Para> +  </sect1>    <sect1>     <title>String Functions</title> @@ -146,573 +194,574 @@ available through operators and may be documented as operators only.      Some are used internally to implement the SQL92 string functions listed above.     </Para> -<Para> -<TABLE TOCENTRY="1"> -<TITLE>String Functions</TITLE> -<TGROUP COLS="4"> -<THEAD> -  <ROW> -    <ENTRY>Function</ENTRY> -    <ENTRY>Returns</ENTRY> -    <ENTRY>Description</ENTRY> -    <ENTRY>Example</ENTRY> -  </ROW> -</THEAD> -<TBODY> -  <ROW> -<ENTRY> char(text) </ENTRY> -<ENTRY> char </ENTRY> -<ENTRY> convert text to char type </ENTRY> -<ENTRY> char('text string') </ENTRY> -  </ROW> -  <ROW> -<ENTRY> char(varchar) </ENTRY> -<ENTRY> char </ENTRY> -<ENTRY> convert varchar to char type </ENTRY> -<ENTRY> char(varchar 'varchar string') </ENTRY> -  </ROW> -  <ROW> -<ENTRY> initcap(text) </ENTRY> -<ENTRY> text </ENTRY> -<ENTRY> first letter of each word to upper case </ENTRY> -<ENTRY> initcap('thomas') </ENTRY> -  </ROW> -  <ROW> -<ENTRY> lpad(text,int,text) </ENTRY> -<ENTRY> text </ENTRY> -<ENTRY> left pad string to specified length </ENTRY> -<ENTRY> lpad('hi',4,'??') </ENTRY> -  </ROW> -  <ROW> -<ENTRY> ltrim(text,text) </ENTRY> -<ENTRY> text </ENTRY> -<ENTRY> left trim characters from text </ENTRY> -<ENTRY> ltrim('xxxxtrim','x') </ENTRY> -  </ROW> -  <ROW> -<ENTRY> textpos(text,text) </ENTRY> -<ENTRY> text </ENTRY> -<ENTRY> locate specified substring </ENTRY> -<ENTRY> position('high','ig') </ENTRY> -  </ROW> -  <ROW> -<ENTRY> rpad(text,int,text) </ENTRY> -<ENTRY> text </ENTRY> -<ENTRY> right pad string to specified length </ENTRY> -<ENTRY> rpad('hi',4,'x') </ENTRY> -  </ROW> -  <ROW> -<ENTRY> rtrim(text,text) </ENTRY> -<ENTRY> text </ENTRY> -<ENTRY> right trim characters from text </ENTRY> -<ENTRY> rtrim('trimxxxx','x') </ENTRY> -  </ROW> -  <ROW> -<ENTRY> substr(text,int[,int]) </ENTRY> -<ENTRY> text </ENTRY> -<ENTRY> extract specified substring </ENTRY> -<ENTRY> substr('hi there',3,5) </ENTRY> -  </ROW> -  <ROW> -<ENTRY> text(char) </ENTRY> -<ENTRY> text </ENTRY> -<ENTRY> convert char to text type </ENTRY> -<ENTRY> text('char string') </ENTRY> -  </ROW> -  <ROW> -<ENTRY> text(varchar) </ENTRY> -<ENTRY> text </ENTRY> -<ENTRY> convert varchar to text type </ENTRY> -<ENTRY> text(varchar 'varchar string') </ENTRY> -  </ROW> -  <ROW> -<ENTRY> translate(text,from,to) </ENTRY> -<ENTRY> text </ENTRY> -<ENTRY> convert character in string </ENTRY> -<ENTRY> translate('12345', '1', 'a') </ENTRY> -  </ROW> -  <ROW> -<ENTRY> varchar(char) </ENTRY> -<ENTRY> varchar </ENTRY> -<ENTRY> convert char to varchar type </ENTRY> -<ENTRY> varchar('char string') </ENTRY> -  </ROW> -  <ROW> -<ENTRY> varchar(text) </ENTRY> -<ENTRY> varchar </ENTRY> -<ENTRY> convert text to varchar type </ENTRY> -<ENTRY> varchar('text string') </ENTRY> -  </ROW> -</TBODY> -</TGROUP> -</TABLE> -</Para> +   <Para> +    <TABLE TOCENTRY="1"> +     <TITLE>String Functions</TITLE> +     <TGROUP COLS="4"> +      <THEAD> +       <ROW> +	<ENTRY>Function</ENTRY> +	<ENTRY>Returns</ENTRY> +	<ENTRY>Description</ENTRY> +	<ENTRY>Example</ENTRY> +       </ROW> +      </THEAD> +      <TBODY> +       <ROW> +	<ENTRY> char(text) </ENTRY> +	<ENTRY> char </ENTRY> +	<ENTRY> convert text to char type </ENTRY> +	<ENTRY> char('text string') </ENTRY> +       </ROW> +       <ROW> +	<ENTRY> char(varchar) </ENTRY> +	<ENTRY> char </ENTRY> +	<ENTRY> convert varchar to char type </ENTRY> +	<ENTRY> char(varchar 'varchar string') </ENTRY> +       </ROW> +       <ROW> +	<ENTRY> initcap(text) </ENTRY> +	<ENTRY> text </ENTRY> +	<ENTRY> first letter of each word to upper case </ENTRY> +	<ENTRY> initcap('thomas') </ENTRY> +       </ROW> +       <ROW> +	<ENTRY> lpad(text,int,text) </ENTRY> +	<ENTRY> text </ENTRY> +	<ENTRY> left pad string to specified length </ENTRY> +	<ENTRY> lpad('hi',4,'??') </ENTRY> +       </ROW> +       <ROW> +	<ENTRY> ltrim(text,text) </ENTRY> +	<ENTRY> text </ENTRY> +	<ENTRY> left trim characters from text </ENTRY> +	<ENTRY> ltrim('xxxxtrim','x') </ENTRY> +       </ROW> +       <ROW> +	<ENTRY> textpos(text,text) </ENTRY> +	<ENTRY> text </ENTRY> +	<ENTRY> locate specified substring </ENTRY> +	<ENTRY> position('high','ig') </ENTRY> +       </ROW> +       <ROW> +	<ENTRY> rpad(text,int,text) </ENTRY> +	<ENTRY> text </ENTRY> +	<ENTRY> right pad string to specified length </ENTRY> +	<ENTRY> rpad('hi',4,'x') </ENTRY> +       </ROW> +       <ROW> +	<ENTRY> rtrim(text,text) </ENTRY> +	<ENTRY> text </ENTRY> +	<ENTRY> right trim characters from text </ENTRY> +	<ENTRY> rtrim('trimxxxx','x') </ENTRY> +       </ROW> +       <ROW> +	<ENTRY> substr(text,int[,int]) </ENTRY> +	<ENTRY> text </ENTRY> +	<ENTRY> extract specified substring </ENTRY> +	<ENTRY> substr('hi there',3,5) </ENTRY> +       </ROW> +       <ROW> +	<ENTRY> text(char) </ENTRY> +	<ENTRY> text </ENTRY> +	<ENTRY> convert char to text type </ENTRY> +	<ENTRY> text('char string') </ENTRY> +       </ROW> +       <ROW> +	<ENTRY> text(varchar) </ENTRY> +	<ENTRY> text </ENTRY> +	<ENTRY> convert varchar to text type </ENTRY> +	<ENTRY> text(varchar 'varchar string') </ENTRY> +       </ROW> +       <ROW> +	<ENTRY> translate(text,from,to) </ENTRY> +	<ENTRY> text </ENTRY> +	<ENTRY> convert character in string </ENTRY> +	<ENTRY> translate('12345', '1', 'a') </ENTRY> +       </ROW> +       <ROW> +	<ENTRY> varchar(char) </ENTRY> +	<ENTRY> varchar </ENTRY> +	<ENTRY> convert char to varchar type </ENTRY> +	<ENTRY> varchar('char string') </ENTRY> +       </ROW> +       <ROW> +	<ENTRY> varchar(text) </ENTRY> +	<ENTRY> varchar </ENTRY> +	<ENTRY> convert text to varchar type </ENTRY> +	<ENTRY> varchar('text string') </ENTRY> +       </ROW> +      </TBODY> +     </TGROUP> +    </TABLE> +   </Para> -<para> -Most functions explicitly defined for text will work for char() and varchar() arguments. -</para> -</sect1> +   <para> +    Most functions explicitly defined for text will work for char() and varchar() arguments. +   </para> +  </sect1> -<sect1> -<title>Date/Time Functions</title> +  <sect1> +   <title>Date/Time Functions</title> -<para> -The date/time functions provide a powerful set of tools for manipulating various date/time types. -</para> +   <para> +    The date/time functions provide a powerful set of tools +    for manipulating various date/time types. +   </para> -<Para> -<TABLE TOCENTRY="1"> -<TITLE>Date/Time Functions</TITLE> -<TGROUP COLS="4"> -<THEAD> -  <ROW> -    <ENTRY>Function</ENTRY> -    <ENTRY>Returns</ENTRY> -    <ENTRY>Description</ENTRY> -    <ENTRY>Example</ENTRY> -  </ROW> -</THEAD> -<TBODY> -  <ROW> -<ENTRY> abstime(datetime) </ENTRY> -<ENTRY> abstime </ENTRY> -<ENTRY> convert to abstime </ENTRY> -<ENTRY> abstime('now'::datetime) </ENTRY> -  </ROW> -  <ROW> -<ENTRY> age(datetime,datetime) </ENTRY> -<ENTRY> timespan </ENTRY> -<ENTRY> span preserving months and years </ENTRY> -<ENTRY> age('now','1957-06-13'::datetime) </ENTRY> -  </ROW> -  <ROW> -<ENTRY> datetime(abstime) </ENTRY> -<ENTRY> datetime </ENTRY> -<ENTRY> convert to datetime </ENTRY> -<ENTRY> datetime('now'::abstime) </ENTRY> -  </ROW> -  <ROW> -<ENTRY> datetime(date) </ENTRY> -<ENTRY> datetime </ENTRY> -<ENTRY> convert to datetime </ENTRY> -<ENTRY> datetime('today'::date) </ENTRY> -  </ROW> -  <ROW> -<ENTRY> datetime(date,time) </ENTRY> -<ENTRY> datetime </ENTRY> -<ENTRY> convert to datetime </ENTRY> -<ENTRY> datetime('1998-02-24'::datetime, '23:07'::time); </ENTRY> -  </ROW> -  <ROW> -<ENTRY> date_part(text,datetime) </ENTRY> -<ENTRY> float8 </ENTRY> -<ENTRY> specified portion of date field </ENTRY> -<ENTRY> date_part('dow','now'::datetime) </ENTRY> -  </ROW> -  <ROW> -<ENTRY> date_part(text,timespan) </ENTRY> -<ENTRY> float8 </ENTRY> -<ENTRY> specified portion of time field </ENTRY> -<ENTRY> date_part('hour','4 hrs 3 mins'::timespan) </ENTRY> -  </ROW> -  <ROW> -<ENTRY> date_trunc(text,datetime) </ENTRY> -<ENTRY> datetime </ENTRY> -<ENTRY> truncate date at specified units </ENTRY> -<ENTRY> date_trunc('month','now'::abstime) </ENTRY> -  </ROW> -  <ROW> -<ENTRY> isfinite(abstime) </ENTRY> -<ENTRY> bool </ENTRY> -<ENTRY> TRUE if this is a finite time </ENTRY> -<ENTRY> isfinite('now'::abstime) </ENTRY> -  </ROW> -  <ROW> -<ENTRY> isfinite(datetime) </ENTRY> -<ENTRY> bool </ENTRY> -<ENTRY> TRUE if this is a finite time </ENTRY> -<ENTRY> isfinite('now'::datetime) </ENTRY> -  </ROW> -  <ROW> -<ENTRY> isfinite(timespan) </ENTRY> -<ENTRY> bool </ENTRY> -<ENTRY> TRUE if this is a finite time </ENTRY> -<ENTRY> isfinite('4 hrs'::timespan) </ENTRY> -  </ROW> -  <ROW> -<ENTRY> reltime(timespan) </ENTRY> -<ENTRY> reltime </ENTRY> -<ENTRY> convert to reltime </ENTRY> -<ENTRY> reltime('4 hrs'::timespan) </ENTRY> -  </ROW> -  <ROW> -<ENTRY> timespan(reltime) </ENTRY> -<ENTRY> timespan </ENTRY> -<ENTRY> convert to timespan </ENTRY> -<ENTRY> timespan('4 hours'::reltime) </ENTRY> +   <Para> +    <TABLE TOCENTRY="1"> +     <TITLE>Date/Time Functions</TITLE> +     <TGROUP COLS="4"> +      <THEAD> +       <ROW> +	<ENTRY>Function</ENTRY> +	<ENTRY>Returns</ENTRY> +	<ENTRY>Description</ENTRY> +	<ENTRY>Example</ENTRY> +       </ROW> +      </THEAD> +      <TBODY> +       <ROW> +	<ENTRY> abstime(datetime) </ENTRY> +	<ENTRY> abstime </ENTRY> +	<ENTRY> convert to abstime </ENTRY> +	<ENTRY> abstime('now'::datetime) </ENTRY> +       </ROW> +       <ROW> +	<ENTRY> age(datetime,datetime) </ENTRY> +	<ENTRY> timespan </ENTRY> +	<ENTRY> span preserving months and years </ENTRY> +	<ENTRY> age('now','1957-06-13'::datetime) </ENTRY> +       </ROW> +       <ROW> +	<ENTRY> datetime(abstime) </ENTRY> +	<ENTRY> datetime </ENTRY> +	<ENTRY> convert to datetime </ENTRY> +	<ENTRY> datetime('now'::abstime) </ENTRY> +       </ROW> +       <ROW> +	<ENTRY> datetime(date) </ENTRY> +	<ENTRY> datetime </ENTRY> +	<ENTRY> convert to datetime </ENTRY> +	<ENTRY> datetime('today'::date) </ENTRY> +       </ROW> +       <ROW> +	<ENTRY> datetime(date,time) </ENTRY> +	<ENTRY> datetime </ENTRY> +	<ENTRY> convert to datetime </ENTRY> +	<ENTRY> datetime('1998-02-24'::datetime, '23:07'::time); </ENTRY>    </ROW> -</TBODY> -</TGROUP> -</TABLE> -</Para> +       <ROW> +	<ENTRY> date_part(text,datetime) </ENTRY> +	<ENTRY> float8 </ENTRY> +	<ENTRY> specified portion of date field </ENTRY> +	<ENTRY> date_part('dow','now'::datetime) </ENTRY> +       </ROW> +       <ROW> +	<ENTRY> date_part(text,timespan) </ENTRY> +	<ENTRY> float8 </ENTRY> +	<ENTRY> specified portion of time field </ENTRY> +	<ENTRY> date_part('hour','4 hrs 3 mins'::timespan) </ENTRY> +       </ROW> +       <ROW> +	<ENTRY> date_trunc(text,datetime) </ENTRY> +	<ENTRY> datetime </ENTRY> +	<ENTRY> truncate date at specified units </ENTRY> +	<ENTRY> date_trunc('month','now'::abstime) </ENTRY> +       </ROW> +       <ROW> +	<ENTRY> isfinite(abstime) </ENTRY> +	<ENTRY> bool </ENTRY> +	<ENTRY> TRUE if this is a finite time </ENTRY> +	<ENTRY> isfinite('now'::abstime) </ENTRY> +       </ROW> +       <ROW> +	<ENTRY> isfinite(datetime) </ENTRY> +	<ENTRY> bool </ENTRY> +	<ENTRY> TRUE if this is a finite time </ENTRY> +	<ENTRY> isfinite('now'::datetime) </ENTRY> +       </ROW> +       <ROW> +	<ENTRY> isfinite(timespan) </ENTRY> +	<ENTRY> bool </ENTRY> +	<ENTRY> TRUE if this is a finite time </ENTRY> +	<ENTRY> isfinite('4 hrs'::timespan) </ENTRY> +       </ROW> +       <ROW> +	<ENTRY> reltime(timespan) </ENTRY> +	<ENTRY> reltime </ENTRY> +	<ENTRY> convert to reltime </ENTRY> +	<ENTRY> reltime('4 hrs'::timespan) </ENTRY> +       </ROW> +       <ROW> +	<ENTRY> timespan(reltime) </ENTRY> +	<ENTRY> timespan </ENTRY> +	<ENTRY> convert to timespan </ENTRY> +	<ENTRY> timespan('4 hours'::reltime) </ENTRY> +       </ROW> +      </TBODY> +     </TGROUP> +    </TABLE> +   </Para> -<Para> -For the -<Function>date_part</Function> and <Function>date_trunc</Function> -functions, arguments can be -`year', `month', `day', `hour', `minute', and `second', -as well as the more specialized quantities -`decade', `century', `millenium', `millisecond', and `microsecond'. -<Function>date_part</Function> allows `dow' -to return day of week and `epoch' to return seconds since 1970 (for <Type>datetime</Type>) -or 'epoch' to return total elapsed seconds (for <Type>timespan</Type>). -</Para> -</sect1> +   <Para> +    For the +    <Function>date_part</Function> and <Function>date_trunc</Function> +    functions, arguments can be +    `year', `month', `day', `hour', `minute', and `second', +    as well as the more specialized quantities +    `decade', `century', `millenium', `millisecond', and `microsecond'. +    <Function>date_part</Function> allows `dow' +    to return day of week and `epoch' to return seconds since 1970 (for <Type>datetime</Type>) +    or 'epoch' to return total elapsed seconds (for <Type>timespan</Type>). +   </Para> +  </sect1> -<sect1> -<title>Geometric Functions</title> +  <sect1> +   <title>Geometric Functions</title> -<para> -The geometric types point, box, lseg, line, path, polygon, and circle have a large set of native -support functions. -</para> +   <para> +    The geometric types point, box, lseg, line, path, polygon, and +    circle have a large set of native support functions. +   </para> -<Para> -<TABLE TOCENTRY="1"> -<TITLE>Geometric Functions</TITLE> -<TGROUP COLS="4"> -<THEAD> -  <ROW> -    <ENTRY>Function</ENTRY> -    <ENTRY>Returns</ENTRY> -    <ENTRY>Description</ENTRY> -    <ENTRY>Example</ENTRY> -  </ROW> -</THEAD> -<TBODY> -  <ROW> -<ENTRY> area(box) </ENTRY> -<ENTRY> float8 </ENTRY> -<ENTRY> area of box </ENTRY> -<ENTRY> area('((0,0),(1,1))'::box) </ENTRY> -  </ROW> -  <ROW> -<ENTRY> area(circle) </ENTRY> -<ENTRY> float8 </ENTRY> -<ENTRY> area of circle </ENTRY> -<ENTRY> area('((0,0),2.0)'::circle) </ENTRY> -  </ROW> -  <ROW> -<ENTRY> box(box,box) </ENTRY> -<ENTRY> box </ENTRY> -<ENTRY> boxes to intersection box </ENTRY> -<ENTRY> box('((0,0),(1,1))','((0.5,0.5),(2,2))') </ENTRY> -  </ROW> -  <ROW> -<ENTRY> center(box) </ENTRY> -<ENTRY> point </ENTRY> -<ENTRY> center of object </ENTRY> -<ENTRY> center('((0,0),(1,2))'::box) </ENTRY> -  </ROW> -  <ROW> -<ENTRY> center(circle) </ENTRY> -<ENTRY> point </ENTRY> -<ENTRY> center of object </ENTRY> -<ENTRY> center('((0,0),2.0)'::circle) </ENTRY> -  </ROW> -  <ROW> -<ENTRY> diameter(circle) </ENTRY> -<ENTRY> float8 </ENTRY> -<ENTRY> diameter of circle </ENTRY> -<ENTRY> diameter('((0,0),2.0)'::circle) </ENTRY> -  </ROW> -  <ROW> -<ENTRY> height(box) </ENTRY> -<ENTRY> float8 </ENTRY> -<ENTRY> vertical size of box </ENTRY> -<ENTRY> height('((0,0),(1,1))'::box) </ENTRY> -  </ROW> -  <ROW> -<ENTRY> isclosed(path) </ENTRY> -<ENTRY> bool </ENTRY> -<ENTRY> TRUE if this is a closed path </ENTRY> -<ENTRY> isclosed('((0,0),(1,1),(2,0))'::path) </ENTRY> -  </ROW> -  <ROW> -<ENTRY> isopen(path) </ENTRY> -<ENTRY> bool </ENTRY> -<ENTRY> TRUE if this is an open path </ENTRY> -<ENTRY> isopen('[(0,0),(1,1),(2,0)]'::path) </ENTRY> -  </ROW> -  <ROW> -<ENTRY> length(lseg) </ENTRY> -<ENTRY> float8 </ENTRY> -<ENTRY> length of line segment </ENTRY> -<ENTRY> length('((-1,0),(1,0))'::lseg) </ENTRY> -  </ROW> -  <ROW> -<ENTRY> length(path) </ENTRY> -<ENTRY> float8 </ENTRY> -<ENTRY> length of path </ENTRY> -<ENTRY> length('((0,0),(1,1),(2,0))'::path) </ENTRY> -  </ROW> -  <ROW> -<ENTRY> pclose(path) </ENTRY> -<ENTRY> path </ENTRY> -<ENTRY> convert path to closed variant </ENTRY> -<ENTRY> popen('[(0,0),(1,1),(2,0)]'::path) </ENTRY> -  </ROW> -  <ROW> -<ENTRY> point(lseg,lseg) </ENTRY> -<ENTRY> point </ENTRY> -<ENTRY> convert to point (intersection) </ENTRY> -<ENTRY> point('((-1,0),(1,0))'::lseg,'((-2,-2),(2,2))'::lseg) </ENTRY> -  </ROW> -  <ROW> -<ENTRY> points(path) </ENTRY> -<ENTRY> int4 </ENTRY> -<ENTRY> number of points in path </ENTRY> -<ENTRY> points('[(0,0),(1,1),(2,0)]'::path) </ENTRY> -  </ROW> -  <ROW> -<ENTRY> popen(path) </ENTRY> -<ENTRY> path </ENTRY> -<ENTRY> convert path to open variant </ENTRY> -<ENTRY> popen('((0,0),(1,1),(2,0))'::path) </ENTRY> -  </ROW> -  <ROW> -<ENTRY> radius(circle) </ENTRY> -<ENTRY> float8 </ENTRY> -<ENTRY> radius of circle </ENTRY> -<ENTRY> radius('((0,0),2.0)'::circle) </ENTRY> -  </ROW> -  <ROW> -<ENTRY> width(box) </ENTRY> -<ENTRY> float8 </ENTRY> -<ENTRY> horizontal size of box </ENTRY> -<ENTRY> width('((0,0),(1,1))'::box) </ENTRY> -  </ROW> -</TBODY> -</TGROUP> -</TABLE> -</Para> +   <Para> +    <TABLE TOCENTRY="1"> +     <TITLE>Geometric Functions</TITLE> +     <TGROUP COLS="4"> +      <THEAD> +       <ROW> +	<ENTRY>Function</ENTRY> +	<ENTRY>Returns</ENTRY> +	<ENTRY>Description</ENTRY> +	<ENTRY>Example</ENTRY> +       </ROW> +      </THEAD> +      <TBODY> +       <ROW> +	<ENTRY> area(box) </ENTRY> +	<ENTRY> float8 </ENTRY> +	<ENTRY> area of box </ENTRY> +	<ENTRY> area('((0,0),(1,1))'::box) </ENTRY> +       </ROW> +       <ROW> +	<ENTRY> area(circle) </ENTRY> +	<ENTRY> float8 </ENTRY> +	<ENTRY> area of circle </ENTRY> +	<ENTRY> area('((0,0),2.0)'::circle) </ENTRY> +       </ROW> +       <ROW> +	<ENTRY> box(box,box) </ENTRY> +	<ENTRY> box </ENTRY> +	<ENTRY> boxes to intersection box </ENTRY> +	<ENTRY> box('((0,0),(1,1))','((0.5,0.5),(2,2))') </ENTRY> +       </ROW> +       <ROW> +	<ENTRY> center(box) </ENTRY> +	<ENTRY> point </ENTRY> +	<ENTRY> center of object </ENTRY> +	<ENTRY> center('((0,0),(1,2))'::box) </ENTRY> +       </ROW> +       <ROW> +	<ENTRY> center(circle) </ENTRY> +	<ENTRY> point </ENTRY> +	<ENTRY> center of object </ENTRY> +	<ENTRY> center('((0,0),2.0)'::circle) </ENTRY> +       </ROW> +       <ROW> +	<ENTRY> diameter(circle) </ENTRY> +	<ENTRY> float8 </ENTRY> +	<ENTRY> diameter of circle </ENTRY> +	<ENTRY> diameter('((0,0),2.0)'::circle) </ENTRY> +       </ROW> +       <ROW> +	<ENTRY> height(box) </ENTRY> +	<ENTRY> float8 </ENTRY> +	<ENTRY> vertical size of box </ENTRY> +	<ENTRY> height('((0,0),(1,1))'::box) </ENTRY> +       </ROW> +       <ROW> +	<ENTRY> isclosed(path) </ENTRY> +	<ENTRY> bool </ENTRY> +	<ENTRY> TRUE if this is a closed path </ENTRY> +	<ENTRY> isclosed('((0,0),(1,1),(2,0))'::path) </ENTRY> +       </ROW> +       <ROW> +	<ENTRY> isopen(path) </ENTRY> +	<ENTRY> bool </ENTRY> +	<ENTRY> TRUE if this is an open path </ENTRY> +	<ENTRY> isopen('[(0,0),(1,1),(2,0)]'::path) </ENTRY> +       </ROW> +       <ROW> +	<ENTRY> length(lseg) </ENTRY> +	<ENTRY> float8 </ENTRY> +	<ENTRY> length of line segment </ENTRY> +	<ENTRY> length('((-1,0),(1,0))'::lseg) </ENTRY> +       </ROW> +       <ROW> +	<ENTRY> length(path) </ENTRY> +	<ENTRY> float8 </ENTRY> +	<ENTRY> length of path </ENTRY> +	<ENTRY> length('((0,0),(1,1),(2,0))'::path) </ENTRY> +       </ROW> +       <ROW> +	<ENTRY> pclose(path) </ENTRY> +	<ENTRY> path </ENTRY> +	<ENTRY> convert path to closed variant </ENTRY> +	<ENTRY> popen('[(0,0),(1,1),(2,0)]'::path) </ENTRY> +       </ROW> +       <ROW> +	<ENTRY> point(lseg,lseg) </ENTRY> +	<ENTRY> point </ENTRY> +	<ENTRY> convert to point (intersection) </ENTRY> +	<ENTRY> point('((-1,0),(1,0))'::lseg,'((-2,-2),(2,2))'::lseg) </ENTRY> +       </ROW> +       <ROW> +	<ENTRY> points(path) </ENTRY> +	<ENTRY> int4 </ENTRY> +	<ENTRY> number of points in path </ENTRY> +	<ENTRY> points('[(0,0),(1,1),(2,0)]'::path) </ENTRY> +       </ROW> +       <ROW> +	<ENTRY> popen(path) </ENTRY> +	<ENTRY> path </ENTRY> +	<ENTRY> convert path to open variant </ENTRY> +	<ENTRY> popen('((0,0),(1,1),(2,0))'::path) </ENTRY> +       </ROW> +       <ROW> +	<ENTRY> radius(circle) </ENTRY> +	<ENTRY> float8 </ENTRY> +	<ENTRY> radius of circle </ENTRY> +	<ENTRY> radius('((0,0),2.0)'::circle) </ENTRY> +       </ROW> +       <ROW> +	<ENTRY> width(box) </ENTRY> +	<ENTRY> float8 </ENTRY> +	<ENTRY> horizontal size of box </ENTRY> +	<ENTRY> width('((0,0),(1,1))'::box) </ENTRY> +       </ROW> +      </TBODY> +     </TGROUP> +    </TABLE> +   </Para> -<Para> -<TABLE TOCENTRY="1"> -<TITLE>Geometric Type Conversion Functions</TITLE> -<TGROUP COLS="4"> -<THEAD> -  <ROW> -    <ENTRY>Function</ENTRY> -    <ENTRY>Returns</ENTRY> -    <ENTRY>Description</ENTRY> -    <ENTRY>Example</ENTRY> -  </ROW> -</THEAD> -<TBODY> -  <ROW> -<ENTRY> box(circle) </ENTRY> -<ENTRY> box </ENTRY> -<ENTRY> convert circle to box </ENTRY> -<ENTRY> box('((0,0),2.0)'::circle) </ENTRY> -  </ROW> -  <ROW> -<ENTRY> box(point,point) </ENTRY> -<ENTRY> box </ENTRY> -<ENTRY> convert points to box </ENTRY> -<ENTRY> box('(0,0)'::point,'(1,1)'::point) </ENTRY> -  </ROW> -  <ROW> -<ENTRY> box(polygon) </ENTRY> -<ENTRY> box </ENTRY> -<ENTRY> convert polygon to box </ENTRY> -<ENTRY> box('((0,0),(1,1),(2,0))'::polygon) </ENTRY> -  </ROW> -  <ROW> -<ENTRY> circle(box) </ENTRY> -<ENTRY> circle </ENTRY> -<ENTRY> convert to circle </ENTRY> -<ENTRY> circle('((0,0),(1,1))'::box) </ENTRY> -  </ROW> -  <ROW> -<ENTRY> circle(point,float8) </ENTRY> -<ENTRY> circle </ENTRY> -<ENTRY> convert to circle </ENTRY> -<ENTRY> circle('(0,0)'::point,2.0) </ENTRY> -  </ROW> -  <ROW> -<ENTRY> lseg(box) </ENTRY> -<ENTRY> lseg </ENTRY> -<ENTRY> convert diagonal to lseg </ENTRY> -<ENTRY> lseg('((-1,0),(1,0))'::box) </ENTRY> -  </ROW> -  <ROW> -<ENTRY> lseg(point,point) </ENTRY> -<ENTRY> lseg </ENTRY> -<ENTRY> convert to lseg </ENTRY> -<ENTRY> lseg('(-1,0)'::point,'(1,0)'::point) </ENTRY> -  </ROW> -  <ROW> -<ENTRY> path(polygon) </ENTRY> -<ENTRY> point </ENTRY> -<ENTRY> convert to path </ENTRY> -<ENTRY> path('((0,0),(1,1),(2,0))'::polygon) </ENTRY> -  </ROW> -  <ROW> -<ENTRY> point(circle) </ENTRY> -<ENTRY> point </ENTRY> -<ENTRY> convert to point (center) </ENTRY> -<ENTRY> point('((0,0),2.0)'::circle) </ENTRY> -  </ROW> -  <ROW> -<ENTRY> point(lseg,lseg) </ENTRY> -<ENTRY> point </ENTRY> -<ENTRY> convert to point (intersection) </ENTRY> -<ENTRY> point('((-1,0),(1,0))'::lseg,'((-2,-2),(2,2))'::lseg) </ENTRY> -  </ROW> -  <ROW> -<ENTRY> point(polygon) </ENTRY> -<ENTRY> point </ENTRY> -<ENTRY> center of polygon </ENTRY> -<ENTRY> point('((0,0),(1,1),(2,0))'::polygon) </ENTRY> -  </ROW> -  <ROW> -<ENTRY> polygon(box) </ENTRY> -<ENTRY> polygon </ENTRY> -<ENTRY> convert to polygon with 12 points </ENTRY> -<ENTRY> polygon('((0,0),(1,1))'::box) </ENTRY> -  </ROW> -  <ROW> -<ENTRY> polygon(circle) </ENTRY> -<ENTRY> polygon </ENTRY> -<ENTRY> convert to polygon with 12 points </ENTRY> -<ENTRY> polygon('((0,0),2.0)'::circle) </ENTRY> -  </ROW> -  <ROW> -<ENTRY> polygon(npts,circle) </ENTRY> -<ENTRY> polygon </ENTRY> -<ENTRY> convert to polygon with npts points </ENTRY> -<ENTRY> polygon(12,'((0,0),2.0)'::circle) </ENTRY> -  </ROW> -  <ROW> -<ENTRY> polygon(path) </ENTRY> -<ENTRY> polygon </ENTRY> -<ENTRY> convert to polygon </ENTRY> -<ENTRY> polygon('((0,0),(1,1),(2,0))'::path) </ENTRY> -  </ROW> -</TBODY> -</TGROUP> -</TABLE> -</Para> +   <Para> +    <TABLE TOCENTRY="1"> +     <TITLE>Geometric Type Conversion Functions</TITLE> +     <TGROUP COLS="4"> +      <THEAD> +       <ROW> +	<ENTRY>Function</ENTRY> +	<ENTRY>Returns</ENTRY> +	<ENTRY>Description</ENTRY> +	<ENTRY>Example</ENTRY> +       </ROW> +      </THEAD> +      <TBODY> +       <ROW> +	<ENTRY> box(circle) </ENTRY> +	<ENTRY> box </ENTRY> +	<ENTRY> convert circle to box </ENTRY> +	<ENTRY> box('((0,0),2.0)'::circle) </ENTRY> +       </ROW> +       <ROW> +	<ENTRY> box(point,point) </ENTRY> +	<ENTRY> box </ENTRY> +	<ENTRY> convert points to box </ENTRY> +	<ENTRY> box('(0,0)'::point,'(1,1)'::point) </ENTRY> +       </ROW> +       <ROW> +	<ENTRY> box(polygon) </ENTRY> +	<ENTRY> box </ENTRY> +	<ENTRY> convert polygon to box </ENTRY> +	<ENTRY> box('((0,0),(1,1),(2,0))'::polygon) </ENTRY> +       </ROW> +       <ROW> +	<ENTRY> circle(box) </ENTRY> +	<ENTRY> circle </ENTRY> +	<ENTRY> convert to circle </ENTRY> +	<ENTRY> circle('((0,0),(1,1))'::box) </ENTRY> +       </ROW> +       <ROW> +	<ENTRY> circle(point,float8) </ENTRY> +	<ENTRY> circle </ENTRY> +	<ENTRY> convert to circle </ENTRY> +	<ENTRY> circle('(0,0)'::point,2.0) </ENTRY> +       </ROW> +       <ROW> +	<ENTRY> lseg(box) </ENTRY> +	<ENTRY> lseg </ENTRY> +	<ENTRY> convert diagonal to lseg </ENTRY> +	<ENTRY> lseg('((-1,0),(1,0))'::box) </ENTRY> +       </ROW> +       <ROW> +	<ENTRY> lseg(point,point) </ENTRY> +	<ENTRY> lseg </ENTRY> +	<ENTRY> convert to lseg </ENTRY> +	<ENTRY> lseg('(-1,0)'::point,'(1,0)'::point) </ENTRY> +       </ROW> +       <ROW> +	<ENTRY> path(polygon) </ENTRY> +	<ENTRY> point </ENTRY> +	<ENTRY> convert to path </ENTRY> +	<ENTRY> path('((0,0),(1,1),(2,0))'::polygon) </ENTRY> +       </ROW> +       <ROW> +	<ENTRY> point(circle) </ENTRY> +	<ENTRY> point </ENTRY> +	<ENTRY> convert to point (center) </ENTRY> +	<ENTRY> point('((0,0),2.0)'::circle) </ENTRY> +       </ROW> +       <ROW> +	<ENTRY> point(lseg,lseg) </ENTRY> +	<ENTRY> point </ENTRY> +	<ENTRY> convert to point (intersection) </ENTRY> +	<ENTRY> point('((-1,0),(1,0))'::lseg,'((-2,-2),(2,2))'::lseg) </ENTRY> +       </ROW> +       <ROW> +	<ENTRY> point(polygon) </ENTRY> +	<ENTRY> point </ENTRY> +	<ENTRY> center of polygon </ENTRY> +	<ENTRY> point('((0,0),(1,1),(2,0))'::polygon) </ENTRY> +       </ROW> +       <ROW> +	<ENTRY> polygon(box) </ENTRY> +	<ENTRY> polygon </ENTRY> +	<ENTRY> convert to polygon with 12 points </ENTRY> +	<ENTRY> polygon('((0,0),(1,1))'::box) </ENTRY> +       </ROW> +       <ROW> +	<ENTRY> polygon(circle) </ENTRY> +	<ENTRY> polygon </ENTRY> +	<ENTRY> convert to polygon with 12 points </ENTRY> +	<ENTRY> polygon('((0,0),2.0)'::circle) </ENTRY> +       </ROW> +       <ROW> +	<ENTRY> polygon(npts,circle) </ENTRY> +	<ENTRY> polygon </ENTRY> +	<ENTRY> convert to polygon with npts points </ENTRY> +	<ENTRY> polygon(12,'((0,0),2.0)'::circle) </ENTRY> +       </ROW> +       <ROW> +	<ENTRY> polygon(path) </ENTRY> +	<ENTRY> polygon </ENTRY> +	<ENTRY> convert to polygon </ENTRY> +	<ENTRY> polygon('((0,0),(1,1),(2,0))'::path) </ENTRY> +       </ROW> +      </TBODY> +     </TGROUP> +    </TABLE> +   </Para> -<Para> -<TABLE TOCENTRY="1"> -<TITLE>Geometric Upgrade Functions</TITLE> -<TGROUP COLS="4"> -<THEAD> -  <ROW> -    <ENTRY>Function</ENTRY> -    <ENTRY>Returns</ENTRY> -    <ENTRY>Description</ENTRY> -    <ENTRY>Example</ENTRY> -  </ROW> -</THEAD> -<TBODY> -  <ROW> -<ENTRY> isoldpath(path) </ENTRY> -<ENTRY> path </ENTRY> -<ENTRY> test path for pre-v6.1 form </ENTRY> -<ENTRY> isoldpath('(1,3,0,0,1,1,2,0)'::path) </ENTRY> -  </ROW> -  <ROW> -<ENTRY> revertpoly(polygon) </ENTRY> -<ENTRY> polygon </ENTRY> -<ENTRY> convert pre-v6.1 polygon </ENTRY> -<ENTRY> revertpoly('((0,0),(1,1),(2,0))'::polygon) </ENTRY> -  </ROW> -  <ROW> -<ENTRY> upgradepath(path) </ENTRY> -<ENTRY> path </ENTRY> -<ENTRY> convert pre-v6.1 path </ENTRY> -<ENTRY> upgradepath('(1,3,0,0,1,1,2,0)'::path) </ENTRY> -  </ROW> -  <ROW> -<ENTRY> upgradepoly(polygon) </ENTRY> -<ENTRY> polygon </ENTRY> -<ENTRY> convert pre-v6.1 polygon </ENTRY> -<ENTRY> upgradepoly('(0,1,2,0,1,0)'::polygon) </ENTRY> -  </ROW> -</TBODY> -</TGROUP> -</TABLE> -</Para> -</sect1> +   <Para> +    <TABLE TOCENTRY="1"> +     <TITLE>Geometric Upgrade Functions</TITLE> +     <TGROUP COLS="4"> +      <THEAD> +       <ROW> +	<ENTRY>Function</ENTRY> +	<ENTRY>Returns</ENTRY> +	<ENTRY>Description</ENTRY> +	<ENTRY>Example</ENTRY> +       </ROW> +      </THEAD> +      <TBODY> +       <ROW> +	<ENTRY> isoldpath(path) </ENTRY> +	<ENTRY> path </ENTRY> +	<ENTRY> test path for pre-v6.1 form </ENTRY> +	<ENTRY> isoldpath('(1,3,0,0,1,1,2,0)'::path) </ENTRY> +       </ROW> +       <ROW> +	<ENTRY> revertpoly(polygon) </ENTRY> +	<ENTRY> polygon </ENTRY> +	<ENTRY> convert pre-v6.1 polygon </ENTRY> +	<ENTRY> revertpoly('((0,0),(1,1),(2,0))'::polygon) </ENTRY> +       </ROW> +       <ROW> +	<ENTRY> upgradepath(path) </ENTRY> +	<ENTRY> path </ENTRY> +	<ENTRY> convert pre-v6.1 path </ENTRY> +	<ENTRY> upgradepath('(1,3,0,0,1,1,2,0)'::path) </ENTRY> +       </ROW> +       <ROW> +	<ENTRY> upgradepoly(polygon) </ENTRY> +	<ENTRY> polygon </ENTRY> +	<ENTRY> convert pre-v6.1 polygon </ENTRY> +	<ENTRY> upgradepoly('(0,1,2,0,1,0)'::polygon) </ENTRY> +       </ROW> +      </TBODY> +     </TGROUP> +    </TABLE> +   </Para> +  </sect1> -<sect1> -<title id="cidr-funcs">IP V4 Functions</title> +  <sect1> +   <title id="cidr-funcs">IP V4 Functions</title> -<Para> -<TABLE TOCENTRY="1"> -<TITLE><ProductName>Postgres</ProductName>IP V4 Functions</TITLE> -<TGROUP COLS="4"> -<THEAD> -  <ROW> -    <ENTRY>Function</ENTRY> -    <ENTRY>Returns</ENTRY> -    <ENTRY>Description</ENTRY> -    <ENTRY>Example</ENTRY> -  </ROW> -</THEAD> -<TBODY> -  <ROW> -<ENTRY> broadcast(cidr) </ENTRY> -<ENTRY> text </ENTRY> -<ENTRY> construct broadcast address as text </ENTRY> -<ENTRY> broadcast('192.168.1.5/24') ==> '192.168.1.255' </ENTRY> -  </ROW> -  <ROW> -<ENTRY> broadcast(inet) </ENTRY> -<ENTRY> text </ENTRY> -<ENTRY> construct broadcast address as text </ENTRY> -<ENTRY> broadcast('192.168.1.5/24') ==> '192.168.1.255' </ENTRY> -  </ROW> -  <ROW> -<ENTRY> host(inet) </ENTRY> -<ENTRY> text </ENTRY> -<ENTRY> extract host address as text </ENTRY> -<ENTRY> host('192.168.1.5/24') ==> '192.168.1.5' </ENTRY> -  </ROW> -  <ROW> -<ENTRY> masklen(cidr) </ENTRY> -<ENTRY> int4 </ENTRY> -<ENTRY> calculate netmask length </ENTRY> -<ENTRY> masklen('192.168.1.5/24') ==> 24</ENTRY> -  </ROW> -  <ROW> -<ENTRY> masklen(inet) </ENTRY> -<ENTRY> int4 </ENTRY> -<ENTRY> calculate netmask length </ENTRY> -<ENTRY> masklen('192.168.1.5/24') ==> 24 </ENTRY> -  </ROW> -  <ROW> -<ENTRY> netmask(inet) </ENTRY> -<ENTRY> text </ENTRY> -<ENTRY> construct netmask as text </ENTRY> -<ENTRY> netmask('192.168.1.5/24') ==> '255.255.255.0' </ENTRY> -  </ROW> -</TBODY> -</TGROUP> -</TABLE> -</Para> +   <Para> +    <TABLE TOCENTRY="1"> +     <TITLE><ProductName>Postgres</ProductName>IP V4 Functions</TITLE> +     <TGROUP COLS="4"> +      <THEAD> +       <ROW> +	<ENTRY>Function</ENTRY> +	<ENTRY>Returns</ENTRY> +	<ENTRY>Description</ENTRY> +	<ENTRY>Example</ENTRY> +       </ROW> +      </THEAD> +      <TBODY> +       <ROW> +	<ENTRY> broadcast(cidr) </ENTRY> +	<ENTRY> text </ENTRY> +	<ENTRY> construct broadcast address as text </ENTRY> +	<ENTRY> broadcast('192.168.1.5/24') ==> '192.168.1.255' </ENTRY> +       </ROW> +       <ROW> +	<ENTRY> broadcast(inet) </ENTRY> +	<ENTRY> text </ENTRY> +	<ENTRY> construct broadcast address as text </ENTRY> +	<ENTRY> broadcast('192.168.1.5/24') ==> '192.168.1.255' </ENTRY> +       </ROW> +       <ROW> +	<ENTRY> host(inet) </ENTRY> +	<ENTRY> text </ENTRY> +	<ENTRY> extract host address as text </ENTRY> +	<ENTRY> host('192.168.1.5/24') ==> '192.168.1.5' </ENTRY> +       </ROW> +       <ROW> +	<ENTRY> masklen(cidr) </ENTRY> +	<ENTRY> int4 </ENTRY> +	<ENTRY> calculate netmask length </ENTRY> +	<ENTRY> masklen('192.168.1.5/24') ==> 24</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> masklen(inet) </ENTRY> +	<ENTRY> int4 </ENTRY> +	<ENTRY> calculate netmask length </ENTRY> +	<ENTRY> masklen('192.168.1.5/24') ==> 24 </ENTRY> +       </ROW> +       <ROW> +	<ENTRY> netmask(inet) </ENTRY> +	<ENTRY> text </ENTRY> +	<ENTRY> construct netmask as text </ENTRY> +	<ENTRY> netmask('192.168.1.5/24') ==> '255.255.255.0' </ENTRY> +       </ROW> +      </TBODY> +     </TGROUP> +    </TABLE> +   </Para> -</Sect1> +  </Sect1> -</chapter> + </chapter>  <!-- Keep this comment at the end of the file  Local variables:  mode: sgml -sgml-omittag:t +sgml-omittag:nil  sgml-shorttag:t  sgml-minimize-attributes:nil  sgml-always-quote-attributes:t diff --git a/doc/src/sgml/oper.sgml b/doc/src/sgml/oper.sgml index 99f96df5946..a2452db4114 100644 --- a/doc/src/sgml/oper.sgml +++ b/doc/src/sgml/oper.sgml @@ -1,26 +1,26 @@ -<Chapter Id="operators"> -<Title>Operators</Title> + <Chapter Id="operators"> +  <Title id="operators-title">Operators</Title> -<Abstract> -<Para> -Describes the built-in operators available in  -<ProductName>Postgres</ProductName>. -</Para> -</Abstract> +  <Abstract> +   <Para> +    Describes the built-in operators available in  +    <ProductName>Postgres</ProductName>. +   </Para> +  </Abstract> -<Para> -<ProductName>Postgres</ProductName> provides a large number of  -built-in operators on system types. -These operators are declared in the system catalog -pg_operator.  Every entry in pg_operator includes -the name of the procedure that implements the operator and the -class <Acronym>OIDs</Acronym> of the input and output types. -</Para> +  <Para> +   <ProductName>Postgres</ProductName> provides a large number of  +   built-in operators on system types. +   These operators are declared in the system catalog +   pg_operator.  Every entry in pg_operator includes +   the name of the procedure that implements the operator and the +   class <Acronym>OIDs</Acronym> of the input and output types. +  </Para> -<Para> -To view all variations of the <Quote>||</Quote> string concatenation operator,  -try -<ProgramListing> +  <Para> +   To view all variations of the <Quote>||</Quote> string concatenation operator,  +   try +   <ProgramListing>      SELECT oprleft, oprright, oprresult, oprcode      FROM pg_operator WHERE oprname = '||'; @@ -30,37 +30,37 @@ oprleft|oprright|oprresult|oprcode     1042|    1042|     1042|textcat     1043|    1043|     1043|textcat  (3 rows) -</ProgramListing> -</Para> +   </ProgramListing> +  </Para> -<Para> -Users may invoke operators using the operator name, as in: +  <Para> +   Users may invoke operators using the operator name, as in: -<ProgramListing> +   <ProgramListing>  select * from emp where salary < 40000; -</ProgramListing> +   </ProgramListing> -Alternatively, users may call the functions that implement the -operators directly.  In this case, the query above would be expressed -as: -<ProgramListing> +   Alternatively, users may call the functions that implement the +   operators directly.  In this case, the query above would be expressed +   as: +   <ProgramListing>  select * from emp where int4lt(salary, 40000); -</ProgramListing> -</Para> +   </ProgramListing> +  </Para> -<Para> -<Application>psql</Application> -has a command (<Command>\dd</Command>) to show these operators. -</Para> +  <Para> +   <Application>psql</Application> +   has a command (<Command>\dd</Command>) to show these operators. +  </Para> -<sect1> -<title>Lexical Precedence</title> +  <sect1> +   <title>Lexical Precedence</title> -<para> -Operators have a precedence which is currently hardcoded into the parser. -Most operators have the same precedence and are left-associative. This may lead -to non-intuitive behavior; for example the boolean operators "<" and ">" -have a different precedence that the boolean operators "<=" and ">=". +   <para> +    Operators have a precedence which is currently hardcoded into the parser. +    Most operators have the same precedence and are left-associative. This may lead +    to non-intuitive behavior; for example the boolean operators "<" and ">" +    have a different precedence that the boolean operators "<=" and ">=".  <table tocentry="1">  <title> @@ -322,560 +322,577 @@ logical union  </para>  </sect1> -<sect1> -<title>General Operators</title> +  <sect1> +   <title>General Operators</title> -<para> -The operators listed here are defined for a number of native data types,  -ranging from numeric types to data/time types. -</para> -<Para> -<TABLE TOCENTRY="1"> -<TITLE><ProductName>Postgres</ProductName> Operators</TITLE> -<TITLEABBREV>Operators</TITLEABBREV> -<TGROUP COLS="3"> -<THEAD> -  <ROW> -    <ENTRY>Operator</ENTRY> -    <ENTRY>Description</ENTRY> -    <ENTRY>Usage</ENTRY> -  </ROW> -</THEAD> -<TBODY> -  <ROW> -    <ENTRY> < </ENTRY> -    <ENTRY>Less than?</ENTRY> -    <ENTRY>1 < 2</ENTRY> -  </ROW> -  <ROW> -    <ENTRY> <= </ENTRY> -    <ENTRY>Less than or equal to?</ENTRY> -    <ENTRY>1 <= 2</ENTRY> -  </ROW> -  <ROW> -    <ENTRY> <> </ENTRY> -    <ENTRY>Not equal?</ENTRY> -    <ENTRY>1 <> 2</ENTRY> -  </ROW> -  <ROW> -    <ENTRY> = </ENTRY> -    <ENTRY>Equal?</ENTRY> -    <ENTRY>1 = 1</ENTRY> -  </ROW> -  <ROW> -    <ENTRY> > </ENTRY> -    <ENTRY>Greater than?</ENTRY> -    <ENTRY>2 > 1</ENTRY> -  </ROW> -  <ROW> -    <ENTRY> >= </ENTRY> -    <ENTRY>Greater than or equal to?</ENTRY> -    <ENTRY>2 >= 1</ENTRY> -  </ROW> -  <ROW> -    <ENTRY> || </ENTRY> -    <ENTRY>Concatenate strings</ENTRY> -    <ENTRY>'Postgre' || 'SQL'</ENTRY> -  </ROW> -  <ROW> -    <ENTRY> !!= </ENTRY> -    <ENTRY>NOT IN</ENTRY> -    <ENTRY>3 !!= i</ENTRY> -  </ROW> -  <ROW> -    <ENTRY> ~~ </ENTRY> -    <ENTRY>LIKE</ENTRY> -    <ENTRY>'scrappy,marc,hermit' ~~ '%scrappy%'</ENTRY> -  </ROW> -  <ROW> -    <ENTRY> !~~ </ENTRY> -    <ENTRY>NOT LIKE</ENTRY> -    <ENTRY>'bruce' !~~ '%al%'</ENTRY> -  </ROW> -  <ROW> -    <ENTRY> ~ </ENTRY> -    <ENTRY>Match (regex), case sensitive</ENTRY> -    <ENTRY>'thomas' ~ '.*thomas.*'</ENTRY> -  </ROW> -  <ROW> -    <ENTRY> ~* </ENTRY> -    <ENTRY>Match (regex), case insensitive</ENTRY> -    <ENTRY>'thomas' ~* '.*Thomas.*'</ENTRY> -  </ROW> -  <ROW> -    <ENTRY> !~ </ENTRY> -    <ENTRY>Does not match (regex), case sensitive</ENTRY> -    <ENTRY>'thomas' !~ '.*Thomas.*'</ENTRY> -  </ROW> -  <ROW> -    <ENTRY> !~* </ENTRY> -    <ENTRY>Does not match (regex), case insensitive</ENTRY> -    <ENTRY>'thomas' !~ '.*vadim.*'</ENTRY> -  </ROW> -</TBODY> -</TGROUP> -</TABLE> -</Para> -</sect1> - -<sect1> -<title id="math-opers">Numerical Operators</title> - -<Para> -<TABLE TOCENTRY="1"> -<TITLE><ProductName>Postgres</ProductName> Numerical Operators</TITLE> -<TITLEABBREV>Operators</TITLEABBREV> -<TGROUP COLS="3"> -<THEAD> -  <ROW> -    <ENTRY>Operator</ENTRY> -    <ENTRY>Description</ENTRY> -    <ENTRY>Usage</ENTRY> -  </ROW> -</THEAD> -<TBODY> -  <ROW> -    <ENTRY> !  </ENTRY> -    <ENTRY>Factorial</ENTRY> -    <ENTRY>3 !</ENTRY> -  </ROW> -  <ROW> -    <ENTRY> !!  </ENTRY> -    <ENTRY>Factorial (left operator)</ENTRY> -    <ENTRY>!! 3</ENTRY> -  </ROW> -  <ROW> -    <ENTRY> % </ENTRY> -    <ENTRY>Modulo</ENTRY> -    <ENTRY>5 % 4</ENTRY> -  </ROW> -  <ROW> -    <ENTRY> % </ENTRY> -    <ENTRY>Truncate</ENTRY> -    <ENTRY>% 4.5</ENTRY> -  </ROW> -  <ROW> -    <ENTRY> * </ENTRY> -    <ENTRY>Multiplication</ENTRY> -    <ENTRY>2 * 3</ENTRY> -  </ROW> -  <ROW> -    <ENTRY> + </ENTRY> -    <ENTRY>Addition</ENTRY> -    <ENTRY>2 + 3</ENTRY> -  </ROW> -  <ROW> -    <ENTRY> - </ENTRY> -    <ENTRY>Subtraction</ENTRY> -    <ENTRY>2 - 3</ENTRY> -  </ROW> -  <ROW> -    <ENTRY> / </ENTRY> -    <ENTRY>Division</ENTRY> -    <ENTRY>4 / 2</ENTRY> -  </ROW> -  <ROW> -    <ENTRY> : </ENTRY> -    <ENTRY>Natural Exponentiation</ENTRY> -    <ENTRY>: 3.0</ENTRY> -  </ROW> -  <ROW> -    <ENTRY> ; </ENTRY> -    <ENTRY>Natural Logarithm</ENTRY> -    <ENTRY>(; 5.0)</ENTRY> -  </ROW> -  <ROW> -    <ENTRY> @ </ENTRY> -    <ENTRY>Absolute value</ENTRY> -    <ENTRY>@ -5.0</ENTRY> -  </ROW> -  <ROW> -    <ENTRY> ^ </ENTRY> -    <ENTRY>Exponentiation</ENTRY> -    <ENTRY>2.0 ^ 3.0</ENTRY> -  </ROW> -  <ROW> -    <ENTRY> |/ </ENTRY> -    <ENTRY>Square root</ENTRY> -    <ENTRY>|/ 25.0</ENTRY> -  </ROW> -  <ROW> -    <ENTRY> ||/ </ENTRY> -    <ENTRY>Cube root</ENTRY> -    <ENTRY>||/ 27.0</ENTRY> -  </ROW> -</TBODY> -</TGROUP> -</TABLE> -</Para> -</sect1> - -<sect1> -<title>Geometric Operators</title> +   <para> +    The operators listed here are defined for a number of native data types,  +    ranging from numeric types to data/time types. +   </para> -<Para> -<TABLE TOCENTRY="1"> -<TITLE><ProductName>Postgres</ProductName> Geometric Operators</TITLE> -<TITLEABBREV>Operators</TITLEABBREV> -<TGROUP COLS="3"> -<THEAD> -  <ROW> -    <ENTRY>Operator</ENTRY> -    <ENTRY>Description</ENTRY> -    <ENTRY>Usage</ENTRY> -  </ROW> -</THEAD> -<TBODY> -  <ROW> -    <ENTRY> + </ENTRY> -    <ENTRY>Translation</ENTRY> -    <ENTRY>'((0,0),(1,1))'::box + '(2.0,0)'::point</ENTRY> -  </ROW> -  <ROW> -    <ENTRY> - </ENTRY> -    <ENTRY>Translation</ENTRY> -    <ENTRY>'((0,0),(1,1))'::box - '(2.0,0)'::point</ENTRY> -  </ROW> -  <ROW> -    <ENTRY> * </ENTRY> -    <ENTRY>Scaling/rotation</ENTRY> -    <ENTRY>'((0,0),(1,1))'::box * '(2.0,0)'::point</ENTRY> -  </ROW> -  <ROW> -    <ENTRY> / </ENTRY> -    <ENTRY>Scaling/rotation</ENTRY> -    <ENTRY>'((0,0),(2,2))'::box / '(2.0,0)'::point</ENTRY> -  </ROW> -  <ROW> -    <ENTRY> # </ENTRY> -    <ENTRY>Intersection</ENTRY> -    <ENTRY>'((1,-1),(-1,1))' # '((1,1),(-1,-1))'</ENTRY> -  </ROW> -  <ROW> -    <ENTRY> # </ENTRY> -    <ENTRY>Number of points in polygon</ENTRY> -    <ENTRY># '((1,0),(0,1),(-1,0))'</ENTRY> -  </ROW> -  <ROW> -    <ENTRY> ## </ENTRY> -    <ENTRY>Point of closest proximity</ENTRY> -    <ENTRY>'(0,0)'::point ## '((2,0),(0,2))'::lseg</ENTRY> -  </ROW> -  <ROW> -    <ENTRY> && </ENTRY> -    <ENTRY>Overlaps?</ENTRY> -    <ENTRY>'((0,0),(1,1))'::box && '((0,0),(2,2))'::box</ENTRY> -  </ROW> -  <ROW> -    <ENTRY> &< </ENTRY> -    <ENTRY>Overlaps to left?</ENTRY> -    <ENTRY>'((0,0),(1,1))'::box &< '((0,0),(2,2))'::box</ENTRY> -  </ROW> -  <ROW> -    <ENTRY> &> </ENTRY> -    <ENTRY>Overlaps to right?</ENTRY> -    <ENTRY>'((0,0),(3,3))'::box &> '((0,0),(2,2))'::box</ENTRY> -  </ROW> -  <ROW> -    <ENTRY> <-> </ENTRY> -    <ENTRY>Distance between</ENTRY> -    <ENTRY>'((0,0),1)'::circle <-> '((5,0),1)'::circle</ENTRY> -  </ROW> -  <ROW> -    <ENTRY> << </ENTRY> -    <ENTRY>Left of?</ENTRY> -    <ENTRY>'((0,0),1)'::circle << '((5,0),1)'::circle</ENTRY> -  </ROW> -  <ROW> -    <ENTRY> <^ </ENTRY> -    <ENTRY>Is below?</ENTRY> -    <ENTRY>'((0,0),1)'::circle <^ '((0,5),1)'::circle</ENTRY> -  </ROW> -  <ROW> -    <ENTRY> >> </ENTRY> -    <ENTRY>Is right of?</ENTRY> -    <ENTRY>'((5,0),1)'::circle >> '((0,0),1)'::circle</ENTRY> -  </ROW> -  <ROW> -    <ENTRY> >^ </ENTRY> -    <ENTRY>Is above?</ENTRY> -    <ENTRY>'((0,5),1)'::circle >^ '((0,0),1)'::circle</ENTRY> -  </ROW> -  <ROW> -    <ENTRY> ?# </ENTRY> -    <ENTRY>Intersects or overlaps</ENTRY> -    <ENTRY>'((-1,0),(1,0))'::lseg ?# '((-2,-2),(2,2))'::box;</ENTRY> -  </ROW> -  <ROW> -    <ENTRY> ?- </ENTRY> -    <ENTRY>Is horizontal?</ENTRY> -    <ENTRY>'(1,0)'::point ?- '(0,0)'::point</ENTRY> -  </ROW> -  <ROW> -    <ENTRY> ?-| </ENTRY> -    <ENTRY>Is perpendicular?</ENTRY> -    <ENTRY>'((0,0),(0,1))'::lseg ?-| '((0,0),(1,0))'::lseg</ENTRY> -  </ROW> -  <ROW> -    <ENTRY> @-@  </ENTRY> -    <ENTRY>Length or circumference</ENTRY> -    <ENTRY>@-@ '((0,0),(1,0))'::path</ENTRY> -  </ROW> -  <ROW> -    <ENTRY> ?| </ENTRY> -    <ENTRY>Is vertical?</ENTRY> -    <ENTRY>'(0,1)'::point ?| '(0,0)'::point</ENTRY> -  </ROW> -  <ROW> -    <ENTRY> ?|| </ENTRY> -    <ENTRY>Is parallel?</ENTRY> -    <ENTRY>'((-1,0),(1,0))'::lseg ?|| '((-1,2),(1,2))'::lseg</ENTRY> -  </ROW> -  <ROW> -    <ENTRY> @ </ENTRY> -    <ENTRY>Contained or on</ENTRY> -    <ENTRY>'(1,1)'::point @ '((0,0),2)'::circle</ENTRY> -  </ROW> -  <ROW> -    <ENTRY> @@ </ENTRY> -    <ENTRY>Center of</ENTRY> -    <ENTRY>@@ '((0,0),10)'::circle</ENTRY> -  </ROW> -  <ROW> -    <ENTRY> ~= </ENTRY> -    <ENTRY>Same as</ENTRY> -    <ENTRY>'((0,0),(1,1))'::polygon ~= '((1,1),(0,0))'::polygon</ENTRY> -  </ROW> -</TBODY> -</TGROUP> -</TABLE> -</Para> -</sect1> +   <Para> +    <TABLE TOCENTRY="1"> +     <TITLE><ProductName>Postgres</ProductName> Operators</TITLE> +     <TITLEABBREV>Operators</TITLEABBREV> +     <TGROUP COLS="3"> +      <THEAD> +       <ROW> +	<ENTRY>Operator</ENTRY> +	<ENTRY>Description</ENTRY> +	<ENTRY>Usage</ENTRY> +       </ROW> +      </THEAD> +      <TBODY> +       <ROW> +	<ENTRY> < </ENTRY> +	<ENTRY>Less than?</ENTRY> +	<ENTRY>1 < 2</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> <= </ENTRY> +	<ENTRY>Less than or equal to?</ENTRY> +	<ENTRY>1 <= 2</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> <> </ENTRY> +	<ENTRY>Not equal?</ENTRY> +	<ENTRY>1 <> 2</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> = </ENTRY> +	<ENTRY>Equal?</ENTRY> +	<ENTRY>1 = 1</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> > </ENTRY> +	<ENTRY>Greater than?</ENTRY> +	<ENTRY>2 > 1</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> >= </ENTRY> +	<ENTRY>Greater than or equal to?</ENTRY> +	<ENTRY>2 >= 1</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> || </ENTRY> +	<ENTRY>Concatenate strings</ENTRY> +	<ENTRY>'Postgre' || 'SQL'</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> !!= </ENTRY> +	<ENTRY>NOT IN</ENTRY> +	<ENTRY>3 !!= i</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> ~~ </ENTRY> +	<ENTRY>LIKE</ENTRY> +	<ENTRY>'scrappy,marc,hermit' ~~ '%scrappy%'</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> !~~ </ENTRY> +	<ENTRY>NOT LIKE</ENTRY> +	<ENTRY>'bruce' !~~ '%al%'</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> ~ </ENTRY> +	<ENTRY>Match (regex), case sensitive</ENTRY> +	<ENTRY>'thomas' ~ '.*thomas.*'</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> ~* </ENTRY> +	<ENTRY>Match (regex), case insensitive</ENTRY> +	<ENTRY>'thomas' ~* '.*Thomas.*'</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> !~ </ENTRY> +	<ENTRY>Does not match (regex), case sensitive</ENTRY> +	<ENTRY>'thomas' !~ '.*Thomas.*'</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> !~* </ENTRY> +	<ENTRY>Does not match (regex), case insensitive</ENTRY> +	<ENTRY>'thomas' !~ '.*vadim.*'</ENTRY> +       </ROW> +      </TBODY> +     </TGROUP> +    </TABLE> +   </Para> +  </sect1> -<sect1> -<title>Time Interval Operators</title> +  <sect1> +   <title id="math-opers">Numerical Operators</title> -<Para> -The time interval data type <Type>tinterval</Type> is a legacy from the original -date/time types and is not as well supported as the more modern types. There -are several operators for this type. +   <Para> +    <TABLE TOCENTRY="1"> +     <TITLE><ProductName>Postgres</ProductName> Numerical Operators</TITLE> +     <TITLEABBREV>Operators</TITLEABBREV> +     <TGROUP COLS="3"> +      <THEAD> +       <ROW> +	<ENTRY>Operator</ENTRY> +	<ENTRY>Description</ENTRY> +	<ENTRY>Usage</ENTRY> +       </ROW> +      </THEAD> +      <TBODY> +       <ROW> +	<ENTRY> !  </ENTRY> +	<ENTRY>Factorial</ENTRY> +	<ENTRY>3 !</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> !!  </ENTRY> +	<ENTRY>Factorial (left operator)</ENTRY> +	<ENTRY>!! 3</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> % </ENTRY> +	<ENTRY>Modulo</ENTRY> +	<ENTRY>5 % 4</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> % </ENTRY> +	<ENTRY>Truncate</ENTRY> +	<ENTRY>% 4.5</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> * </ENTRY> +	<ENTRY>Multiplication</ENTRY> +	<ENTRY>2 * 3</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> + </ENTRY> +	<ENTRY>Addition</ENTRY> +	<ENTRY>2 + 3</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> - </ENTRY> +	<ENTRY>Subtraction</ENTRY> +	<ENTRY>2 - 3</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> / </ENTRY> +	<ENTRY>Division</ENTRY> +	<ENTRY>4 / 2</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> : </ENTRY> +	<ENTRY>Natural Exponentiation</ENTRY> +	<ENTRY>: 3.0</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> ; </ENTRY> +	<ENTRY>Natural Logarithm</ENTRY> +	<ENTRY>(; 5.0)</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> @ </ENTRY> +	<ENTRY>Absolute value</ENTRY> +	<ENTRY>@ -5.0</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> ^ </ENTRY> +	<ENTRY>Exponentiation</ENTRY> +	<ENTRY>2.0 ^ 3.0</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> |/ </ENTRY> +	<ENTRY>Square root</ENTRY> +	<ENTRY>|/ 25.0</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> ||/ </ENTRY> +	<ENTRY>Cube root</ENTRY> +	<ENTRY>||/ 27.0</ENTRY> +       </ROW> +      </TBODY> +     </TGROUP> +    </TABLE> +   </Para> +  </sect1> -<TABLE TOCENTRY="1"> -<TITLE><ProductName>Postgres</ProductName> Time Interval Operators</TITLE> -<TITLEABBREV>Operators</TITLEABBREV> -<TGROUP COLS="3"> -<THEAD> -  <ROW> -    <ENTRY>Operator</ENTRY> -    <ENTRY>Description</ENTRY> -    <ENTRY>Usage</ENTRY> -  </ROW> -</THEAD> -<TBODY> -  <ROW> -    <ENTRY> #< </ENTRY> -    <ENTRY>Interval less than?</ENTRY> -    <ENTRY></ENTRY> -  </ROW> -  <ROW> -    <ENTRY> #<= </ENTRY> -    <ENTRY>Interval less than or equal to?</ENTRY> -    <ENTRY></ENTRY> -  </ROW> -  <ROW> -    <ENTRY> #<> </ENTRY> -    <ENTRY>Interval not equal?</ENTRY> -    <ENTRY></ENTRY> -  </ROW> -  <ROW> -    <ENTRY> #= </ENTRY> -    <ENTRY>Interval equal?</ENTRY> -    <ENTRY></ENTRY> -  </ROW> -  <ROW> -    <ENTRY> #> </ENTRY> -    <ENTRY>Interval greater than?</ENTRY> -    <ENTRY></ENTRY> -  </ROW> -  <ROW> -    <ENTRY> #>= </ENTRY> -    <ENTRY>Interval greater than or equal to?</ENTRY> -    <ENTRY></ENTRY> -  </ROW> -  <ROW> -    <ENTRY> <#> </ENTRY> -    <ENTRY>Convert to time interval</ENTRY> -    <ENTRY></ENTRY> -  </ROW> -  <ROW> -    <ENTRY> << </ENTRY> -    <ENTRY>Interval less than?</ENTRY> -    <ENTRY></ENTRY> -  </ROW> -  <ROW> -    <ENTRY> | </ENTRY> -    <ENTRY>Start of interval</ENTRY> -    <ENTRY></ENTRY> -  </ROW> -  <ROW> -    <ENTRY> ~= </ENTRY> -    <ENTRY>Same as</ENTRY> -    <ENTRY></ENTRY> -  </ROW> -  <ROW> -    <ENTRY> <?> </ENTRY> -    <ENTRY>Time inside interval?</ENTRY> -    <ENTRY></ENTRY> -  </ROW> -</TBODY> -</TGROUP> -</TABLE> -</Para> -</sect1> +  <sect1> +   <title>Geometric Operators</title> -<Sect1> -<title id="cidr-opers">IP V4 CIDR Operators</title> +   <Para> +    <TABLE TOCENTRY="1"> +     <TITLE><ProductName>Postgres</ProductName> Geometric Operators</TITLE> +     <TITLEABBREV>Operators</TITLEABBREV> +     <TGROUP COLS="3"> +      <THEAD> +       <ROW> +	<ENTRY>Operator</ENTRY> +	<ENTRY>Description</ENTRY> +	<ENTRY>Usage</ENTRY> +       </ROW> +      </THEAD> +      <TBODY> +       <ROW> +	<ENTRY> + </ENTRY> +	<ENTRY>Translation</ENTRY> +	<ENTRY>'((0,0),(1,1))'::box + '(2.0,0)'::point</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> - </ENTRY> +	<ENTRY>Translation</ENTRY> +	<ENTRY>'((0,0),(1,1))'::box - '(2.0,0)'::point</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> * </ENTRY> +	<ENTRY>Scaling/rotation</ENTRY> +	<ENTRY>'((0,0),(1,1))'::box * '(2.0,0)'::point</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> / </ENTRY> +	<ENTRY>Scaling/rotation</ENTRY> +	<ENTRY>'((0,0),(2,2))'::box / '(2.0,0)'::point</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> # </ENTRY> +	<ENTRY>Intersection</ENTRY> +	<ENTRY>'((1,-1),(-1,1))' # '((1,1),(-1,-1))'</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> # </ENTRY> +	<ENTRY>Number of points in polygon</ENTRY> +	<ENTRY># '((1,0),(0,1),(-1,0))'</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> ## </ENTRY> +	<ENTRY>Point of closest proximity</ENTRY> +	<ENTRY>'(0,0)'::point ## '((2,0),(0,2))'::lseg</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> && </ENTRY> +	<ENTRY>Overlaps?</ENTRY> +	<ENTRY>'((0,0),(1,1))'::box && '((0,0),(2,2))'::box</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> &< </ENTRY> +	<ENTRY>Overlaps to left?</ENTRY> +	<ENTRY>'((0,0),(1,1))'::box &< '((0,0),(2,2))'::box</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> &> </ENTRY> +	<ENTRY>Overlaps to right?</ENTRY> +	<ENTRY>'((0,0),(3,3))'::box &> '((0,0),(2,2))'::box</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> <-> </ENTRY> +	<ENTRY>Distance between</ENTRY> +	<ENTRY>'((0,0),1)'::circle <-> '((5,0),1)'::circle</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> << </ENTRY> +	<ENTRY>Left of?</ENTRY> +	<ENTRY>'((0,0),1)'::circle << '((5,0),1)'::circle</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> <^ </ENTRY> +	<ENTRY>Is below?</ENTRY> +	<ENTRY>'((0,0),1)'::circle <^ '((0,5),1)'::circle</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> >> </ENTRY> +	<ENTRY>Is right of?</ENTRY> +	<ENTRY>'((5,0),1)'::circle >> '((0,0),1)'::circle</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> >^ </ENTRY> +	<ENTRY>Is above?</ENTRY> +	<ENTRY>'((0,5),1)'::circle >^ '((0,0),1)'::circle</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> ?# </ENTRY> +	<ENTRY>Intersects or overlaps</ENTRY> +	<ENTRY>'((-1,0),(1,0))'::lseg ?# '((-2,-2),(2,2))'::box;</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> ?- </ENTRY> +	<ENTRY>Is horizontal?</ENTRY> +	<ENTRY>'(1,0)'::point ?- '(0,0)'::point</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> ?-| </ENTRY> +	<ENTRY>Is perpendicular?</ENTRY> +	<ENTRY>'((0,0),(0,1))'::lseg ?-| '((0,0),(1,0))'::lseg</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> @-@  </ENTRY> +	<ENTRY>Length or circumference</ENTRY> +	<ENTRY>@-@ '((0,0),(1,0))'::path</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> ?| </ENTRY> +	<ENTRY>Is vertical?</ENTRY> +	<ENTRY>'(0,1)'::point ?| '(0,0)'::point</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> ?|| </ENTRY> +	<ENTRY>Is parallel?</ENTRY> +	<ENTRY>'((-1,0),(1,0))'::lseg ?|| '((-1,2),(1,2))'::lseg</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> @ </ENTRY> +	<ENTRY>Contained or on</ENTRY> +	<ENTRY>'(1,1)'::point @ '((0,0),2)'::circle</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> @@ </ENTRY> +	<ENTRY>Center of</ENTRY> +	<ENTRY>@@ '((0,0),10)'::circle</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> ~= </ENTRY> +	<ENTRY>Same as</ENTRY> +	<ENTRY>'((0,0),(1,1))'::polygon ~= '((1,1),(0,0))'::polygon</ENTRY> +       </ROW> +      </TBODY> +     </TGROUP> +    </TABLE> +   </Para> +  </sect1> +   +  <sect1> +   <title>Time Interval Operators</title> +    +   <Para> +    The time interval data type <Type>tinterval</Type> is a legacy from the original +    date/time types and is not as well supported as the more modern types. There +    are several operators for this type. +     +    <TABLE TOCENTRY="1"> +     <TITLE><ProductName>Postgres</ProductName> Time Interval Operators</TITLE> +     <TITLEABBREV>Operators</TITLEABBREV> +     <TGROUP COLS="3"> +      <THEAD> +       <ROW> +	<ENTRY>Operator</ENTRY> +	<ENTRY>Description</ENTRY> +	<ENTRY>Usage</ENTRY> +       </ROW> +      </THEAD> +      <TBODY> +       <ROW> +	<ENTRY> #< </ENTRY> +	<ENTRY>Interval less than?</ENTRY> +	<ENTRY></ENTRY> +       </ROW> +       <ROW> +	<ENTRY> #<= </ENTRY> +	<ENTRY>Interval less than or equal to?</ENTRY> +	<ENTRY></ENTRY> +       </ROW> +       <ROW> +	<ENTRY> #<> </ENTRY> +	<ENTRY>Interval not equal?</ENTRY> +	<ENTRY></ENTRY> +       </ROW> +       <ROW> +	<ENTRY> #= </ENTRY> +	<ENTRY>Interval equal?</ENTRY> +	<ENTRY></ENTRY> +       </ROW> +       <ROW> +	<ENTRY> #> </ENTRY> +	<ENTRY>Interval greater than?</ENTRY> +	<ENTRY></ENTRY> +       </ROW> +       <ROW> +	<ENTRY> #>= </ENTRY> +	<ENTRY>Interval greater than or equal to?</ENTRY> +	<ENTRY></ENTRY> +       </ROW> +       <ROW> +	<ENTRY> <#> </ENTRY> +	<ENTRY>Convert to time interval</ENTRY> +	<ENTRY></ENTRY> +       </ROW> +       <ROW> +	<ENTRY> << </ENTRY> +	<ENTRY>Interval less than?</ENTRY> +	<ENTRY></ENTRY> +       </ROW> +       <ROW> +	<ENTRY> | </ENTRY> +	<ENTRY>Start of interval</ENTRY> +	<ENTRY></ENTRY> +       </ROW> +       <ROW> +	<ENTRY> ~= </ENTRY> +	<ENTRY>Same as</ENTRY> +	<ENTRY></ENTRY> +       </ROW> +       <ROW> +	<ENTRY> <?> </ENTRY> +	<ENTRY>Time inside interval?</ENTRY> +	<ENTRY></ENTRY> +       </ROW> +      </TBODY> +     </TGROUP> +    </TABLE> +   </Para> +  </sect1> -<Para> -<TABLE TOCENTRY="1"> -<TITLE><ProductName>Postgres</ProductName>IP V4 CIDR Operators</TITLE> -<TITLEABBREV>Operators</TITLEABBREV> -<TGROUP COLS="3"> -<THEAD> -  <ROW> -    <ENTRY>Operator</ENTRY> -    <ENTRY>Description</ENTRY> -    <ENTRY>Usage</ENTRY> -  </ROW> -</THEAD> -<TBODY> -  <ROW> -    <ENTRY> < </ENTRY> -    <ENTRY>Less than</ENTRY> -    <ENTRY>'192.168.1.5'::cidr < '192.168.1.6'::cidr</ENTRY> -  </ROW> -  <ROW> -    <ENTRY> <= </ENTRY> -    <ENTRY>Less than or equal</ENTRY> -    <ENTRY>'192.168.1.5'::cidr <= '192.168.1.5'::cidr</ENTRY> -  </ROW> -  <ROW> -    <ENTRY> = </ENTRY> -    <ENTRY>Equals</ENTRY> -    <ENTRY>'192.168.1.5'::cidr = '192.168.1.5'::cidr</ENTRY> -  </ROW> -  <ROW> -    <ENTRY> >= </ENTRY> -    <ENTRY>Greater or equal</ENTRY> -    <ENTRY>'192.168.1.5'::cidr >= '192.168.1.5'::cidr</ENTRY> -  </ROW> -  <ROW> -    <ENTRY> > </ENTRY> -    <ENTRY>Greater</ENTRY> -    <ENTRY>'192.168.1.5'::cidr > '192.168.1.4'::cidr</ENTRY> -  </ROW> -  <ROW> -    <ENTRY> <> </ENTRY> -    <ENTRY>Not equal</ENTRY> -    <ENTRY>'192.168.1.5'::cidr <> '192.168.1.4'::cidr</ENTRY> -  </ROW> -  <ROW> -    <ENTRY> << </ENTRY> -    <ENTRY>is contained within</ENTRY> -    <ENTRY>'192.168.1.5'::cidr << '192.168.1/24'::cidr</ENTRY> -  </ROW> -  <ROW> -    <ENTRY> <<= </ENTRY> -    <ENTRY>is contained within or equals</ENTRY> -    <ENTRY>'192.168.1/24'::cidr <<= '192.168.1/24'::cidr</ENTRY> -  </ROW> -  <ROW> -    <ENTRY> >> </ENTRY> -    <ENTRY>contains</ENTRY> -    <ENTRY>'192.168.1/24'::cidr >> '192.168.1.5'::cidr</ENTRY> -  </ROW> -  <ROW> -    <ENTRY> >>= </ENTRY> -    <ENTRY>contains or equals</ENTRY> -    <ENTRY>'192.168.1/24'::cidr >>= '192.168.1/24'::cidr</ENTRY> -  </ROW> -</TBODY> -</TGROUP> -</TABLE> -</Para> -</Sect1> +  <Sect1> +   <title id="cidr-opers">IP V4 CIDR Operators</title> -<Sect1> -<title id="inet-opers">IP V4 INET Operators</title> +   <Para> +    <TABLE TOCENTRY="1"> +     <TITLE><ProductName>Postgres</ProductName>IP V4 CIDR Operators</TITLE> +     <TITLEABBREV>Operators</TITLEABBREV> +     <TGROUP COLS="3"> +      <THEAD> +       <ROW> +	<ENTRY>Operator</ENTRY> +	<ENTRY>Description</ENTRY> +	<ENTRY>Usage</ENTRY> +       </ROW> +      </THEAD> +      <TBODY> +       <ROW> +	<ENTRY> < </ENTRY> +	<ENTRY>Less than</ENTRY> +	<ENTRY>'192.168.1.5'::cidr < '192.168.1.6'::cidr</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> <= </ENTRY> +	<ENTRY>Less than or equal</ENTRY> +	<ENTRY>'192.168.1.5'::cidr <= '192.168.1.5'::cidr</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> = </ENTRY> +	<ENTRY>Equals</ENTRY> +	<ENTRY>'192.168.1.5'::cidr = '192.168.1.5'::cidr</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> >= </ENTRY> +	<ENTRY>Greater or equal</ENTRY> +	<ENTRY>'192.168.1.5'::cidr >= '192.168.1.5'::cidr</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> > </ENTRY> +	<ENTRY>Greater</ENTRY> +	<ENTRY>'192.168.1.5'::cidr > '192.168.1.4'::cidr</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> <> </ENTRY> +	<ENTRY>Not equal</ENTRY> +	<ENTRY>'192.168.1.5'::cidr <> '192.168.1.4'::cidr</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> << </ENTRY> +	<ENTRY>is contained within</ENTRY> +	<ENTRY>'192.168.1.5'::cidr << '192.168.1/24'::cidr</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> <<= </ENTRY> +	<ENTRY>is contained within or equals</ENTRY> +	<ENTRY>'192.168.1/24'::cidr <<= '192.168.1/24'::cidr</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> >> </ENTRY> +	<ENTRY>contains</ENTRY> +	<ENTRY>'192.168.1/24'::cidr >> '192.168.1.5'::cidr</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> >>= </ENTRY> +	<ENTRY>contains or equals</ENTRY> +	<ENTRY>'192.168.1/24'::cidr >>= '192.168.1/24'::cidr</ENTRY> +       </ROW> +      </TBODY> +     </TGROUP> +    </TABLE> +   </Para> +  </Sect1> -<Para> -<TABLE TOCENTRY="1"> -<TITLE><ProductName>Postgres</ProductName>IP V4 INET Operators</TITLE> -<TITLEABBREV>Operators</TITLEABBREV> -<TGROUP COLS="3"> -<THEAD> -  <ROW> -    <ENTRY>Operator</ENTRY> -    <ENTRY>Description</ENTRY> -    <ENTRY>Usage</ENTRY> -  </ROW> -</THEAD> -<TBODY> -  <ROW> -    <ENTRY> < </ENTRY> -    <ENTRY>Less than</ENTRY> -    <ENTRY>'192.168.1.5'::inet < '192.168.1.6'::inet</ENTRY> -  </ROW> -  <ROW> -    <ENTRY> <= </ENTRY> -    <ENTRY>Less than or equal</ENTRY> -    <ENTRY>'192.168.1.5'::inet <= '192.168.1.5'::inet</ENTRY> -  </ROW> -  <ROW> -    <ENTRY> = </ENTRY> -    <ENTRY>Equals</ENTRY> -    <ENTRY>'192.168.1.5'::inet = '192.168.1.5'::inet</ENTRY> -  </ROW> -  <ROW> -    <ENTRY> >= </ENTRY> -    <ENTRY>Greater or equal</ENTRY> -    <ENTRY>'192.168.1.5'::inet >= '192.168.1.5'::inet</ENTRY> -  </ROW> -  <ROW> -    <ENTRY> > </ENTRY> -    <ENTRY>Greater</ENTRY> -    <ENTRY>'192.168.1.5'::inet > '192.168.1.4'::inet</ENTRY> -  </ROW> -  <ROW> -    <ENTRY> <> </ENTRY> -    <ENTRY>Not equal</ENTRY> -    <ENTRY>'192.168.1.5'::inet <> '192.168.1.4'::inet</ENTRY> -  </ROW> -  <ROW> -    <ENTRY> << </ENTRY> -    <ENTRY>is contained within</ENTRY> -    <ENTRY>'192.168.1.5'::inet << '192.168.1/24'::inet</ENTRY> -  </ROW> -  <ROW> -    <ENTRY> <<= </ENTRY> -    <ENTRY>is contained within or equals</ENTRY> -    <ENTRY>'192.168.1/24'::inet <<= '192.168.1/24'::inet</ENTRY> -  </ROW> -  <ROW> -    <ENTRY> >> </ENTRY> -    <ENTRY>contains</ENTRY> -    <ENTRY>'192.168.1/24'::inet >> '192.168.1.5'::inet</ENTRY> -  </ROW> -  <ROW> -    <ENTRY> >>= </ENTRY> -    <ENTRY>contains or equals</ENTRY> -    <ENTRY>'192.168.1/24'::inet >>= '192.168.1/24'::inet</ENTRY> -  </ROW> -</TBODY> -</TGROUP> -</TABLE> -</Para> -</Sect1> +  <Sect1> +   <title id="inet-opers">IP V4 INET Operators</title> +    +   <Para> +    <TABLE TOCENTRY="1"> +     <TITLE><ProductName>Postgres</ProductName>IP V4 INET Operators</TITLE> +     <TITLEABBREV>Operators</TITLEABBREV> +     <TGROUP COLS="3"> +      <THEAD> +       <ROW> +	<ENTRY>Operator</ENTRY> +	<ENTRY>Description</ENTRY> +	<ENTRY>Usage</ENTRY> +       </ROW> +      </THEAD> +      <TBODY> +       <ROW> +	<ENTRY> < </ENTRY> +	<ENTRY>Less than</ENTRY> +	<ENTRY>'192.168.1.5'::inet < '192.168.1.6'::inet</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> <= </ENTRY> +	<ENTRY>Less than or equal</ENTRY> +	<ENTRY>'192.168.1.5'::inet <= '192.168.1.5'::inet</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> = </ENTRY> +	<ENTRY>Equals</ENTRY> +	<ENTRY>'192.168.1.5'::inet = '192.168.1.5'::inet</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> >= </ENTRY> +	<ENTRY>Greater or equal</ENTRY> +	<ENTRY>'192.168.1.5'::inet >= '192.168.1.5'::inet</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> > </ENTRY> +	<ENTRY>Greater</ENTRY> +	<ENTRY>'192.168.1.5'::inet > '192.168.1.4'::inet</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> <> </ENTRY> +	<ENTRY>Not equal</ENTRY> +	<ENTRY>'192.168.1.5'::inet <> '192.168.1.4'::inet</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> << </ENTRY> +	<ENTRY>is contained within</ENTRY> +	<ENTRY>'192.168.1.5'::inet << '192.168.1/24'::inet</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> <<= </ENTRY> +	<ENTRY>is contained within or equals</ENTRY> +	<ENTRY>'192.168.1/24'::inet <<= '192.168.1/24'::inet</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> >> </ENTRY> +	<ENTRY>contains</ENTRY> +	<ENTRY>'192.168.1/24'::inet >> '192.168.1.5'::inet</ENTRY> +       </ROW> +       <ROW> +	<ENTRY> >>= </ENTRY> +	<ENTRY>contains or equals</ENTRY> +	<ENTRY>'192.168.1/24'::inet >>= '192.168.1/24'::inet</ENTRY> +       </ROW> +      </TBODY> +     </TGROUP> +    </TABLE> +   </Para> +  </Sect1> -</Chapter> + </Chapter> +<!-- Keep this comment at the end of the file +Local variables: +mode: sgml +sgml-omittag:nil +sgml-shorttag:t +sgml-minimize-attributes:nil +sgml-always-quote-attributes:t +sgml-indent-step:1 +sgml-indent-data:t +sgml-parent-document:nil +sgml-default-dtd-file:"./reference.ced" +sgml-exposed-tags:nil +sgml-local-catalogs:"/usr/lib/sgml/CATALOG" +sgml-local-ecat-files:nil +End: +--> diff --git a/doc/src/sgml/syntax.sgml b/doc/src/sgml/syntax.sgml index 65f46cd24dd..72043575f38 100644 --- a/doc/src/sgml/syntax.sgml +++ b/doc/src/sgml/syntax.sgml @@ -1,62 +1,73 @@ -<chapter> -<title>SQL Syntax</title> - -<sect1> -<title>Key Words</title> - -<para> -<acronym>SQL92</acronym> defines <firstterm>key words</firstterm>  -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> -<productname>Postgres</productname> implements an extended subset of the -<acronym>SQL92</acronym> and <acronym>SQL3</acronym> languages. Some language -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> - -<para> -Information on <acronym>SQL92</acronym> and <acronym>SQL3</acronym> key words -is derived from <xref linkend="DATE97" endterm="DATE97">. -</para> - -<sect2> -<title>Reserved Key Words</title> - -<para> -<acronym>SQL92</acronym> and <acronym>SQL3</acronym> have  -<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> -Any string can be specified as an identifier if surrounded by -double quotes (<quote>like this!</quote>). Some care is required since -such an identifier will be case sensitive -and will retain embedded whitespace other special characters.</para> -</tip> - -<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> + <chapter> +  <title>SQL Syntax</title> + +  <abstract> +   <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> + +  <sect1> +   <title>Key Words</title> + +   <para> +    <acronym>SQL92</acronym> defines <firstterm>key words</firstterm>  +    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> +    <productname>Postgres</productname> implements an extended subset of the +    <acronym>SQL92</acronym> and <acronym>SQL3</acronym> languages. Some language +    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> + +   <para> +    Information on <acronym>SQL92</acronym> and <acronym>SQL3</acronym> key words +    is derived from <xref linkend="DATE97" endterm="DATE97">. +   </para> + +   <sect2> +    <title>Reserved Key Words</title> + +    <para> +     <acronym>SQL92</acronym> and <acronym>SQL3</acronym> have  +     <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> +      Any string can be specified as an identifier if surrounded by +      double quotes (<quote>like this!</quote>). Some care is required since +      such an identifier will be case sensitive +      and will retain embedded whitespace other special characters. +     </para> +    </tip> + +    <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   BINARY   CLUSTER CONSTRAINT COPY @@ -69,32 +80,33 @@ RESET  SETOF SHOW  UNLISTEN UNTIL   VACUUM VERBOSE -</programlisting> -</para> +     </programlisting> +    </para> -<para> -The following are <productname>Postgres</productname> -reserved words which are also <acronym>SQL92</acronym>  -or <acronym>SQL3</acronym> reserved words, and which -are allowed to be present as column labels, but not as identifiers: +    <para> +     The following are <productname>Postgres</productname> +     reserved words which are also <acronym>SQL92</acronym>  +     or <acronym>SQL3</acronym> reserved words, and which +     are allowed to be present as column labels, but not as identifiers: -<programlisting> +     <programlisting>  CASE COALESCE CROSS CURRENT   ELSE END  FALSE FOREIGN  -GROUP  +GLOBAL GROUP  +LOCAL  NULLIF  ORDER   POSITION PRECISION   TABLE THEN TRANSACTION TRUE  WHEN -</programlisting> +     </programlisting> -The following are <productname>Postgres</productname> -reserved words which are also <acronym>SQL92</acronym>  -or <acronym>SQL3</acronym> reserved words: +     The following are <productname>Postgres</productname> +     reserved words which are also <acronym>SQL92</acronym>  +     or <acronym>SQL3</acronym> reserved words: -<programlisting> +     <programlisting>  ADD ALL ALTER AND ANY AS ASC  BEGIN BETWEEN BOTH BY  CASCADE CAST CHAR CHARACTER CHECK CLOSE  @@ -118,49 +130,49 @@ TO TRAILING TRIM  UNION UNIQUE UPDATE USER USING  VALUES VARCHAR VARYING VIEW  WHERE WITH WORK  -</programlisting> -</para> +     </programlisting> +    </para> -<para> -The following are <acronym>SQL92</acronym> reserved key words which -are not <productname>Postgres</productname> reserved key words, but which -if used as function names are always translated into the function -<function>length</function>: +    <para> +     The following are <acronym>SQL92</acronym> reserved key words which +     are not <productname>Postgres</productname> reserved key words, but which +     if used as function names are always translated into the function +     <function>length</function>: -<programlisting> +     <programlisting>  CHAR_LENGTH CHARACTER_LENGTH -</programlisting> -</para> +     </programlisting> +    </para> -<para> -The following are <acronym>SQL92</acronym> or <acronym>SQL3</acronym>  -reserved key words which -are not <productname>Postgres</productname> reserved key words, but -if used as type names are always translated into an alternate, native type: +    <para> +     The following are <acronym>SQL92</acronym> or <acronym>SQL3</acronym>  +     reserved key words which +     are not <productname>Postgres</productname> reserved key words, but +     if used as type names are always translated into an alternate, native type: -<programlisting> +     <programlisting>  BOOLEAN DOUBLE FLOAT INT INTEGER INTERVAL REAL SMALLINT -</programlisting> -</para> - -<para> -The following are either <acronym>SQL92</acronym> -or <acronym>SQL3</acronym> reserved key words -which are not key words 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 -future: - -<note> -<para> -Some of these key words represent functions in <acronym>SQL92</acronym>. -These functions are defined in <productname>Postgres</productname>, -but the parser does not consider the names to be key words and they are allowed -in other contexts. -</para> -</note> - -<programlisting> +     </programlisting> +    </para> + +    <para> +     The following are either <acronym>SQL92</acronym> +     or <acronym>SQL3</acronym> reserved key words +     which are not key words in <productname>Postgres</productname>. +     These have no proscribed usage in <productname>Postgres</productname> +     at the time of writing (v6.5) but may become reserved key words in the +     future: + +     <note> +      <para> +       Some of these key words represent functions in <acronym>SQL92</acronym>. +       These functions are defined in <productname>Postgres</productname>, +       but the parser does not consider the names to be key words and they are allowed +       in other contexts. +      </para> +     </note> + +     <programlisting>  ALLOCATE ARE ASSERTION AT AUTHORIZATION AVG   BIT BIT_LENGTH  CASCADED CATALOG COLLATION CONNECT CONNECTION @@ -168,7 +180,7 @@ CASCADED CATALOG COLLATION CONNECT CONNECTION  DATE DEALLOCATE DEC DESCRIBE DESCRIPTOR DIAGNOSTICS DISCONNECT DOMAIN   END-EXEC ESCAPE EXCEPT EXCEPTION EXEC EXTERNAL   FIRST FOUND -GET GLOBAL GO GOTO  +GET GO GOTO   IDENTITY IMMEDIATE INDICATOR INITIALLY INPUT INTERSECT ISOLATION   LAST LEVEL LOWER   MAX MIN MODULE  @@ -181,56 +193,56 @@ TEMPORARY TRANSLATE TRANSLATION  UNKNOWN UPPER USAGE  VALUE   WHENEVER WRITE -</programlisting> -</para> -</sect2> - -<sect2> -<title>Non-reserved Keywords</title> - -<para> -<acronym>SQL92</acronym> and <acronym>SQL3</acronym> have  -<firstterm>non-reserved keywords</firstterm> which have -a proscribed meaning in the language but which are also allowed -as identifiers. -<productname>Postgres</productname> has additional keywords -which allow similar unrestricted usage. -In particular, these keywords -are allowed as column or table names. -</para> - -<para> -The following are <productname>Postgres</productname> -non-reserved key words which are neither <acronym>SQL92</acronym> -nor <acronym>SQL3</acronym> non-reserved key words: - -<programlisting> -AFTER AGGREGATE  +     </programlisting> +    </para> +   </sect2> + +   <sect2> +    <title>Non-reserved Keywords</title> + +    <para> +     <acronym>SQL92</acronym> and <acronym>SQL3</acronym> have  +     <firstterm>non-reserved keywords</firstterm> which have +     a proscribed meaning in the language but which are also allowed +     as identifiers. +     <productname>Postgres</productname> has additional keywords +     which allow similar unrestricted usage. +     In particular, these keywords +     are allowed as column or table names. +    </para> + +    <para> +     The following are <productname>Postgres</productname> +     non-reserved key words which are neither <acronym>SQL92</acronym> +     nor <acronym>SQL3</acronym> non-reserved key words: + +     <programlisting> +ACCESS AFTER AGGREGATE   BACKWARD BEFORE   CACHE CREATEDB CREATEUSER CYCLE  DATABASE DELIMITERS  -EACH ENCODING  +EACH ENCODING EXCLUSIVE  FORWARD FUNCTION   HANDLER  INCREMENT INDEX INHERITS INSENSITIVE INSTEAD ISNULL  LANCOMPILER LOCATION  -MAXVALUE MINVALUE +MAXVALUE MINVALUE MODE  NOCREATEDB NOCREATEUSER NOTHING NOTNULL   OIDS OPERATOR   PASSWORD PROCEDURAL  RECIPE RENAME  RETURNS ROW RULE -SEQUENCE SERIAL START STATEMENT STDIN STDOUT  +SEQUENCE SERIAL SHARE START STATEMENT STDIN STDOUT   TRUSTED   VALID VERSION -</programlisting> -</para> +     </programlisting> +    </para> -<para> -The following are <productname>Postgres</productname> -non-reserved key words which are <acronym>SQL92</acronym> -or <acronym>SQL3</acronym> reserved key words: +    <para> +     The following are <productname>Postgres</productname> +     non-reserved key words which are <acronym>SQL92</acronym> +     or <acronym>SQL3</acronym> reserved key words: -<programlisting> +     <programlisting>  ABSOLUTE ACTION  DAY  HOUR @@ -246,30 +258,30 @@ SCROLL SECOND  TIME TIMESTAMP TIMEZONE_HOUR TIMEZONE_MINUTE TRIGGER   YEAR  ZONE -</programlisting> -</para> +     </programlisting> +    </para> -<para> -The following are <productname>Postgres</productname> -non-reserved key words which are also either <acronym>SQL92</acronym> -or <acronym>SQL3</acronym> non-reserved key words: +    <para> +     The following are <productname>Postgres</productname> +     non-reserved key words which are also either <acronym>SQL92</acronym> +     or <acronym>SQL3</acronym> non-reserved key words: -<programlisting> -TYPE -</programlisting> -</para> +     <programlisting> +COMMITTED SERIALIZABLE TYPE +     </programlisting> +    </para> -<para> -The following are either <acronym>SQL92</acronym> -or <acronym>SQL3</acronym> non-reserved key words which are not -key words of any kind in <productname>Postgres</productname>: +    <para> +     The following are either <acronym>SQL92</acronym> +     or <acronym>SQL3</acronym> non-reserved key words which are not +     key words of any kind in <productname>Postgres</productname>: -<programlisting> +     <programlisting>  ADA  C CATALOG_NAME CHARACTER_SET_CATALOG CHARACTER_SET_NAME   CHARACTER_SET_SCHEMA CLASS_ORIGIN COBOL COLLATION_CATALOG  COLLATION_NAME COLLATION_SCHEMA COLUMN_NAME -COMMAND_FUNCTION COMMITTED CONDITION_NUMBER +COMMAND_FUNCTION CONDITION_NUMBER  CONNECTION_NAME CONSTRAINT_CATALOG CONSTRAINT_NAME  CONSTRAINT_SCHEMA CURSOR_NAME  DATA DATE_TIME_INTERVAL_CODE DATE_TIME_INTERVAL_PRECISION @@ -281,15 +293,29 @@ NAME NULLABLE NUMBER  PAD PASCAL PLI  REPEATABLE RETURNED_LENGTH RETURNED_OCTET_LENGTH  RETURNED_SQLSTATE ROW_COUNT -SCALE SCHEMA_NAME SERIALIZABLE SERVER_NAME SPACE +SCALE SCHEMA_NAME SERVER_NAME SPACE  SUBCLASS_ORIGIN  TABLE_NAME  UNCOMMITTED UNNAMED -</programlisting> -</para> -</sect2> -</sect1> -</chapter> +     </programlisting> +    </para> +   </sect2> +  </sect1> + +  <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  Local variables: | 
