Commit 84956e71 authored by Peter Eisentraut's avatar Peter Eisentraut

Markup additions and spell check. (covers User's Guide)

parent ba708ea3
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/array.sgml,v 1.11 2001/05/12 22:51:34 petere Exp $ --> <!-- $Header: /cvsroot/pgsql/doc/src/sgml/array.sgml,v 1.12 2001/09/09 17:21:44 petere Exp $ -->
<chapter id="arrays"> <chapter id="arrays">
<title>Arrays</title> <title>Arrays</title>
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<para> <para>
<productname>Postgres</productname> allows columns of a table to be <productname>Postgres</productname> allows columns of a table to be
defined as variable-length multi-dimensional arrays. Arrays of any defined as variable-length multidimensional arrays. Arrays of any
built-in type or user-defined type can be created. To illustrate built-in type or user-defined type can be created. To illustrate
their use, we create this table: their use, we create this table:
<programlisting> <programlisting>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/datatype.sgml,v 1.61 2001/09/04 03:17:54 momjian Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/datatype.sgml,v 1.62 2001/09/09 17:21:51 petere Exp $
--> -->
<chapter id="datatype"> <chapter id="datatype">
...@@ -361,59 +361,59 @@ $Header: /cvsroot/pgsql/doc/src/sgml/datatype.sgml,v 1.61 2001/09/04 03:17:54 mo ...@@ -361,59 +361,59 @@ $Header: /cvsroot/pgsql/doc/src/sgml/datatype.sgml,v 1.61 2001/09/04 03:17:54 mo
<tbody> <tbody>
<row> <row>
<entry>smallint</entry> <entry><type>smallint</></entry>
<entry>2 bytes</entry> <entry>2 bytes</entry>
<entry>Fixed-precision</entry> <entry>Fixed-precision</entry>
<entry>-32768 to +32767</entry> <entry>-32768 to +32767</entry>
</row> </row>
<row> <row>
<entry>integer</entry> <entry><type>integer</></entry>
<entry>4 bytes</entry> <entry>4 bytes</entry>
<entry>Usual choice for fixed-precision</entry> <entry>Usual choice for fixed-precision</entry>
<entry>-2147483648 to +2147483647</entry> <entry>-2147483648 to +2147483647</entry>
</row> </row>
<row> <row>
<entry>bigint</entry> <entry><type>bigint</></entry>
<entry>8 bytes</entry> <entry>8 bytes</entry>
<entry>Very large range fixed-precision</entry> <entry>Very large range fixed-precision</entry>
<entry>about 18 decimal digits</entry> <entry>about 18 decimal digits</entry>
</row> </row>
<row> <row>
<entry>decimal</entry> <entry><type>decimal</></entry>
<entry>variable</entry> <entry>variable</entry>
<entry>user-specified precision, exact</entry> <entry>user-specified precision, exact</entry>
<entry>no limit</entry> <entry>no limit</entry>
</row> </row>
<row> <row>
<entry>numeric</entry> <entry><type>numeric</></entry>
<entry>variable</entry> <entry>variable</entry>
<entry>user-specified precision, exact</entry> <entry>user-specified precision, exact</entry>
<entry>no limit</entry> <entry>no limit</entry>
</row> </row>
<row> <row>
<entry>real</entry> <entry><type>real</></entry>
<entry>4 bytes</entry> <entry>4 bytes</entry>
<entry>variable-precision, inexact</entry> <entry>variable-precision, inexact</entry>
<entry>6 decimal digits precision</entry> <entry>6 decimal digits precision</entry>
</row> </row>
<row> <row>
<entry>double precision</entry> <entry><type>double precision</></entry>
<entry>8 bytes</entry> <entry>8 bytes</entry>
<entry>variable-precision, inexact</entry> <entry>variable-precision, inexact</entry>
<entry>15 decimal digits precision</entry> <entry>15 decimal digits precision</entry>
</row> </row>
<row> <row>
<entry>serial</entry> <entry><type>serial</></entry>
<entry>4 bytes</entry> <entry>4 bytes</entry>
<entry>autoincrementing integer</entry> <entry>autoincrementing integer</entry>
<entry>1 to 2147483647</entry> <entry>1 to 2147483647</entry>
</row> </row>
<row> <row>
<entry>bigserial</entry> <entry><type>bigserial</type></entry>
<entry>8 bytes</entry> <entry>8 bytes</entry>
<entry>autoincrementing integer</entry> <entry>autoincrementing integer</entry>
<entry>1 to 9223372036854775807</entry> <entry>1 to 9223372036854775807</entry>
...@@ -557,7 +557,7 @@ NUMERIC ...@@ -557,7 +557,7 @@ NUMERIC
<para> <para>
The data types <type>real</type> and <type>double The data types <type>real</type> and <type>double
precision</type> are inexact, variable precision numeric types. precision</type> are inexact, variable precision numeric types.
In practice, these types are usually implementations of IEEE 754 In practice, these types are usually implementations of <acronym>IEEE</acronym> 754
binary floating point (single and double precision, binary floating point (single and double precision,
respectively), to the extent that the underlying processor, respectively), to the extent that the underlying processor,
operating system, and compiler support it. operating system, and compiler support it.
...@@ -636,7 +636,7 @@ NUMERIC ...@@ -636,7 +636,7 @@ NUMERIC
</indexterm> </indexterm>
<para> <para>
The <type>serial</type> datatypes are not truly types, but are a The <type>serial</type> data types are not truly types, but are a
notational convenience for setting up unique identifier columns notational convenience for setting up unique identifier columns
in tables. in tables.
In the current implementation, specifying In the current implementation, specifying
...@@ -777,21 +777,17 @@ CREATE TABLE <replaceable class="parameter">tablename</replaceable> (<replaceabl ...@@ -777,21 +777,17 @@ CREATE TABLE <replaceable class="parameter">tablename</replaceable> (<replaceabl
</thead> </thead>
<tbody> <tbody>
<row> <row>
<entry>character(<replaceable>n</>), char(<replaceable>n</>)</entry> <entry><type>character(<replaceable>n</>)</type>, <type>char(<replaceable>n</>)</type></entry>
<entry>Fixed-length blank padded</entry> <entry>Fixed-length blank padded</entry>
</row> </row>
<row> <row>
<entry>character varying(<replaceable>n</>), varchar(<replaceable>n</>)</entry> <entry><type>character varying(<replaceable>n</>)</type>, <type>varchar(<replaceable>n</>)</type></entry>
<entry>Variable-length with limit</entry> <entry>Variable-length with limit</entry>
</row> </row>
<row> <row>
<entry>text</entry> <entry><type>text</type></entry>
<entry>Variable unlimited length</entry> <entry>Variable unlimited length</entry>
</row> </row>
<row>
<entry>bytea</entry>
<entry>binary data</entry>
</row>
</tbody> </tbody>
</tgroup> </tgroup>
</table> </table>
...@@ -839,19 +835,6 @@ CREATE TABLE <replaceable class="parameter">tablename</replaceable> (<replaceabl ...@@ -839,19 +835,6 @@ CREATE TABLE <replaceable class="parameter">tablename</replaceable> (<replaceabl
standard, many other RDBMS packages have it as well. standard, many other RDBMS packages have it as well.
</para> </para>
<para>
The <type>bytea</type> data type allows storage of binary data,
specifically allowing storage of NULLs which are entered as
<literal>'\\000'</>. The first backslash is interpreted by the
single quotes, and the second is recognized by <type>bytea</> and
preceeds a three digit octal value. For a similar reason, a
backslash must be entered into a field as <literal>'\\\\'</> or
<literal>'\\134'</>. You may also have to escape line feeds and
carriage return if your interface automatically translates these. It
can store values of any length. <type>Bytea</> is a non-standard
data type.
</para>
<para> <para>
The storage requirement for data of these types is 4 bytes plus The storage requirement for data of these types is 4 bytes plus
the actual string, and in case of <type>character</type> plus the the actual string, and in case of <type>character</type> plus the
...@@ -860,7 +843,7 @@ CREATE TABLE <replaceable class="parameter">tablename</replaceable> (<replaceabl ...@@ -860,7 +843,7 @@ CREATE TABLE <replaceable class="parameter">tablename</replaceable> (<replaceabl
that can be stored is about 1 GB. (The maximum value that will be that can be stored is about 1 GB. (The maximum value that will be
allowed for <replaceable>n</> in the data type declaration is allowed for <replaceable>n</> in the data type declaration is
actually larger than that. It wouldn't be very useful to change actually larger than that. It wouldn't be very useful to change
this because with multi-byte character encodings the number of this because with multibyte character encodings the number of
characters and bytes can be quite different anyway.) characters and bytes can be quite different anyway.)
</para> </para>
...@@ -957,6 +940,23 @@ SELECT b, char_length(b) FROM test2; ...@@ -957,6 +940,23 @@ SELECT b, char_length(b) FROM test2;
</sect1> </sect1>
<sect1 id="datatype-binary">
<title>Binary Data</title>
<para>
The <type>bytea</type> data type allows storage of binary data,
specifically allowing storage of NULLs which are entered as
<literal>'\\000'</>. The first backslash is interpreted by the
single quotes, and the second is recognized by <type>bytea</> and
precedes a three digit octal value. For a similar reason, a
backslash must be entered into a field as <literal>'\\\\'</> or
<literal>'\\134'</>. You may also have to escape line feeds and
carriage return if your interface automatically translates these. It
can store values of any length. <type>Bytea</> is a non-standard
data type.
</para>
</sect1>
<sect1 id="datatype-datetime"> <sect1 id="datatype-datetime">
<title>Date/Time Types</title> <title>Date/Time Types</title>
...@@ -1083,7 +1083,7 @@ SELECT b, char_length(b) FROM test2; ...@@ -1083,7 +1083,7 @@ SELECT b, char_length(b) FROM test2;
</para> </para>
<sect3> <sect3>
<title>date</title> <title><type>date</type></title>
<indexterm> <indexterm>
<primary>date</primary> <primary>date</primary>
...@@ -1260,7 +1260,7 @@ SELECT b, char_length(b) FROM test2; ...@@ -1260,7 +1260,7 @@ SELECT b, char_length(b) FROM test2;
</sect3> </sect3>
<sect3> <sect3>
<title>time [ without time zone ]</title> <title><type>time [ without time zone ]</type></title>
<indexterm> <indexterm>
<primary>time</primary> <primary>time</primary>
...@@ -1328,7 +1328,7 @@ SELECT b, char_length(b) FROM test2; ...@@ -1328,7 +1328,7 @@ SELECT b, char_length(b) FROM test2;
</sect3> </sect3>
<sect3> <sect3>
<title>time with time zone</title> <title><type>time with time zone</type></title>
<para> <para>
This type is defined by SQL92, but the definition exhibits This type is defined by SQL92, but the definition exhibits
...@@ -1382,7 +1382,7 @@ SELECT b, char_length(b) FROM test2; ...@@ -1382,7 +1382,7 @@ SELECT b, char_length(b) FROM test2;
</sect3> </sect3>
<sect3> <sect3>
<title>timestamp</title> <title><type>timestamp</type></title>
<indexterm> <indexterm>
<primary>timestamp</primary> <primary>timestamp</primary>
...@@ -1442,7 +1442,7 @@ January 8 04:05:06 1999 PST ...@@ -1442,7 +1442,7 @@ January 8 04:05:06 1999 PST
</sect3> </sect3>
<sect3> <sect3>
<title>interval</title> <title><type>interval</type></title>
<indexterm> <indexterm>
<primary>interval</primary> <primary>interval</primary>
...@@ -1664,7 +1664,7 @@ January 8 04:05:06 1999 PST ...@@ -1664,7 +1664,7 @@ January 8 04:05:06 1999 PST
</listitem> </listitem>
<listitem> <listitem>
<para> <para>
The <envar>PGDATESTYLE</envar> environment variable used by the frontend libpq The <envar>PGDATESTYLE</envar> environment variable used by the frontend <application>libpq</application>
on session start-up. on session start-up.
</para> </para>
</listitem> </listitem>
...@@ -1753,13 +1753,13 @@ January 8 04:05:06 1999 PST ...@@ -1753,13 +1753,13 @@ January 8 04:05:06 1999 PST
<itemizedlist spacing="compact" mark="bullet"> <itemizedlist spacing="compact" mark="bullet">
<listitem> <listitem>
<para> <para>
The TZ environment variable is used by the backend directly The <envar>TZ</envar> environment variable is used by the backend directly
on postmaster start-up as the default time zone. on postmaster start-up as the default time zone.
</para> </para>
</listitem> </listitem>
<listitem> <listitem>
<para> <para>
The PGTZ environment variable, if set at the client, is used by libpq The <envar>PGTZ</envar> environment variable, if set at the client, is used by libpq
to send a <command>SET TIME ZONE</command> command to the backend upon to send a <command>SET TIME ZONE</command> command to the backend upon
connection. connection.
</para> </para>
...@@ -1796,7 +1796,7 @@ January 8 04:05:06 1999 PST ...@@ -1796,7 +1796,7 @@ January 8 04:05:06 1999 PST
<para> <para>
If the runtime option <literal>AUSTRALIAN_TIMEZONES</literal> is set If the runtime option <literal>AUSTRALIAN_TIMEZONES</literal> is set
then <literal>CST</literal> and <literal>EST</literal> refer to then <literal>CST</literal> and <literal>EST</literal> refer to
Australian timezones, not American ones. Australian time zones, not American ones.
</para> </para>
</note> </note>
</para> </para>
...@@ -1939,49 +1939,49 @@ SELECT * FROM test1 WHERE a; ...@@ -1939,49 +1939,49 @@ SELECT * FROM test1 WHERE a;
</thead> </thead>
<tbody> <tbody>
<row> <row>
<entry>point</entry> <entry><type>point</type></entry>
<entry>16 bytes</entry> <entry>16 bytes</entry>
<entry>(x,y)</entry> <entry>(x,y)</entry>
<entry>Point in space</entry> <entry>Point in space</entry>
</row> </row>
<row> <row>
<entry>line</entry> <entry><type>line</type></entry>
<entry>32 bytes</entry> <entry>32 bytes</entry>
<entry>((x1,y1),(x2,y2))</entry> <entry>((x1,y1),(x2,y2))</entry>
<entry>Infinite line</entry> <entry>Infinite line</entry>
</row> </row>
<row> <row>
<entry>lseg</entry> <entry><type>lseg</type></entry>
<entry>32 bytes</entry> <entry>32 bytes</entry>
<entry>((x1,y1),(x2,y2))</entry> <entry>((x1,y1),(x2,y2))</entry>
<entry>Finite line segment</entry> <entry>Finite line segment</entry>
</row> </row>
<row> <row>
<entry>box</entry> <entry><type>box</type></entry>
<entry>32 bytes</entry> <entry>32 bytes</entry>
<entry>((x1,y1),(x2,y2))</entry> <entry>((x1,y1),(x2,y2))</entry>
<entry>Rectangular box</entry> <entry>Rectangular box</entry>
</row> </row>
<row> <row>
<entry>path</entry> <entry><type>path</type></entry>
<entry>4+32n bytes</entry> <entry>4+32n bytes</entry>
<entry>((x1,y1),...)</entry> <entry>((x1,y1),...)</entry>
<entry>Closed path (similar to polygon)</entry> <entry>Closed path (similar to polygon)</entry>
</row> </row>
<row> <row>
<entry>path</entry> <entry><type>path</type></entry>
<entry>4+32n bytes</entry> <entry>4+32n bytes</entry>
<entry>[(x1,y1),...]</entry> <entry>[(x1,y1),...]</entry>
<entry>Open path</entry> <entry>Open path</entry>
</row> </row>
<row> <row>
<entry>polygon</entry> <entry><type>polygon</type></entry>
<entry>4+32n bytes</entry> <entry>4+32n bytes</entry>
<entry>((x1,y1),...)</entry> <entry>((x1,y1),...)</entry>
<entry>Polygon (similar to closed path)</entry> <entry>Polygon (similar to closed path)</entry>
</row> </row>
<row> <row>
<entry>circle</entry> <entry><type>circle</type></entry>
<entry>24 bytes</entry> <entry>24 bytes</entry>
<entry><(x,y),r></entry> <entry><(x,y),r></entry>
<entry>Circle (center and radius)</entry> <entry>Circle (center and radius)</entry>
...@@ -2296,21 +2296,21 @@ SELECT * FROM test1 WHERE a; ...@@ -2296,21 +2296,21 @@ SELECT * FROM test1 WHERE a;
<tbody> <tbody>
<row> <row>
<entry>cidr</entry> <entry><type>cidr</type></entry>
<entry>12 bytes</entry> <entry>12 bytes</entry>
<entry>IP networks</entry> <entry>IP networks</entry>
<entry>valid IPv4 networks</entry> <entry>valid IPv4 networks</entry>
</row> </row>
<row> <row>
<entry>inet</entry> <entry><type>inet</type></entry>
<entry>12 bytes</entry> <entry>12 bytes</entry>
<entry>IP hosts and networks</entry> <entry>IP hosts and networks</entry>
<entry>valid IPv4 hosts or networks</entry> <entry>valid IPv4 hosts or networks</entry>
</row> </row>
<row> <row>
<entry>macaddr</entry> <entry><type>macaddr</type></entry>
<entry>6 bytes</entry> <entry>6 bytes</entry>
<entry>MAC addresses</entry> <entry>MAC addresses</entry>
<entry>customary formats</entry> <entry>customary formats</entry>
...@@ -2386,9 +2386,9 @@ SELECT * FROM test1 WHERE a; ...@@ -2386,9 +2386,9 @@ SELECT * FROM test1 WHERE a;
<tgroup cols="3"> <tgroup cols="3">
<thead> <thead>
<row> <row>
<entry>CIDR Input</entry> <entry><type>CIDR</type> Input</entry>
<entry>CIDR Displayed</entry> <entry><type>CIDR</type> Displayed</entry>
<entry>abbrev(CIDR)</entry> <entry><function>abbrev</function>(<type>CIDR</type>)</entry>
</row> </row>
</thead> </thead>
<tbody> <tbody>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/datetime.sgml,v 2.19 2001/06/18 19:05:11 tgl Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/datetime.sgml,v 2.20 2001/09/09 17:21:58 petere Exp $
Date/time details Date/time details
--> -->
...@@ -225,7 +225,7 @@ Date/time details ...@@ -225,7 +225,7 @@ Date/time details
<row> <row>
<entry>DNT</entry> <entry>DNT</entry>
<entry>+1:00 </entry> <entry>+1:00 </entry>
<entry>Dansk Normal Tid</entry> <entry><foreignphrase>Dansk Normal Tid</foreignphrase></entry>
</row> </row>
<row> <row>
<entry>FST</entry> <entry>FST</entry>
......
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/func.sgml,v 1.69 2001/09/06 03:22:41 momjian Exp $ --> <!-- $Header: /cvsroot/pgsql/doc/src/sgml/func.sgml,v 1.70 2001/09/09 17:21:58 petere Exp $ -->
<chapter id="functions"> <chapter id="functions">
<title>Functions and Operators</title> <title>Functions and Operators</title>
...@@ -496,163 +496,163 @@ ...@@ -496,163 +496,163 @@
<tbody> <tbody>
<row> <row>
<entry>abs(<replaceable>x</replaceable>)</entry> <entry><function>abs</function>(<replaceable>x</replaceable>)</entry>
<entry>(same as x)</entry> <entry>(same as x)</entry>
<entry>absolute value</entry> <entry>absolute value</entry>
<entry>abs(-17.4)</entry> <entry><literal>abs(-17.4)</literal></entry>
<entry>17.4</entry> <entry>17.4</entry>
</row> </row>
<row> <row>
<entry>cbrt(<type>dp</type>)</entry> <entry><function>cbrt</function>(<type>dp</type>)</entry>
<entry><type>dp</type></entry> <entry><type>dp</type></entry>
<entry>cube root</entry> <entry>cube root</entry>
<entry>cbrt(27.0)</entry> <entry><literal>cbrt(27.0)</literal></entry>
<entry>3</entry> <entry>3</entry>
</row> </row>
<row> <row>
<entry>ceil(<type>numeric</type>)</entry> <entry><function>ceil</function>(<type>numeric</type>)</entry>
<entry><type>numeric</type></entry> <entry><type>numeric</type></entry>
<entry>smallest integer not less than argument</entry> <entry>smallest integer not less than argument</entry>
<entry>ceil(-42.8)</entry> <entry><literal>ceil(-42.8)</literal></entry>
<entry>-42</entry> <entry>-42</entry>
</row> </row>
<row> <row>
<entry>degrees(<type>dp</type>)</entry> <entry><function>degrees</function>(<type>dp</type>)</entry>
<entry><type>dp</type></entry> <entry><type>dp</type></entry>
<entry>radians to degrees</entry> <entry>radians to degrees</entry>
<entry>degrees(0.5)</entry> <entry><literal>degrees(0.5)</literal></entry>
<entry>28.6478897565412</entry> <entry>28.6478897565412</entry>
</row> </row>
<row> <row>
<entry>exp(<type>dp</type>)</entry> <entry><function>exp</function>(<type>dp</type>)</entry>
<entry><type>dp</type></entry> <entry><type>dp</type></entry>
<entry>exponential</entry> <entry>exponential</entry>
<entry>exp(1.0)</entry> <entry><literal>exp(1.0)</literal></entry>
<entry>2.71828182845905</entry> <entry>2.71828182845905</entry>
</row> </row>
<row> <row>
<entry>floor(<type>numeric</type>)</entry> <entry><function>floor</function>(<type>numeric</type>)</entry>
<entry><type>numeric</type></entry> <entry><type>numeric</type></entry>
<entry>largest integer not greater than argument</entry> <entry>largest integer not greater than argument</entry>
<entry>floor(-42.8)</entry> <entry><literal>floor(-42.8)</literal></entry>
<entry>-43</entry> <entry>-43</entry>
</row> </row>
<row> <row>
<entry>ln(<type>dp</type>)</entry> <entry><function>ln</function>(<type>dp</type>)</entry>
<entry><type>dp</type></entry> <entry><type>dp</type></entry>
<entry>natural logarithm</entry> <entry>natural logarithm</entry>
<entry>ln(2.0)</entry> <entry><literal>ln(2.0)</literal></entry>
<entry>0.693147180559945</entry> <entry>0.693147180559945</entry>
</row> </row>
<row> <row>
<entry>log(<type>dp</type>)</entry> <entry><function>log</function>(<type>dp</type>)</entry>
<entry><type>dp</type></entry> <entry><type>dp</type></entry>
<entry>base 10 logarithm</entry> <entry>base 10 logarithm</entry>
<entry>log(100.0)</entry> <entry><literal>log(100.0)</literal></entry>
<entry>2</entry> <entry>2</entry>
</row> </row>
<row> <row>
<entry>log(<parameter>b</parameter> <type>numeric</type>, <entry><function>log</function>(<parameter>b</parameter> <type>numeric</type>,
<parameter>x</parameter> <type>numeric</type>)</entry> <parameter>x</parameter> <type>numeric</type>)</entry>
<entry><type>numeric</type></entry> <entry><type>numeric</type></entry>
<entry>logarithm to base <parameter>b</parameter></entry> <entry>logarithm to base <parameter>b</parameter></entry>
<entry>log(2.0, 64.0)</entry> <entry><literal>log(2.0, 64.0)</literal></entry>
<entry>6.0000000000</entry> <entry>6.0000000000</entry>
</row> </row>
<row> <row>
<entry>mod(<parameter>y</parameter>, <parameter>x</parameter>)</entry> <entry><function>mod</function>(<parameter>y</parameter>, <parameter>x</parameter>)</entry>
<entry>(same as argument types)</entry> <entry>(same as argument types)</entry>
<entry>remainder of <parameter>y</parameter>/<parameter>x</parameter></entry> <entry>remainder of <parameter>y</parameter>/<parameter>x</parameter></entry>
<entry>mod(9,4)</entry> <entry><literal>mod(9,4)</literal></entry>
<entry>1</entry> <entry>1</entry>
</row> </row>
<row> <row>
<entry>pi()</entry> <entry><function>pi</function>()</entry>
<entry><type>dp</type></entry> <entry><type>dp</type></entry>
<entry><quote>Pi</quote> constant</entry> <entry><quote>Pi</quote> constant</entry>
<entry>pi()</entry> <entry><literal>pi()</literal></entry>
<entry>3.14159265358979</entry> <entry>3.14159265358979</entry>
</row> </row>
<row> <row>
<entry>pow(<parameter>e</parameter> <type>dp</type>, <entry><function>pow</function>(<parameter>e</parameter> <type>dp</type>,
<parameter>n</parameter> <type>dp</type>)</entry> <parameter>n</parameter> <type>dp</type>)</entry>
<entry><type>dp</type></entry> <entry><type>dp</type></entry>
<entry>raise a number to exponent <parameter>e</parameter></entry> <entry>raise a number to exponent <parameter>e</parameter></entry>
<entry>pow(9.0, 3.0)</entry> <entry><literal>pow(9.0, 3.0)</literal></entry>
<entry>729</entry> <entry>729</entry>
</row> </row>
<row> <row>
<entry>radians(<type>dp</type>)</entry> <entry><function>radians</function>(<type>dp</type>)</entry>
<entry><type>dp</type></entry> <entry><type>dp</type></entry>
<entry>degrees to radians</entry> <entry>degrees to radians</entry>
<entry>radians(45.0)</entry> <entry><literal>radians(45.0)</literal></entry>
<entry>0.785398163397448</entry> <entry>0.785398163397448</entry>
</row> </row>
<row> <row>
<entry>random()</entry> <entry><function>random</function>()</entry>
<entry><type>dp</type></entry> <entry><type>dp</type></entry>
<entry>value between 0.0 to 1.0</entry> <entry>value between 0.0 to 1.0</entry>
<entry>random()</entry> <entry><literal>random()</literal></entry>
<entry></entry> <entry></entry>
</row> </row>
<row> <row>
<entry>round(<type>dp</type>)</entry> <entry><function>round</function>(<type>dp</type>)</entry>
<entry><type>dp</type></entry> <entry><type>dp</type></entry>
<entry>round to nearest integer</entry> <entry>round to nearest integer</entry>
<entry>round(42.4)</entry> <entry><literal>round(42.4)</literal></entry>
<entry>42</entry> <entry>42</entry>
</row> </row>
<row> <row>
<entry>round(<parameter>v</parameter> <type>numeric</type>, <parameter>s</parameter> <type>integer</type>)</entry> <entry><function>round</function>(<parameter>v</parameter> <type>numeric</type>, <parameter>s</parameter> <type>integer</type>)</entry>
<entry><type>numeric</type></entry> <entry><type>numeric</type></entry>
<entry>round to <parameter>s</parameter> decimal places</entry> <entry>round to <parameter>s</parameter> decimal places</entry>
<entry>round(42.4382, 2)</entry> <entry><literal>round(42.4382, 2)</literal></entry>
<entry>42.44</entry> <entry>42.44</entry>
</row> </row>
<!-- <!--
<row> <row>
<entry>setseed(<replaceable>new-seed</replaceable>)</entry> <entry><function>setseed</function>(<replaceable>new-seed</replaceable>)</entry>
<entry>set seed for subsequent random() calls</entry> <entry>set seed for subsequent random() calls</entry>
<entry>setseed(0.54823)</entry> <entry><literal>setseed(0.54823)</literal></entry>
<entry></entry> <entry></entry>
</row> </row>
--> -->
<row> <row>
<entry>sqrt(<type>dp</type>)</entry> <entry><function>sqrt</function>(<type>dp</type>)</entry>
<entry><type>dp</type></entry> <entry><type>dp</type></entry>
<entry>square root</entry> <entry>square root</entry>
<entry>sqrt(2.0)</entry> <entry><literal>sqrt(2.0)</literal></entry>
<entry>1.4142135623731</entry> <entry>1.4142135623731</entry>
</row> </row>
<row> <row>
<entry>trunc(<type>dp</type>)</entry> <entry><function>trunc</function>(<type>dp</type>)</entry>
<entry><type>dp</type></entry> <entry><type>dp</type></entry>
<entry>truncate toward zero</entry> <entry>truncate toward zero</entry>
<entry>trunc(42.8)</entry> <entry><literal>trunc(42.8)</literal></entry>
<entry>42</entry> <entry>42</entry>
</row> </row>
<row> <row>
<entry>trunc(<type>numeric</type>, <parameter>s</parameter> <type>integer</type>)</entry> <entry><function>trunc</function>(<type>numeric</type>, <parameter>s</parameter> <type>integer</type>)</entry>
<entry><type>numeric</type></entry> <entry><type>numeric</type></entry>
<entry>truncate to <parameter>s</parameter> decimal places</entry> <entry>truncate to <parameter>s</parameter> decimal places</entry>
<entry>trunc(42.4382, 2)</entry> <entry><literal>trunc(42.4382, 2)</literal></entry>
<entry>42.43</entry> <entry>42.43</entry>
</row> </row>
...@@ -661,7 +661,7 @@ ...@@ -661,7 +661,7 @@
</table> </table>
<para> <para>
In the table above, "<literal>dp</literal>" indicates <type>double precision</type>. In the table above, <literal>dp</literal> indicates <type>double precision</type>.
The functions <function>exp</function>, <function>ln</function>, The functions <function>exp</function>, <function>ln</function>,
<function>log</function>, <function>pow</function>, <function>log</function>, <function>pow</function>,
<function>round</function> (1 argument), <function>sqrt</function>, <function>round</function> (1 argument), <function>sqrt</function>,
...@@ -688,42 +688,42 @@ ...@@ -688,42 +688,42 @@
<tbody> <tbody>
<row> <row>
<entry>acos(<replaceable>x</replaceable>)</entry> <entry><function>acos</function>(<replaceable>x</replaceable>)</entry>
<entry>inverse cosine</entry> <entry>inverse cosine</entry>
</row> </row>
<row> <row>
<entry>asin(<replaceable>x</replaceable>)</entry> <entry><function>asin</function>(<replaceable>x</replaceable>)</entry>
<entry>inverse sine</entry> <entry>inverse sine</entry>
</row> </row>
<row> <row>
<entry>atan(<replaceable>x</replaceable>)</entry> <entry><function>atan</function>(<replaceable>x</replaceable>)</entry>
<entry>inverse tangent</entry> <entry>inverse tangent</entry>
</row> </row>
<row> <row>
<entry>atan2(<replaceable>x</replaceable>, <replaceable>y</replaceable>)</entry> <entry><function>atan2</function>(<replaceable>x</replaceable>, <replaceable>y</replaceable>)</entry>
<entry>inverse tangent of <replaceable>y</replaceable>/<replaceable>x</replaceable></entry> <entry>inverse tangent of <replaceable>y</replaceable>/<replaceable>x</replaceable></entry>
</row> </row>
<row> <row>
<entry>cos(<replaceable>x</replaceable>)</entry> <entry><function>cos</function>(<replaceable>x</replaceable>)</entry>
<entry>cosine</entry> <entry>cosine</entry>
</row> </row>
<row> <row>
<entry>cot(<replaceable>x</replaceable>)</entry> <entry><function>cot</function>(<replaceable>x</replaceable>)</entry>
<entry>cotangent</entry> <entry>cotangent</entry>
</row> </row>
<row> <row>
<entry>sin(<replaceable>x</replaceable>)</entry> <entry><function>sin</function>(<replaceable>x</replaceable>)</entry>
<entry>sine</entry> <entry>sine</entry>
</row> </row>
<row> <row>
<entry>tan(<replaceable>x</replaceable>)</entry> <entry><function>tan</function>(<replaceable>x</replaceable>)</entry>
<entry>tangent</entry> <entry>tangent</entry>
</row> </row>
</tbody> </tbody>
...@@ -786,20 +786,20 @@ ...@@ -786,20 +786,20 @@
<secondary>concatenation</secondary> <secondary>concatenation</secondary>
</indexterm> </indexterm>
</entry> </entry>
<entry>'Postgre' || 'SQL'</entry> <entry><literal>'Postgre' || 'SQL'</></entry>
<entry>PostgreSQL</entry> <entry><literal>PostgreSQL</></entry>
</row> </row>
<row> <row>
<entry>bit_length(<parameter>string</parameter>)</entry> <entry><function>bit_length</function>(<parameter>string</parameter>)</entry>
<entry><type>integer</type></entry> <entry><type>integer</type></entry>
<entry>number of bits in string</entry> <entry>number of bits in string</entry>
<entry>bit_length('jose')</entry> <entry><literal>bit_length('jose')</literal></entry>
<entry>32</entry> <entry><literal>32</literal></entry>
</row> </row>
<row> <row>
<entry>char_length(<parameter>string</parameter>) or character_length(<parameter>string</parameter>)</entry> <entry><function>char_length</function>(<parameter>string</parameter>) or character_length(<parameter>string</parameter>)</entry>
<entry><type>integer</type></entry> <entry><type>integer</type></entry>
<entry> <entry>
length of string length of string
...@@ -813,36 +813,36 @@ ...@@ -813,36 +813,36 @@
<see>character strings, length</see> <see>character strings, length</see>
</indexterm> </indexterm>
</entry> </entry>
<entry>char_length('jose')</entry> <entry><literal>char_length('jose')</></entry>
<entry>4</entry> <entry><literal>4</></entry>
</row> </row>
<row> <row>
<entry>lower(<parameter>string</parameter>)</entry> <entry><function>lower</function>(<parameter>string</parameter>)</entry>
<entry><type>text</type></entry> <entry><type>text</type></entry>
<entry>Convert string to lower case.</entry> <entry>Convert string to lower case.</entry>
<entry>lower('TOM')</entry> <entry><literal>lower('TOM')</literal></entry>
<entry>tom</entry> <entry><literal>tom</literal></entry>
</row> </row>
<row> <row>
<entry>octet_length(<parameter>string</parameter>)</entry> <entry><function>octet_length</function>(<parameter>string</parameter>)</entry>
<entry><type>integer</type></entry> <entry><type>integer</type></entry>
<entry>number of bytes in string</entry> <entry>number of bytes in string</entry>
<entry>octet_length('jose')</entry> <entry><literal>octet_length('jose')</literal></entry>
<entry>4</entry> <entry><literal>4</literal></entry>
</row> </row>
<row> <row>
<entry>position(<parameter>substring</parameter> in <parameter>string</parameter>)</entry> <entry><function>position</function>(<parameter>substring</parameter> in <parameter>string</parameter>)</entry>
<entry><type>integer</type></entry> <entry><type>integer</type></entry>
<entry>location of specified substring</entry> <entry>location of specified substring</entry>
<entry>position('om' in 'Thomas')</entry> <entry><literal>position('om' in 'Thomas')</literal></entry>
<entry>3</entry> <entry><literal>3</literal></entry>
</row> </row>
<row> <row>
<entry>substring(<parameter>string</parameter> <optional>from <type>integer</type></optional> <optional>for <type>integer</type></optional>)</entry> <entry><function>substring</function>(<parameter>string</parameter> <optional>from <type>integer</type></optional> <optional>for <type>integer</type></optional>)</entry>
<entry><type>text</type></entry> <entry><type>text</type></entry>
<entry> <entry>
extract substring extract substring
...@@ -850,13 +850,13 @@ ...@@ -850,13 +850,13 @@
<primary>substring</primary> <primary>substring</primary>
</indexterm> </indexterm>
</entry> </entry>
<entry>substring('Thomas' from 2 for 3)</entry> <entry><literal>substring('Thomas' from 2 for 3)</literal></entry>
<entry>hom</entry> <entry><literal>hom</literal></entry>
</row> </row>
<row> <row>
<entry> <entry>
trim(<optional>leading | trailing | both</optional> <function>trim</function>(<optional>leading | trailing | both</optional>
<optional><parameter>characters</parameter></optional> from <optional><parameter>characters</parameter></optional> from
<parameter>string</parameter>) <parameter>string</parameter>)
</entry> </entry>
...@@ -866,16 +866,16 @@ ...@@ -866,16 +866,16 @@
<parameter>characters</parameter> (a space by default) from the <parameter>characters</parameter> (a space by default) from the
beginning/end/both ends of the <parameter>string</parameter>. beginning/end/both ends of the <parameter>string</parameter>.
</entry> </entry>
<entry>trim(both 'x' from 'xTomx')</entry> <entry><literal>trim(both 'x' from 'xTomx')</literal></entry>
<entry>Tom</entry> <entry><literal>Tom</literal></entry>
</row> </row>
<row> <row>
<entry>upper(<parameter>string</parameter>)</entry> <entry><function>upper</function>(<parameter>string</parameter>)</entry>
<entry><type>text</type></entry> <entry><type>text</type></entry>
<entry>Convert string to upper case.</entry> <entry>Convert string to upper case.</entry>
<entry>upper('tom')</entry> <entry><literal>upper('tom')</literal></entry>
<entry>TOM</entry> <entry><literal>TOM</literal></entry>
</row> </row>
</tbody> </tbody>
</tgroup> </tgroup>
...@@ -902,58 +902,62 @@ ...@@ -902,58 +902,62 @@
<tbody> <tbody>
<row> <row>
<entry>ascii(<type>text</type>)</entry> <entry><function>ascii</function>(<type>text</type>)</entry>
<entry>integer</entry> <entry>integer</entry>
<entry>Returns the <acronym>ASCII</acronym> code of the first character of the argument.</entry> <entry>Returns the <acronym>ASCII</acronym> code of the first character of the argument.</entry>
<entry>ascii('x')</entry> <entry><literal>ascii('x')</literal></entry>
<entry>120</entry> <entry><literal>120</literal></entry>
</row> </row>
<row> <row>
<entry>btrim(<parameter>string</parameter> <type>text</type>, <parameter>trim</parameter> <type>text</type>)</entry> <entry><function>btrim</function>(<parameter>string</parameter> <type>text</type>, <parameter>trim</parameter> <type>text</type>)</entry>
<entry><type>text</type></entry> <entry><type>text</type></entry>
<entry> <entry>
Remove (trim) the longest string consisting only of characters Remove (trim) the longest string consisting only of characters
in <parameter>trim</parameter> from the start and end of in <parameter>trim</parameter> from the start and end of
<parameter>string</parameter>. <parameter>string</parameter>.
</entry> </entry>
<entry>btrim('xyxtrimyyx','xy')</entry> <entry><literal>btrim('xyxtrimyyx','xy')</literal></entry>
<entry>trim</entry> <entry><literal>trim</literal></entry>
</row> </row>
<row> <row>
<entry>chr(<type>integer</type>)</entry> <entry><function>chr</function>(<type>integer</type>)</entry>
<entry><type>text</type></entry> <entry><type>text</type></entry>
<entry>Returns the character with the given <acronym>ASCII</acronym> code.</entry> <entry>Returns the character with the given <acronym>ASCII</acronym> code.</entry>
<entry>chr(65)</entry> <entry><literal>chr(65)</literal></entry>
<entry>A</entry> <entry><literal>A</literal></entry>
</row> </row>
<row> <row>
<entry>convert(<parameter>string</parameter> <type>text</type>, <entry>
[<parameter>src_encoding</parameter> <type>name</type>,] <function>convert</function>(<parameter>string</parameter> <type>text</type>,
<parameter>dest_encoding</parameter> <type>name</type>)</entry> <optional><parameter>src_encoding</parameter> <type>name</type>,</optional>
<parameter>dest_encoding</parameter> <type>name</type>)
</entry>
<entry><type>text</type></entry> <entry><type>text</type></entry>
<entry>Converts string using <parameter>dest_encoding</parameter>. <entry>
The original encoding is specified by <parameter>src_encoding</parameter>. Converts string using <parameter>dest_encoding</parameter>.
If <parameter>src_encoding</parameter> is omitted, database encoding The original encoding is specified by
is assumed. <parameter>src_encoding</parameter>. If
<parameter>src_encoding</parameter> is omitted, database
encoding is assumed.
</entry> </entry>
<entry>convert('text_in_unicode','UNICODE','LATIN1')</entry> <entry><literal>convert('text_in_unicode', 'UNICODE', 'LATIN1')</literal></entry>
<entry>text_in_unicode (represented in ISO-8859-1)</entry> <entry><literal>text_in_unicode</literal> represented in ISO 8859-1</entry>
</row> </row>
<row> <row>
<entry>initcap(<type>text</type>)</entry> <entry><function>initcap</function>(<type>text</type>)</entry>
<entry><type>text</type></entry> <entry><type>text</type></entry>
<entry>Converts first letter of each word (whitespace separated) to upper case.</entry> <entry>Converts first letter of each word (whitespace separated) to upper case.</entry>
<entry>initcap('hi thomas')</entry> <entry><literal>initcap('hi thomas')</literal></entry>
<entry>Hi Thomas</entry> <entry><literal>Hi Thomas</literal></entry>
</row> </row>
<row> <row>
<entry> <entry>
lpad(<parameter>string</parameter> <type>text</type>, <function>lpad</function>(<parameter>string</parameter> <type>text</type>,
<parameter>length</parameter> <type>integer</type> <parameter>length</parameter> <type>integer</type>
<optional>, <parameter>fill</parameter> <type>text</type></optional>) <optional>, <parameter>fill</parameter> <type>text</type></optional>)
</entry> </entry>
...@@ -966,32 +970,32 @@ ...@@ -966,32 +970,32 @@
<parameter>length</parameter> then it is truncated (on the <parameter>length</parameter> then it is truncated (on the
right). right).
</entry> </entry>
<entry>lpad('hi', 5, 'xy')</entry> <entry><literal>lpad('hi', 5, 'xy')</literal></entry>
<entry>xyxhi</entry> <entry><literal>xyxhi</literal></entry>
</row> </row>
<row> <row>
<entry>ltrim(<parameter>string</parameter> <type>text</type>, <parameter>trim</parameter> <type>text</type>)</entry> <entry><function>ltrim</function>(<parameter>string</parameter> <type>text</type>, <parameter>trim</parameter> <type>text</type>)</entry>
<entry><type>text</type></entry> <entry><type>text</type></entry>
<entry> <entry>
Removes the longest string containing only characters from Removes the longest string containing only characters from
<parameter>trim</parameter> from the start of the string. <parameter>trim</parameter> from the start of the string.
</entry> </entry>
<entry>ltrim('zzzytrim','xyz')</entry> <entry><literal>ltrim('zzzytrim','xyz')</literal></entry>
<entry>trim</entry> <entry><literal>trim</literal></entry>
</row> </row>
<row> <row>
<entry>repeat(<type>text</type>, <type>integer</type>)</entry> <entry><function>repeat</function>(<type>text</type>, <type>integer</type>)</entry>
<entry><type>text</type></entry> <entry><type>text</type></entry>
<entry>Repeat text a number of times.</entry> <entry>Repeat text a number of times.</entry>
<entry>repeat('Pg', 4)</entry> <entry><literal>repeat('Pg', 4)</literal></entry>
<entry>PgPgPgPg</entry> <entry><literal>PgPgPgPg</literal></entry>
</row> </row>
<row> <row>
<entry> <entry>
rpad(<parameter>string</parameter> <type>text</type>, <function>rpad</function>(<parameter>string</parameter> <type>text</type>,
<parameter>length</parameter> <type>integer</type> <parameter>length</parameter> <type>integer</type>
<optional>, <parameter>fill</parameter> <type>text</type></optional>) <optional>, <parameter>fill</parameter> <type>text</type></optional>)
</entry> </entry>
...@@ -1003,23 +1007,23 @@ ...@@ -1003,23 +1007,23 @@
<parameter>string</parameter> is already longer than <parameter>string</parameter> is already longer than
<parameter>length</parameter> then it is truncated. <parameter>length</parameter> then it is truncated.
</entry> </entry>
<entry>rpad('hi', 5, 'xy')</entry> <entry><literal>rpad('hi', 5, 'xy')</literal></entry>
<entry>hixyx</entry> <entry><literal>hixyx</literal></entry>
</row> </row>
<row> <row>
<entry>rtrim(<parameter>string</parameter> text, <parameter>trim</parameter> text)</entry> <entry><function>rtrim</function>(<parameter>string</parameter> text, <parameter>trim</parameter> text)</entry>
<entry><type>text</type></entry> <entry><type>text</type></entry>
<entry> <entry>
Removes the longest string containing only characters from Removes the longest string containing only characters from
<parameter>trim</parameter> from the end of the string. <parameter>trim</parameter> from the end of the string.
</entry> </entry>
<entry>rtrim('trimxxxx','x')</entry> <entry><literal>rtrim('trimxxxx','x')</literal></entry>
<entry>trim</entry> <entry><literal>trim</literal></entry>
</row> </row>
<row> <row>
<entry>strpos(<parameter>string</parameter>, <parameter>substring</parameter>)</entry> <entry><function>strpos</function>(<parameter>string</parameter>, <parameter>substring</parameter>)</entry>
<entry><type>text</type></entry> <entry><type>text</type></entry>
<entry> <entry>
Locates specified substring. (same as Locates specified substring. (same as
...@@ -1027,31 +1031,31 @@ ...@@ -1027,31 +1031,31 @@
<parameter>string</parameter>)</literal>, but note the reversed <parameter>string</parameter>)</literal>, but note the reversed
argument order) argument order)
</entry> </entry>
<entry>strpos('high','ig')</entry> <entry><literal>strpos('high','ig')</literal></entry>
<entry>2</entry> <entry><literal>2</literal></entry>
</row> </row>
<row> <row>
<entry>substr(<parameter>string</parameter>, <parameter>from</parameter> <optional>, <parameter>count</parameter></optional>)</entry> <entry><function>substr</function>(<parameter>string</parameter>, <parameter>from</parameter> <optional>, <parameter>count</parameter></optional>)</entry>
<entry><type>text</type></entry> <entry><type>text</type></entry>
<entry> <entry>
Extracts specified substring. (same as <literal>substring(<parameter>string</parameter> from <parameter>from</parameter> for <parameter>count</parameter>)</literal>) Extracts specified substring. (same as <literal>substring(<parameter>string</parameter> from <parameter>from</parameter> for <parameter>count</parameter>)</literal>)
</entry> </entry>
<entry>substr('alphabet', 3, 2)</entry> <entry><literal>substr('alphabet', 3, 2)</literal></entry>
<entry>ph</entry> <entry><literal>ph</literal></entry>
</row> </row>
<row> <row>
<entry>to_ascii(<type>text</type> <optional>, <parameter>encoding</parameter></optional>)</entry> <entry><function>to_ascii</function>(<type>text</type> <optional>, <parameter>encoding</parameter></optional>)</entry>
<entry><type>text</type></entry> <entry><type>text</type></entry>
<entry>Converts text from multibyte encoding to <acronym>ASCII</acronym>.</entry> <entry>Converts text from multibyte encoding to <acronym>ASCII</acronym>.</entry>
<entry>to_ascii('Karel')</entry> <entry><literal>to_ascii('Karel')</literal></entry>
<entry>Karel</entry> <entry><literal>Karel</literal></entry>
</row> </row>
<row> <row>
<entry> <entry>
translate(<parameter>string</parameter> <type>text</type>, <function>translate</function>(<parameter>string</parameter> <type>text</type>,
<parameter>from</parameter> <type>text</type>, <parameter>from</parameter> <type>text</type>,
<parameter>to</parameter> <type>text</type>) <parameter>to</parameter> <type>text</type>)
</entry> </entry>
...@@ -1062,27 +1066,27 @@ ...@@ -1062,27 +1066,27 @@
the corresponding character in the <parameter>to</parameter> the corresponding character in the <parameter>to</parameter>
set. set.
</entry> </entry>
<entry>translate('12345', '14', 'ax')</entry> <entry><literal>translate('12345', '14', 'ax')</literal></entry>
<entry>a23x5</entry> <entry><literal>a23x5</literal></entry>
</row> </row>
<row> <row>
<entry> <entry>
encode(<parameter>data</parameter> <type>bytea</type>, <function>encode</function>(<parameter>data</parameter> <type>bytea</type>,
<parameter>type</parameter> <type>text</type>) <parameter>type</parameter> <type>text</type>)
</entry> </entry>
<entry><type>text</type></entry> <entry><type>text</type></entry>
<entry> <entry>
Encodes binary data to ascii-only representation. Supported Encodes binary data to <acronym>ASCII</acronym>-only representation. Supported
types are: 'base64', 'hex'. types are: 'base64', 'hex'.
</entry> </entry>
<entry>encode('123\\000\\001', 'base64')</entry> <entry><literal>encode('123\\000\\001', 'base64')</literal></entry>
<entry>MTIzAAE=</entry> <entry><literal>MTIzAAE=</literal></entry>
</row> </row>
<row> <row>
<entry> <entry>
decode(<parameter>string</parameter> <type>text</type>, <function>decode</function>(<parameter>string</parameter> <type>text</type>,
<parameter>type</parameter> <type>text</type>) <parameter>type</parameter> <type>text</type>)
</entry> </entry>
<entry><type>bytea</type></entry> <entry><type>bytea</type></entry>
...@@ -1090,8 +1094,8 @@ ...@@ -1090,8 +1094,8 @@
Decodes binary data from <parameter>string</parameter> previously Decodes binary data from <parameter>string</parameter> previously
encoded with encode(). Parameter type is same as in encode(). encoded with encode(). Parameter type is same as in encode().
</entry> </entry>
<entry>decode('MTIzAAE=', 'base64')</entry> <entry><literal>decode('MTIzAAE=', 'base64')</literal></entry>
<entry>123\000\001</entry> <entry><literal>123\000\001</literal></entry>
</row> </row>
</tbody> </tbody>
...@@ -1235,22 +1239,22 @@ ...@@ -1235,22 +1239,22 @@
<ROW> <ROW>
<ENTRY> <literal>~</literal> </ENTRY> <ENTRY> <literal>~</literal> </ENTRY>
<ENTRY>Matches regular expression, case sensitive</ENTRY> <ENTRY>Matches regular expression, case sensitive</ENTRY>
<ENTRY>'thomas' ~ '.*thomas.*'</ENTRY> <ENTRY><literal>'thomas' ~ '.*thomas.*'</literal></ENTRY>
</ROW> </ROW>
<ROW> <ROW>
<ENTRY> <literal>~*</literal> </ENTRY> <ENTRY> <literal>~*</literal> </ENTRY>
<ENTRY>Matches regular expression, case insensitive</ENTRY> <ENTRY>Matches regular expression, case insensitive</ENTRY>
<ENTRY>'thomas' ~* '.*Thomas.*'</ENTRY> <ENTRY><literal>'thomas' ~* '.*Thomas.*'</literal></ENTRY>
</ROW> </ROW>
<ROW> <ROW>
<ENTRY> <literal>!~</literal> </ENTRY> <ENTRY> <literal>!~</literal> </ENTRY>
<ENTRY>Does not match regular expression, case sensitive</ENTRY> <ENTRY>Does not match regular expression, case sensitive</ENTRY>
<ENTRY>'thomas' !~ '.*Thomas.*'</ENTRY> <ENTRY><literal>'thomas' !~ '.*Thomas.*'</literal></ENTRY>
</ROW> </ROW>
<ROW> <ROW>
<ENTRY> <literal>!~*</literal> </ENTRY> <ENTRY> <literal>!~*</literal> </ENTRY>
<ENTRY>Does not match regular expression, case insensitive</ENTRY> <ENTRY>Does not match regular expression, case insensitive</ENTRY>
<ENTRY>'thomas' !~* '.*vadim.*'</ENTRY> <ENTRY><literal>'thomas' !~* '.*vadim.*'</literal></ENTRY>
</ROW> </ROW>
</tbody> </tbody>
</tgroup> </tgroup>
...@@ -1402,12 +1406,12 @@ ...@@ -1402,12 +1406,12 @@
<para> <para>
Within a bracket expression, a collating element (a character, a Within a bracket expression, a collating element (a character, a
multi-character sequence that collates as if it were a single multiple-character sequence that collates as if it were a single
character, or a collating-sequence name for either) enclosed in character, or a collating-sequence name for either) enclosed in
<literal>[.</literal> and <literal>.]</literal> stands for the <literal>[.</literal> and <literal>.]</literal> stands for the
sequence of characters of that collating element. The sequence is sequence of characters of that collating element. The sequence is
a single element of the bracket expression's list. A bracket a single element of the bracket expression's list. A bracket
expression containing a multi-character collating element can thus expression containing a multiple-character collating element can thus
match more than one character, e.g. if the collating sequence match more than one character, e.g. if the collating sequence
includes a <literal>ch</literal> collating element, then the RE includes a <literal>ch</literal> collating element, then the RE
<literal>[[.ch.]]*c</literal> matches the first five characters of <literal>[[.ch.]]*c</literal> matches the first five characters of
...@@ -1454,7 +1458,7 @@ ...@@ -1454,7 +1458,7 @@
characters. A word character is an alnum character (as defined by characters. A word character is an alnum character (as defined by
<citerefentry><refentrytitle>ctype</refentrytitle><manvolnum>3</manvolnum></citerefentry>) <citerefentry><refentrytitle>ctype</refentrytitle><manvolnum>3</manvolnum></citerefentry>)
or an underscore. This is an extension, compatible with but not or an underscore. This is an extension, compatible with but not
specified by POSIX 1003.2, and should be used with caution in specified by <acronym>POSIX</acronym> 1003.2, and should be used with caution in
software intended to be portable to other systems. software intended to be portable to other systems.
</para> </para>
...@@ -1559,52 +1563,52 @@ ...@@ -1559,52 +1563,52 @@
</thead> </thead>
<tbody> <tbody>
<row> <row>
<entry>to_char(timestamp, text)</entry> <entry><function>to_char</function>(<type>timestamp</type>, <type>text</type>)</entry>
<entry>text</entry> <entry><type>text</type></entry>
<entry>convert timestamp to string</entry> <entry>convert time stamp to string</entry>
<entry>to_char(timestamp 'now','HH12:MI:SS')</entry> <entry><literal>to_char(timestamp 'now','HH12:MI:SS')</literal></entry>
</row> </row>
<row> <row>
<entry>to_char(interval, text)</entry> <entry><function>to_char</function>(<type>interval</type>, <type>text</type>)</entry>
<entry>text</entry> <entry><type>text</type></entry>
<entry>convert interval to string</entry> <entry>convert interval to string</entry>
<entry>to_char(interval '15h 2m 12s','HH24:MI:SS')</entry> <entry><literal>to_char(interval '15h 2m 12s','HH24:MI:SS')</literal></entry>
</row> </row>
<row> <row>
<entry>to_char(int, text)</entry> <entry><function>to_char</function>(<type>int</type>, <type>text</type>)</entry>
<entry>text</entry> <entry><type>text</type></entry>
<entry>convert int4/int8 to string</entry> <entry>convert int4/int8 to string</entry>
<entry>to_char(125, '999')</entry> <entry><literal>to_char(125, '999')</literal></entry>
</row> </row>
<row> <row>
<entry>to_char(double precision, text)</entry> <entry><function>to_char</function>(<type>double precision</type>, <type>text</type>)</entry>
<entry>text</entry> <entry><type>text</type></entry>
<entry>convert real/double precision to string</entry> <entry>convert real/double precision to string</entry>
<entry>to_char(125.8, '999D9')</entry> <entry><literal>to_char(125.8, '999D9')</literal></entry>
</row> </row>
<row> <row>
<entry>to_char(numeric, text)</entry> <entry><function>to_char</function>(<type>numeric</type>, <type>text</type>)</entry>
<entry>text</entry> <entry><type>text</type></entry>
<entry>convert numeric to string</entry> <entry>convert numeric to string</entry>
<entry>to_char(numeric '-125.8', '999D99S')</entry> <entry><literal>to_char(numeric '-125.8', '999D99S')</literal></entry>
</row> </row>
<row> <row>
<entry>to_date(text, text)</entry> <entry><function>to_date</function>(<type>text</type>, <type>text</type>)</entry>
<entry>date</entry> <entry><type>date</type></entry>
<entry>convert string to date</entry> <entry>convert string to date</entry>
<entry>to_date('05 Dec 2000', 'DD Mon YYYY')</entry> <entry><literal>to_date('05 Dec 2000', 'DD Mon YYYY')</literal></entry>
</row> </row>
<row> <row>
<entry>to_timestamp(text, text)</entry> <entry><function>to_timestamp</function>(<type>text</type>, <type>text</type>)</entry>
<entry>timestamp</entry> <entry><type>timestamp</type></entry>
<entry>convert string to timestamp</entry> <entry>convert string to time stamp</entry>
<entry>to_timestamp('05 Dec 2000', 'DD Mon YYYY')</entry> <entry><literal>to_timestamp('05 Dec 2000', 'DD Mon YYYY')</literal></entry>
</row> </row>
<row> <row>
<entry>to_number(text, text)</entry> <entry><function>to_number</function>(<type>text</type>, <type>text</type>)</entry>
<entry>numeric</entry> <entry><type>numeric</type></entry>
<entry>convert string to numeric</entry> <entry>convert string to numeric</entry>
<entry>to_number('12,454.8-', '99G999D9S')</entry> <entry><literal>to_number('12,454.8-', '99G999D9S')</literal></entry>
</row> </row>
</tbody> </tbody>
</tgroup> </tgroup>
...@@ -1632,175 +1636,175 @@ ...@@ -1632,175 +1636,175 @@
</thead> </thead>
<tbody> <tbody>
<row> <row>
<entry>HH</entry> <entry><literal>HH</literal></entry>
<entry>hour of day (01-12)</entry> <entry>hour of day (01-12)</entry>
</row> </row>
<row> <row>
<entry>HH12</entry> <entry><literal>HH12</literal></entry>
<entry>hour of day (01-12)</entry> <entry>hour of day (01-12)</entry>
</row> </row>
<row> <row>
<entry>HH24</entry> <entry><literal>HH24</literal></entry>
<entry>hour of day (00-23)</entry> <entry>hour of day (00-23)</entry>
</row> </row>
<row> <row>
<entry>MI</entry> <entry><literal>MI</literal></entry>
<entry>minute (00-59)</entry> <entry>minute (00-59)</entry>
</row> </row>
<row> <row>
<entry>SS</entry> <entry><literal>SS</literal></entry>
<entry>second (00-59)</entry> <entry>second (00-59)</entry>
</row> </row>
<row> <row>
<entry>MS</entry> <entry><literal>MS</literal></entry>
<entry>millisecond (000-999)</entry> <entry>millisecond (000-999)</entry>
</row> </row>
<row> <row>
<entry>US</entry> <entry><literal>US</literal></entry>
<entry>microsecond (000000-999999)</entry> <entry>microsecond (000000-999999)</entry>
</row> </row>
<row> <row>
<entry>SSSS</entry> <entry><literal>SSSS</literal></entry>
<entry>seconds past midnight (0-86399)</entry> <entry>seconds past midnight (0-86399)</entry>
</row> </row>
<row> <row>
<entry>AM or A.M. or PM or P.M.</entry> <entry><literal>AM</literal> or <literal>A.M.</literal> or <literal>PM</literal> or <literal>P.M.</literal></entry>
<entry>meridian indicator (upper case)</entry> <entry>meridian indicator (upper case)</entry>
</row> </row>
<row> <row>
<entry>am or a.m. or pm or p.m.</entry> <entry><literal>am</literal> or <literal>a.m.</literal> or <literal>pm</literal> or <literal>p.m.</literal></entry>
<entry>meridian indicator (lower case)</entry> <entry>meridian indicator (lower case)</entry>
</row> </row>
<row> <row>
<entry>Y,YYY</entry> <entry><literal>Y,YYY</literal></entry>
<entry>year (4 and more digits) with comma</entry> <entry>year (4 and more digits) with comma</entry>
</row> </row>
<row> <row>
<entry>YYYY</entry> <entry><literal>YYYY</literal></entry>
<entry>year (4 and more digits)</entry> <entry>year (4 and more digits)</entry>
</row> </row>
<row> <row>
<entry>YYY</entry> <entry><literal>YYY</literal></entry>
<entry>last 3 digits of year</entry> <entry>last 3 digits of year</entry>
</row> </row>
<row> <row>
<entry>YY</entry> <entry><literal>YY</literal></entry>
<entry>last 2 digits of year</entry> <entry>last 2 digits of year</entry>
</row> </row>
<row> <row>
<entry>Y</entry> <entry><literal>Y</literal></entry>
<entry>last digit of year</entry> <entry>last digit of year</entry>
</row> </row>
<row> <row>
<entry>BC or B.C. or AD or A.D.</entry> <entry><literal>BC</literal> or <literal>B.C.</literal> or <literal>AD</literal> or <literal>A.D.</literal></entry>
<entry>year indicator (upper case)</entry> <entry>era indicator (upper case)</entry>
</row> </row>
<row> <row>
<entry>bc or b.c. or ad or a.d.</entry> <entry><literal>bc</literal> or <literal>b.c.</literal> or <literal>ad</literal> or <literal>a.d.</literal></entry>
<entry>year indicator (lower case)</entry> <entry>era indicator (lower case)</entry>
</row> </row>
<row> <row>
<entry>MONTH</entry> <entry><literal>MONTH</literal></entry>
<entry>full upper case month name (blank-padded to 9 chars)</entry> <entry>full upper case month name (blank-padded to 9 chars)</entry>
</row> </row>
<row> <row>
<entry>Month</entry> <entry><literal>Month</literal></entry>
<entry>full mixed case month name (blank-padded to 9 chars)</entry> <entry>full mixed case month name (blank-padded to 9 chars)</entry>
</row> </row>
<row> <row>
<entry>month</entry> <entry><literal>month</literal></entry>
<entry>full lower case month name (blank-padded to 9 chars)</entry> <entry>full lower case month name (blank-padded to 9 chars)</entry>
</row> </row>
<row> <row>
<entry>MON</entry> <entry><literal>MON</literal></entry>
<entry>abbreviated upper case month name (3 chars)</entry> <entry>abbreviated upper case month name (3 chars)</entry>
</row> </row>
<row> <row>
<entry>Mon</entry> <entry><literal>Mon</literal></entry>
<entry>abbreviated mixed case month name (3 chars)</entry> <entry>abbreviated mixed case month name (3 chars)</entry>
</row> </row>
<row> <row>
<entry>mon</entry> <entry><literal>mon</literal></entry>
<entry>abbreviated lower case month name (3 chars)</entry> <entry>abbreviated lower case month name (3 chars)</entry>
</row> </row>
<row> <row>
<entry>MM</entry> <entry><literal>MM</literal></entry>
<entry>month number (01-12)</entry> <entry>month number (01-12)</entry>
</row> </row>
<row> <row>
<entry>DAY</entry> <entry><literal>DAY</literal></entry>
<entry>full upper case day name (blank-padded to 9 chars)</entry> <entry>full upper case day name (blank-padded to 9 chars)</entry>
</row> </row>
<row> <row>
<entry>Day</entry> <entry><literal>Day</literal></entry>
<entry>full mixed case day name (blank-padded to 9 chars)</entry> <entry>full mixed case day name (blank-padded to 9 chars)</entry>
</row> </row>
<row> <row>
<entry>day</entry> <entry><literal>day</literal></entry>
<entry>full lower case day name (blank-padded to 9 chars)</entry> <entry>full lower case day name (blank-padded to 9 chars)</entry>
</row> </row>
<row> <row>
<entry>DY</entry> <entry><literal>DY</literal></entry>
<entry>abbreviated upper case day name (3 chars)</entry> <entry>abbreviated upper case day name (3 chars)</entry>
</row> </row>
<row> <row>
<entry>Dy</entry> <entry><literal>Dy</literal></entry>
<entry>abbreviated mixed case day name (3 chars)</entry> <entry>abbreviated mixed case day name (3 chars)</entry>
</row> </row>
<row> <row>
<entry>dy</entry> <entry><literal>dy</literal></entry>
<entry>abbreviated lower case day name (3 chars)</entry> <entry>abbreviated lower case day name (3 chars)</entry>
</row> </row>
<row> <row>
<entry>DDD</entry> <entry><literal>DDD</literal></entry>
<entry>day of year (001-366)</entry> <entry>day of year (001-366)</entry>
</row> </row>
<row> <row>
<entry>DD</entry> <entry><literal>DD</literal></entry>
<entry>day of month (01-31)</entry> <entry>day of month (01-31)</entry>
</row> </row>
<row> <row>
<entry>D</entry> <entry><literal>D</literal></entry>
<entry>day of week (1-7; SUN=1)</entry> <entry>day of week (1-7; SUN=1)</entry>
</row> </row>
<row> <row>
<entry>W</entry> <entry><literal>W</literal></entry>
<entry>week of month (1-5) where first week start on the first day of the month</entry> <entry>week of month (1-5) where first week start on the first day of the month</entry>
</row> </row>
<row> <row>
<entry>WW</entry> <entry><literal>WW</literal></entry>
<entry>week number of year (1-53) where first week start on the first day of the year</entry> <entry>week number of year (1-53) where first week start on the first day of the year</entry>
</row> </row>
<row> <row>
<entry>IW</entry> <entry><literal>IW</literal></entry>
<entry>ISO week number of year (The first Thursday of the new year is in week 1.)</entry> <entry>ISO week number of year (The first Thursday of the new year is in week 1.)</entry>
</row> </row>
<row> <row>
<entry>CC</entry> <entry><literal>CC</literal></entry>
<entry>century (2 digits)</entry> <entry>century (2 digits)</entry>
</row> </row>
<row> <row>
<entry>J</entry> <entry><literal>J</literal></entry>
<entry>Julian Day (days since January 1, 4712 BC)</entry> <entry>Julian Day (days since January 1, 4712 BC)</entry>
</row> </row>
<row> <row>
<entry>Q</entry> <entry><literal>Q</literal></entry>
<entry>quarter</entry> <entry>quarter</entry>
</row> </row>
<row> <row>
<entry>RM</entry> <entry><literal>RM</literal></entry>
<entry>month in Roman Numerals (I-XII; I=January) - upper case</entry> <entry>month in Roman Numerals (I-XII; I=January) - upper case</entry>
</row> </row>
<row> <row>
<entry>rm</entry> <entry><literal>rm</literal></entry>
<entry>month in Roman Numerals (I-XII; I=January) - lower case</entry> <entry>month in Roman Numerals (I-XII; I=January) - lower case</entry>
</row> </row>
<row> <row>
<entry>TZ</entry> <entry><literal>TZ</literal></entry>
<entry>timezone name - upper case</entry> <entry>timezone name - upper case</entry>
</row> </row>
<row> <row>
<entry>tz</entry> <entry><literal>tz</literal></entry>
<entry>timezone name - lower case</entry> <entry>timezone name - lower case</entry>
</row> </row>
</tbody> </tbody>
...@@ -1830,27 +1834,27 @@ ...@@ -1830,27 +1834,27 @@
<row> <row>
<entry><literal>FM</literal> prefix</entry> <entry><literal>FM</literal> prefix</entry>
<entry>fill mode (suppress padding blanks and zeroes)</entry> <entry>fill mode (suppress padding blanks and zeroes)</entry>
<entry>FMMonth</entry> <entry><literal>FMMonth</literal></entry>
</row> </row>
<row> <row>
<entry><literal>TH</literal> suffix</entry> <entry><literal>TH</literal> suffix</entry>
<entry>add upper-case ordinal number suffix</entry> <entry>add upper-case ordinal number suffix</entry>
<entry>DDTH</entry> <entry><literal>DDTH</literal></entry>
</row> </row>
<row> <row>
<entry><literal>th</literal> suffix</entry> <entry><literal>th</literal> suffix</entry>
<entry>add lower-case ordinal number suffix</entry> <entry>add lower-case ordinal number suffix</entry>
<entry>DDth</entry> <entry><literal>DDth</literal></entry>
</row> </row>
<row> <row>
<entry><literal>FX</literal> prefix</entry> <entry><literal>FX</literal> prefix</entry>
<entry>FiXed format global option (see below)</entry> <entry>Fixed format global option (see below)</entry>
<entry>FX Month DD Day</entry> <entry><literal>FX Month DD Day</literal></entry>
</row> </row>
<row> <row>
<entry><literal>SP</literal> suffix</entry> <entry><literal>SP</literal> suffix</entry>
<entry>spell mode (not yet implemented)</entry> <entry>spell mode (not yet implemented)</entry>
<entry>DDSP</entry> <entry><literal>DDSP</literal></entry>
</row> </row>
</tbody> </tbody>
</tgroup> </tgroup>
...@@ -1913,8 +1917,8 @@ ...@@ -1913,8 +1917,8 @@
<listitem> <listitem>
<para> <para>
<literal>YYYY</literal> conversion from string to timestamp or <literal>YYYY</literal> conversion from string to <type>timestamp</type> or
date is restricted if you use a year with more than 4 digits. You must <type>date</type> is restricted if you use a year with more than 4 digits. You must
use some non-digit character or template after <literal>YYYY</literal>, use some non-digit character or template after <literal>YYYY</literal>,
otherwise the year is always interpreted as 4 digits. For example otherwise the year is always interpreted as 4 digits. For example
(with year 20000): (with year 20000):
...@@ -1928,14 +1932,14 @@ ...@@ -1928,14 +1932,14 @@
<listitem> <listitem>
<para> <para>
Millisecond <literal>MS</literal> and microcesond <literal>US</literal> Millisecond <literal>MS</literal> and microsecond <literal>US</literal>
values are in conversion from string to timestamp used as part of values are in conversion from string to time stamp used as part of
second after decimal point. For example second after decimal point. For example
<literal>to_timestamp('12:3', 'SS:MS')</literal> is not 3 milliseconds, <literal>to_timestamp('12:3', 'SS:MS')</literal> is not 3 milliseconds,
but 300, because the conversion count it as <literal>12 + 0.3</literal>. but 300, because the conversion count it as <literal>12 + 0.3</literal>.
It means for format 'SS:MS' is '12:3' or '12:30' or '12:300' same It means for format 'SS:MS' is '12:3' or '12:30' or '12:300' same
number of miliceconds. For the three milliseconds must be used number of milliseconds. For the three milliseconds must be used
'12:003' that the counversion count as '12:003' that the conversion count as
<literal> 12 + 0.003 = 12.003 seconds </literal>. Here is a more <literal> 12 + 0.003 = 12.003 seconds </literal>. Here is a more
complex example: complex example:
<literal>to_timestamp('15:12:02.020.001230','HH:MI:SS.MS.US')</literal> <literal>to_timestamp('15:12:02.020.001230','HH:MI:SS.MS.US')</literal>
...@@ -1957,68 +1961,68 @@ ...@@ -1957,68 +1961,68 @@
</thead> </thead>
<tbody> <tbody>
<row> <row>
<entry>9</entry> <entry><literal>9</literal></entry>
<entry>value with the specified number of digits</entry> <entry>value with the specified number of digits</entry>
</row> </row>
<row> <row>
<entry>0</entry> <entry><literal>0</literal></entry>
<entry>value with leading zeros</entry> <entry>value with leading zeros</entry>
</row> </row>
<row> <row>
<entry>. (period)</entry> <entry><literal>.</literal> (period)</entry>
<entry>decimal point</entry> <entry>decimal point</entry>
</row> </row>
<row> <row>
<entry>, (comma)</entry> <entry><literal>,</literal> (comma)</entry>
<entry>group (thousand) separator</entry> <entry>group (thousand) separator</entry>
</row> </row>
<row> <row>
<entry>PR</entry> <entry><literal>PR</literal></entry>
<entry>negative value in angle brackets</entry> <entry>negative value in angle brackets</entry>
</row> </row>
<row> <row>
<entry>S</entry> <entry><literal>S</literal></entry>
<entry>negative value with minus sign (uses locale)</entry> <entry>negative value with minus sign (uses locale)</entry>
</row> </row>
<row> <row>
<entry>L</entry> <entry><literal>L</literal></entry>
<entry>currency symbol (uses locale)</entry> <entry>currency symbol (uses locale)</entry>
</row> </row>
<row> <row>
<entry>D</entry> <entry><literal>D</literal></entry>
<entry>decimal point (uses locale)</entry> <entry>decimal point (uses locale)</entry>
</row> </row>
<row> <row>
<entry>G</entry> <entry><literal>G</literal></entry>
<entry>group separator (uses locale)</entry> <entry>group separator (uses locale)</entry>
</row> </row>
<row> <row>
<entry>MI</entry> <entry><literal>MI</literal></entry>
<entry>minus sign in specified position (if number < 0)</entry> <entry>minus sign in specified position (if number < 0)</entry>
</row> </row>
<row> <row>
<entry>PL</entry> <entry><literal>PL</literal></entry>
<entry>plus sign in specified position (if number > 0)</entry> <entry>plus sign in specified position (if number > 0)</entry>
</row> </row>
<row> <row>
<entry>SG</entry> <entry><literal>SG</literal></entry>
<entry>plus/minus sign in specified position</entry> <entry>plus/minus sign in specified position</entry>
</row> </row>
<row> <row>
<entry>RN</entry> <entry><literal>RN</literal></entry>
<entry>roman numeral (input between 1 and 3999)</entry> <entry>roman numeral (input between 1 and 3999)</entry>
</row> </row>
<row> <row>
<entry>TH or th</entry> <entry><literal>TH</literal> or <literal>th</literal></entry>
<entry>convert to ordinal number</entry> <entry>convert to ordinal number</entry>
</row> </row>
<row> <row>
<entry>V</entry> <entry><literal>V</literal></entry>
<entry>shift <replaceable>n</replaceable> digits (see <entry>shift <replaceable>n</replaceable> digits (see
notes)</entry> notes)</entry>
</row> </row>
<row> <row>
<entry>EEEE</entry> <entry><literal>EEEE</literal></entry>
<entry>scientific numbers (not supported yet)</entry> <entry>scientific numbers (not supported yet)</entry>
</row> </row>
</tbody> </tbody>
...@@ -2093,135 +2097,135 @@ ...@@ -2093,135 +2097,135 @@
</thead> </thead>
<tbody> <tbody>
<row> <row>
<entry>to_char(now(),'Day, DD HH12:MI:SS')</entry> <entry><literal>to_char(now(),'Day, DD HH12:MI:SS')</literal></entry>
<entry><literal>'Tuesday , 06 05:39:18'</literal></entry> <entry><literal>'Tuesday , 06 05:39:18'</literal></entry>
</row> </row>
<row> <row>
<entry>to_char(now(),'FMDay, FMDD HH12:MI:SS')</entry> <entry><literal>to_char(now(),'FMDay, FMDD HH12:MI:SS')</literal></entry>
<entry><literal>'Tuesday, 6 05:39:18'</literal></entry> <entry><literal>'Tuesday, 6 05:39:18'</literal></entry>
</row> </row>
<row> <row>
<entry>to_char(-0.1,'99.99')</entry> <entry><literal>to_char(-0.1,'99.99')</literal></entry>
<entry><literal>' -.10'</literal></entry> <entry><literal>' -.10'</literal></entry>
</row> </row>
<row> <row>
<entry>to_char(-0.1,'FM9.99')</entry> <entry><literal>to_char(-0.1,'FM9.99')</literal></entry>
<entry><literal>'-.1'</literal></entry> <entry><literal>'-.1'</literal></entry>
</row> </row>
<row> <row>
<entry>to_char(0.1,'0.9')</entry> <entry><literal>to_char(0.1,'0.9')</literal></entry>
<entry><literal>' 0.1'</literal></entry> <entry><literal>' 0.1'</literal></entry>
</row> </row>
<row> <row>
<entry>to_char(12,'9990999.9')</entry> <entry><literal>to_char(12,'9990999.9')</literal></entry>
<entry><literal>' 0012.0'</literal></entry> <entry><literal>' 0012.0'</literal></entry>
</row> </row>
<row> <row>
<entry>to_char(12,'FM9990999.9')</entry> <entry><literal>to_char(12,'FM9990999.9')</literal></entry>
<entry><literal>'0012'</literal></entry> <entry><literal>'0012'</literal></entry>
</row> </row>
<row> <row>
<entry>to_char(485,'999')</entry> <entry><literal>to_char(485,'999')</literal></entry>
<entry><literal>' 485'</literal></entry> <entry><literal>' 485'</literal></entry>
</row> </row>
<row> <row>
<entry>to_char(-485,'999')</entry> <entry><literal>to_char(-485,'999')</literal></entry>
<entry><literal>'-485'</literal></entry> <entry><literal>'-485'</literal></entry>
</row> </row>
<row> <row>
<entry>to_char(485,'9 9 9')</entry> <entry><literal>to_char(485,'9 9 9')</literal></entry>
<entry><literal>' 4 8 5'</literal></entry> <entry><literal>' 4 8 5'</literal></entry>
</row> </row>
<row> <row>
<entry>to_char(1485,'9,999')</entry> <entry><literal>to_char(1485,'9,999')</literal></entry>
<entry><literal>' 1,485'</literal></entry> <entry><literal>' 1,485'</literal></entry>
</row> </row>
<row> <row>
<entry>to_char(1485,'9G999')</entry> <entry><literal>to_char(1485,'9G999')</literal></entry>
<entry><literal>' 1 485'</literal></entry> <entry><literal>' 1 485'</literal></entry>
</row> </row>
<row> <row>
<entry>to_char(148.5,'999.999')</entry> <entry><literal>to_char(148.5,'999.999')</literal></entry>
<entry><literal>' 148.500'</literal></entry> <entry><literal>' 148.500'</literal></entry>
</row> </row>
<row> <row>
<entry>to_char(148.5,'999D999')</entry> <entry><literal>to_char(148.5,'999D999')</literal></entry>
<entry><literal>' 148,500'</literal></entry> <entry><literal>' 148,500'</literal></entry>
</row> </row>
<row> <row>
<entry>to_char(3148.5,'9G999D999')</entry> <entry><literal>to_char(3148.5,'9G999D999')</literal></entry>
<entry><literal>' 3 148,500'</literal></entry> <entry><literal>' 3 148,500'</literal></entry>
</row> </row>
<row> <row>
<entry>to_char(-485,'999S')</entry> <entry><literal>to_char(-485,'999S')</literal></entry>
<entry><literal>'485-'</literal></entry> <entry><literal>'485-'</literal></entry>
</row> </row>
<row> <row>
<entry>to_char(-485,'999MI')</entry> <entry><literal>to_char(-485,'999MI')</literal></entry>
<entry><literal>'485-'</literal></entry> <entry><literal>'485-'</literal></entry>
</row> </row>
<row> <row>
<entry>to_char(485,'999MI')</entry> <entry><literal>to_char(485,'999MI')</literal></entry>
<entry><literal>'485'</literal></entry> <entry><literal>'485'</literal></entry>
</row> </row>
<row> <row>
<entry>to_char(485,'PL999')</entry> <entry><literal>to_char(485,'PL999')</literal></entry>
<entry><literal>'+485'</literal></entry> <entry><literal>'+485'</literal></entry>
</row> </row>
<row> <row>
<entry>to_char(485,'SG999')</entry> <entry><literal>to_char(485,'SG999')</literal></entry>
<entry><literal>'+485'</literal></entry> <entry><literal>'+485'</literal></entry>
</row> </row>
<row> <row>
<entry>to_char(-485,'SG999')</entry> <entry><literal>to_char(-485,'SG999')</literal></entry>
<entry><literal>'-485'</literal></entry> <entry><literal>'-485'</literal></entry>
</row> </row>
<row> <row>
<entry>to_char(-485,'9SG99')</entry> <entry><literal>to_char(-485,'9SG99')</literal></entry>
<entry><literal>'4-85'</literal></entry> <entry><literal>'4-85'</literal></entry>
</row> </row>
<row> <row>
<entry>to_char(-485,'999PR')</entry> <entry><literal>to_char(-485,'999PR')</literal></entry>
<entry><literal>'&lt;485&gt;'</literal></entry> <entry><literal>'&lt;485&gt;'</literal></entry>
</row> </row>
<row> <row>
<entry>to_char(485,'L999')</entry> <entry><literal>to_char(485,'L999')</literal></entry>
<entry><literal>'DM 485</literal></entry> <entry><literal>'DM 485</literal></entry>
</row> </row>
<row> <row>
<entry>to_char(485,'RN')</entry> <entry><literal>to_char(485,'RN')</literal></entry>
<entry><literal>' CDLXXXV'</literal></entry> <entry><literal>' CDLXXXV'</literal></entry>
</row> </row>
<row> <row>
<entry>to_char(485,'FMRN')</entry> <entry><literal>to_char(485,'FMRN')</literal></entry>
<entry><literal>'CDLXXXV'</literal></entry> <entry><literal>'CDLXXXV'</literal></entry>
</row> </row>
<row> <row>
<entry>to_char(5.2,'FMRN')</entry> <entry><literal>to_char(5.2,'FMRN')</literal></entry>
<entry><literal>V</literal></entry> <entry><literal>V</literal></entry>
</row> </row>
<row> <row>
<entry>to_char(482,'999th')</entry> <entry><literal>to_char(482,'999th')</literal></entry>
<entry><literal>' 482nd'</literal></entry> <entry><literal>' 482nd'</literal></entry>
</row> </row>
<row> <row>
<entry>to_char(485, '"Good number:"999')</entry> <entry><literal>to_char(485, '"Good number:"999')</literal></entry>
<entry><literal>'Good number: 485'</literal></entry> <entry><literal>'Good number: 485'</literal></entry>
</row> </row>
<row> <row>
<entry>to_char(485.8,'"Pre:"999" Post:" .999')</entry> <entry><literal>to_char(485.8,'"Pre:"999" Post:" .999')</literal></entry>
<entry><literal>'Pre: 485 Post: .800'</literal></entry> <entry><literal>'Pre: 485 Post: .800'</literal></entry>
</row> </row>
<row> <row>
<entry>to_char(12,'99V999')</entry> <entry><literal>to_char(12,'99V999')</literal></entry>
<entry><literal>' 12000'</literal></entry> <entry><literal>' 12000'</literal></entry>
</row> </row>
<row> <row>
<entry>to_char(12.4,'99V999')</entry> <entry><literal>to_char(12.4,'99V999')</literal></entry>
<entry><literal>' 12400'</literal></entry> <entry><literal>' 12400'</literal></entry>
</row> </row>
<row> <row>
<entry>to_char(12.45, '99V9')</entry> <entry><literal>to_char(12.45, '99V9')</literal></entry>
<entry><literal>' 125'</literal></entry> <entry><literal>' 125'</literal></entry>
</row> </row>
</tbody> </tbody>
...@@ -2259,24 +2263,24 @@ ...@@ -2259,24 +2263,24 @@
<tbody> <tbody>
<row> <row>
<entry>age(timestamp)</entry> <entry><function>age</function>(<type>timestamp</type>)</entry>
<entry>interval</entry> <entry><type>interval</type></entry>
<entry>Subtract from today</entry> <entry>Subtract from today</entry>
<entry>age(timestamp '1957-06-13')</entry> <entry><literal>age(timestamp '1957-06-13')</literal></entry>
<entry>43 years 8 mons 3 days</entry> <entry><literal>43 years 8 mons 3 days</literal></entry>
</row> </row>
<row> <row>
<entry>age(timestamp, timestamp)</entry> <entry><function>age</function>(<type>timestamp</type>, <type>timestamp</type>)</entry>
<entry>interval</entry> <entry><type>interval</type></entry>
<entry>Subtract arguments</entry> <entry>Subtract arguments</entry>
<entry>age('2001-04-10', timestamp '1957-06-13')</entry> <entry><literal>age('2001-04-10', timestamp '1957-06-13')</literal></entry>
<entry>43 years 9 mons 27 days</entry> <entry><literal>43 years 9 mons 27 days</literal></entry>
</row> </row>
<row> <row>
<entry>current_date</entry> <entry><function>current_date</function></entry>
<entry>date</entry> <entry><type>date</type></entry>
<entry>Today's date; see <link <entry>Today's date; see <link
linkend="functions-datetime-current">below</link> linkend="functions-datetime-current">below</link>
</entry> </entry>
...@@ -2285,8 +2289,8 @@ ...@@ -2285,8 +2289,8 @@
</row> </row>
<row> <row>
<entry>current_time</entry> <entry><function>current_time</function></entry>
<entry>time</entry> <entry><type>time</type></entry>
<entry>Time of day; see <link <entry>Time of day; see <link
linkend="functions-datetime-current">below</link> linkend="functions-datetime-current">below</link>
</entry> </entry>
...@@ -2295,8 +2299,8 @@ ...@@ -2295,8 +2299,8 @@
</row> </row>
<row> <row>
<entry>current_timestamp</entry> <entry><function>current_timestamp</function></entry>
<entry>timestamp</entry> <entry><type>timestamp</type></entry>
<entry>date and time; see also <link <entry>date and time; see also <link
linkend="functions-datetime-current">below</link> linkend="functions-datetime-current">below</link>
</entry> </entry>
...@@ -2305,76 +2309,76 @@ ...@@ -2305,76 +2309,76 @@
</row> </row>
<row> <row>
<entry>date_part(text, timestamp)</entry> <entry><function>date_part</function>(<type>text</type>, <type>timestamp</type>)</entry>
<entry>double precision</entry> <entry><type>double precision</type></entry>
<entry>Get subfield (equivalent to <entry>Get subfield (equivalent to
<function>extract</function>); see also <link <function>extract</function>); see also <link
linkend="functions-datetime-datepart">below</link> linkend="functions-datetime-datepart">below</link>
</entry> </entry>
<entry>date_part('hour', timestamp '2001-02-16 20:38:40')</entry> <entry><literal>date_part('hour', timestamp '2001-02-16 20:38:40')</literal></entry>
<entry>20</entry> <entry><literal>20</literal></entry>
</row> </row>
<row> <row>
<entry>date_part(text, interval)</entry> <entry><function>date_part</function>(<type>text</type>, <type>interval</type>)</entry>
<entry>double precision</entry> <entry><type>double precision</type></entry>
<entry>Get subfield (equivalent to <entry>Get subfield (equivalent to
<function>extract</function>); see also <link <function>extract</function>); see also <link
linkend="functions-datetime-datepart">below</link> linkend="functions-datetime-datepart">below</link>
</entry> </entry>
<entry>date_part('month', interval '2 years 3 months')</entry> <entry><literal>date_part('month', interval '2 years 3 months')</literal></entry>
<entry>3</entry> <entry><literal>3</literal></entry>
</row> </row>
<row> <row>
<entry>date_trunc(text, timestamp)</entry> <entry><function>date_trunc</function>(<type>text</type>, <type>timestamp</type>)</entry>
<entry>timestamp</entry> <entry><type>timestamp</type></entry>
<entry>Truncate to specified precision; see also <link <entry>Truncate to specified precision; see also <link
linkend="functions-datetime-trunc">below</link> linkend="functions-datetime-trunc">below</link>
</entry> </entry>
<entry>date_trunc('hour', timestamp '2001-02-16 20:38:40')</entry> <entry><literal>date_trunc('hour', timestamp '2001-02-16 20:38:40')</literal></entry>
<entry>2001-02-16 20:00:00+00</entry> <entry><literal>2001-02-16 20:00:00+00</literal></entry>
</row> </row>
<row> <row>
<entry>extract(<parameter>field</parameter> from timestamp)</entry> <entry><function>extract</function>(<parameter>field</parameter> from <type>timestamp</type>)</entry>
<entry>double precision</entry> <entry><type>double precision</type></entry>
<entry>Get subfield; see also <link <entry>Get subfield; see also <link
linkend="functions-datetime-extract">below</link> linkend="functions-datetime-extract">below</link>
</entry> </entry>
<entry>extract(hour from timestamp '2001-02-16 20:38:40')</entry> <entry><literal>extract(hour from timestamp '2001-02-16 20:38:40')</literal></entry>
<entry>20</entry> <entry><literal>20</literal></entry>
</row> </row>
<row> <row>
<entry>extract(<parameter>field</parameter> from interval)</entry> <entry><function>extract</function>(<parameter>field</parameter> from <type>interval</type>)</entry>
<entry>double precision</entry> <entry><type>double precision</type></entry>
<entry>Get subfield; see also <link <entry>Get subfield; see also <link
linkend="functions-datetime-extract">below</link> linkend="functions-datetime-extract">below</link>
</entry> </entry>
<entry>extract(month from interval '2 years 3 months')</entry> <entry><literal>extract(month from interval '2 years 3 months')</literal></entry>
<entry>3</entry> <entry><literal>3</literal></entry>
</row> </row>
<row> <row>
<entry>isfinite(timestamp)</entry> <entry><function>isfinite</function>(<type>timestamp</type>)</entry>
<entry>boolean</entry> <entry><type>boolean</type></entry>
<entry>Test for finite time stamp (neither invalid nor infinity)</entry> <entry>Test for finite time stamp (neither invalid nor infinity)</entry>
<entry>isfinite(timestamp '2001-02-16 21:28:30')</entry> <entry><literal>isfinite(timestamp '2001-02-16 21:28:30')</literal></entry>
<entry>true</entry> <entry><literal>true</literal></entry>
</row> </row>
<row> <row>
<entry>isfinite(interval)</entry> <entry><function>isfinite</function>(<type>interval</type>)</entry>
<entry>boolean</entry> <entry><type>boolean</type></entry>
<entry>Test for finite interval</entry> <entry>Test for finite interval</entry>
<entry>isfinite(interval '4 hours')</entry> <entry><literal>isfinite(interval '4 hours')</literal></entry>
<entry>true</entry> <entry><literal>true</literal></entry>
</row> </row>
<row> <row>
<entry>now()</entry> <entry><function>now</function>()</entry>
<entry>timestamp</entry> <entry><type>timestamp</type></entry>
<entry>Current date and time (equivalent to <entry>Current date and time (equivalent to
<function>current_timestamp</function>); see also <link <function>current_timestamp</function>); see also <link
linkend="functions-datetime-current">below</link> linkend="functions-datetime-current">below</link>
...@@ -2384,29 +2388,29 @@ ...@@ -2384,29 +2388,29 @@
</row> </row>
<row> <row>
<entry>timeofday()</entry> <entry><function>timeofday()</function></entry>
<entry>text</entry> <entry><type>text</type></entry>
<entry>High-precision date and time; see also <link <entry>High-precision date and time; see also <link
linkend="functions-datetime-current">below</link> linkend="functions-datetime-current">below</link>
</entry> </entry>
<entry>timeofday()</entry> <entry><literal>timeofday()</literal></entry>
<entry>Wed Feb 21 17:01:13.000126 2001 EST</entry> <entry><literal>Wed Feb 21 17:01:13.000126 2001 EST</literal></entry>
</row> </row>
<row> <row>
<entry>timestamp(date)</entry> <entry><function>timestamp</function>(<type>date</type>)</entry>
<entry>timestamp</entry> <entry><type>timestamp</type></entry>
<entry>Date to timestamp</entry> <entry><type>date</type> to <type>timestamp</type></entry>
<entry>timestamp(date '2000-12-25')</entry> <entry><literal>timestamp(date '2000-12-25')</literal></entry>
<entry>2000-12-25 00:00:00</entry> <entry><literal>2000-12-25 00:00:00</literal></entry>
</row> </row>
<row> <row>
<entry>timestamp(date, time)</entry> <entry><function>timestamp</function>(<type>date</type>, <type>time</type>)</entry>
<entry>timestamp</entry> <entry><type>timestamp</type></entry>
<entry>Date and time to a timestamp</entry> <entry><type>date</type> and <type>time</type> to <type>timestamp</type></entry>
<entry>timestamp(date '1998-02-24',time '23:07')</entry> <entry><literal>timestamp(date '1998-02-24',time '23:07')</literal></entry>
<entry>1998-02-24 23:07:00</entry> <entry><literal>1998-02-24 23:07:00</literal></entry>
</row> </row>
</tbody> </tbody>
</tgroup> </tgroup>
...@@ -2436,7 +2440,7 @@ EXTRACT (<replaceable>field</replaceable> FROM <replaceable>source</replaceable> ...@@ -2436,7 +2440,7 @@ EXTRACT (<replaceable>field</replaceable> FROM <replaceable>source</replaceable>
<!-- alphabetical --> <!-- alphabetical -->
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term>century</term> <term><literal>century</literal></term>
<listitem> <listitem>
<para> <para>
The year field divided by 100 The year field divided by 100
...@@ -2458,7 +2462,7 @@ SELECT EXTRACT(CENTURY FROM TIMESTAMP '2001-02-16 20:38:40'); ...@@ -2458,7 +2462,7 @@ SELECT EXTRACT(CENTURY FROM TIMESTAMP '2001-02-16 20:38:40');
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>day</term> <term><literal>day</literal></term>
<listitem> <listitem>
<para> <para>
The day (of the month) field (1 - 31) The day (of the month) field (1 - 31)
...@@ -2474,7 +2478,7 @@ SELECT EXTRACT(DAY FROM TIMESTAMP '2001-02-16 20:38:40'); ...@@ -2474,7 +2478,7 @@ SELECT EXTRACT(DAY FROM TIMESTAMP '2001-02-16 20:38:40');
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>decade</term> <term><literal>decade</literal></term>
<listitem> <listitem>
<para> <para>
The year field divided by 10 The year field divided by 10
...@@ -2490,7 +2494,7 @@ SELECT EXTRACT(DECADE FROM TIMESTAMP '2001-02-16 20:38:40'); ...@@ -2490,7 +2494,7 @@ SELECT EXTRACT(DECADE FROM TIMESTAMP '2001-02-16 20:38:40');
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>dow</term> <term><literal>dow</literal></term>
<listitem> <listitem>
<para> <para>
The day of the week (0 - 6; Sunday is 0) (for The day of the week (0 - 6; Sunday is 0) (for
...@@ -2507,7 +2511,7 @@ SELECT EXTRACT(DOW FROM TIMESTAMP '2001-02-16 20:38:40'); ...@@ -2507,7 +2511,7 @@ SELECT EXTRACT(DOW FROM TIMESTAMP '2001-02-16 20:38:40');
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>doy</term> <term><literal>doy</literal></term>
<listitem> <listitem>
<para> <para>
The day of the year (1 - 365/366) (for <type>timestamp</type> values only) The day of the year (1 - 365/366) (for <type>timestamp</type> values only)
...@@ -2522,7 +2526,7 @@ SELECT EXTRACT(DOY FROM TIMESTAMP '2001-02-16 20:38:40'); ...@@ -2522,7 +2526,7 @@ SELECT EXTRACT(DOY FROM TIMESTAMP '2001-02-16 20:38:40');
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>epoch</term> <term><literal>epoch</literal></term>
<listitem> <listitem>
<para> <para>
For <type>date</type> and <type>timestamp</type> values, the For <type>date</type> and <type>timestamp</type> values, the
...@@ -2544,7 +2548,7 @@ SELECT EXTRACT(EPOCH FROM INTERVAL '5 days 3 hours'); ...@@ -2544,7 +2548,7 @@ SELECT EXTRACT(EPOCH FROM INTERVAL '5 days 3 hours');
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>hour</term> <term><literal>hour</literal></term>
<listitem> <listitem>
<para> <para>
The hour field (0 - 23) The hour field (0 - 23)
...@@ -2560,7 +2564,7 @@ SELECT EXTRACT(HOUR FROM TIMESTAMP '2001-02-16 20:38:40'); ...@@ -2560,7 +2564,7 @@ SELECT EXTRACT(HOUR FROM TIMESTAMP '2001-02-16 20:38:40');
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>microseconds</term> <term><literal>microseconds</literal></term>
<listitem> <listitem>
<para> <para>
The seconds field, including fractional parts, multiplied by 1 The seconds field, including fractional parts, multiplied by 1
...@@ -2577,7 +2581,7 @@ SELECT EXTRACT(MICROSECONDS FROM TIME '17:12:28.5'); ...@@ -2577,7 +2581,7 @@ SELECT EXTRACT(MICROSECONDS FROM TIME '17:12:28.5');
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>millennium</term> <term><literal>millennium</literal></term>
<listitem> <listitem>
<para> <para>
The year field divided by 1000 The year field divided by 1000
...@@ -2599,7 +2603,7 @@ SELECT EXTRACT(MILLENNIUM FROM TIMESTAMP '2001-02-16 20:38:40'); ...@@ -2599,7 +2603,7 @@ SELECT EXTRACT(MILLENNIUM FROM TIMESTAMP '2001-02-16 20:38:40');
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>milliseconds</term> <term><literal>milliseconds</literal></term>
<listitem> <listitem>
<para> <para>
The seconds field, including fractional parts, multiplied by The seconds field, including fractional parts, multiplied by
...@@ -2616,7 +2620,7 @@ SELECT EXTRACT(MILLISECONDS FROM TIME '17:12:28.5'); ...@@ -2616,7 +2620,7 @@ SELECT EXTRACT(MILLISECONDS FROM TIME '17:12:28.5');
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>minute</term> <term><literal>minute</literal></term>
<listitem> <listitem>
<para> <para>
The minutes field (0 - 59) The minutes field (0 - 59)
...@@ -2632,7 +2636,7 @@ SELECT EXTRACT(MINUTE FROM TIMESTAMP '2001-02-16 20:38:40'); ...@@ -2632,7 +2636,7 @@ SELECT EXTRACT(MINUTE FROM TIMESTAMP '2001-02-16 20:38:40');
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>month</term> <term><literal>month</literal></term>
<listitem> <listitem>
<para> <para>
For <type>timestamp</type> values, the number of the month For <type>timestamp</type> values, the number of the month
...@@ -2656,7 +2660,7 @@ SELECT EXTRACT(MONTH FROM INTERVAL '2 years 13 months'); ...@@ -2656,7 +2660,7 @@ SELECT EXTRACT(MONTH FROM INTERVAL '2 years 13 months');
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>quarter</term> <term><literal>quarter</literal></term>
<listitem> <listitem>
<para> <para>
The quarter of the year (1 - 4) that the day is in (for The quarter of the year (1 - 4) that the day is in (for
...@@ -2673,7 +2677,7 @@ SELECT EXTRACT(QUARTER FROM TIMESTAMP '2001-02-16 20:38:40'); ...@@ -2673,7 +2677,7 @@ SELECT EXTRACT(QUARTER FROM TIMESTAMP '2001-02-16 20:38:40');
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>second</term> <term><literal>second</literal></term>
<listitem> <listitem>
<para> <para>
The seconds field, including fractional parts (0 - The seconds field, including fractional parts (0 -
...@@ -2694,7 +2698,7 @@ SELECT EXTRACT(SECOND FROM TIME '17:12:28.5'); ...@@ -2694,7 +2698,7 @@ SELECT EXTRACT(SECOND FROM TIME '17:12:28.5');
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>week</term> <term><literal>week</literal></term>
<listitem> <listitem>
<para> <para>
From a <type>timestamp</type> value, calculate the number of From a <type>timestamp</type> value, calculate the number of
...@@ -2715,7 +2719,7 @@ SELECT EXTRACT(WEEK FROM TIMESTAMP '2001-02-16 20:38:40'); ...@@ -2715,7 +2719,7 @@ SELECT EXTRACT(WEEK FROM TIMESTAMP '2001-02-16 20:38:40');
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>year</term> <term><literal>year</literal></term>
<listitem> <listitem>
<para> <para>
The year field The year field
...@@ -2887,7 +2891,7 @@ SELECT timeofday(); ...@@ -2887,7 +2891,7 @@ SELECT timeofday();
good as microseconds (depending on your platform); the other functions good as microseconds (depending on your platform); the other functions
rely on <function>time(2)</function> which is restricted to one-second rely on <function>time(2)</function> which is restricted to one-second
resolution. For historical reasons, <function>timeofday()</function> resolution. For historical reasons, <function>timeofday()</function>
returns its result as a text string rather than a timestamp value. returns its result as a text string rather than a <type>timestamp</type> value.
</para> </para>
<para> <para>
...@@ -2899,7 +2903,7 @@ SELECT timeofday(); ...@@ -2899,7 +2903,7 @@ SELECT timeofday();
</para> </para>
<para> <para>
All the date/time datatypes also accept the special literal value All the date/time data types also accept the special literal value
<literal>now</> to specify the current date and time. Thus, <literal>now</> to specify the current date and time. Thus,
the following three all return the same result: the following three all return the same result:
<programlisting> <programlisting>
...@@ -2911,7 +2915,7 @@ SELECT TIMESTAMP 'now'; ...@@ -2911,7 +2915,7 @@ SELECT TIMESTAMP 'now';
<para> <para>
You do not want to use the third form when specifying a DEFAULT You do not want to use the third form when specifying a DEFAULT
value while creating a table. The system will convert <literal>now</> value while creating a table. The system will convert <literal>now</>
to a timestamp as soon as the constant is parsed, so that when to a <type>timestamp</type> as soon as the constant is parsed, so that when
the default value is needed, the default value is needed,
the time of the table creation would be used! The first two the time of the table creation would be used! The first two
forms will not be evaluated until the default value is used, forms will not be evaluated until the default value is used,
...@@ -2928,8 +2932,10 @@ SELECT TIMESTAMP 'now'; ...@@ -2928,8 +2932,10 @@ SELECT TIMESTAMP 'now';
<title>Geometric Functions and Operators</title> <title>Geometric Functions and Operators</title>
<para> <para>
The geometric types point, box, lseg, line, path, polygon, and The geometric types <type>point</type>, <type>box</type>,
circle have a large set of native support functions and operators. <type>lseg</type>, <type>line</type>, <type>path</type>,
<type>polygon</type>, and <type>circle</type> have a large set of
native support functions and operators.
</para> </para>
<table> <table>
...@@ -2946,122 +2952,122 @@ SELECT TIMESTAMP 'now'; ...@@ -2946,122 +2952,122 @@ SELECT TIMESTAMP 'now';
<ROW> <ROW>
<ENTRY> + </ENTRY> <ENTRY> + </ENTRY>
<ENTRY>Translation</ENTRY> <ENTRY>Translation</ENTRY>
<ENTRY>box '((0,0),(1,1))' + point '(2.0,0)'</ENTRY> <ENTRY><literal>box '((0,0),(1,1))' + point '(2.0,0)'</literal></ENTRY>
</ROW> </ROW>
<ROW> <ROW>
<ENTRY> - </ENTRY> <ENTRY> - </ENTRY>
<ENTRY>Translation</ENTRY> <ENTRY>Translation</ENTRY>
<ENTRY>box '((0,0),(1,1))' - point '(2.0,0)'</ENTRY> <ENTRY><literal>box '((0,0),(1,1))' - point '(2.0,0)'</literal></ENTRY>
</ROW> </ROW>
<ROW> <ROW>
<ENTRY> * </ENTRY> <ENTRY> * </ENTRY>
<ENTRY>Scaling/rotation</ENTRY> <ENTRY>Scaling/rotation</ENTRY>
<ENTRY>box '((0,0),(1,1))' * point '(2.0,0)'</ENTRY> <ENTRY><literal>box '((0,0),(1,1))' * point '(2.0,0)'</literal></ENTRY>
</ROW> </ROW>
<ROW> <ROW>
<ENTRY> / </ENTRY> <ENTRY> / </ENTRY>
<ENTRY>Scaling/rotation</ENTRY> <ENTRY>Scaling/rotation</ENTRY>
<ENTRY>box '((0,0),(2,2))' / point '(2.0,0)'</ENTRY> <ENTRY><literal>box '((0,0),(2,2))' / point '(2.0,0)'</literal></ENTRY>
</ROW> </ROW>
<ROW> <ROW>
<ENTRY> # </ENTRY> <ENTRY> # </ENTRY>
<ENTRY>Intersection</ENTRY> <ENTRY>Intersection</ENTRY>
<ENTRY>'((1,-1),(-1,1))' # '((1,1),(-1,-1))'</ENTRY> <ENTRY><literal>'((1,-1),(-1,1))' # '((1,1),(-1,-1))'</literal></ENTRY>
</ROW> </ROW>
<ROW> <ROW>
<ENTRY> # </ENTRY> <ENTRY> # </ENTRY>
<ENTRY>Number of points in polygon</ENTRY> <ENTRY>Number of points in polygon</ENTRY>
<ENTRY># '((1,0),(0,1),(-1,0))'</ENTRY> <ENTRY><literal># '((1,0),(0,1),(-1,0))'</literal></ENTRY>
</ROW> </ROW>
<ROW> <ROW>
<ENTRY> ## </ENTRY> <ENTRY> ## </ENTRY>
<ENTRY>Point of closest proximity</ENTRY> <ENTRY>Point of closest proximity</ENTRY>
<ENTRY>point '(0,0)' ## lseg '((2,0),(0,2))'</ENTRY> <ENTRY><literal>point '(0,0)' ## lseg '((2,0),(0,2))'</literal></ENTRY>
</ROW> </ROW>
<ROW> <ROW>
<ENTRY> &amp;&amp; </ENTRY> <ENTRY> &amp;&amp; </ENTRY>
<ENTRY>Overlaps?</ENTRY> <ENTRY>Overlaps?</ENTRY>
<ENTRY>box '((0,0),(1,1))' &amp;&amp; box '((0,0),(2,2))'</ENTRY> <ENTRY><literal>box '((0,0),(1,1))' &amp;&amp; box '((0,0),(2,2))'</literal></ENTRY>
</ROW> </ROW>
<ROW> <ROW>
<ENTRY> &amp;&lt; </ENTRY> <ENTRY> &amp;&lt; </ENTRY>
<ENTRY>Overlaps to left?</ENTRY> <ENTRY>Overlaps to left?</ENTRY>
<ENTRY>box '((0,0),(1,1))' &amp;&lt; box '((0,0),(2,2))'</ENTRY> <ENTRY><literal>box '((0,0),(1,1))' &amp;&lt; box '((0,0),(2,2))'</literal></ENTRY>
</ROW> </ROW>
<ROW> <ROW>
<ENTRY> &amp;&gt; </ENTRY> <ENTRY> &amp;&gt; </ENTRY>
<ENTRY>Overlaps to right?</ENTRY> <ENTRY>Overlaps to right?</ENTRY>
<ENTRY>box '((0,0),(3,3))' &amp;&gt; box '((0,0),(2,2))'</ENTRY> <ENTRY><literal>box '((0,0),(3,3))' &amp;&gt; box '((0,0),(2,2))'</literal></ENTRY>
</ROW> </ROW>
<ROW> <ROW>
<ENTRY> &lt;-&gt; </ENTRY> <ENTRY> &lt;-&gt; </ENTRY>
<ENTRY>Distance between</ENTRY> <ENTRY>Distance between</ENTRY>
<ENTRY>circle '((0,0),1)' &lt;-&gt; circle '((5,0),1)'</ENTRY> <ENTRY><literal>circle '((0,0),1)' &lt;-&gt; circle '((5,0),1)'</literal></ENTRY>
</ROW> </ROW>
<ROW> <ROW>
<ENTRY> &lt;&lt; </ENTRY> <ENTRY> &lt;&lt; </ENTRY>
<ENTRY>Left of?</ENTRY> <ENTRY>Left of?</ENTRY>
<ENTRY>circle '((0,0),1)' &lt;&lt; circle '((5,0),1)'</ENTRY> <ENTRY><literal>circle '((0,0),1)' &lt;&lt; circle '((5,0),1)'</literal></ENTRY>
</ROW> </ROW>
<ROW> <ROW>
<ENTRY> &lt;^ </ENTRY> <ENTRY> &lt;^ </ENTRY>
<ENTRY>Is below?</ENTRY> <ENTRY>Is below?</ENTRY>
<ENTRY>circle '((0,0),1)' &lt;^ circle '((0,5),1)'</ENTRY> <ENTRY><literal>circle '((0,0),1)' &lt;^ circle '((0,5),1)'</literal></ENTRY>
</ROW> </ROW>
<ROW> <ROW>
<ENTRY> &gt;&gt; </ENTRY> <ENTRY> &gt;&gt; </ENTRY>
<ENTRY>Is right of?</ENTRY> <ENTRY>Is right of?</ENTRY>
<ENTRY>circle '((5,0),1)' &gt;&gt; circle '((0,0),1)'</ENTRY> <ENTRY><literal>circle '((5,0),1)' &gt;&gt; circle '((0,0),1)'</literal></ENTRY>
</ROW> </ROW>
<ROW> <ROW>
<ENTRY> &gt;^ </ENTRY> <ENTRY> &gt;^ </ENTRY>
<ENTRY>Is above?</ENTRY> <ENTRY>Is above?</ENTRY>
<ENTRY>circle '((0,5),1)' >^ circle '((0,0),1)'</ENTRY> <ENTRY><literal>circle '((0,5),1)' >^ circle '((0,0),1)'</literal></ENTRY>
</ROW> </ROW>
<ROW> <ROW>
<ENTRY> ?# </ENTRY> <ENTRY> ?# </ENTRY>
<ENTRY>Intersects or overlaps</ENTRY> <ENTRY>Intersects or overlaps</ENTRY>
<ENTRY>lseg '((-1,0),(1,0))' ?# box '((-2,-2),(2,2))';</ENTRY> <ENTRY><literal>lseg '((-1,0),(1,0))' ?# box '((-2,-2),(2,2))'</literal></ENTRY>
</ROW> </ROW>
<ROW> <ROW>
<ENTRY> ?- </ENTRY> <ENTRY> ?- </ENTRY>
<ENTRY>Is horizontal?</ENTRY> <ENTRY>Is horizontal?</ENTRY>
<ENTRY>point '(1,0)' ?- point '(0,0)'</ENTRY> <ENTRY><literal>point '(1,0)' ?- point '(0,0)'</literal></ENTRY>
</ROW> </ROW>
<ROW> <ROW>
<ENTRY> ?-| </ENTRY> <ENTRY> ?-| </ENTRY>
<ENTRY>Is perpendicular?</ENTRY> <ENTRY>Is perpendicular?</ENTRY>
<ENTRY>lseg '((0,0),(0,1))' ?-| lseg '((0,0),(1,0))'</ENTRY> <ENTRY><literal>lseg '((0,0),(0,1))' ?-| lseg '((0,0),(1,0))'</literal></ENTRY>
</ROW> </ROW>
<ROW> <ROW>
<ENTRY> @-@ </ENTRY> <ENTRY> @-@ </ENTRY>
<ENTRY>Length or circumference</ENTRY> <ENTRY>Length or circumference</ENTRY>
<ENTRY>@-@ path '((0,0),(1,0))'</ENTRY> <ENTRY><literal>@-@ path '((0,0),(1,0))'</literal></ENTRY>
</ROW> </ROW>
<ROW> <ROW>
<ENTRY> ?| </ENTRY> <ENTRY> ?| </ENTRY>
<ENTRY>Is vertical?</ENTRY> <ENTRY>Is vertical?</ENTRY>
<ENTRY>point '(0,1)' ?| point '(0,0)'</ENTRY> <ENTRY><literal>point '(0,1)' ?| point '(0,0)'</literal></ENTRY>
</ROW> </ROW>
<ROW> <ROW>
<ENTRY> ?|| </ENTRY> <ENTRY> ?|| </ENTRY>
<ENTRY>Is parallel?</ENTRY> <ENTRY>Is parallel?</ENTRY>
<ENTRY>lseg '((-1,0),(1,0))' ?|| lseg '((-1,2),(1,2))'</ENTRY> <ENTRY><literal>lseg '((-1,0),(1,0))' ?|| lseg '((-1,2),(1,2))'</literal></ENTRY>
</ROW> </ROW>
<ROW> <ROW>
<ENTRY> @ </ENTRY> <ENTRY> @ </ENTRY>
<ENTRY>Contained or on</ENTRY> <ENTRY>Contained or on</ENTRY>
<ENTRY>point '(1,1)' @ circle '((0,0),2)'</ENTRY> <ENTRY><literal>point '(1,1)' @ circle '((0,0),2)'</literal></ENTRY>
</ROW> </ROW>
<ROW> <ROW>
<ENTRY> @@ </ENTRY> <ENTRY> @@ </ENTRY>
<ENTRY>Center of</ENTRY> <ENTRY>Center of</ENTRY>
<ENTRY>@@ circle '((0,0),10)'</ENTRY> <ENTRY><literal>@@ circle '((0,0),10)'</literal></ENTRY>
</ROW> </ROW>
<ROW> <ROW>
<ENTRY> ~= </ENTRY> <ENTRY> ~= </ENTRY>
<ENTRY>Same as</ENTRY> <ENTRY>Same as</ENTRY>
<ENTRY>polygon '((0,0),(1,1))' ~= polygon '((1,1),(0,0))'</ENTRY> <ENTRY><literal>polygon '((0,0),(1,1))' ~= polygon '((1,1),(0,0))'</literal></ENTRY>
</ROW> </ROW>
</TBODY> </TBODY>
</TGROUP> </TGROUP>
...@@ -3080,91 +3086,91 @@ SELECT TIMESTAMP 'now'; ...@@ -3080,91 +3086,91 @@ SELECT TIMESTAMP 'now';
</thead> </thead>
<tbody> <tbody>
<row> <row>
<entry>area(object)</entry> <entry><function>area</function>(object)</entry>
<entry>double precision</entry> <entry><type>double precision</type></entry>
<entry>area of item</entry> <entry>area of item</entry>
<entry>area(box '((0,0),(1,1))')</entry> <entry><literal>area(box '((0,0),(1,1))')</literal></entry>
</row> </row>
<row> <row>
<entry>box(box, box)</entry> <entry><function>box</function>(box, box)</entry>
<entry>box</entry> <entry><type>box</type></entry>
<entry>intersection box</entry> <entry>intersection box</entry>
<entry>box(box '((0,0),(1,1))',box '((0.5,0.5),(2,2))')</entry> <entry><literal>box(box '((0,0),(1,1))',box '((0.5,0.5),(2,2))')</literal></entry>
</row> </row>
<row> <row>
<entry>center(object)</entry> <entry><function>center</function>(object)</entry>
<entry>point</entry> <entry><type>point</type></entry>
<entry>center of item</entry> <entry>center of item</entry>
<entry>center(box '((0,0),(1,2))')</entry> <entry><literal>center(box '((0,0),(1,2))')</literal></entry>
</row> </row>
<row> <row>
<entry>diameter(circle)</entry> <entry><function>diameter</function>(circle)</entry>
<entry>double precision</entry> <entry><type>double precision</type></entry>
<entry>diameter of circle</entry> <entry>diameter of circle</entry>
<entry>diameter(circle '((0,0),2.0)')</entry> <entry><literal>diameter(circle '((0,0),2.0)')</literal></entry>
</row> </row>
<row> <row>
<entry>height(box)</entry> <entry><function>height</function>(box)</entry>
<entry>double precision</entry> <entry><type>double precision</type></entry>
<entry>vertical size of box</entry> <entry>vertical size of box</entry>
<entry>height(box '((0,0),(1,1))')</entry> <entry><literal>height(box '((0,0),(1,1))')</literal></entry>
</row> </row>
<row> <row>
<entry>isclosed(path)</entry> <entry><function>isclosed</function>(path)</entry>
<entry>boolean</entry> <entry><type>boolean</type></entry>
<entry>a closed path?</entry> <entry>a closed path?</entry>
<entry>isclosed(path '((0,0),(1,1),(2,0))')</entry> <entry><literal>isclosed(path '((0,0),(1,1),(2,0))')</literal></entry>
</row> </row>
<row> <row>
<entry>isopen(path)</entry> <entry><function>isopen</function>(path)</entry>
<entry>boolean</entry> <entry><type>boolean</type></entry>
<entry>an open path?</entry> <entry>an open path?</entry>
<entry>isopen(path '[(0,0),(1,1),(2,0)]')</entry> <entry><literal>isopen(path '[(0,0),(1,1),(2,0)]')</literal></entry>
</row> </row>
<row> <row>
<entry>length(object)</entry> <entry><function>length</function>(object)</entry>
<entry>double precision</entry> <entry><type>double precision</type></entry>
<entry>length of item</entry> <entry>length of item</entry>
<entry>length(path '((-1,0),(1,0))')</entry> <entry><literal>length(path '((-1,0),(1,0))')</literal></entry>
</row> </row>
<row> <row>
<entry>pclose(path)</entry> <entry><function>pclose</function>(path)</entry>
<entry>path</entry> <entry><type>path</type></entry>
<entry>convert path to closed</entry> <entry>convert path to closed</entry>
<entry>popen(path '[(0,0),(1,1),(2,0)]')</entry> <entry><literal>popen(path '[(0,0),(1,1),(2,0)]')</literal></entry>
</row> </row>
<!-- <![IGNORE[
Not defined by this name. Implements the intersection operator '#' <!-- Not defined by this name. Implements the intersection operator '#' -->
<row> <row>
<entry>point(lseg,lseg)</entry> <entry><function>point</function>(lseg,lseg)</entry>
<entry>point</entry> <entry><type>point</type></entry>
<entry>intersection</entry> <entry>intersection</entry>
<entry>point(lseg '((-1,0),(1,0))',lseg '((-2,-2),(2,2))')</entry> <entry><literal>point(lseg '((-1,0),(1,0))',lseg '((-2,-2),(2,2))')</literal></entry>
</row> </row>
--> ]]>
<row> <row>
<entry>npoint(path)</entry> <entry><function>npoint</function>(path)</entry>
<entry>int4</entry> <entry><type>integer</type></entry>
<entry>number of points</entry> <entry>number of points</entry>
<entry>npoints(path '[(0,0),(1,1),(2,0)]')</entry> <entry><literal>npoints(path '[(0,0),(1,1),(2,0)]')</literal></entry>
</row> </row>
<row> <row>
<entry>popen(path)</entry> <entry><function>popen</function>(path)</entry>
<entry>path</entry> <entry><type>path</type></entry>
<entry>convert path to open path</entry> <entry>convert path to open path</entry>
<entry>popen(path '((0,0),(1,1),(2,0))')</entry> <entry><literal>popen(path '((0,0),(1,1),(2,0))')</literal></entry>
</row> </row>
<row> <row>
<entry>radius(circle)</entry> <entry><function>radius</function>(circle)</entry>
<entry>double precision</entry> <entry><type>double precision</type></entry>
<entry>radius of circle</entry> <entry>radius of circle</entry>
<entry>radius(circle '((0,0),2.0)')</entry> <entry><literal>radius(circle '((0,0),2.0)')</literal></entry>
</row> </row>
<row> <row>
<entry>width(box)</entry> <entry><function>width</function>(box)</entry>
<entry>double precision</entry> <entry><type>double precision</type></entry>
<entry>horizontal size</entry> <entry>horizontal size</entry>
<entry>width(box '((0,0),(1,1))')</entry> <entry><literal>width(box '((0,0),(1,1))')</literal></entry>
</row> </row>
</tbody> </tbody>
</tgroup> </tgroup>
...@@ -3184,94 +3190,94 @@ Not defined by this name. Implements the intersection operator '#' ...@@ -3184,94 +3190,94 @@ Not defined by this name. Implements the intersection operator '#'
</thead> </thead>
<tbody> <tbody>
<row> <row>
<entry>box(circle)</entry> <entry><function>box</function>(<type>circle</type>)</entry>
<entry>box</entry> <entry><type>box</type></entry>
<entry>circle to box</entry> <entry>circle to box</entry>
<entry>box(circle '((0,0),2.0)')</entry> <entry><literal>box(circle '((0,0),2.0)')</literal></entry>
</row> </row>
<row> <row>
<entry>box(point, point)</entry> <entry><function>box</function>(<type>point</type>, <type>point</type>)</entry>
<entry>box</entry> <entry><type>box</type></entry>
<entry>points to box</entry> <entry>points to box</entry>
<entry>box(point '(0,0)', point '(1,1)')</entry> <entry><literal>box(point '(0,0)', point '(1,1)')</literal></entry>
</row> </row>
<row> <row>
<entry>box(polygon)</entry> <entry><function>box</function>(<type>polygon</type>)</entry>
<entry>box</entry> <entry><type>box</type></entry>
<entry>polygon to box</entry> <entry>polygon to box</entry>
<entry>box(polygon '((0,0),(1,1),(2,0))')</entry> <entry><literal>box(polygon '((0,0),(1,1),(2,0))')</literal></entry>
</row> </row>
<row> <row>
<entry>circle(box)</entry> <entry><function>circle</function>(<type>box</type>)</entry>
<entry>circle</entry> <entry><type>circle</type></entry>
<entry>to circle</entry> <entry>to circle</entry>
<entry>circle(box '((0,0),(1,1))')</entry> <entry><literal>circle(box '((0,0),(1,1))')</literal></entry>
</row> </row>
<row> <row>
<entry>circle(point, double precision)</entry> <entry><function>circle</function>(<type>point</type>, <type>double precision</type>)</entry>
<entry>circle</entry> <entry><type>circle</type></entry>
<entry>point to circle</entry> <entry>point to circle</entry>
<entry>circle(point '(0,0)', 2.0)</entry> <entry><literal>circle(point '(0,0)', 2.0)</literal></entry>
</row> </row>
<row> <row>
<entry>lseg(box)</entry> <entry><function>lseg</function>(<type>box</type>)</entry>
<entry>lseg</entry> <entry><type>lseg</type></entry>
<entry>box diagonal to lseg</entry> <entry>box diagonal to lseg</entry>
<entry>lseg(box '((-1,0),(1,0))')</entry> <entry><literal>lseg(box '((-1,0),(1,0))')</literal></entry>
</row> </row>
<row> <row>
<entry>lseg(point, point)</entry> <entry><function>lseg</function>(<type>point</type>, <type>point</type>)</entry>
<entry>lseg</entry> <entry><type>lseg</type></entry>
<entry>points to lseg</entry> <entry>points to lseg</entry>
<entry>lseg(point '(-1,0)', point '(1,0)')</entry> <entry><literal>lseg(point '(-1,0)', point '(1,0)')</literal></entry>
</row> </row>
<row> <row>
<entry>path(polygon)</entry> <entry><function>path</function>(<type>polygon</type>)</entry>
<entry>point</entry> <entry><type>point</type></entry>
<entry>polygon to path</entry> <entry>polygon to path</entry>
<entry>path(polygon '((0,0),(1,1),(2,0))')</entry> <entry><literal>path(polygon '((0,0),(1,1),(2,0))')</literal></entry>
</row> </row>
<row> <row>
<entry>point(circle)</entry> <entry><function>point</function>(<type>circle</type>)</entry>
<entry>point</entry> <entry><type>point</type></entry>
<entry>center</entry> <entry>center</entry>
<entry>point(circle '((0,0),2.0)')</entry> <entry><literal>point(circle '((0,0),2.0)')</literal></entry>
</row> </row>
<row> <row>
<entry>point(lseg, lseg)</entry> <entry><function>point</function>(<type>lseg</type>, <type>lseg</type>)</entry>
<entry>point</entry> <entry><type>point</type></entry>
<entry>intersection</entry> <entry>intersection</entry>
<entry>point(lseg '((-1,0),(1,0))', lseg '((-2,-2),(2,2))')</entry> <entry><literal>point(lseg '((-1,0),(1,0))', lseg '((-2,-2),(2,2))')</literal></entry>
</row> </row>
<row> <row>
<entry>point(polygon)</entry> <entry><function>point</function>(<type>polygon</type>)</entry>
<entry>point</entry> <entry><type>point</type></entry>
<entry>center</entry> <entry>center</entry>
<entry>point(polygon '((0,0),(1,1),(2,0))')</entry> <entry><literal>point(polygon '((0,0),(1,1),(2,0))')</literal></entry>
</row> </row>
<row> <row>
<entry>polygon(box)</entry> <entry><function>polygon</function>(<type>box</type>)</entry>
<entry>polygon</entry> <entry><type>polygon</type></entry>
<entry>12 point polygon</entry> <entry>12 point polygon</entry>
<entry>polygon(box '((0,0),(1,1))')</entry> <entry><literal>polygon(box '((0,0),(1,1))')</literal></entry>
</row> </row>
<row> <row>
<entry>polygon(circle)</entry> <entry><function>polygon</function>(<type>circle</type>)</entry>
<entry>polygon</entry> <entry><type>polygon</type></entry>
<entry>12-point polygon</entry> <entry>12-point polygon</entry>
<entry>polygon(circle '((0,0),2.0)')</entry> <entry><literal>polygon(circle '((0,0),2.0)')</literal></entry>
</row> </row>
<row> <row>
<entry>polygon(<replaceable class="parameter">npts</replaceable>, circle)</entry> <entry><function>polygon</function>(<replaceable class="parameter">npts</replaceable>, <type>circle</type>)</entry>
<entry>polygon</entry> <entry><type>polygon</type></entry>
<entry><replaceable class="parameter">npts</replaceable> polygon</entry> <entry><replaceable class="parameter">npts</replaceable> polygon</entry>
<entry>polygon(12, circle '((0,0),2.0)')</entry> <entry><literal>polygon(12, circle '((0,0),2.0)')</literal></entry>
</row> </row>
<row> <row>
<entry>polygon(path)</entry> <entry><function>polygon</function>(<type>path</type>)</entry>
<entry>polygon</entry> <entry><type>polygon</type></entry>
<entry>path to polygon</entry> <entry>path to polygon</entry>
<entry>polygon(path '((0,0),(1,1),(2,0))')</entry> <entry><literal>polygon(path '((0,0),(1,1),(2,0))')</literal></entry>
</row> </row>
</tbody> </tbody>
</tgroup> </tgroup>
...@@ -3298,52 +3304,52 @@ Not defined by this name. Implements the intersection operator '#' ...@@ -3298,52 +3304,52 @@ Not defined by this name. Implements the intersection operator '#'
<ROW> <ROW>
<ENTRY> &lt; </ENTRY> <ENTRY> &lt; </ENTRY>
<ENTRY>Less than</ENTRY> <ENTRY>Less than</ENTRY>
<ENTRY>inet '192.168.1.5' &lt; inet '192.168.1.6'</ENTRY> <ENTRY><literal>inet '192.168.1.5' &lt; inet '192.168.1.6'</literal></ENTRY>
</ROW> </ROW>
<ROW> <ROW>
<ENTRY> &lt;= </ENTRY> <ENTRY> &lt;= </ENTRY>
<ENTRY>Less than or equal</ENTRY> <ENTRY>Less than or equal</ENTRY>
<ENTRY>inet '192.168.1.5' &lt;= inet '192.168.1.5'</ENTRY> <ENTRY><literal>inet '192.168.1.5' &lt;= inet '192.168.1.5'</literal></ENTRY>
</ROW> </ROW>
<ROW> <ROW>
<ENTRY> = </ENTRY> <ENTRY> = </ENTRY>
<ENTRY>Equals</ENTRY> <ENTRY>Equals</ENTRY>
<ENTRY>inet '192.168.1.5' = inet '192.168.1.5'</ENTRY> <ENTRY><literal>inet '192.168.1.5' = inet '192.168.1.5'</literal></ENTRY>
</ROW> </ROW>
<ROW> <ROW>
<ENTRY> &gt;= </ENTRY> <ENTRY> &gt;= </ENTRY>
<ENTRY>Greater or equal</ENTRY> <ENTRY>Greater or equal</ENTRY>
<ENTRY>inet '192.168.1.5' &gt;= inet '192.168.1.5'</ENTRY> <ENTRY><literal>inet '192.168.1.5' &gt;= inet '192.168.1.5'</literal></ENTRY>
</ROW> </ROW>
<ROW> <ROW>
<ENTRY> &gt; </ENTRY> <ENTRY> &gt; </ENTRY>
<ENTRY>Greater</ENTRY> <ENTRY>Greater</ENTRY>
<ENTRY>inet '192.168.1.5' &gt; inet '192.168.1.4'</ENTRY> <ENTRY><literal>inet '192.168.1.5' &gt; inet '192.168.1.4'</literal></ENTRY>
</ROW> </ROW>
<ROW> <ROW>
<ENTRY> &lt;&gt; </ENTRY> <ENTRY> &lt;&gt; </ENTRY>
<ENTRY>Not equal</ENTRY> <ENTRY>Not equal</ENTRY>
<ENTRY>inet '192.168.1.5' &lt;&gt; inet '192.168.1.4'</ENTRY> <ENTRY><literal>inet '192.168.1.5' &lt;&gt; inet '192.168.1.4'</literal></ENTRY>
</ROW> </ROW>
<ROW> <ROW>
<ENTRY> &lt;&lt; </ENTRY> <ENTRY> &lt;&lt; </ENTRY>
<ENTRY>is contained within</ENTRY> <ENTRY>is contained within</ENTRY>
<ENTRY>inet '192.168.1.5' &lt;&lt; inet '192.168.1/24'</ENTRY> <ENTRY><literal>inet '192.168.1.5' &lt;&lt; inet '192.168.1/24'</literal></ENTRY>
</ROW> </ROW>
<ROW> <ROW>
<ENTRY> &lt;&lt;= </ENTRY> <ENTRY> &lt;&lt;= </ENTRY>
<ENTRY>is contained within or equals</ENTRY> <ENTRY>is contained within or equals</ENTRY>
<ENTRY>inet '192.168.1/24' &lt;&lt;= inet '192.168.1/24'</ENTRY> <ENTRY><literal>inet '192.168.1/24' &lt;&lt;= inet '192.168.1/24'</literal></ENTRY>
</ROW> </ROW>
<ROW> <ROW>
<ENTRY> &gt;&gt; </ENTRY> <ENTRY> &gt;&gt; </ENTRY>
<ENTRY>contains</ENTRY> <ENTRY>contains</ENTRY>
<ENTRY>inet'192.168.1/24' &gt;&gt; inet '192.168.1.5'</ENTRY> <ENTRY><literal>inet'192.168.1/24' &gt;&gt; inet '192.168.1.5'</literal></ENTRY>
</ROW> </ROW>
<ROW> <ROW>
<ENTRY> &gt;&gt;= </ENTRY> <ENTRY> &gt;&gt;= </ENTRY>
<ENTRY>contains or equals</ENTRY> <ENTRY>contains or equals</ENTRY>
<ENTRY>inet '192.168.1/24' &gt;&gt;= inet '192.168.1/24'</ENTRY> <ENTRY><literal>inet '192.168.1/24' &gt;&gt;= inet '192.168.1/24'</literal></ENTRY>
</ROW> </ROW>
</TBODY> </TBODY>
</TGROUP> </TGROUP>
...@@ -3374,60 +3380,60 @@ Not defined by this name. Implements the intersection operator '#' ...@@ -3374,60 +3380,60 @@ Not defined by this name. Implements the intersection operator '#'
</thead> </thead>
<tbody> <tbody>
<row> <row>
<entry>broadcast(inet)</entry> <entry><function>broadcast</function>(<type>inet</type>)</entry>
<entry>inet</entry> <entry><type>inet</type></entry>
<entry>broadcast address for network</entry> <entry>broadcast address for network</entry>
<entry>broadcast('192.168.1.5/24')</entry> <entry><literal>broadcast('192.168.1.5/24')</literal></entry>
<entry>192.168.1.255/24</entry> <entry><literal>192.168.1.255/24</literal></entry>
</row> </row>
<row> <row>
<entry>host(inet)</entry> <entry><function>host</function>(<type>inet</type>)</entry>
<entry>text</entry> <entry><type>text</type></entry>
<entry>extract IP address as text</entry> <entry>extract IP address as text</entry>
<entry>host('192.168.1.5/24')</entry> <entry><literal>host('192.168.1.5/24')</literal></entry>
<entry>192.168.1.5</entry> <entry><literal>192.168.1.5</literal></entry>
</row> </row>
<row> <row>
<entry>masklen(inet)</entry> <entry><function>masklen</function>(<type>inet</type>)</entry>
<entry>integer</entry> <entry><type>integer</type></entry>
<entry>extract netmask length</entry> <entry>extract netmask length</entry>
<entry>masklen('192.168.1.5/24')</entry> <entry><literal>masklen('192.168.1.5/24')</literal></entry>
<entry>24</entry> <entry><literal>24</literal></entry>
</row> </row>
<row> <row>
<entry>set_masklen(inet,integer)</entry> <entry><function>set_masklen</function>(<type>inet</type>,<type>integer</type>)</entry>
<entry>inet</entry> <entry><type>inet</type></entry>
<entry>set netmask length for inet value</entry> <entry>set netmask length for inet value</entry>
<entry>set_masklen('192.168.1.5/24',16)</entry> <entry><literal>set_masklen('192.168.1.5/24',16)</literal></entry>
<entry>192.168.1.5/16</entry> <entry><literal>192.168.1.5/16</literal></entry>
</row> </row>
<row> <row>
<entry>netmask(inet)</entry> <entry><function>netmask</function>(<type>inet</type>)</entry>
<entry>inet</entry> <entry><type>inet</type></entry>
<entry>construct netmask for network</entry> <entry>construct netmask for network</entry>
<entry>netmask('192.168.1.5/24')</entry> <entry><literal>netmask('192.168.1.5/24')</literal></entry>
<entry>255.255.255.0</entry> <entry><literal>255.255.255.0</literal></entry>
</row> </row>
<row> <row>
<entry>network(inet)</entry> <entry><function>network</function>(<type>inet</type>)</entry>
<entry>cidr</entry> <entry><type>cidr</type></entry>
<entry>extract network part of address</entry> <entry>extract network part of address</entry>
<entry>network('192.168.1.5/24')</entry> <entry><literal>network('192.168.1.5/24')</literal></entry>
<entry>192.168.1.0/24</entry> <entry><literal>192.168.1.0/24</literal></entry>
</row> </row>
<row> <row>
<entry>text(inet)</entry> <entry><function>text</function>(<type>inet</type>)</entry>
<entry>text</entry> <entry><type>text</type></entry>
<entry>extract IP address and masklen as text</entry> <entry>extract IP address and masklen as text</entry>
<entry>text(inet '192.168.1.5')</entry> <entry><literal>text(inet '192.168.1.5')</literal></entry>
<entry>192.168.1.5/32</entry> <entry><literal>192.168.1.5/32</literal></entry>
</row> </row>
<row> <row>
<entry>abbrev(inet)</entry> <entry><function>abbrev</function>(<type>inet</type>)</entry>
<entry>text</entry> <entry><type>text</type></entry>
<entry>extract abbreviated display as text</entry> <entry>extract abbreviated display as text</entry>
<entry>abbrev(cidr '10.1.0.0/16')</entry> <entry><literal>abbrev(cidr '10.1.0.0/16')</literal></entry>
<entry>10.1/16</entry> <entry><literal>10.1/16</literal></entry>
</row> </row>
</tbody> </tbody>
</tgroup> </tgroup>
...@@ -3438,8 +3444,8 @@ Not defined by this name. Implements the intersection operator '#' ...@@ -3438,8 +3444,8 @@ Not defined by this name. Implements the intersection operator '#'
<type>cidr</type> values as well. The <function>host</>(), <type>cidr</type> values as well. The <function>host</>(),
<function>text</>(), and <function>abbrev</>() functions are primarily <function>text</>(), and <function>abbrev</>() functions are primarily
intended to offer alternative display formats. You can cast a text intended to offer alternative display formats. You can cast a text
field to inet using normal casting syntax: inet(fieldname) or field to inet using normal casting syntax: <literal>inet(expression)</literal> or
fieldname::inet. <literal>colname::inet</literal>.
</para> </para>
<para> <para>
...@@ -3457,11 +3463,11 @@ Not defined by this name. Implements the intersection operator '#' ...@@ -3457,11 +3463,11 @@ Not defined by this name. Implements the intersection operator '#'
</thead> </thead>
<tbody> <tbody>
<row> <row>
<entry>trunc(macaddr)</entry> <entry><function>trunc</function>(<type>macaddr</type>)</entry>
<entry>macaddr</entry> <entry><type>macaddr</type></entry>
<entry>set last 3 bytes to zero</entry> <entry>set last 3 bytes to zero</entry>
<entry>trunc(macaddr '12:34:56:78:90:ab')</entry> <entry><literal>trunc(macaddr '12:34:56:78:90:ab')</literal></entry>
<entry>12:34:56:00:00:00</entry> <entry><literal>12:34:56:00:00:00</literal></entry>
</row> </row>
</tbody> </tbody>
</tgroup> </tgroup>
...@@ -3722,18 +3728,18 @@ SELECT NULLIF(value, '(none)') ... ...@@ -3722,18 +3728,18 @@ SELECT NULLIF(value, '(none)') ...
<tbody> <tbody>
<row> <row>
<entry>has_table_privilege(<parameter>user</parameter>, <entry><function>has_table_privilege</function>(<parameter>user</parameter>,
<parameter>table</parameter>, <parameter>table</parameter>,
<parameter>access</parameter>) <parameter>access</parameter>)
</entry> </entry>
<entry>boolean</> <entry><type>boolean</type></>
<entry>does user have access to table</> <entry>does user have access to table</>
</row> </row>
<row> <row>
<entry>has_table_privilege(<parameter>table</parameter>, <entry><function>has_table_privilege</function>(<parameter>table</parameter>,
<parameter>access</parameter>) <parameter>access</parameter>)
</entry> </entry>
<entry>boolean</> <entry><type>boolean</type></>
<entry>does current user have access to table</> <entry>does current user have access to table</>
</row> </row>
</tbody> </tbody>
...@@ -3747,7 +3753,7 @@ SELECT NULLIF(value, '(none)') ... ...@@ -3747,7 +3753,7 @@ SELECT NULLIF(value, '(none)') ...
<para> <para>
<function>has_table_privilege</> determines whether a user <function>has_table_privilege</> determines whether a user
can access a table in a particular way. The user can be can access a table in a particular way. The user can be
specified by name or by usesysid, or if the argument is omitted specified by name or by ID (<classname>pg_user</>.<structfield>usesysid</>) or if the argument is omitted
<function>current_user</> is assumed. The table can be specified <function>current_user</> is assumed. The table can be specified
by name or by OID. (Thus, there are actually six variants of by name or by OID. (Thus, there are actually six variants of
<function>has_table_privilege</>, which can be distinguished by <function>has_table_privilege</>, which can be distinguished by
...@@ -3811,13 +3817,13 @@ SELECT NULLIF(value, '(none)') ... ...@@ -3811,13 +3817,13 @@ SELECT NULLIF(value, '(none)') ...
</row> </row>
<row> <row>
<entry>COUNT(*)</entry> <entry><function>count</function>(*)</entry>
<entry>number of input values</entry> <entry>number of input values</entry>
<entry>The return value is of type <type>bigint</type>.</entry> <entry>The return value is of type <type>bigint</type>.</entry>
</row> </row>
<row> <row>
<entry>COUNT(<replaceable class="parameter">expression</replaceable>)</entry> <entry><function>count</function>(<replaceable class="parameter">expression</replaceable>)</entry>
<entry> <entry>
Counts the input values for which the value of <replaceable Counts the input values for which the value of <replaceable
class="parameter">expression</replaceable> is not NULL. class="parameter">expression</replaceable> is not NULL.
...@@ -3826,7 +3832,7 @@ SELECT NULLIF(value, '(none)') ... ...@@ -3826,7 +3832,7 @@ SELECT NULLIF(value, '(none)') ...
</row> </row>
<row> <row>
<entry>MAX(<replaceable class="parameter">expression</replaceable>)</entry> <entry><function>max</function>(<replaceable class="parameter">expression</replaceable>)</entry>
<entry>the maximum value of <replaceable class="parameter">expression</replaceable> across all input values</entry> <entry>the maximum value of <replaceable class="parameter">expression</replaceable> across all input values</entry>
<entry> <entry>
Available for all numeric, string, and date/time types. The Available for all numeric, string, and date/time types. The
...@@ -3835,7 +3841,7 @@ SELECT NULLIF(value, '(none)') ... ...@@ -3835,7 +3841,7 @@ SELECT NULLIF(value, '(none)') ...
</row> </row>
<row> <row>
<entry>MIN(<replaceable class="parameter">expression</replaceable>)</entry> <entry><function>min</function>(<replaceable class="parameter">expression</replaceable>)</entry>
<entry>the minimum value of <replaceable class="parameter">expression</replaceable> across all input values</entry> <entry>the minimum value of <replaceable class="parameter">expression</replaceable> across all input values</entry>
<entry> <entry>
Available for all numeric, string, and date/time types. The Available for all numeric, string, and date/time types. The
...@@ -3844,7 +3850,7 @@ SELECT NULLIF(value, '(none)') ... ...@@ -3844,7 +3850,7 @@ SELECT NULLIF(value, '(none)') ...
</row> </row>
<row> <row>
<entry>STDDEV(<replaceable class="parameter">expression</replaceable>)</entry> <entry><function>stddev</function>(<replaceable class="parameter">expression</replaceable>)</entry>
<entry>the sample standard deviation of the input values</entry> <entry>the sample standard deviation of the input values</entry>
<entry> <entry>
<indexterm> <indexterm>
...@@ -3860,7 +3866,7 @@ SELECT NULLIF(value, '(none)') ... ...@@ -3860,7 +3866,7 @@ SELECT NULLIF(value, '(none)') ...
</row> </row>
<row> <row>
<entry>SUM(<replaceable class="parameter">expression</replaceable>)</entry> <entry><function>sum</function>(<replaceable class="parameter">expression</replaceable>)</entry>
<entry>sum of <replaceable class="parameter">expression</replaceable> across all input values</entry> <entry>sum of <replaceable class="parameter">expression</replaceable> across all input values</entry>
<entry> <entry>
Summation is available on the following data types: Summation is available on the following data types:
...@@ -3876,7 +3882,7 @@ SELECT NULLIF(value, '(none)') ... ...@@ -3876,7 +3882,7 @@ SELECT NULLIF(value, '(none)') ...
</row> </row>
<row> <row>
<entry>VARIANCE(<replaceable class="parameter">expression</replaceable>)</entry> <entry><function>variance</function>(<replaceable class="parameter">expression</replaceable>)</entry>
<entry>the sample variance of the input values</entry> <entry>the sample variance of the input values</entry>
<entry> <entry>
<indexterm> <indexterm>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/history.sgml,v 1.13 2001/02/03 19:03:26 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/history.sgml,v 1.14 2001/09/09 17:21:59 petere Exp $
--> -->
<sect1 id="history"> <sect1 id="history">
...@@ -13,7 +13,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/history.sgml,v 1.13 2001/02/03 19:03:26 pet ...@@ -13,7 +13,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/history.sgml,v 1.13 2001/02/03 19:03:26 pet
California at Berkeley. With over a decade of California at Berkeley. With over a decade of
development behind it, <productname>PostgreSQL</productname> development behind it, <productname>PostgreSQL</productname>
is the most advanced open-source database available anywhere, is the most advanced open-source database available anywhere,
offering multi-version concurrency control, supporting almost offering multiversion concurrency control, supporting almost
all SQL constructs (including subselects, transactions, and all SQL constructs (including subselects, transactions, and
user-defined types and functions), and having a wide range of user-defined types and functions), and having a wide range of
language bindings available (including C, C++, Java, Perl, Tcl, and Python). language bindings available (including C, C++, Java, Perl, Tcl, and Python).
...@@ -72,7 +72,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/history.sgml,v 1.13 2001/02/03 19:03:26 pet ...@@ -72,7 +72,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/history.sgml,v 1.13 2001/02/03 19:03:26 pet
Finally, Finally,
<ulink url="http://www.illustra.com/">Illustra Information Technologies</ulink> <ulink url="http://www.illustra.com/">Illustra Information Technologies</ulink>
(since merged into (since merged into
<ulink url="http://www.informix.com/">Informix</ulink>) <ulink url="http://www.informix.com/"><productname>Informix</productname></ulink>)
picked up picked up
the code and commercialized it. the code and commercialized it.
<productname>Postgres</productname> became the primary data manager <productname>Postgres</productname> became the primary data manager
...@@ -141,7 +141,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/history.sgml,v 1.13 2001/02/03 19:03:26 pet ...@@ -141,7 +141,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/history.sgml,v 1.13 2001/02/03 19:03:26 pet
<para> <para>
A new front-end library, <filename>libpgtcl</filename>, A new front-end library, <filename>libpgtcl</filename>,
supported <acronym>Tcl</acronym>-based clients. A sample shell, supported <acronym>Tcl</acronym>-based clients. A sample shell,
pgtclsh, provided new Tcl commands to interface <command>pgtclsh</command>, provided new Tcl commands to interface
<application>tcl</application> <application>tcl</application>
programs with the <productname>Postgres95</productname> backend. programs with the <productname>Postgres95</productname> backend.
</para> </para>
...@@ -211,7 +211,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/history.sgml,v 1.13 2001/02/03 19:03:26 pet ...@@ -211,7 +211,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/history.sgml,v 1.13 2001/02/03 19:03:26 pet
<itemizedlist> <itemizedlist>
<listitem> <listitem>
<para> <para>
Table-level locking has been replaced with multi-version concurrency control, Table-level locking has been replaced with multiversion concurrency control,
which allows readers to continue reading consistent data during writer activity which allows readers to continue reading consistent data during writer activity
and enables hot backups from pg_dump while the database stays available for and enables hot backups from pg_dump while the database stays available for
queries. queries.
......
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/indices.sgml,v 1.22 2001/08/24 14:07:48 petere Exp $ --> <!-- $Header: /cvsroot/pgsql/doc/src/sgml/indices.sgml,v 1.23 2001/09/09 17:21:59 petere Exp $ -->
<chapter id="indexes"> <chapter id="indexes">
<title id="indexes-title">Indexes</title> <title id="indexes-title">Indexes</title>
...@@ -571,7 +571,7 @@ CREATE MEMSTORE ON <replaceable>table</replaceable> COLUMNS <replaceable>cols</r ...@@ -571,7 +571,7 @@ CREATE MEMSTORE ON <replaceable>table</replaceable> COLUMNS <replaceable>cols</r
retrieving by that combination! However, if you want to make the retrieval retrieving by that combination! However, if you want to make the retrieval
efficient, you'll have to resort to the means your efficient, you'll have to resort to the means your
<acronym>RDBMS</acronym> provider gives you <acronym>RDBMS</acronym> provider gives you
- be it an index, my imaginary MEMSTORE command, or an intelligent - be it an index, my imaginary <literal>MEMSTORE</literal> command, or an intelligent
<acronym>RDBMS</acronym> <acronym>RDBMS</acronym>
that creates indexes without your knowledge based on the fact that you have that creates indexes without your knowledge based on the fact that you have
sent it many queries based on a specific combination of keys... (It learns sent it many queries based on a specific combination of keys... (It learns
...@@ -629,7 +629,7 @@ CREATE MEMSTORE ON <replaceable>table</replaceable> COLUMNS <replaceable>cols</r ...@@ -629,7 +629,7 @@ CREATE MEMSTORE ON <replaceable>table</replaceable> COLUMNS <replaceable>cols</r
that involve deciding what predicate(s) match the workload/query in that involve deciding what predicate(s) match the workload/query in
some useful way. For those who are into database theory, the problems some useful way. For those who are into database theory, the problems
are basically analogous to the corresponding materialized view are basically analogous to the corresponding materialized view
problems, albeit with different cost parameters and formulae. These problems, albeit with different cost parameters and formulas. These
are, in the general case, hard problems for the standard ordinal are, in the general case, hard problems for the standard ordinal
<acronym>SQL</acronym> <acronym>SQL</acronym>
types; they're super-hard problems with black-box extension types, types; they're super-hard problems with black-box extension types,
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/Attic/inherit.sgml,v 1.13 2001/01/13 23:58:55 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/Attic/inherit.sgml,v 1.14 2001/09/09 17:21:59 petere Exp $
--> -->
<chapter id="inherit"> <chapter id="inherit">
...@@ -37,7 +37,7 @@ CREATE TABLE capitals ( ...@@ -37,7 +37,7 @@ CREATE TABLE capitals (
<note> <note>
<para> <para>
The inheritance hierarchy is a actually a directed acyclic graph. The inheritance hierarchy is actually a directed acyclic graph.
</para> </para>
</note> </note>
</para> </para>
...@@ -100,7 +100,7 @@ SELECT name, altitude ...@@ -100,7 +100,7 @@ SELECT name, altitude
<para> <para>
In some cases you may wish to know which table a particular tuple In some cases you may wish to know which table a particular tuple
originated from. There is a system column called originated from. There is a system column called
<quote>TABLEOID</quote> in each table which can tell you the <structfield>TABLEOID</structfield> in each table which can tell you the
originating table: originating table:
<programlisting> <programlisting>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/legal.sgml,v 1.10 2001/02/03 19:03:27 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/legal.sgml,v 1.11 2001/09/09 17:21:59 petere Exp $
--> -->
<copyright> <copyright>
...@@ -42,7 +42,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/legal.sgml,v 1.10 2001/02/03 19:03:27 peter ...@@ -42,7 +42,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/legal.sgml,v 1.10 2001/02/03 19:03:27 peter
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
PROVIDED HEREUNDER IS ON AN "AS-IS" BASIS, AND THE UNIVERSITY OF PROVIDED HEREUNDER IS ON AN "AS-IS" BASIS, AND THE UNIVERSITY OF
CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTAINANCE, SUPPORT, CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
UPDATES, ENHANCEMENTS, OR MODIFICATIONS. UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
</para> </para>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/Attic/manage.sgml,v 1.13 2001/02/04 15:28:18 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/Attic/manage.sgml,v 1.14 2001/09/09 17:21:59 petere Exp $
--> -->
<Chapter Id="manage"> <Chapter Id="manage">
<Title>Managing a Database</Title> <Title>Managing a Database</Title>
<Note> <comment>
<Para> This section is currently a thinly disguised copy of the
This section is currently a thinly disguised copy of the Tutorial. Needs to be augmented.
Tutorial. Needs to be augmented.
- thomas 1998-01-12 - thomas 1998-01-12
</Para> </comment>
</Note>
<Para> <Para>
Although the <FirstTerm>site administrator</FirstTerm> is responsible for overall management Although the <FirstTerm>site administrator</FirstTerm> is responsible for overall management
...@@ -89,9 +87,9 @@ ERROR: CREATE DATABASE: Permission denied. ...@@ -89,9 +87,9 @@ ERROR: CREATE DATABASE: Permission denied.
Alternate database locations are created and referenced by an environment variable Alternate database locations are created and referenced by an environment variable
which gives the absolute path to the intended storage location. which gives the absolute path to the intended storage location.
This environment variable must have been defined before the postmaster was started This environment variable must have been defined before the postmaster was started
and the location it points to must be writable by the postgres administrator account. and the location it points to must be writable by the administrator account.
Consult with the site administrator Consult with the site administrator
regarding preconfigured alternate database locations. regarding preconfigured alternative database locations.
Any valid environment variable name may be used to reference an alternate location, Any valid environment variable name may be used to reference an alternate location,
although using variable names with a prefix of <envar>PGDATA</envar> is recommended although using variable names with a prefix of <envar>PGDATA</envar> is recommended
to avoid confusion to avoid confusion
...@@ -101,7 +99,7 @@ ERROR: CREATE DATABASE: Permission denied. ...@@ -101,7 +99,7 @@ ERROR: CREATE DATABASE: Permission denied.
<Note> <Note>
<Para> <Para>
In previous versions of <ProductName>Postgres</ProductName>, In previous versions of <ProductName>Postgres</ProductName>,
it was also permissable to use an absolute path name to specify it was also permissible to use an absolute path name to specify
an alternate storage location. an alternate storage location.
Although the environment variable style of specification Although the environment variable style of specification
is to be preferred since it allows the site administrator more flexibility in is to be preferred since it allows the site administrator more flexibility in
...@@ -181,7 +179,7 @@ enter, edit, and execute <Acronym>SQL</Acronym> commands. ...@@ -181,7 +179,7 @@ enter, edit, and execute <Acronym>SQL</Acronym> commands.
</ListItem> </ListItem>
<ListItem> <ListItem>
<Para> <Para>
writing a C program using the LIBPQ subroutine writing a C program using the <application>LIBPQ</application> subroutine
library. This allows you to submit <Acronym>SQL</Acronym> commands library. This allows you to submit <Acronym>SQL</Acronym> commands
from C and get answers and status messages back to from C and get answers and status messages back to
your program. This interface is discussed further your program. This interface is discussed further
...@@ -213,7 +211,7 @@ mydb=> ...@@ -213,7 +211,7 @@ mydb=>
</Para> </Para>
<Para> <Para>
This prompt indicates that psql is listening This prompt indicates that <command>psql</command> is listening
to you and that you can type <Acronym>SQL</Acronym> queries into a to you and that you can type <Acronym>SQL</Acronym> queries into a
workspace maintained by the terminal monitor. workspace maintained by the terminal monitor.
The <Application>psql</Application> program responds to escape codes that begin The <Application>psql</Application> program responds to escape codes that begin
...@@ -235,7 +233,7 @@ mydb=> \g ...@@ -235,7 +233,7 @@ mydb=> \g
terminate your query with a semicolon, the "<literal>\g</literal>" is not terminate your query with a semicolon, the "<literal>\g</literal>" is not
necessary. necessary.
<Application>psql</Application> will automatically process semicolon terminated queries. <Application>psql</Application> will automatically process semicolon terminated queries.
To read queries from a file, say myFile, instead of To read queries from a file, say <filename>myFile</filename>, instead of
entering them interactively, type: entering them interactively, type:
<ProgramListing> <ProgramListing>
mydb=> \i fileName mydb=> \i fileName
...@@ -247,7 +245,7 @@ mydb=> \q ...@@ -247,7 +245,7 @@ mydb=> \q
</ProgramListing> </ProgramListing>
and <Application>psql</Application> will quit and return you to your command and <Application>psql</Application> will quit and return you to your command
shell. (For more escape codes, type <Command>\?</Command> at the psql shell. (For more escape codes, type <Command>\?</Command> at the <command>psql</command>
prompt.) prompt.)
White space (i.e., spaces, tabs and newlines) may be White space (i.e., spaces, tabs and newlines) may be
used freely in <Acronym>SQL</Acronym> queries. Single-line comments are denoted by used freely in <Acronym>SQL</Acronym> queries. Single-line comments are denoted by
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/mvcc.sgml,v 2.16 2001/07/09 22:18:33 tgl Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/mvcc.sgml,v 2.17 2001/09/09 17:21:59 petere Exp $
--> -->
<chapter id="mvcc"> <chapter id="mvcc">
...@@ -593,7 +593,7 @@ ERROR: Can't serialize access due to concurrent update ...@@ -593,7 +593,7 @@ ERROR: Can't serialize access due to concurrent update
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term>
GiST and R-Tree indexes <acronym>GiST</acronym> and R-Tree indexes
</term> </term>
<listitem> <listitem>
<para> <para>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/notation.sgml,v 1.14 2001/02/03 19:03:27 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/notation.sgml,v 1.15 2001/09/09 17:21:59 petere Exp $
--> -->
<sect1 id="notation"> <sect1 id="notation">
...@@ -38,10 +38,10 @@ $Header: /cvsroot/pgsql/doc/src/sgml/notation.sgml,v 1.14 2001/02/03 19:03:27 pe ...@@ -38,10 +38,10 @@ $Header: /cvsroot/pgsql/doc/src/sgml/notation.sgml,v 1.14 2001/02/03 19:03:27 pe
<para> <para>
Examples will show commands executed from various accounts and programs. Examples will show commands executed from various accounts and programs.
Commands executed from a Unix shell may be preceeded with a dollar sign Commands executed from a Unix shell may be preceded with a dollar sign
(<quote><literal>$</literal></quote>). Commands executed from particular user (<quote><literal>$</literal></quote>). Commands executed from particular user
accounts such as root or postgres are specially flagged and explained. accounts such as <systemitem>root</> or <systemitem>postgres</> are specially flagged and explained.
<acronym>SQL</acronym> commands may be preceeded with <acronym>SQL</acronym> commands may be preceded with
<quote><literal>=&gt;</literal></quote> <quote><literal>=&gt;</literal></quote>
or will have no leading prompt, depending on the context. or will have no leading prompt, depending on the context.
</para> </para>
...@@ -49,7 +49,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/notation.sgml,v 1.14 2001/02/03 19:03:27 pe ...@@ -49,7 +49,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/notation.sgml,v 1.14 2001/02/03 19:03:27 pe
<note> <note>
<para> <para>
The notation for The notation for
flagging commands is not universally consistant throughout the flagging commands is not universally consistent throughout the
documentation set. documentation set.
Please report problems to the documentation mailing list Please report problems to the documentation mailing list
<email>pgsql-docs@postgresql.org</email>. <email>pgsql-docs@postgresql.org</email>.
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/perform.sgml,v 1.7 2001/06/22 18:53:36 tgl Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/perform.sgml,v 1.8 2001/09/09 17:21:59 petere Exp $
--> -->
<chapter id="performance-tips"> <chapter id="performance-tips">
...@@ -109,9 +109,9 @@ Seq Scan on tenk1 (cost=0.00..333.00 rows=10000 width=148) ...@@ -109,9 +109,9 @@ Seq Scan on tenk1 (cost=0.00..333.00 rows=10000 width=148)
select * from pg_class where relname = 'tenk1'; select * from pg_class where relname = 'tenk1';
</programlisting> </programlisting>
you'll find out that tenk1 has 233 disk you will find out that <classname>tenk1</classname> has 233 disk
pages and 10000 tuples. So the cost is estimated at 233 page pages and 10000 tuples. So the cost is estimated at 233 page
reads, defined as 1.0 apiece, plus 10000 * cpu_tuple_cost which is reads, defined as 1.0 apiece, plus 10000 * <varname>cpu_tuple_cost</varname> which is
currently 0.01 (try <command>show cpu_tuple_cost</command>). currently 0.01 (try <command>show cpu_tuple_cost</command>).
</para> </para>
...@@ -152,7 +152,7 @@ Index Scan using tenk1_unique1 on tenk1 (cost=0.00..173.32 rows=47 width=148) ...@@ -152,7 +152,7 @@ Index Scan using tenk1_unique1 on tenk1 (cost=0.00..173.32 rows=47 width=148)
and you will see that if we make the WHERE condition selective and you will see that if we make the WHERE condition selective
enough, the planner will enough, the planner will
eventually decide that an indexscan is cheaper than a sequential scan. eventually decide that an index scan is cheaper than a sequential scan.
This plan will only have to visit 50 tuples because of the index, This plan will only have to visit 50 tuples because of the index,
so it wins despite the fact that each individual fetch is more expensive so it wins despite the fact that each individual fetch is more expensive
than reading a whole disk page sequentially. than reading a whole disk page sequentially.
...@@ -169,7 +169,7 @@ NOTICE: QUERY PLAN: ...@@ -169,7 +169,7 @@ NOTICE: QUERY PLAN:
Index Scan using tenk1_unique1 on tenk1 (cost=0.00..173.44 rows=1 width=148) Index Scan using tenk1_unique1 on tenk1 (cost=0.00..173.44 rows=1 width=148)
</programlisting> </programlisting>
The added clause "stringu1 = 'xxx'" reduces the output-rows estimate, The added clause <literal>stringu1 = 'xxx'</literal> reduces the output-rows estimate,
but not the cost because we still have to visit the same set of tuples. but not the cost because we still have to visit the same set of tuples.
</para> </para>
...@@ -190,18 +190,18 @@ Nested Loop (cost=0.00..269.11 rows=47 width=296) ...@@ -190,18 +190,18 @@ Nested Loop (cost=0.00..269.11 rows=47 width=296)
</para> </para>
<para> <para>
In this nested-loop join, the outer scan is the same indexscan we had In this nested-loop join, the outer scan is the same index scan we had
in the example before last, and so its cost and row count are the same in the example before last, and so its cost and row count are the same
because we are applying the "unique1 &lt; 50" WHERE clause at that node. because we are applying the "unique1 &lt; 50" WHERE clause at that node.
The "t1.unique2 = t2.unique2" clause isn't relevant yet, so it doesn't The "t1.unique2 = t2.unique2" clause isn't relevant yet, so it doesn't
affect the outer scan's row count. For the inner scan, the affect row count of the outer scan. For the inner scan, the unique2 value of the
current current
outer-scan tuple's unique2 value is plugged into the inner indexscan outer-scan tuple is plugged into the inner index scan
to produce an indexqual like to produce an index qualification like
"t2.unique2 = <replaceable>constant</replaceable>". So we get the "t2.unique2 = <replaceable>constant</replaceable>". So we get the
same inner-scan plan and costs that we'd get from, say, "explain select same inner-scan plan and costs that we'd get from, say, <literal>explain select
* from tenk2 where unique2 = 42". The loop node's costs are then set * from tenk2 where unique2 = 42</literal>. The costs of the loop node are then set
on the basis of the outer scan's cost, plus one repetition of the on the basis of the cost of the outer scan, plus one repetition of the
inner scan for each outer tuple (47 * 2.01, here), plus a little CPU inner scan for each outer tuple (47 * 2.01, here), plus a little CPU
time for join processing. time for join processing.
</para> </para>
...@@ -212,7 +212,7 @@ Nested Loop (cost=0.00..269.11 rows=47 width=296) ...@@ -212,7 +212,7 @@ Nested Loop (cost=0.00..269.11 rows=47 width=296)
in general you can have WHERE clauses that mention both relations and in general you can have WHERE clauses that mention both relations and
so can only be applied at the join point, not to either input scan. so can only be applied at the join point, not to either input scan.
For example, if we added "WHERE ... AND t1.hundred &lt; t2.hundred", For example, if we added "WHERE ... AND t1.hundred &lt; t2.hundred",
that'd decrease the output row count of the join node, but not change that would decrease the output row count of the join node, but not change
either input scan. either input scan.
</para> </para>
...@@ -237,13 +237,13 @@ Hash Join (cost=173.44..557.03 rows=47 width=296) ...@@ -237,13 +237,13 @@ Hash Join (cost=173.44..557.03 rows=47 width=296)
(cost=0.00..173.32 rows=47 width=148) (cost=0.00..173.32 rows=47 width=148)
</programlisting> </programlisting>
This plan proposes to extract the 50 interesting rows of tenk1 This plan proposes to extract the 50 interesting rows of <classname>tenk1</classname>
using ye same olde indexscan, stash them into an in-memory hash table, using ye same olde index scan, stash them into an in-memory hash table,
and then do a sequential scan of tenk2, probing into the hash table and then do a sequential scan of <classname>tenk2</classname>, probing into the hash table
for possible matches of "t1.unique2 = t2.unique2" at each tenk2 tuple. for possible matches of "t1.unique2 = t2.unique2" at each <classname>tenk2</classname> tuple.
The cost to read tenk1 and set up the hash table is entirely start-up The cost to read <classname>tenk1</classname> and set up the hash table is entirely start-up
cost for the hash join, since we won't get any tuples out until we can cost for the hash join, since we won't get any tuples out until we can
start reading tenk2. The total time estimate for the join also start reading <classname>tenk2</classname>. The total time estimate for the join also
includes a hefty charge for CPU time to probe the hash table includes a hefty charge for CPU time to probe the hash table
10000 times. Note, however, that we are NOT charging 10000 times 173.32; 10000 times. Note, however, that we are NOT charging 10000 times 173.32;
the hash table setup is only done once in this plan type. the hash table setup is only done once in this plan type.
...@@ -302,8 +302,8 @@ SELECT * FROM a,b,c WHERE a.id = b.id AND b.ref = c.id; ...@@ -302,8 +302,8 @@ SELECT * FROM a,b,c WHERE a.id = b.id AND b.ref = c.id;
annoyingly long time. When there are too many input tables, the annoyingly long time. When there are too many input tables, the
<productname>Postgres</productname> planner will switch from exhaustive <productname>Postgres</productname> planner will switch from exhaustive
search to a <firstterm>genetic</firstterm> probabilistic search search to a <firstterm>genetic</firstterm> probabilistic search
through a limited number of possibilities. (The switchover threshold is through a limited number of possibilities. (The switch-over threshold is
set by the GEQO_THRESHOLD run-time set by the <varname>GEQO_THRESHOLD</varname> run-time
parameter described in the <citetitle>Administrator's Guide</citetitle>.) parameter described in the <citetitle>Administrator's Guide</citetitle>.)
The genetic search takes less time, but it won't The genetic search takes less time, but it won't
necessarily find the best possible plan. necessarily find the best possible plan.
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/problems.sgml,v 2.7 2001/03/24 03:40:44 tgl Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/problems.sgml,v 2.8 2001/09/09 17:21:59 petere Exp $
--> -->
<sect1 id="bug-reporting"> <sect1 id="bug-reporting">
...@@ -137,10 +137,10 @@ $Header: /cvsroot/pgsql/doc/src/sgml/problems.sgml,v 2.7 2001/03/24 03:40:44 tgl ...@@ -137,10 +137,10 @@ $Header: /cvsroot/pgsql/doc/src/sgml/problems.sgml,v 2.7 2001/03/24 03:40:44 tgl
query. query.
You are encouraged to You are encouraged to
minimize the size of your example, but this is not absolutely necessary. minimize the size of your example, but this is not absolutely necessary.
If the bug is reproduceable, we will find it either way. If the bug is reproducible, we will find it either way.
</para> </para>
<para> <para>
If your application uses some other client interface, such as PHP, then If your application uses some other client interface, such as <applicatioN>PHP</>, then
please try to isolate the offending queries. We will probably not set up a please try to isolate the offending queries. We will probably not set up a
web server to reproduce your problem. In any case remember to provide web server to reproduce your problem. In any case remember to provide
the exact input files, do not guess that the problem happens for the exact input files, do not guess that the problem happens for
...@@ -174,7 +174,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/problems.sgml,v 2.7 2001/03/24 03:40:44 tgl ...@@ -174,7 +174,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/problems.sgml,v 2.7 2001/03/24 03:40:44 tgl
The output you expected is very important to state. If you just write The output you expected is very important to state. If you just write
"This command gives me that output." or "This is not "This command gives me that output." or "This is not
what I expected.", we might run it ourselves, scan the output, and what I expected.", we might run it ourselves, scan the output, and
think it looks okay and is exactly what we expected. We should not have to think it looks OK and is exactly what we expected. We should not have to
spend the time to decode the exact semantics behind your commands. spend the time to decode the exact semantics behind your commands.
Especially refrain from merely saying that "This is not what SQL says/Oracle Especially refrain from merely saying that "This is not what SQL says/Oracle
does." Digging out the correct behavior from <acronym>SQL</acronym> does." Digging out the correct behavior from <acronym>SQL</acronym>
...@@ -188,7 +188,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/problems.sgml,v 2.7 2001/03/24 03:40:44 tgl ...@@ -188,7 +188,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/problems.sgml,v 2.7 2001/03/24 03:40:44 tgl
<para> <para>
Any command line options and other start-up options, including concerned Any command line options and other start-up options, including concerned
environment variables or configuration files that you changed from the environment variables or configuration files that you changed from the
default. Again, be exact. If you are using a pre-packaged default. Again, be exact. If you are using a prepackaged
distribution that starts the database server at boot time, you should try distribution that starts the database server at boot time, you should try
to find out how that is done. to find out how that is done.
</para> </para>
...@@ -212,7 +212,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/problems.sgml,v 2.7 2001/03/24 03:40:44 tgl ...@@ -212,7 +212,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/problems.sgml,v 2.7 2001/03/24 03:40:44 tgl
old enough. You can also look into the <filename>README</filename> file old enough. You can also look into the <filename>README</filename> file
in the source directory or at the in the source directory or at the
name of your distribution file or package name. name of your distribution file or package name.
If you run a pre-packaged version, such as RPMs, say so, including any If you run a prepackaged version, such as RPMs, say so, including any
subversion the package may have. If you are talking about a CVS subversion the package may have. If you are talking about a CVS
snapshot, mention that, including its date and time. snapshot, mention that, including its date and time.
</para> </para>
......
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/queries.sgml,v 1.8 2001/08/30 08:16:42 ishii Exp $ --> <!-- $Header: /cvsroot/pgsql/doc/src/sgml/queries.sgml,v 1.9 2001/09/09 17:21:59 petere Exp $ -->
<chapter id="queries"> <chapter id="queries">
<title>Queries</title> <title>Queries</title>
...@@ -85,7 +85,7 @@ FROM <replaceable>table_reference</replaceable> <optional>, <replaceable>table_r ...@@ -85,7 +85,7 @@ FROM <replaceable>table_reference</replaceable> <optional>, <replaceable>table_r
A table reference may be a table name or a derived table such as a A table reference may be a table name or a derived table such as a
subquery, a table join, or complex combinations of these. If more subquery, a table join, or complex combinations of these. If more
than one table reference is listed in the FROM clause they are than one table reference is listed in the FROM clause they are
CROSS JOINed (see below) to form the derived table that may then cross-joined (see below) to form the derived table that may then
be subject to transformations by the WHERE, GROUP BY, and HAVING be subject to transformations by the WHERE, GROUP BY, and HAVING
clauses and is finally the result of the overall table expression. clauses and is finally the result of the overall table expression.
</para> </para>
...@@ -150,7 +150,7 @@ FROM <replaceable>table_reference</replaceable> <optional>, <replaceable>table_r ...@@ -150,7 +150,7 @@ FROM <replaceable>table_reference</replaceable> <optional>, <replaceable>table_r
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>Qualified JOINs</term> <term>Qualified joins</term>
<listitem> <listitem>
<indexterm> <indexterm>
...@@ -166,7 +166,7 @@ FROM <replaceable>table_reference</replaceable> <optional>, <replaceable>table_r ...@@ -166,7 +166,7 @@ FROM <replaceable>table_reference</replaceable> <optional>, <replaceable>table_r
<para> <para>
The words <token>INNER</token> and <token>OUTER</token> are The words <token>INNER</token> and <token>OUTER</token> are
optional for all JOINs. <token>INNER</token> is the default; optional for all joins. <token>INNER</token> is the default;
<token>LEFT</token>, <token>RIGHT</token>, and <token>LEFT</token>, <token>RIGHT</token>, and
<token>FULL</token> imply an OUTER JOIN. <token>FULL</token> imply an OUTER JOIN.
</para> </para>
...@@ -281,7 +281,7 @@ FROM <replaceable>table_reference</replaceable> <optional>, <replaceable>table_r ...@@ -281,7 +281,7 @@ FROM <replaceable>table_reference</replaceable> <optional>, <replaceable>table_r
<para> <para>
Joins of all types can be chained together or nested: either Joins of all types can be chained together or nested: either
or both of <replaceable>T1</replaceable> and or both of <replaceable>T1</replaceable> and
<replaceable>T2</replaceable> may be JOINed tables. Parentheses <replaceable>T2</replaceable> may be joined tables. Parentheses
may be used around JOIN clauses to control the join order. In the may be used around JOIN clauses to control the join order. In the
absence of parentheses, JOIN clauses nest left-to-right. absence of parentheses, JOIN clauses nest left-to-right.
</para> </para>
...@@ -479,7 +479,7 @@ FROM a NATURAL JOIN b WHERE b.val &gt; 5 ...@@ -479,7 +479,7 @@ FROM a NATURAL JOIN b WHERE b.val &gt; 5
Which one of these you use is mainly a matter of style. The JOIN Which one of these you use is mainly a matter of style. The JOIN
syntax in the FROM clause is probably not as portable to other syntax in the FROM clause is probably not as portable to other
products. For outer joins there is no choice in any case: they products. For outer joins there is no choice in any case: they
must be done in the FROM clause. An outer join's ON/USING clause must be done in the FROM clause. A ON/USING clause of an outer join
is <emphasis>not</> equivalent to a WHERE condition, because it is <emphasis>not</> equivalent to a WHERE condition, because it
determines the addition of rows (for unmatched input rows) as well determines the addition of rows (for unmatched input rows) as well
as the removal of rows from the final result. as the removal of rows from the final result.
...@@ -505,16 +505,18 @@ FROM FDT WHERE ...@@ -505,16 +505,18 @@ FROM FDT WHERE
</programlisting> </programlisting>
<para> <para>
In the examples above, FDT is the table derived in the FROM In the examples above, <literal>FDT</literal> is the table derived
clause. Rows that do not meet the search condition of the where in the FROM clause. Rows that do not meet the search condition of
clause are eliminated from FDT. Notice the use of scalar the where clause are eliminated from
subqueries as value expressions. Just like <literal>FDT</literal>. Notice the use of scalar subqueries as
any other query, the subqueries can employ complex table value expressions. Just like any other query, the subqueries can
expressions. Notice how FDT is referenced in the subqueries. employ complex table expressions. Notice how
Qualifying C1 as FDT.C1 is only necessary if C1 is also the name of a <literal>FDT</literal> is referenced in the subqueries.
column in the derived input table of the subquery. Qualifying the Qualifying <literal>C1</> as <literal>FDT.C1</> is only necessary
column name adds clarity even when it is not needed. This shows how if <literal>C1</> is also the name of a column in the derived
the column naming scope of an outer query extends into its inner queries. input table of the subquery. Qualifying the column name adds
clarity even when it is not needed. This shows how the column
naming scope of an outer query extends into its inner queries.
</para> </para>
</sect2> </sect2>
...@@ -569,7 +571,7 @@ SELECT pid, p.name, (sum(s.units) * p.price) AS sales ...@@ -569,7 +571,7 @@ SELECT pid, p.name, (sum(s.units) * p.price) AS sales
FROM products p LEFT JOIN sales s USING ( pid ) FROM products p LEFT JOIN sales s USING ( pid )
GROUP BY pid, p.name, p.price; GROUP BY pid, p.name, p.price;
</programlisting> </programlisting>
In this example, the columns pid, p.name, and p.price must be in In this example, the columns <literal>pid</literal>, <literal>p.name</literal>, and <literal>p.price</literal> must be in
the GROUP BY clause since they are referenced in the query select the GROUP BY clause since they are referenced in the query select
list. The column s.units does not have to be in the GROUP BY list list. The column s.units does not have to be in the GROUP BY list
since it is only used in an aggregate expression since it is only used in an aggregate expression
...@@ -868,12 +870,12 @@ SELECT a, b FROM table1 ORDER BY a + b; ...@@ -868,12 +870,12 @@ SELECT a, b FROM table1 ORDER BY a + b;
SELECT a AS b FROM table1 ORDER BY a; SELECT a AS b FROM table1 ORDER BY a;
</programlisting> </programlisting>
But these extensions do not work in queries involving UNION, INTERSECT, But these extensions do not work in queries involving UNION, INTERSECT,
or EXCEPT, and are not portable to other DBMSes. or EXCEPT, and are not portable to other <acronym>DBMS</acronym>.
</para> </para>
<para> <para>
Each column specification may be followed by an optional ASC or Each column specification may be followed by an optional <token>ASC</token> or
DESC to set the sort direction. ASC is default. Ascending order <token>DESC</token> to set the sort direction. <token>ASC</token> is default. Ascending order
puts smaller values first, where <quote>smaller</quote> is defined puts smaller values first, where <quote>smaller</quote> is defined
in terms of the <literal>&lt;</literal> operator. Similarly, in terms of the <literal>&lt;</literal> operator. Similarly,
descending order is determined with the <literal>&gt;</literal> descending order is determined with the <literal>&gt;</literal>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/syntax.sgml,v 1.45 2001/08/26 21:17:12 tgl Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/syntax.sgml,v 1.46 2001/09/09 17:21:59 petere Exp $
--> -->
<chapter id="sql-syntax"> <chapter id="sql-syntax">
...@@ -462,7 +462,7 @@ CAST ( '<replaceable>string</replaceable>' AS <replaceable>type</replaceable> ) ...@@ -462,7 +462,7 @@ CAST ( '<replaceable>string</replaceable>' AS <replaceable>type</replaceable> )
<listitem> <listitem>
<para> <para>
"$" (dollar) cannot be a single-character operator, although it "$" (dollar) cannot be a single-character operator, although it
can be part of a multi-character operator name. can be part of a multiple-character operator name.
</para> </para>
</listitem> </listitem>
...@@ -476,7 +476,7 @@ CAST ( '<replaceable>string</replaceable>' AS <replaceable>type</replaceable> ) ...@@ -476,7 +476,7 @@ CAST ( '<replaceable>string</replaceable>' AS <replaceable>type</replaceable> )
<listitem> <listitem>
<para> <para>
A multi-character operator name cannot end in "+" or "-", A multiple-character operator name cannot end in "+" or "-",
unless the name also contains at least one of these characters: unless the name also contains at least one of these characters:
<literallayout> <literallayout>
~ ! @ # % ^ &amp; | ` ? $ ~ ! @ # % ^ &amp; | ` ? $
...@@ -600,7 +600,7 @@ CAST ( '<replaceable>string</replaceable>' AS <replaceable>type</replaceable> ) ...@@ -600,7 +600,7 @@ CAST ( '<replaceable>string</replaceable>' AS <replaceable>type</replaceable> )
<para> <para>
Alternatively, C-style block comments can be used: Alternatively, C-style block comments can be used:
<programlisting> <programlisting>
/* multi-line comment /* multiline comment
* with nesting: /* nested block comment */ * with nesting: /* nested block comment */
*/ */
</programlisting> </programlisting>
...@@ -634,7 +634,7 @@ CAST ( '<replaceable>string</replaceable>' AS <replaceable>type</replaceable> ) ...@@ -634,7 +634,7 @@ CAST ( '<replaceable>string</replaceable>' AS <replaceable>type</replaceable> )
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term>oid</term> <term><structfield>oid</></term>
<listitem> <listitem>
<para> <para>
<indexterm> <indexterm>
...@@ -649,20 +649,22 @@ CAST ( '<replaceable>string</replaceable>' AS <replaceable>type</replaceable> ) ...@@ -649,20 +649,22 @@ CAST ( '<replaceable>string</replaceable>' AS <replaceable>type</replaceable> )
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>tableoid</term> <term><structfield>tableoid</></term>
<listitem> <listitem>
<para> <para>
The OID of the table containing this row. This attribute is The OID of the table containing this row. This attribute is
particularly handy for queries that select from inheritance particularly handy for queries that select from inheritance
hierarchies, since without it, it's difficult to tell which hierarchies, since without it, it's difficult to tell which
individual table a row came from. The tableoid can be joined individual table a row came from. The
against the OID attribute of pg_class to obtain the table name. <structfield>tableoid</structfield> can be joined against the
<structfield>oid</structfield> column of
<classname>pg_class</classname> to obtain the table name.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>xmin</term> <term><structfield>xmin</></term>
<listitem> <listitem>
<para> <para>
The identity (transaction ID) of the inserting transaction for The identity (transaction ID) of the inserting transaction for
...@@ -673,7 +675,7 @@ CAST ( '<replaceable>string</replaceable>' AS <replaceable>type</replaceable> ) ...@@ -673,7 +675,7 @@ CAST ( '<replaceable>string</replaceable>' AS <replaceable>type</replaceable> )
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>cmin</term> <term><structfield>cmin</></term>
<listitem> <listitem>
<para> <para>
The command identifier (starting at zero) within the inserting The command identifier (starting at zero) within the inserting
...@@ -683,7 +685,7 @@ CAST ( '<replaceable>string</replaceable>' AS <replaceable>type</replaceable> ) ...@@ -683,7 +685,7 @@ CAST ( '<replaceable>string</replaceable>' AS <replaceable>type</replaceable> )
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>xmax</term> <term><structfield>xmax</></term>
<listitem> <listitem>
<para> <para>
The identity (transaction ID) of the deleting transaction, The identity (transaction ID) of the deleting transaction,
...@@ -696,7 +698,7 @@ CAST ( '<replaceable>string</replaceable>' AS <replaceable>type</replaceable> ) ...@@ -696,7 +698,7 @@ CAST ( '<replaceable>string</replaceable>' AS <replaceable>type</replaceable> )
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>cmax</term> <term><structfield>cmax</></term>
<listitem> <listitem>
<para> <para>
The command identifier within the deleting transaction, or zero. The command identifier within the deleting transaction, or zero.
...@@ -705,16 +707,16 @@ CAST ( '<replaceable>string</replaceable>' AS <replaceable>type</replaceable> ) ...@@ -705,16 +707,16 @@ CAST ( '<replaceable>string</replaceable>' AS <replaceable>type</replaceable> )
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>ctid</term> <term><structfield>ctid</></term>
<listitem> <listitem>
<para> <para>
The tuple ID of the tuple within its table. This is a pair The tuple ID of the tuple within its table. This is a pair
(block number, tuple index within block) that identifies the (block number, tuple index within block) that identifies the
physical location of the tuple. Note that although the ctid physical location of the tuple. Note that although the <structfield>ctid</structfield>
can be used to locate the tuple very quickly, a row's ctid can be used to locate the tuple very quickly, a row's <structfield>ctid</structfield>
will change each time it is updated or moved by <command>VACUUM will change each time it is updated or moved by <command>VACUUM
FULL</>. FULL</>.
Therefore ctid is useless as a long-term row identifier. Therefore <structfield>ctid</structfield> is useless as a long-term row identifier.
The OID, or even better a user-defined serial number, should The OID, or even better a user-defined serial number, should
be used to identify logical rows. be used to identify logical rows.
</para> </para>
...@@ -731,9 +733,9 @@ CAST ( '<replaceable>string</replaceable>' AS <replaceable>type</replaceable> ) ...@@ -731,9 +733,9 @@ CAST ( '<replaceable>string</replaceable>' AS <replaceable>type</replaceable> )
Recommended practice when using OIDs for row identification is to create Recommended practice when using OIDs for row identification is to create
a unique index on the OID column of each table for which the OID will be a unique index on the OID column of each table for which the OID will be
used. Never assume that OIDs are unique across tables; use the used. Never assume that OIDs are unique across tables; use the
combination of tableoid and row OID if you need a database-wide combination of <structfield>tableoid</> and row OID if you need a database-wide
identifier. (Future releases of Postgres are likely to use a separate identifier. (Future releases of Postgres are likely to use a separate
OID counter for each table, so that tableoid <emphasis>must</> be OID counter for each table, so that <structfield>tableoid</> <emphasis>must</> be
included to arrive at a globally unique identifier.) included to arrive at a globally unique identifier.)
</para> </para>
......
...@@ -150,8 +150,8 @@ extended user-defined types to use these same features transparently. ...@@ -150,8 +150,8 @@ extended user-defined types to use these same features transparently.
<para> <para>
An additional heuristic is provided in the parser to allow better guesses An additional heuristic is provided in the parser to allow better guesses
at proper behavior for <acronym>SQL</acronym> standard types. There are at proper behavior for <acronym>SQL</acronym> standard types. There are
several basic <firstterm>type categories</firstterm> defined: boolean, several basic <firstterm>type categories</firstterm> defined: <type>boolean</type>,
numeric, string, bitstring, datetime, timespan, geometric, network, <type>numeric</type>, <type>string</type>, <type>bitstring</type>, <type>datetime</type>, <type>timespan</type>, <type>geometric</type>, <type>network</type>,
and user-defined. Each category, with the exception of user-defined, has and user-defined. Each category, with the exception of user-defined, has
a <firstterm>preferred type</firstterm> which is preferentially selected a <firstterm>preferred type</firstterm> which is preferentially selected
when there is ambiguity. when there is ambiguity.
...@@ -273,7 +273,7 @@ If only one candidate remains, use it; else continue to the next step. ...@@ -273,7 +273,7 @@ If only one candidate remains, use it; else continue to the next step.
</step> </step>
<step performance="required"> <step performance="required">
<para> <para>
If any input arguments are "unknown", check the type categories accepted If any input arguments are <quote>unknown</quote>, check the type categories accepted
at those argument positions by the remaining candidates. At each position, at those argument positions by the remaining candidates. At each position,
select "string" select "string"
category if any candidate accepts that category (this bias towards string category if any candidate accepts that category (this bias towards string
...@@ -281,7 +281,7 @@ is appropriate since an unknown-type literal does look like a string). ...@@ -281,7 +281,7 @@ is appropriate since an unknown-type literal does look like a string).
Otherwise, if all the remaining candidates accept the same type category, Otherwise, if all the remaining candidates accept the same type category,
select that category; otherwise fail because select that category; otherwise fail because
the correct choice cannot be deduced without more clues. Also note whether the correct choice cannot be deduced without more clues. Also note whether
any of the candidates accept a preferred datatype within the selected category. any of the candidates accept a preferred data type within the selected category.
Now discard operator candidates that do not accept the selected type category; Now discard operator candidates that do not accept the selected type category;
furthermore, if any candidate accepts a preferred type at a given argument furthermore, if any candidate accepts a preferred type at a given argument
position, discard candidates that accept non-preferred types for that position, discard candidates that accept non-preferred types for that
...@@ -391,7 +391,7 @@ tgl=> SELECT 'abc' || 'def' AS "Unspecified"; ...@@ -391,7 +391,7 @@ tgl=> SELECT 'abc' || 'def' AS "Unspecified";
In this case there is no initial hint for which type to use, since no types In this case there is no initial hint for which type to use, since no types
are specified in the query. So, the parser looks for all candidate operators are specified in the query. So, the parser looks for all candidate operators
and finds that there are candidates accepting both string-category and and finds that there are candidates accepting both string-category and
bitstring-category inputs. Since string category is preferred when available, bit-string-category inputs. Since string category is preferred when available,
that category is selected, and then the that category is selected, and then the
"preferred type" for strings, <type>text</type>, is used as the specific "preferred type" for strings, <type>text</type>, is used as the specific
type to resolve the unknown literals to. type to resolve the unknown literals to.
...@@ -440,7 +440,7 @@ will try to oblige. ...@@ -440,7 +440,7 @@ will try to oblige.
<step performance="required"> <step performance="required">
<para> <para>
Check for an exact match in the pg_proc system catalog. Check for an exact match in the <classname>pg_proc</classname> system catalog.
(Cases involving <type>unknown</type> will never find a match at (Cases involving <type>unknown</type> will never find a match at
this step.) this step.)
</para></step> </para></step>
...@@ -491,7 +491,7 @@ is appropriate since an unknown-type literal does look like a string). ...@@ -491,7 +491,7 @@ is appropriate since an unknown-type literal does look like a string).
Otherwise, if all the remaining candidates accept the same type category, Otherwise, if all the remaining candidates accept the same type category,
select that category; otherwise fail because select that category; otherwise fail because
the correct choice cannot be deduced without more clues. Also note whether the correct choice cannot be deduced without more clues. Also note whether
any of the candidates accept a preferred datatype within the selected category. any of the candidates accept a preferred data type within the selected category.
Now discard operator candidates that do not accept the selected type category; Now discard operator candidates that do not accept the selected type category;
furthermore, if any candidate accepts a preferred type at a given argument furthermore, if any candidate accepts a preferred type at a given argument
position, discard candidates that accept non-preferred types for that position, discard candidates that accept non-preferred types for that
...@@ -512,10 +512,10 @@ then fail. ...@@ -512,10 +512,10 @@ then fail.
If no best match could be identified, see whether the function call appears If no best match could be identified, see whether the function call appears
to be a trivial type coercion request. This happens if the function call to be a trivial type coercion request. This happens if the function call
has just one argument and the function name is the same as the (internal) has just one argument and the function name is the same as the (internal)
name of some datatype. Furthermore, the function argument must be either name of some data type. Furthermore, the function argument must be either
an unknown-type literal or a type that is binary-compatible with the named an unknown-type literal or a type that is binary-compatible with the named
datatype. When these conditions are met, the function argument is coerced data type. When these conditions are met, the function argument is coerced
to the named datatype. to the named data type.
</para> </para>
</step> </step>
</procedure> </procedure>
...@@ -527,7 +527,7 @@ to the named datatype. ...@@ -527,7 +527,7 @@ to the named datatype.
<title>Factorial Function</title> <title>Factorial Function</title>
<para> <para>
There is only one factorial function defined in the pg_proc catalog. There is only one factorial function defined in the <classname>pg_proc</classname> catalog.
So the following query automatically converts the <type>int2</type> argument So the following query automatically converts the <type>int2</type> argument
to <type>int4</type>: to <type>int4</type>:
...@@ -554,7 +554,7 @@ tgl=> select int4fac(int4(int2 '4')); ...@@ -554,7 +554,7 @@ tgl=> select int4fac(int4(int2 '4'));
<title>Substring Function</title> <title>Substring Function</title>
<para> <para>
There are two <function>substr</function> functions declared in pg_proc. However, There are two <function>substr</function> functions declared in <classname>pg_proc</classname>. However,
only one takes two arguments, of types <type>text</type> and <type>int4</type>. only one takes two arguments, of types <type>text</type> and <type>int4</type>.
</para> </para>
...@@ -679,8 +679,8 @@ tgl=> SELECT * FROM vv; ...@@ -679,8 +679,8 @@ tgl=> SELECT * FROM vv;
What's really happened here is that the two unknown literals are resolved What's really happened here is that the two unknown literals are resolved
to text by default, allowing the <literal>||</literal> operator to be to text by default, allowing the <literal>||</literal> operator to be
resolved as text concatenation. Then the text result of the operator resolved as text concatenation. Then the text result of the operator
is coerced to varchar to match the target column type. (But, since the is coerced to <type>varchar</type> to match the target column type. (But, since the
parser knows that text and varchar are binary-compatible, this coercion parser knows that text and <type>varchar</type> are binary-compatible, this coercion
is implicit and does not insert any real function call.) Finally, the is implicit and does not insert any real function call.) Finally, the
sizing function <literal>varchar(varchar,int4)</literal> is found in the system sizing function <literal>varchar(varchar,int4)</literal> is found in the system
catalogs and applied to the operator's result and the stored column length. catalogs and applied to the operator's result and the stored column length.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment