Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
84956e71
Commit
84956e71
authored
Sep 09, 2001
by
Peter Eisentraut
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Markup additions and spell check. (covers User's Guide)
parent
ba708ea3
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
704 additions
and
696 deletions
+704
-696
doc/src/sgml/array.sgml
doc/src/sgml/array.sgml
+2
-2
doc/src/sgml/datatype.sgml
doc/src/sgml/datatype.sgml
+56
-56
doc/src/sgml/datetime.sgml
doc/src/sgml/datetime.sgml
+2
-2
doc/src/sgml/func.sgml
doc/src/sgml/func.sgml
+529
-523
doc/src/sgml/history.sgml
doc/src/sgml/history.sgml
+5
-5
doc/src/sgml/indices.sgml
doc/src/sgml/indices.sgml
+3
-3
doc/src/sgml/inherit.sgml
doc/src/sgml/inherit.sgml
+3
-3
doc/src/sgml/legal.sgml
doc/src/sgml/legal.sgml
+2
-2
doc/src/sgml/manage.sgml
doc/src/sgml/manage.sgml
+12
-14
doc/src/sgml/mvcc.sgml
doc/src/sgml/mvcc.sgml
+2
-2
doc/src/sgml/notation.sgml
doc/src/sgml/notation.sgml
+5
-5
doc/src/sgml/perform.sgml
doc/src/sgml/perform.sgml
+21
-21
doc/src/sgml/problems.sgml
doc/src/sgml/problems.sgml
+6
-6
doc/src/sgml/queries.sgml
doc/src/sgml/queries.sgml
+22
-20
doc/src/sgml/syntax.sgml
doc/src/sgml/syntax.sgml
+20
-18
doc/src/sgml/typeconv.sgml
doc/src/sgml/typeconv.sgml
+14
-14
No files found.
doc/src/sgml/array.sgml
View file @
84956e71
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/array.sgml,v 1.1
1 2001/05/12 22:51:3
4 petere Exp $ -->
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/array.sgml,v 1.1
2 2001/09/09 17:21:4
4 petere Exp $ -->
<chapter id="arrays">
<title>Arrays</title>
...
...
@@ -9,7 +9,7 @@
<para>
<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
their use, we create this table:
<programlisting>
...
...
doc/src/sgml/datatype.sgml
View file @
84956e71
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/datatype.sgml,v 1.6
1 2001/09/04 03:17:54 momjian
Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/datatype.sgml,v 1.6
2 2001/09/09 17:21:51 petere
Exp $
-->
<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
<tbody>
<row>
<entry>
smallint
</entry>
<entry>
<type>smallint</>
</entry>
<entry>2 bytes</entry>
<entry>Fixed-precision</entry>
<entry>-32768 to +32767</entry>
</row>
<row>
<entry>
integer
</entry>
<entry>
<type>integer</>
</entry>
<entry>4 bytes</entry>
<entry>Usual choice for fixed-precision</entry>
<entry>-2147483648 to +2147483647</entry>
</row>
<row>
<entry>
bigint
</entry>
<entry>
<type>bigint</>
</entry>
<entry>8 bytes</entry>
<entry>Very large range fixed-precision</entry>
<entry>about 18 decimal digits</entry>
</row>
<row>
<entry>
decimal
</entry>
<entry>
<type>decimal</>
</entry>
<entry>variable</entry>
<entry>user-specified precision, exact</entry>
<entry>no limit</entry>
</row>
<row>
<entry>
numeric
</entry>
<entry>
<type>numeric</>
</entry>
<entry>variable</entry>
<entry>user-specified precision, exact</entry>
<entry>no limit</entry>
</row>
<row>
<entry>
real
</entry>
<entry>
<type>real</>
</entry>
<entry>4 bytes</entry>
<entry>variable-precision, inexact</entry>
<entry>6 decimal digits precision</entry>
</row>
<row>
<entry>
double precision
</entry>
<entry>
<type>double precision</>
</entry>
<entry>8 bytes</entry>
<entry>variable-precision, inexact</entry>
<entry>15 decimal digits precision</entry>
</row>
<row>
<entry>
serial
</entry>
<entry>
<type>serial</>
</entry>
<entry>4 bytes</entry>
<entry>autoincrementing integer</entry>
<entry>1 to 2147483647</entry>
</row>
<row>
<entry>
bigserial
</entry>
<entry>
<type>bigserial</type>
</entry>
<entry>8 bytes</entry>
<entry>autoincrementing integer</entry>
<entry>1 to 9223372036854775807</entry>
...
...
@@ -557,7 +557,7 @@ NUMERIC
<para>
The data types <type>real</type> and <type>double
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,
respectively), to the extent that the underlying processor,
operating system, and compiler support it.
...
...
@@ -636,7 +636,7 @@ NUMERIC
</indexterm>
<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
in tables.
In the current implementation, specifying
...
...
@@ -777,21 +777,17 @@ CREATE TABLE <replaceable class="parameter">tablename</replaceable> (<replaceabl
</thead>
<tbody>
<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>
</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>
</row>
<row>
<entry>
text
</entry>
<entry>
<type>text</type>
</entry>
<entry>Variable unlimited length</entry>
</row>
<row>
<entry>bytea</entry>
<entry>binary data</entry>
</row>
</tbody>
</tgroup>
</table>
...
...
@@ -839,19 +835,6 @@ CREATE TABLE <replaceable class="parameter">tablename</replaceable> (<replaceabl
standard, many other RDBMS packages have it as well.
</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>
The storage requirement for data of these types is 4 bytes plus
the actual string, and in case of <type>character</type> plus the
...
...
@@ -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
allowed for <replaceable>n</> in the data type declaration is
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.)
</para>
...
...
@@ -957,6 +940,23 @@ SELECT b, char_length(b) FROM test2;
</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">
<title>Date/Time Types</title>
...
...
@@ -1083,7 +1083,7 @@ SELECT b, char_length(b) FROM test2;
</para>
<sect3>
<title>
date
</title>
<title>
<type>date</type>
</title>
<indexterm>
<primary>date</primary>
...
...
@@ -1260,7 +1260,7 @@ SELECT b, char_length(b) FROM test2;
</sect3>
<sect3>
<title>
time [ without time zone ]
</title>
<title>
<type>time [ without time zone ]</type>
</title>
<indexterm>
<primary>time</primary>
...
...
@@ -1328,7 +1328,7 @@ SELECT b, char_length(b) FROM test2;
</sect3>
<sect3>
<title>
time with time zone
</title>
<title>
<type>time with time zone</type>
</title>
<para>
This type is defined by SQL92, but the definition exhibits
...
...
@@ -1382,7 +1382,7 @@ SELECT b, char_length(b) FROM test2;
</sect3>
<sect3>
<title>
timestamp
</title>
<title>
<type>timestamp</type>
</title>
<indexterm>
<primary>timestamp</primary>
...
...
@@ -1442,7 +1442,7 @@ January 8 04:05:06 1999 PST
</sect3>
<sect3>
<title>
interval
</title>
<title>
<type>interval</type>
</title>
<indexterm>
<primary>interval</primary>
...
...
@@ -1664,7 +1664,7 @@ January 8 04:05:06 1999 PST
</listitem>
<listitem>
<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.
</para>
</listitem>
...
...
@@ -1753,13 +1753,13 @@ January 8 04:05:06 1999 PST
<itemizedlist spacing="compact" mark="bullet">
<listitem>
<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.
</para>
</listitem>
<listitem>
<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
connection.
</para>
...
...
@@ -1796,7 +1796,7 @@ January 8 04:05:06 1999 PST
<para>
If the runtime option <literal>AUSTRALIAN_TIMEZONES</literal> is set
then <literal>CST</literal> and <literal>EST</literal> refer to
Australian timezones, not American ones.
Australian time
zones, not American ones.
</para>
</note>
</para>
...
...
@@ -1939,49 +1939,49 @@ SELECT * FROM test1 WHERE a;
</thead>
<tbody>
<row>
<entry>
point
</entry>
<entry>
<type>point</type>
</entry>
<entry>16 bytes</entry>
<entry>(x,y)</entry>
<entry>Point in space</entry>
</row>
<row>
<entry>
line
</entry>
<entry>
<type>line</type>
</entry>
<entry>32 bytes</entry>
<entry>((x1,y1),(x2,y2))</entry>
<entry>Infinite line</entry>
</row>
<row>
<entry>
lseg
</entry>
<entry>
<type>lseg</type>
</entry>
<entry>32 bytes</entry>
<entry>((x1,y1),(x2,y2))</entry>
<entry>Finite line segment</entry>
</row>
<row>
<entry>
box
</entry>
<entry>
<type>box</type>
</entry>
<entry>32 bytes</entry>
<entry>((x1,y1),(x2,y2))</entry>
<entry>Rectangular box</entry>
</row>
<row>
<entry>
path
</entry>
<entry>
<type>path</type>
</entry>
<entry>4+32n bytes</entry>
<entry>((x1,y1),...)</entry>
<entry>Closed path (similar to polygon)</entry>
</row>
<row>
<entry>
path
</entry>
<entry>
<type>path</type>
</entry>
<entry>4+32n bytes</entry>
<entry>[(x1,y1),...]</entry>
<entry>Open path</entry>
</row>
<row>
<entry>
polygon
</entry>
<entry>
<type>polygon</type>
</entry>
<entry>4+32n bytes</entry>
<entry>((x1,y1),...)</entry>
<entry>Polygon (similar to closed path)</entry>
</row>
<row>
<entry>
circle
</entry>
<entry>
<type>circle</type>
</entry>
<entry>24 bytes</entry>
<entry><(x,y),r></entry>
<entry>Circle (center and radius)</entry>
...
...
@@ -2296,21 +2296,21 @@ SELECT * FROM test1 WHERE a;
<tbody>
<row>
<entry>
cidr
</entry>
<entry>
<type>cidr</type>
</entry>
<entry>12 bytes</entry>
<entry>IP networks</entry>
<entry>valid IPv4 networks</entry>
</row>
<row>
<entry>
inet
</entry>
<entry>
<type>inet</type>
</entry>
<entry>12 bytes</entry>
<entry>IP hosts and networks</entry>
<entry>valid IPv4 hosts or networks</entry>
</row>
<row>
<entry>
macaddr
</entry>
<entry>
<type>macaddr</type>
</entry>
<entry>6 bytes</entry>
<entry>MAC addresses</entry>
<entry>customary formats</entry>
...
...
@@ -2386,9 +2386,9 @@ SELECT * FROM test1 WHERE a;
<tgroup cols="3">
<thead>
<row>
<entry>
CIDR
Input</entry>
<entry>
CIDR
Displayed</entry>
<entry>
abbrev(CIDR
)</entry>
<entry>
<type>CIDR</type>
Input</entry>
<entry>
<type>CIDR</type>
Displayed</entry>
<entry>
<function>abbrev</function>(<type>CIDR</type>
)</entry>
</row>
</thead>
<tbody>
...
...
doc/src/sgml/datetime.sgml
View file @
84956e71
<!--
$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
-->
...
...
@@ -225,7 +225,7 @@ Date/time details
<row>
<entry>DNT</entry>
<entry>+1:00 </entry>
<entry>
Dansk Normal Tid
</entry>
<entry>
<foreignphrase>Dansk Normal Tid</foreignphrase>
</entry>
</row>
<row>
<entry>FST</entry>
...
...
doc/src/sgml/func.sgml
View file @
84956e71
<!-- $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">
<title>Functions and Operators</title>
...
...
@@ -496,163 +496,163 @@
<tbody>
<row>
<entry>
abs
(<replaceable>x</replaceable>)</entry>
<entry>
<function>abs</function>
(<replaceable>x</replaceable>)</entry>
<entry>(same as x)</entry>
<entry>absolute value</entry>
<entry>
abs(-17.4)
</entry>
<entry>
<literal>abs(-17.4)</literal>
</entry>
<entry>17.4</entry>
</row>
<row>
<entry>
cbrt
(<type>dp</type>)</entry>
<entry>
<function>cbrt</function>
(<type>dp</type>)</entry>
<entry><type>dp</type></entry>
<entry>cube root</entry>
<entry>
cbrt(27.0)
</entry>
<entry>
<literal>cbrt(27.0)</literal>
</entry>
<entry>3</entry>
</row>
<row>
<entry>
ceil
(<type>numeric</type>)</entry>
<entry>
<function>ceil</function>
(<type>numeric</type>)</entry>
<entry><type>numeric</type></entry>
<entry>smallest integer not less than argument</entry>
<entry>
ceil(-42.8)
</entry>
<entry>
<literal>ceil(-42.8)</literal>
</entry>
<entry>-42</entry>
</row>
<row>
<entry>
degrees
(<type>dp</type>)</entry>
<entry>
<function>degrees</function>
(<type>dp</type>)</entry>
<entry><type>dp</type></entry>
<entry>radians to degrees</entry>
<entry>
degrees(0.5)
</entry>
<entry>
<literal>degrees(0.5)</literal>
</entry>
<entry>28.6478897565412</entry>
</row>
<row>
<entry>
exp
(<type>dp</type>)</entry>
<entry>
<function>exp</function>
(<type>dp</type>)</entry>
<entry><type>dp</type></entry>
<entry>exponential</entry>
<entry>
exp(1.0)
</entry>
<entry>
<literal>exp(1.0)</literal>
</entry>
<entry>2.71828182845905</entry>
</row>
<row>
<entry>
floor
(<type>numeric</type>)</entry>
<entry>
<function>floor</function>
(<type>numeric</type>)</entry>
<entry><type>numeric</type></entry>
<entry>largest integer not greater than argument</entry>
<entry>
floor(-42.8)
</entry>
<entry>
<literal>floor(-42.8)</literal>
</entry>
<entry>-43</entry>
</row>
<row>
<entry>
ln
(<type>dp</type>)</entry>
<entry>
<function>ln</function>
(<type>dp</type>)</entry>
<entry><type>dp</type></entry>
<entry>natural logarithm</entry>
<entry>
ln(2.0)
</entry>
<entry>
<literal>ln(2.0)</literal>
</entry>
<entry>0.693147180559945</entry>
</row>
<row>
<entry>
log
(<type>dp</type>)</entry>
<entry>
<function>log</function>
(<type>dp</type>)</entry>
<entry><type>dp</type></entry>
<entry>base 10 logarithm</entry>
<entry>
log(100.0)
</entry>
<entry>
<literal>log(100.0)</literal>
</entry>
<entry>2</entry>
</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>
<entry><type>numeric</type></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>
</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>remainder of <parameter>y</parameter>/<parameter>x</parameter></entry>
<entry>
mod(9,4)
</entry>
<entry>
<literal>mod(9,4)</literal>
</entry>
<entry>1</entry>
</row>
<row>
<entry>
pi
()</entry>
<entry>
<function>pi</function>
()</entry>
<entry><type>dp</type></entry>
<entry><quote>Pi</quote> constant</entry>
<entry>
pi()
</entry>
<entry>
<literal>pi()</literal>
</entry>
<entry>3.14159265358979</entry>
</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>
<entry><type>dp</type></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>
</row>
<row>
<entry>
radians
(<type>dp</type>)</entry>
<entry>
<function>radians</function>
(<type>dp</type>)</entry>
<entry><type>dp</type></entry>
<entry>degrees to radians</entry>
<entry>
radians(45.0)
</entry>
<entry>
<literal>radians(45.0)</literal>
</entry>
<entry>0.785398163397448</entry>
</row>
<row>
<entry>
random
()</entry>
<entry>
<function>random</function>
()</entry>
<entry><type>dp</type></entry>
<entry>value between 0.0 to 1.0</entry>
<entry>
random()
</entry>
<entry>
<literal>random()</literal>
</entry>
<entry></entry>
</row>
<row>
<entry>
round
(<type>dp</type>)</entry>
<entry>
<function>round</function>
(<type>dp</type>)</entry>
<entry><type>dp</type></entry>
<entry>round to nearest integer</entry>
<entry>
round(42.4)
</entry>
<entry>
<literal>round(42.4)</literal>
</entry>
<entry>42</entry>
</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>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>
</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>
setseed(0.54823)
</entry>
<entry>
<literal>setseed(0.54823)</literal>
</entry>
<entry></entry>
</row>
-->
<row>
<entry>
sqrt
(<type>dp</type>)</entry>
<entry>
<function>sqrt</function>
(<type>dp</type>)</entry>
<entry><type>dp</type></entry>
<entry>square root</entry>
<entry>
sqrt(2.0)
</entry>
<entry>
<literal>sqrt(2.0)</literal>
</entry>
<entry>1.4142135623731</entry>
</row>
<row>
<entry>
trunc
(<type>dp</type>)</entry>
<entry>
<function>trunc</function>
(<type>dp</type>)</entry>
<entry><type>dp</type></entry>
<entry>truncate toward zero</entry>
<entry>
trunc(42.8)
</entry>
<entry>
<literal>trunc(42.8)</literal>
</entry>
<entry>42</entry>
</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>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>
</row>
...
...
@@ -661,7 +661,7 @@
</table>
<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>,
<function>log</function>, <function>pow</function>,
<function>round</function> (1 argument), <function>sqrt</function>,
...
...
@@ -688,42 +688,42 @@
<tbody>
<row>
<entry>
acos
(<replaceable>x</replaceable>)</entry>
<entry>
<function>acos</function>
(<replaceable>x</replaceable>)</entry>
<entry>inverse cosine</entry>
</row>
<row>
<entry>
asin
(<replaceable>x</replaceable>)</entry>
<entry>
<function>asin</function>
(<replaceable>x</replaceable>)</entry>
<entry>inverse sine</entry>
</row>
<row>
<entry>
atan
(<replaceable>x</replaceable>)</entry>
<entry>
<function>atan</function>
(<replaceable>x</replaceable>)</entry>
<entry>inverse tangent</entry>
</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>
</row>
<row>
<entry>
cos
(<replaceable>x</replaceable>)</entry>
<entry>
<function>cos</function>
(<replaceable>x</replaceable>)</entry>
<entry>cosine</entry>
</row>
<row>
<entry>
cot
(<replaceable>x</replaceable>)</entry>
<entry>
<function>cot</function>
(<replaceable>x</replaceable>)</entry>
<entry>cotangent</entry>
</row>
<row>
<entry>
sin
(<replaceable>x</replaceable>)</entry>
<entry>
<function>sin</function>
(<replaceable>x</replaceable>)</entry>
<entry>sine</entry>
</row>
<row>
<entry>
tan
(<replaceable>x</replaceable>)</entry>
<entry>
<function>tan</function>
(<replaceable>x</replaceable>)</entry>
<entry>tangent</entry>
</row>
</tbody>
...
...
@@ -786,20 +786,20 @@
<secondary>concatenation</secondary>
</indexterm>
</entry>
<entry>
'Postgre' || 'SQL'
</entry>
<entry>
PostgreSQL
</entry>
<entry>
<literal>'Postgre' || 'SQL'</>
</entry>
<entry>
<literal>PostgreSQL</>
</entry>
</row>
<row>
<entry>
bit_length
(<parameter>string</parameter>)</entry>
<entry>
<function>bit_length</function>
(<parameter>string</parameter>)</entry>
<entry><type>integer</type></entry>
<entry>number of bits in string</entry>
<entry>
bit_length('jose')
</entry>
<entry>
32
</entry>
<entry>
<literal>bit_length('jose')</literal>
</entry>
<entry>
<literal>32</literal>
</entry>
</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>
length of string
...
...
@@ -813,36 +813,36 @@
<see>character strings, length</see>
</indexterm>
</entry>
<entry>
char_length('jose')
</entry>
<entry>
4
</entry>
<entry>
<literal>char_length('jose')</>
</entry>
<entry>
<literal>4</>
</entry>
</row>
<row>
<entry>
lower
(<parameter>string</parameter>)</entry>
<entry>
<function>lower</function>
(<parameter>string</parameter>)</entry>
<entry><type>text</type></entry>
<entry>Convert string to lower case.</entry>
<entry>
lower('TOM')
</entry>
<entry>
tom
</entry>
<entry>
<literal>lower('TOM')</literal>
</entry>
<entry>
<literal>tom</literal>
</entry>
</row>
<row>
<entry>
octet_length
(<parameter>string</parameter>)</entry>
<entry>
<function>octet_length</function>
(<parameter>string</parameter>)</entry>
<entry><type>integer</type></entry>
<entry>number of bytes in string</entry>
<entry>
octet_length('jose')
</entry>
<entry>
4
</entry>
<entry>
<literal>octet_length('jose')</literal>
</entry>
<entry>
<literal>4</literal>
</entry>
</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>location of specified substring</entry>
<entry>
position('om' in 'Thomas')
</entry>
<entry>
3
</entry>
<entry>
<literal>position('om' in 'Thomas')</literal>
</entry>
<entry>
<literal>3</literal>
</entry>
</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>
extract substring
...
...
@@ -850,13 +850,13 @@
<primary>substring</primary>
</indexterm>
</entry>
<entry>
substring('Thomas' from 2 for 3)
</entry>
<entry>
hom
</entry>
<entry>
<literal>substring('Thomas' from 2 for 3)</literal>
</entry>
<entry>
<literal>hom</literal>
</entry>
</row>
<row>
<entry>
trim
(<optional>leading | trailing | both</optional>
<function>trim</function>
(<optional>leading | trailing | both</optional>
<optional><parameter>characters</parameter></optional> from
<parameter>string</parameter>)
</entry>
...
...
@@ -866,16 +866,16 @@
<parameter>characters</parameter> (a space by default) from the
beginning/end/both ends of the <parameter>string</parameter>.
</entry>
<entry>
trim(both 'x' from 'xTomx')
</entry>
<entry>
Tom
</entry>
<entry>
<literal>trim(both 'x' from 'xTomx')</literal>
</entry>
<entry>
<literal>Tom</literal>
</entry>
</row>
<row>
<entry>
upper
(<parameter>string</parameter>)</entry>
<entry>
<function>upper</function>
(<parameter>string</parameter>)</entry>
<entry><type>text</type></entry>
<entry>Convert string to upper case.</entry>
<entry>
upper('tom')
</entry>
<entry>
TOM
</entry>
<entry>
<literal>upper('tom')</literal>
</entry>
<entry>
<literal>TOM</literal>
</entry>
</row>
</tbody>
</tgroup>
...
...
@@ -902,58 +902,62 @@
<tbody>
<row>
<entry>
ascii
(<type>text</type>)</entry>
<entry>
<function>ascii</function>
(<type>text</type>)</entry>
<entry>integer</entry>
<entry>Returns the <acronym>ASCII</acronym> code of the first character of the argument.</entry>
<entry>
ascii('x')
</entry>
<entry>
120
</entry>
<entry>
<literal>ascii('x')</literal>
</entry>
<entry>
<literal>120</literal>
</entry>
</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>
Remove (trim) the longest string consisting only of characters
in <parameter>trim</parameter> from the start and end of
<parameter>string</parameter>.
</entry>
<entry>
btrim('xyxtrimyyx','xy')
</entry>
<entry>
trim
</entry>
<entry>
<literal>btrim('xyxtrimyyx','xy')</literal>
</entry>
<entry>
<literal>trim</literal>
</entry>
</row>
<row>
<entry>
chr
(<type>integer</type>)</entry>
<entry>
<function>chr</function>
(<type>integer</type>)</entry>
<entry><type>text</type></entry>
<entry>Returns the character with the given <acronym>ASCII</acronym> code.</entry>
<entry>
chr(65)
</entry>
<entry>
A
</entry>
<entry>
<literal>chr(65)</literal>
</entry>
<entry>
<literal>A</literal>
</entry>
</row>
<row>
<entry>convert(<parameter>string</parameter> <type>text</type>,
[<parameter>src_encoding</parameter> <type>name</type>,]
<parameter>dest_encoding</parameter> <type>name</type>)</entry>
<entry>
<function>convert</function>(<parameter>string</parameter> <type>text</type>,
<optional><parameter>src_encoding</parameter> <type>name</type>,</optional>
<parameter>dest_encoding</parameter> <type>name</type>)
</entry>
<entry><type>text</type></entry>
<entry>Converts string using <parameter>dest_encoding</parameter>.
The original encoding is specified by <parameter>src_encoding</parameter>.
If <parameter>src_encoding</parameter> is omitted, database encoding
is assumed.
<entry>
Converts string using <parameter>dest_encoding</parameter>.
The original encoding is specified by
<parameter>src_encoding</parameter>. If
<parameter>src_encoding</parameter> is omitted, database
encoding is assumed.
</entry>
<entry>
convert('text_in_unicode','UNICODE','LATIN1')
</entry>
<entry>
text_in_unicode (represented in ISO-8859-1)
</entry>
<entry>
<literal>convert('text_in_unicode', 'UNICODE', 'LATIN1')</literal>
</entry>
<entry>
<literal>text_in_unicode</literal> represented in ISO 8859-1
</entry>
</row>
<row>
<entry>
initcap
(<type>text</type>)</entry>
<entry>
<function>initcap</function>
(<type>text</type>)</entry>
<entry><type>text</type></entry>
<entry>Converts first letter of each word (whitespace separated) to upper case.</entry>
<entry>
initcap('hi thomas')
</entry>
<entry>
Hi Thomas
</entry>
<entry>
<literal>initcap('hi thomas')</literal>
</entry>
<entry>
<literal>Hi Thomas</literal>
</entry>
</row>
<row>
<entry>
lpad
(<parameter>string</parameter> <type>text</type>,
<function>lpad</function>
(<parameter>string</parameter> <type>text</type>,
<parameter>length</parameter> <type>integer</type>
<optional>, <parameter>fill</parameter> <type>text</type></optional>)
</entry>
...
...
@@ -966,32 +970,32 @@
<parameter>length</parameter> then it is truncated (on the
right).
</entry>
<entry>
lpad('hi', 5, 'xy')
</entry>
<entry>
xyxhi
</entry>
<entry>
<literal>lpad('hi', 5, 'xy')</literal>
</entry>
<entry>
<literal>xyxhi</literal>
</entry>
</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>
Removes the longest string containing only characters from
<parameter>trim</parameter> from the start of the string.
</entry>
<entry>
ltrim('zzzytrim','xyz')
</entry>
<entry>
trim
</entry>
<entry>
<literal>ltrim('zzzytrim','xyz')</literal>
</entry>
<entry>
<literal>trim</literal>
</entry>
</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>Repeat text a number of times.</entry>
<entry>
repeat('Pg', 4)
</entry>
<entry>
PgPgPgPg
</entry>
<entry>
<literal>repeat('Pg', 4)</literal>
</entry>
<entry>
<literal>PgPgPgPg</literal>
</entry>
</row>
<row>
<entry>
rpad
(<parameter>string</parameter> <type>text</type>,
<function>rpad</function>
(<parameter>string</parameter> <type>text</type>,
<parameter>length</parameter> <type>integer</type>
<optional>, <parameter>fill</parameter> <type>text</type></optional>)
</entry>
...
...
@@ -1003,23 +1007,23 @@
<parameter>string</parameter> is already longer than
<parameter>length</parameter> then it is truncated.
</entry>
<entry>
rpad('hi', 5, 'xy')
</entry>
<entry>
hixyx
</entry>
<entry>
<literal>rpad('hi', 5, 'xy')</literal>
</entry>
<entry>
<literal>hixyx</literal>
</entry>
</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>
Removes the longest string containing only characters from
<parameter>trim</parameter> from the end of the string.
</entry>
<entry>
rtrim('trimxxxx','x')
</entry>
<entry>
trim
</entry>
<entry>
<literal>rtrim('trimxxxx','x')</literal>
</entry>
<entry>
<literal>trim</literal>
</entry>
</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>
Locates specified substring. (same as
...
...
@@ -1027,31 +1031,31 @@
<parameter>string</parameter>)</literal>, but note the reversed
argument order)
</entry>
<entry>
strpos('high','ig')
</entry>
<entry>
2
</entry>
<entry>
<literal>strpos('high','ig')</literal>
</entry>
<entry>
<literal>2</literal>
</entry>
</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>
Extracts specified substring. (same as <literal>substring(<parameter>string</parameter> from <parameter>from</parameter> for <parameter>count</parameter>)</literal>)
</entry>
<entry>
substr('alphabet', 3, 2)
</entry>
<entry>
ph
</entry>
<entry>
<literal>substr('alphabet', 3, 2)</literal>
</entry>
<entry>
<literal>ph</literal>
</entry>
</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>Converts text from multibyte encoding to <acronym>ASCII</acronym>.</entry>
<entry>
to_ascii('Karel')
</entry>
<entry>
Karel
</entry>
<entry>
<literal>to_ascii('Karel')</literal>
</entry>
<entry>
<literal>Karel</literal>
</entry>
</row>
<row>
<entry>
translate
(<parameter>string</parameter> <type>text</type>,
<function>translate</function>
(<parameter>string</parameter> <type>text</type>,
<parameter>from</parameter> <type>text</type>,
<parameter>to</parameter> <type>text</type>)
</entry>
...
...
@@ -1062,27 +1066,27 @@
the corresponding character in the <parameter>to</parameter>
set.
</entry>
<entry>
translate('12345', '14', 'ax')
</entry>
<entry>
a23x5
</entry>
<entry>
<literal>translate('12345', '14', 'ax')</literal>
</entry>
<entry>
<literal>a23x5</literal>
</entry>
</row>
<row>
<entry>
encode
(<parameter>data</parameter> <type>bytea</type>,
<function>encode</function>
(<parameter>data</parameter> <type>bytea</type>,
<parameter>type</parameter> <type>text</type>)
</entry>
<entry><type>text</type></entry>
<entry>
Encodes binary data to
ascii
-only representation. Supported
Encodes binary data to
<acronym>ASCII</acronym>
-only representation. Supported
types are: 'base64', 'hex'.
</entry>
<entry>
encode('123\\000\\001', 'base64')
</entry>
<entry>
MTIzAAE=
</entry>
<entry>
<literal>encode('123\\000\\001', 'base64')</literal>
</entry>
<entry>
<literal>MTIzAAE=</literal>
</entry>
</row>
<row>
<entry>
decode
(<parameter>string</parameter> <type>text</type>,
<function>decode</function>
(<parameter>string</parameter> <type>text</type>,
<parameter>type</parameter> <type>text</type>)
</entry>
<entry><type>bytea</type></entry>
...
...
@@ -1090,8 +1094,8 @@
Decodes binary data from <parameter>string</parameter> previously
encoded with encode(). Parameter type is same as in encode().
</entry>
<entry>
decode('MTIzAAE=', 'base64')
</entry>
<entry>
123\000\001
</entry>
<entry>
<literal>decode('MTIzAAE=', 'base64')</literal>
</entry>
<entry>
<literal>123\000\001</literal>
</entry>
</row>
</tbody>
...
...
@@ -1235,22 +1239,22 @@
<ROW>
<ENTRY> <literal>~</literal> </ENTRY>
<ENTRY>Matches regular expression, case sensitive</ENTRY>
<ENTRY>
'thomas' ~ '.*thomas.*'
</ENTRY>
<ENTRY>
<literal>'thomas' ~ '.*thomas.*'</literal>
</ENTRY>
</ROW>
<ROW>
<ENTRY> <literal>~*</literal> </ENTRY>
<ENTRY>Matches regular expression, case insensitive</ENTRY>
<ENTRY>
'thomas' ~* '.*Thomas.*'
</ENTRY>
<ENTRY>
<literal>'thomas' ~* '.*Thomas.*'</literal>
</ENTRY>
</ROW>
<ROW>
<ENTRY> <literal>!~</literal> </ENTRY>
<ENTRY>Does not match regular expression, case sensitive</ENTRY>
<ENTRY>
'thomas' !~ '.*Thomas.*'
</ENTRY>
<ENTRY>
<literal>'thomas' !~ '.*Thomas.*'</literal>
</ENTRY>
</ROW>
<ROW>
<ENTRY> <literal>!~*</literal> </ENTRY>
<ENTRY>Does not match regular expression, case insensitive</ENTRY>
<ENTRY>
'thomas' !~* '.*vadim.*'
</ENTRY>
<ENTRY>
<literal>'thomas' !~* '.*vadim.*'</literal>
</ENTRY>
</ROW>
</tbody>
</tgroup>
...
...
@@ -1402,12 +1406,12 @@
<para>
Within a bracket expression, a collating element (a character, a
multi-character sequence that collates as if it were a single
multi
ple
-character sequence that collates as if it were a single
character, or a collating-sequence name for either) enclosed in
<literal>[.</literal> and <literal>.]</literal> stands for the
sequence of characters of that collating element. The sequence is
a single element of the bracket expression's list. A bracket
expression containing a multi-character collating element can thus
expression containing a multi
ple
-character collating element can thus
match more than one character, e.g. if the collating sequence
includes a <literal>ch</literal> collating element, then the RE
<literal>[[.ch.]]*c</literal> matches the first five characters of
...
...
@@ -1454,7 +1458,7 @@
characters. A word character is an alnum character (as defined by
<citerefentry><refentrytitle>ctype</refentrytitle><manvolnum>3</manvolnum></citerefentry>)
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.
</para>
...
...
@@ -1559,52 +1563,52 @@
</thead>
<tbody>
<row>
<entry>
to_char(timestamp, text
)</entry>
<entry>
text
</entry>
<entry>convert timestamp to string</entry>
<entry>
to_char(timestamp 'now','HH12:MI:SS')
</entry>
<entry>
<function>to_char</function>(<type>timestamp</type>, <type>text</type>
)</entry>
<entry>
<type>text</type>
</entry>
<entry>convert time
stamp to string</entry>
<entry>
<literal>to_char(timestamp 'now','HH12:MI:SS')</literal>
</entry>
</row>
<row>
<entry>
to_char(interval, text
)</entry>
<entry>
text
</entry>
<entry>
<function>to_char</function>(<type>interval</type>, <type>text</type>
)</entry>
<entry>
<type>text</type>
</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>
<entry>
to_char(int, text
)</entry>
<entry>
text
</entry>
<entry>
<function>to_char</function>(<type>int</type>, <type>text</type>
)</entry>
<entry>
<type>text</type>
</entry>
<entry>convert int4/int8 to string</entry>
<entry>
to_char(125, '999')
</entry>
<entry>
<literal>to_char(125, '999')</literal>
</entry>
</row>
<row>
<entry>
to_char(double precision, text
)</entry>
<entry>
text
</entry>
<entry>
<function>to_char</function>(<type>double precision</type>, <type>text</type>
)</entry>
<entry>
<type>text</type>
</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>
<entry>
to_char(numeric, text
)</entry>
<entry>
text
</entry>
<entry>
<function>to_char</function>(<type>numeric</type>, <type>text</type>
)</entry>
<entry>
<type>text</type>
</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>
<entry>
to_date(text, text
)</entry>
<entry>
date
</entry>
<entry>
<function>to_date</function>(<type>text</type>, <type>text</type>
)</entry>
<entry>
<type>date</type>
</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>
<entry>
to_timestamp(text, text
)</entry>
<entry>
timestamp
</entry>
<entry>convert string to timestamp</entry>
<entry>
to_timestamp('05 Dec 2000', 'DD Mon YYYY')
</entry>
<entry>
<function>to_timestamp</function>(<type>text</type>, <type>text</type>
)</entry>
<entry>
<type>timestamp</type>
</entry>
<entry>convert string to time
stamp</entry>
<entry>
<literal>to_timestamp('05 Dec 2000', 'DD Mon YYYY')</literal>
</entry>
</row>
<row>
<entry>
to_number(text, text
)</entry>
<entry>
numeric
</entry>
<entry>
<function>to_number</function>(<type>text</type>, <type>text</type>
)</entry>
<entry>
<type>numeric</type>
</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>
</tbody>
</tgroup>
...
...
@@ -1632,175 +1636,175 @@
</thead>
<tbody>
<row>
<entry>
HH
</entry>
<entry>
<literal>HH</literal>
</entry>
<entry>hour of day (01-12)</entry>
</row>
<row>
<entry>
HH12
</entry>
<entry>
<literal>HH12</literal>
</entry>
<entry>hour of day (01-12)</entry>
</row>
<row>
<entry>
HH24
</entry>
<entry>
<literal>HH24</literal>
</entry>
<entry>hour of day (00-23)</entry>
</row>
<row>
<entry>
MI
</entry>
<entry>
<literal>MI</literal>
</entry>
<entry>minute (00-59)</entry>
</row>
<row>
<entry>
SS
</entry>
<entry>
<literal>SS</literal>
</entry>
<entry>second (00-59)</entry>
</row>
<row>
<entry>
MS
</entry>
<entry>
<literal>MS</literal>
</entry>
<entry>millisecond (000-999)</entry>
</row>
<row>
<entry>
US
</entry>
<entry>
<literal>US</literal>
</entry>
<entry>microsecond (000000-999999)</entry>
</row>
<row>
<entry>
SSSS
</entry>
<entry>
<literal>SSSS</literal>
</entry>
<entry>seconds past midnight (0-86399)</entry>
</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>
</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>
</row>
<row>
<entry>
Y,YYY
</entry>
<entry>
<literal>Y,YYY</literal>
</entry>
<entry>year (4 and more digits) with comma</entry>
</row>
<row>
<entry>
YYYY
</entry>
<entry>
<literal>YYYY</literal>
</entry>
<entry>year (4 and more digits)</entry>
</row>
<row>
<entry>
YYY
</entry>
<entry>
<literal>YYY</literal>
</entry>
<entry>last 3 digits of year</entry>
</row>
<row>
<entry>
YY
</entry>
<entry>
<literal>YY</literal>
</entry>
<entry>last 2 digits of year</entry>
</row>
<row>
<entry>
Y
</entry>
<entry>
<literal>Y</literal>
</entry>
<entry>last digit of year</entry>
</row>
<row>
<entry>
BC or B.C. or AD or A.D.
</entry>
<entry>
year
indicator (upper case)</entry>
<entry>
<literal>BC</literal> or <literal>B.C.</literal> or <literal>AD</literal> or <literal>A.D.</literal>
</entry>
<entry>
era
indicator (upper case)</entry>
</row>
<row>
<entry>
bc or b.c. or ad or a.d.
</entry>
<entry>
year
indicator (lower case)</entry>
<entry>
<literal>bc</literal> or <literal>b.c.</literal> or <literal>ad</literal> or <literal>a.d.</literal>
</entry>
<entry>
era
indicator (lower case)</entry>
</row>
<row>
<entry>
MONTH
</entry>
<entry>
<literal>MONTH</literal>
</entry>
<entry>full upper case month name (blank-padded to 9 chars)</entry>
</row>
<row>
<entry>
Month
</entry>
<entry>
<literal>Month</literal>
</entry>
<entry>full mixed case month name (blank-padded to 9 chars)</entry>
</row>
<row>
<entry>
month
</entry>
<entry>
<literal>month</literal>
</entry>
<entry>full lower case month name (blank-padded to 9 chars)</entry>
</row>
<row>
<entry>
MON
</entry>
<entry>
<literal>MON</literal>
</entry>
<entry>abbreviated upper case month name (3 chars)</entry>
</row>
<row>
<entry>
Mon
</entry>
<entry>
<literal>Mon</literal>
</entry>
<entry>abbreviated mixed case month name (3 chars)</entry>
</row>
<row>
<entry>
mon
</entry>
<entry>
<literal>mon</literal>
</entry>
<entry>abbreviated lower case month name (3 chars)</entry>
</row>
<row>
<entry>
MM
</entry>
<entry>
<literal>MM</literal>
</entry>
<entry>month number (01-12)</entry>
</row>
<row>
<entry>
DAY
</entry>
<entry>
<literal>DAY</literal>
</entry>
<entry>full upper case day name (blank-padded to 9 chars)</entry>
</row>
<row>
<entry>
Day
</entry>
<entry>
<literal>Day</literal>
</entry>
<entry>full mixed case day name (blank-padded to 9 chars)</entry>
</row>
<row>
<entry>
day
</entry>
<entry>
<literal>day</literal>
</entry>
<entry>full lower case day name (blank-padded to 9 chars)</entry>
</row>
<row>
<entry>
DY
</entry>
<entry>
<literal>DY</literal>
</entry>
<entry>abbreviated upper case day name (3 chars)</entry>
</row>
<row>
<entry>
Dy
</entry>
<entry>
<literal>Dy</literal>
</entry>
<entry>abbreviated mixed case day name (3 chars)</entry>
</row>
<row>
<entry>
dy
</entry>
<entry>
<literal>dy</literal>
</entry>
<entry>abbreviated lower case day name (3 chars)</entry>
</row>
<row>
<entry>
DDD
</entry>
<entry>
<literal>DDD</literal>
</entry>
<entry>day of year (001-366)</entry>
</row>
<row>
<entry>
DD
</entry>
<entry>
<literal>DD</literal>
</entry>
<entry>day of month (01-31)</entry>
</row>
<row>
<entry>
D
</entry>
<entry>
<literal>D</literal>
</entry>
<entry>day of week (1-7; SUN=1)</entry>
</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>
</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>
</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>
</row>
<row>
<entry>
CC
</entry>
<entry>
<literal>CC</literal>
</entry>
<entry>century (2 digits)</entry>
</row>
<row>
<entry>
J
</entry>
<entry>
<literal>J</literal>
</entry>
<entry>Julian Day (days since January 1, 4712 BC)</entry>
</row>
<row>
<entry>
Q
</entry>
<entry>
<literal>Q</literal>
</entry>
<entry>quarter</entry>
</row>
<row>
<entry>
RM
</entry>
<entry>
<literal>RM</literal>
</entry>
<entry>month in Roman Numerals (I-XII; I=January) - upper case</entry>
</row>
<row>
<entry>
rm
</entry>
<entry>
<literal>rm</literal>
</entry>
<entry>month in Roman Numerals (I-XII; I=January) - lower case</entry>
</row>
<row>
<entry>
TZ
</entry>
<entry>
<literal>TZ</literal>
</entry>
<entry>timezone name - upper case</entry>
</row>
<row>
<entry>
tz
</entry>
<entry>
<literal>tz</literal>
</entry>
<entry>timezone name - lower case</entry>
</row>
</tbody>
...
...
@@ -1830,27 +1834,27 @@
<row>
<entry><literal>FM</literal> prefix</entry>
<entry>fill mode (suppress padding blanks and zeroes)</entry>
<entry>
FMMonth
</entry>
<entry>
<literal>FMMonth</literal>
</entry>
</row>
<row>
<entry><literal>TH</literal> suffix</entry>
<entry>add upper-case ordinal number suffix</entry>
<entry>
DDTH
</entry>
<entry>
<literal>DDTH</literal>
</entry>
</row>
<row>
<entry><literal>th</literal> suffix</entry>
<entry>add lower-case ordinal number suffix</entry>
<entry>
DDth
</entry>
<entry>
<literal>DDth</literal>
</entry>
</row>
<row>
<entry><literal>FX</literal> prefix</entry>
<entry>Fi
X
ed format global option (see below)</entry>
<entry>
FX Month DD Day
</entry>
<entry>Fi
x
ed format global option (see below)</entry>
<entry>
<literal>FX Month DD Day</literal>
</entry>
</row>
<row>
<entry><literal>SP</literal> suffix</entry>
<entry>spell mode (not yet implemented)</entry>
<entry>
DDSP
</entry>
<entry>
<literal>DDSP</literal>
</entry>
</row>
</tbody>
</tgroup>
...
...
@@ -1913,8 +1917,8 @@
<listitem>
<para>
<literal>YYYY</literal> conversion from string to
timestamp
or
date
is restricted if you use a year with more than 4 digits. You must
<literal>YYYY</literal> conversion from string to
<type>timestamp</type>
or
<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>,
otherwise the year is always interpreted as 4 digits. For example
(with year 20000):
...
...
@@ -1928,14 +1932,14 @@
<listitem>
<para>
Millisecond <literal>MS</literal> and micro
ces
ond <literal>US</literal>
values are in conversion from string to timestamp used as part of
Millisecond <literal>MS</literal> and micro
sec
ond <literal>US</literal>
values are in conversion from string to time
stamp used as part of
second after decimal point. For example
<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>.
It means for format 'SS:MS' is '12:3' or '12:30' or '12:300' same
number of mil
ic
econds. For the three milliseconds must be used
'12:003' that the co
u
nversion count as
number of mil
lis
econds. For the three milliseconds must be used
'12:003' that the conversion count as
<literal> 12 + 0.003 = 12.003 seconds </literal>. Here is a more
complex example:
<literal>to_timestamp('15:12:02.020.001230','HH:MI:SS.MS.US')</literal>
...
...
@@ -1957,68 +1961,68 @@
</thead>
<tbody>
<row>
<entry>
9
</entry>
<entry>
<literal>9</literal>
</entry>
<entry>value with the specified number of digits</entry>
</row>
<row>
<entry>
0
</entry>
<entry>
<literal>0</literal>
</entry>
<entry>value with leading zeros</entry>
</row>
<row>
<entry>
.
(period)</entry>
<entry>
<literal>.</literal>
(period)</entry>
<entry>decimal point</entry>
</row>
<row>
<entry>
,
(comma)</entry>
<entry>
<literal>,</literal>
(comma)</entry>
<entry>group (thousand) separator</entry>
</row>
<row>
<entry>
PR
</entry>
<entry>
<literal>PR</literal>
</entry>
<entry>negative value in angle brackets</entry>
</row>
<row>
<entry>
S
</entry>
<entry>
<literal>S</literal>
</entry>
<entry>negative value with minus sign (uses locale)</entry>
</row>
<row>
<entry>
L
</entry>
<entry>
<literal>L</literal>
</entry>
<entry>currency symbol (uses locale)</entry>
</row>
<row>
<entry>
D
</entry>
<entry>
<literal>D</literal>
</entry>
<entry>decimal point (uses locale)</entry>
</row>
<row>
<entry>
G
</entry>
<entry>
<literal>G</literal>
</entry>
<entry>group separator (uses locale)</entry>
</row>
<row>
<entry>
MI
</entry>
<entry>
<literal>MI</literal>
</entry>
<entry>minus sign in specified position (if number < 0)</entry>
</row>
<row>
<entry>
PL
</entry>
<entry>
<literal>PL</literal>
</entry>
<entry>plus sign in specified position (if number > 0)</entry>
</row>
<row>
<entry>
SG
</entry>
<entry>
<literal>SG</literal>
</entry>
<entry>plus/minus sign in specified position</entry>
</row>
<row>
<entry>
RN
</entry>
<entry>
<literal>RN</literal>
</entry>
<entry>roman numeral (input between 1 and 3999)</entry>
</row>
<row>
<entry>
TH or th
</entry>
<entry>
<literal>TH</literal> or <literal>th</literal>
</entry>
<entry>convert to ordinal number</entry>
</row>
<row>
<entry>
V
</entry>
<entry>
<literal>V</literal>
</entry>
<entry>shift <replaceable>n</replaceable> digits (see
notes)</entry>
</row>
<row>
<entry>
EEEE
</entry>
<entry>
<literal>EEEE</literal>
</entry>
<entry>scientific numbers (not supported yet)</entry>
</row>
</tbody>
...
...
@@ -2093,135 +2097,135 @@
</thead>
<tbody>
<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>
</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>
</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>
</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>
</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>
</row>
<row>
<entry>
to_char(12,'9990999.9')
</entry>
<entry>
<literal>to_char(12,'9990999.9')</literal>
</entry>
<entry><literal>' 0012.0'</literal></entry>
</row>
<row>
<entry>
to_char(12,'FM9990999.9')
</entry>
<entry>
<literal>to_char(12,'FM9990999.9')</literal>
</entry>
<entry><literal>'0012'</literal></entry>
</row>
<row>
<entry>
to_char(485,'999')
</entry>
<entry>
<literal>to_char(485,'999')</literal>
</entry>
<entry><literal>' 485'</literal></entry>
</row>
<row>
<entry>
to_char(-485,'999')
</entry>
<entry>
<literal>to_char(-485,'999')</literal>
</entry>
<entry><literal>'-485'</literal></entry>
</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>
</row>
<row>
<entry>
to_char(1485,'9,999')
</entry>
<entry>
<literal>to_char(1485,'9,999')</literal>
</entry>
<entry><literal>' 1,485'</literal></entry>
</row>
<row>
<entry>
to_char(1485,'9G999')
</entry>
<entry>
<literal>to_char(1485,'9G999')</literal>
</entry>
<entry><literal>' 1 485'</literal></entry>
</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>
</row>
<row>
<entry>
to_char(148.5,'999D999')
</entry>
<entry>
<literal>to_char(148.5,'999D999')</literal>
</entry>
<entry><literal>' 148,500'</literal></entry>
</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>
</row>
<row>
<entry>
to_char(-485,'999S')
</entry>
<entry>
<literal>to_char(-485,'999S')</literal>
</entry>
<entry><literal>'485-'</literal></entry>
</row>
<row>
<entry>
to_char(-485,'999MI')
</entry>
<entry>
<literal>to_char(-485,'999MI')</literal>
</entry>
<entry><literal>'485-'</literal></entry>
</row>
<row>
<entry>
to_char(485,'999MI')
</entry>
<entry>
<literal>to_char(485,'999MI')</literal>
</entry>
<entry><literal>'485'</literal></entry>
</row>
<row>
<entry>
to_char(485,'PL999')
</entry>
<entry>
<literal>to_char(485,'PL999')</literal>
</entry>
<entry><literal>'+485'</literal></entry>
</row>
<row>
<entry>
to_char(485,'SG999')
</entry>
<entry>
<literal>to_char(485,'SG999')</literal>
</entry>
<entry><literal>'+485'</literal></entry>
</row>
<row>
<entry>
to_char(-485,'SG999')
</entry>
<entry>
<literal>to_char(-485,'SG999')</literal>
</entry>
<entry><literal>'-485'</literal></entry>
</row>
<row>
<entry>
to_char(-485,'9SG99')
</entry>
<entry>
<literal>to_char(-485,'9SG99')</literal>
</entry>
<entry><literal>'4-85'</literal></entry>
</row>
<row>
<entry>
to_char(-485,'999PR')
</entry>
<entry>
<literal>to_char(-485,'999PR')</literal>
</entry>
<entry><literal>'<485>'</literal></entry>
</row>
<row>
<entry>
to_char(485,'L999')
</entry>
<entry>
<literal>to_char(485,'L999')</literal>
</entry>
<entry><literal>'DM 485</literal></entry>
</row>
<row>
<entry>
to_char(485,'RN')
</entry>
<entry>
<literal>to_char(485,'RN')</literal>
</entry>
<entry><literal>' CDLXXXV'</literal></entry>
</row>
<row>
<entry>
to_char(485,'FMRN')
</entry>
<entry>
<literal>to_char(485,'FMRN')</literal>
</entry>
<entry><literal>'CDLXXXV'</literal></entry>
</row>
<row>
<entry>
to_char(5.2,'FMRN')
</entry>
<entry>
<literal>to_char(5.2,'FMRN')</literal>
</entry>
<entry><literal>V</literal></entry>
</row>
<row>
<entry>
to_char(482,'999th')
</entry>
<entry>
<literal>to_char(482,'999th')</literal>
</entry>
<entry><literal>' 482nd'</literal></entry>
</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>
</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>
</row>
<row>
<entry>
to_char(12,'99V999')
</entry>
<entry>
<literal>to_char(12,'99V999')</literal>
</entry>
<entry><literal>' 12000'</literal></entry>
</row>
<row>
<entry>
to_char(12.4,'99V999')
</entry>
<entry>
<literal>to_char(12.4,'99V999')</literal>
</entry>
<entry><literal>' 12400'</literal></entry>
</row>
<row>
<entry>
to_char(12.45, '99V9')
</entry>
<entry>
<literal>to_char(12.45, '99V9')</literal>
</entry>
<entry><literal>' 125'</literal></entry>
</row>
</tbody>
...
...
@@ -2259,24 +2263,24 @@
<tbody>
<row>
<entry>
age(timestamp
)</entry>
<entry>
interval
</entry>
<entry>
<function>age</function>(<type>timestamp</type>
)</entry>
<entry>
<type>interval</type>
</entry>
<entry>Subtract from today</entry>
<entry>
age(timestamp '1957-06-13')
</entry>
<entry>
43 years 8 mons 3 days
</entry>
<entry>
<literal>age(timestamp '1957-06-13')</literal>
</entry>
<entry>
<literal>43 years 8 mons 3 days</literal>
</entry>
</row>
<row>
<entry>
age(timestamp, timestamp
)</entry>
<entry>
interval
</entry>
<entry>
<function>age</function>(<type>timestamp</type>, <type>timestamp</type>
)</entry>
<entry>
<type>interval</type>
</entry>
<entry>Subtract arguments</entry>
<entry>
age('2001-04-10', timestamp '1957-06-13')
</entry>
<entry>
43 years 9 mons 27 days
</entry>
<entry>
<literal>age('2001-04-10', timestamp '1957-06-13')</literal>
</entry>
<entry>
<literal>43 years 9 mons 27 days</literal>
</entry>
</row>
<row>
<entry>
current_date
</entry>
<entry>
date
</entry>
<entry>
<function>current_date</function>
</entry>
<entry>
<type>date</type>
</entry>
<entry>Today's date; see <link
linkend="functions-datetime-current">below</link>
</entry>
...
...
@@ -2285,8 +2289,8 @@
</row>
<row>
<entry>
current_time
</entry>
<entry>
time
</entry>
<entry>
<function>current_time</function>
</entry>
<entry>
<type>time</type>
</entry>
<entry>Time of day; see <link
linkend="functions-datetime-current">below</link>
</entry>
...
...
@@ -2295,8 +2299,8 @@
</row>
<row>
<entry>
current_timestamp
</entry>
<entry>
timestamp
</entry>
<entry>
<function>current_timestamp</function>
</entry>
<entry>
<type>timestamp</type>
</entry>
<entry>date and time; see also <link
linkend="functions-datetime-current">below</link>
</entry>
...
...
@@ -2305,76 +2309,76 @@
</row>
<row>
<entry>
date_part(text, timestamp
)</entry>
<entry>
double precision
</entry>
<entry>
<function>date_part</function>(<type>text</type>, <type>timestamp</type>
)</entry>
<entry>
<type>double precision</type>
</entry>
<entry>Get subfield (equivalent to
<function>extract</function>); see also <link
linkend="functions-datetime-datepart">below</link>
</entry>
<entry>
date_part('hour', timestamp '2001-02-16 20:38:40')
</entry>
<entry>
20
</entry>
<entry>
<literal>date_part('hour', timestamp '2001-02-16 20:38:40')</literal>
</entry>
<entry>
<literal>20</literal>
</entry>
</row>
<row>
<entry>
date_part(text, interval
)</entry>
<entry>
double precision
</entry>
<entry>
<function>date_part</function>(<type>text</type>, <type>interval</type>
)</entry>
<entry>
<type>double precision</type>
</entry>
<entry>Get subfield (equivalent to
<function>extract</function>); see also <link
linkend="functions-datetime-datepart">below</link>
</entry>
<entry>
date_part('month', interval '2 years 3 months')
</entry>
<entry>
3
</entry>
<entry>
<literal>date_part('month', interval '2 years 3 months')</literal>
</entry>
<entry>
<literal>3</literal>
</entry>
</row>
<row>
<entry>
date_trunc(text, timestamp
)</entry>
<entry>
timestamp
</entry>
<entry>
<function>date_trunc</function>(<type>text</type>, <type>timestamp</type>
)</entry>
<entry>
<type>timestamp</type>
</entry>
<entry>Truncate to specified precision; see also <link
linkend="functions-datetime-trunc">below</link>
</entry>
<entry>
date_trunc('hour', timestamp '2001-02-16 20:38:40')
</entry>
<entry>
2001-02-16 20:00:00+00
</entry>
<entry>
<literal>date_trunc('hour', timestamp '2001-02-16 20:38:40')</literal>
</entry>
<entry>
<literal>2001-02-16 20:00:00+00</literal>
</entry>
</row>
<row>
<entry>
extract(<parameter>field</parameter> from timestamp
)</entry>
<entry>
double precision
</entry>
<entry>
<function>extract</function>(<parameter>field</parameter> from <type>timestamp</type>
)</entry>
<entry>
<type>double precision</type>
</entry>
<entry>Get subfield; see also <link
linkend="functions-datetime-extract">below</link>
</entry>
<entry>
extract(hour from timestamp '2001-02-16 20:38:40')
</entry>
<entry>
20
</entry>
<entry>
<literal>extract(hour from timestamp '2001-02-16 20:38:40')</literal>
</entry>
<entry>
<literal>20</literal>
</entry>
</row>
<row>
<entry>
extract(<parameter>field</parameter> from interval
)</entry>
<entry>
double precision
</entry>
<entry>
<function>extract</function>(<parameter>field</parameter> from <type>interval</type>
)</entry>
<entry>
<type>double precision</type>
</entry>
<entry>Get subfield; see also <link
linkend="functions-datetime-extract">below</link>
</entry>
<entry>
extract(month from interval '2 years 3 months')
</entry>
<entry>
3
</entry>
<entry>
<literal>extract(month from interval '2 years 3 months')</literal>
</entry>
<entry>
<literal>3</literal>
</entry>
</row>
<row>
<entry>
isfinite(timestamp
)</entry>
<entry>
boolean
</entry>
<entry>
<function>isfinite</function>(<type>timestamp</type>
)</entry>
<entry>
<type>boolean</type>
</entry>
<entry>Test for finite time stamp (neither invalid nor infinity)</entry>
<entry>
isfinite(timestamp '2001-02-16 21:28:30')
</entry>
<entry>
true
</entry>
<entry>
<literal>isfinite(timestamp '2001-02-16 21:28:30')</literal>
</entry>
<entry>
<literal>true</literal>
</entry>
</row>
<row>
<entry>
isfinite(interval
)</entry>
<entry>
boolean
</entry>
<entry>
<function>isfinite</function>(<type>interval</type>
)</entry>
<entry>
<type>boolean</type>
</entry>
<entry>Test for finite interval</entry>
<entry>
isfinite(interval '4 hours')
</entry>
<entry>
true
</entry>
<entry>
<literal>isfinite(interval '4 hours')</literal>
</entry>
<entry>
<literal>true</literal>
</entry>
</row>
<row>
<entry>
now
()</entry>
<entry>
timestamp
</entry>
<entry>
<function>now</function>
()</entry>
<entry>
<type>timestamp</type>
</entry>
<entry>Current date and time (equivalent to
<function>current_timestamp</function>); see also <link
linkend="functions-datetime-current">below</link>
...
...
@@ -2384,29 +2388,29 @@
</row>
<row>
<entry>
timeofday()
</entry>
<entry>
text
</entry>
<entry>
<function>timeofday()</function>
</entry>
<entry>
<type>text</type>
</entry>
<entry>High-precision date and time; see also <link
linkend="functions-datetime-current">below</link>
</entry>
<entry>
timeofday()
</entry>
<entry>
Wed Feb 21 17:01:13.000126 2001 EST
</entry>
<entry>
<literal>timeofday()</literal>
</entry>
<entry>
<literal>Wed Feb 21 17:01:13.000126 2001 EST</literal>
</entry>
</row>
<row>
<entry>
timestamp(date
)</entry>
<entry>
timestamp
</entry>
<entry>
Date to timestamp
</entry>
<entry>
timestamp(date '2000-12-25')
</entry>
<entry>
2000-12-25 00:00:00
</entry>
<entry>
<function>timestamp</function>(<type>date</type>
)</entry>
<entry>
<type>timestamp</type>
</entry>
<entry>
<type>date</type> to <type>timestamp</type>
</entry>
<entry>
<literal>timestamp(date '2000-12-25')</literal>
</entry>
<entry>
<literal>2000-12-25 00:00:00</literal>
</entry>
</row>
<row>
<entry>
timestamp(date, time
)</entry>
<entry>
timestamp
</entry>
<entry>
Date and time to a timestamp
</entry>
<entry>
timestamp(date '1998-02-24',time '23:07')
</entry>
<entry>
1998-02-24 23:07:00
</entry>
<entry>
<function>timestamp</function>(<type>date</type>, <type>time</type>
)</entry>
<entry>
<type>timestamp</type>
</entry>
<entry>
<type>date</type> and <type>time</type> to <type>timestamp</type>
</entry>
<entry>
<literal>timestamp(date '1998-02-24',time '23:07')</literal>
</entry>
<entry>
<literal>1998-02-24 23:07:00</literal>
</entry>
</row>
</tbody>
</tgroup>
...
...
@@ -2436,7 +2440,7 @@ EXTRACT (<replaceable>field</replaceable> FROM <replaceable>source</replaceable>
<!-- alphabetical -->
<variablelist>
<varlistentry>
<term>
century
</term>
<term>
<literal>century</literal>
</term>
<listitem>
<para>
The year field divided by 100
...
...
@@ -2458,7 +2462,7 @@ SELECT EXTRACT(CENTURY FROM TIMESTAMP '2001-02-16 20:38:40');
</varlistentry>
<varlistentry>
<term>
day
</term>
<term>
<literal>day</literal>
</term>
<listitem>
<para>
The day (of the month) field (1 - 31)
...
...
@@ -2474,7 +2478,7 @@ SELECT EXTRACT(DAY FROM TIMESTAMP '2001-02-16 20:38:40');
</varlistentry>
<varlistentry>
<term>
decade
</term>
<term>
<literal>decade</literal>
</term>
<listitem>
<para>
The year field divided by 10
...
...
@@ -2490,7 +2494,7 @@ SELECT EXTRACT(DECADE FROM TIMESTAMP '2001-02-16 20:38:40');
</varlistentry>
<varlistentry>
<term>
dow
</term>
<term>
<literal>dow</literal>
</term>
<listitem>
<para>
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');
</varlistentry>
<varlistentry>
<term>
doy
</term>
<term>
<literal>doy</literal>
</term>
<listitem>
<para>
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');
</varlistentry>
<varlistentry>
<term>
epoch
</term>
<term>
<literal>epoch</literal>
</term>
<listitem>
<para>
For <type>date</type> and <type>timestamp</type> values, the
...
...
@@ -2544,7 +2548,7 @@ SELECT EXTRACT(EPOCH FROM INTERVAL '5 days 3 hours');
</varlistentry>
<varlistentry>
<term>
hour
</term>
<term>
<literal>hour</literal>
</term>
<listitem>
<para>
The hour field (0 - 23)
...
...
@@ -2560,7 +2564,7 @@ SELECT EXTRACT(HOUR FROM TIMESTAMP '2001-02-16 20:38:40');
</varlistentry>
<varlistentry>
<term>
microseconds
</term>
<term>
<literal>microseconds</literal>
</term>
<listitem>
<para>
The seconds field, including fractional parts, multiplied by 1
...
...
@@ -2577,7 +2581,7 @@ SELECT EXTRACT(MICROSECONDS FROM TIME '17:12:28.5');
</varlistentry>
<varlistentry>
<term>
millennium
</term>
<term>
<literal>millennium</literal>
</term>
<listitem>
<para>
The year field divided by 1000
...
...
@@ -2599,7 +2603,7 @@ SELECT EXTRACT(MILLENNIUM FROM TIMESTAMP '2001-02-16 20:38:40');
</varlistentry>
<varlistentry>
<term>
milliseconds
</term>
<term>
<literal>milliseconds</literal>
</term>
<listitem>
<para>
The seconds field, including fractional parts, multiplied by
...
...
@@ -2616,7 +2620,7 @@ SELECT EXTRACT(MILLISECONDS FROM TIME '17:12:28.5');
</varlistentry>
<varlistentry>
<term>
minute
</term>
<term>
<literal>minute</literal>
</term>
<listitem>
<para>
The minutes field (0 - 59)
...
...
@@ -2632,7 +2636,7 @@ SELECT EXTRACT(MINUTE FROM TIMESTAMP '2001-02-16 20:38:40');
</varlistentry>
<varlistentry>
<term>
month
</term>
<term>
<literal>month</literal>
</term>
<listitem>
<para>
For <type>timestamp</type> values, the number of the month
...
...
@@ -2656,7 +2660,7 @@ SELECT EXTRACT(MONTH FROM INTERVAL '2 years 13 months');
</varlistentry>
<varlistentry>
<term>
quarter
</term>
<term>
<literal>quarter</literal>
</term>
<listitem>
<para>
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');
</varlistentry>
<varlistentry>
<term>
second
</term>
<term>
<literal>second</literal>
</term>
<listitem>
<para>
The seconds field, including fractional parts (0 -
...
...
@@ -2694,7 +2698,7 @@ SELECT EXTRACT(SECOND FROM TIME '17:12:28.5');
</varlistentry>
<varlistentry>
<term>
week
</term>
<term>
<literal>week</literal>
</term>
<listitem>
<para>
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');
</varlistentry>
<varlistentry>
<term>
year
</term>
<term>
<literal>year</literal>
</term>
<listitem>
<para>
The year field
...
...
@@ -2887,7 +2891,7 @@ SELECT timeofday();
good as microseconds (depending on your platform); the other functions
rely on <function>time(2)</function> which is restricted to one-second
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>
...
...
@@ -2899,7 +2903,7 @@ SELECT timeofday();
</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,
the following three all return the same result:
<programlisting>
...
...
@@ -2911,7 +2915,7 @@ SELECT TIMESTAMP 'now';
<para>
You do not want to use the third form when specifying a DEFAULT
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 time of the table creation would be used! The first two
forms will not be evaluated until the default value is used,
...
...
@@ -2928,8 +2932,10 @@ SELECT TIMESTAMP 'now';
<title>Geometric Functions and Operators</title>
<para>
The geometric types point, box, lseg, line, path, polygon, and
circle have a large set of native support functions and operators.
The geometric types <type>point</type>, <type>box</type>,
<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>
<table>
...
...
@@ -2946,122 +2952,122 @@ SELECT TIMESTAMP 'now';
<ROW>
<ENTRY> + </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>
<ENTRY> - </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>
<ENTRY> * </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>
<ENTRY> / </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>
<ENTRY> # </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>
<ENTRY> # </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>
<ENTRY> ## </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>
<ENTRY> && </ENTRY>
<ENTRY>Overlaps?</ENTRY>
<ENTRY>
box '((0,0),(1,1))' && box '((0,0),(2,2))'
</ENTRY>
<ENTRY>
<literal>box '((0,0),(1,1))' && box '((0,0),(2,2))'</literal>
</ENTRY>
</ROW>
<ROW>
<ENTRY> &< </ENTRY>
<ENTRY>Overlaps to left?</ENTRY>
<ENTRY>
box '((0,0),(1,1))' &< box '((0,0),(2,2))'
</ENTRY>
<ENTRY>
<literal>box '((0,0),(1,1))' &< box '((0,0),(2,2))'</literal>
</ENTRY>
</ROW>
<ROW>
<ENTRY> &> </ENTRY>
<ENTRY>Overlaps to right?</ENTRY>
<ENTRY>
box '((0,0),(3,3))' &> box '((0,0),(2,2))'
</ENTRY>
<ENTRY>
<literal>box '((0,0),(3,3))' &> box '((0,0),(2,2))'</literal>
</ENTRY>
</ROW>
<ROW>
<ENTRY> <-> </ENTRY>
<ENTRY>Distance between</ENTRY>
<ENTRY>
circle '((0,0),1)' <-> circle '((5,0),1)'
</ENTRY>
<ENTRY>
<literal>circle '((0,0),1)' <-> circle '((5,0),1)'</literal>
</ENTRY>
</ROW>
<ROW>
<ENTRY> << </ENTRY>
<ENTRY>Left of?</ENTRY>
<ENTRY>
circle '((0,0),1)' << circle '((5,0),1)'
</ENTRY>
<ENTRY>
<literal>circle '((0,0),1)' << circle '((5,0),1)'</literal>
</ENTRY>
</ROW>
<ROW>
<ENTRY> <^ </ENTRY>
<ENTRY>Is below?</ENTRY>
<ENTRY>
circle '((0,0),1)' <^ circle '((0,5),1)'
</ENTRY>
<ENTRY>
<literal>circle '((0,0),1)' <^ circle '((0,5),1)'</literal>
</ENTRY>
</ROW>
<ROW>
<ENTRY> >> </ENTRY>
<ENTRY>Is right of?</ENTRY>
<ENTRY>
circle '((5,0),1)' >> circle '((0,0),1)'
</ENTRY>
<ENTRY>
<literal>circle '((5,0),1)' >> circle '((0,0),1)'</literal>
</ENTRY>
</ROW>
<ROW>
<ENTRY> >^ </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>
<ENTRY> ?# </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>
<ENTRY> ?- </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>
<ENTRY> ?-| </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>
<ENTRY> @-@ </ENTRY>
<ENTRY>Length or circumference</ENTRY>
<ENTRY>
@-@ path '((0,0),(1,0))'
</ENTRY>
<ENTRY>
<literal>@-@ path '((0,0),(1,0))'</literal>
</ENTRY>
</ROW>
<ROW>
<ENTRY> ?| </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>
<ENTRY> ?|| </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>
<ENTRY> @ </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>
<ENTRY> @@ </ENTRY>
<ENTRY>Center of</ENTRY>
<ENTRY>
@@ circle '((0,0),10)'
</ENTRY>
<ENTRY>
<literal>@@ circle '((0,0),10)'</literal>
</ENTRY>
</ROW>
<ROW>
<ENTRY> ~= </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>
</TBODY>
</TGROUP>
...
...
@@ -3080,91 +3086,91 @@ SELECT TIMESTAMP 'now';
</thead>
<tbody>
<row>
<entry>
area
(object)</entry>
<entry>
double precision
</entry>
<entry>
<function>area</function>
(object)</entry>
<entry>
<type>double precision</type>
</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>
<entry>
box
(box, box)</entry>
<entry>
box
</entry>
<entry>
<function>box</function>
(box, box)</entry>
<entry>
<type>box</type>
</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>
<entry>
center
(object)</entry>
<entry>
point
</entry>
<entry>
<function>center</function>
(object)</entry>
<entry>
<type>point</type>
</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>
<entry>
diameter
(circle)</entry>
<entry>
double precision
</entry>
<entry>
<function>diameter</function>
(circle)</entry>
<entry>
<type>double precision</type>
</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>
<entry>
height
(box)</entry>
<entry>
double precision
</entry>
<entry>
<function>height</function>
(box)</entry>
<entry>
<type>double precision</type>
</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>
<entry>
isclosed
(path)</entry>
<entry>
boolean
</entry>
<entry>
<function>isclosed</function>
(path)</entry>
<entry>
<type>boolean</type>
</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>
<entry>
isopen
(path)</entry>
<entry>
boolean
</entry>
<entry>
<function>isopen</function>
(path)</entry>
<entry>
<type>boolean</type>
</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>
<entry>
length
(object)</entry>
<entry>
double precision
</entry>
<entry>
<function>length</function>
(object)</entry>
<entry>
<type>double precision</type>
</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>
<entry>
pclose
(path)</entry>
<entry>
path
</entry>
<entry>
<function>pclose</function>
(path)</entry>
<entry>
<type>path</type>
</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>
<!
--
Not defined by this name. Implements the intersection operator '#'
<!
[IGNORE[
<!-- Not defined by this name. Implements the intersection operator '#' -->
<row>
<entry>
point
(lseg,lseg)</entry>
<entry>
point
</entry>
<entry>
<function>point</function>
(lseg,lseg)</entry>
<entry>
<type>point</type>
</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>
<entry>
npoint
(path)</entry>
<entry>
int4
</entry>
<entry>
<function>npoint</function>
(path)</entry>
<entry>
<type>integer</type>
</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>
<entry>
popen
(path)</entry>
<entry>
path
</entry>
<entry>
<function>popen</function>
(path)</entry>
<entry>
<type>path</type>
</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>
<entry>
radius
(circle)</entry>
<entry>
double precision
</entry>
<entry>
<function>radius</function>
(circle)</entry>
<entry>
<type>double precision</type>
</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>
<entry>
width
(box)</entry>
<entry>
double precision
</entry>
<entry>
<function>width</function>
(box)</entry>
<entry>
<type>double precision</type>
</entry>
<entry>horizontal size</entry>
<entry>
width(box '((0,0),(1,1))')
</entry>
<entry>
<literal>width(box '((0,0),(1,1))')</literal>
</entry>
</row>
</tbody>
</tgroup>
...
...
@@ -3184,94 +3190,94 @@ Not defined by this name. Implements the intersection operator '#'
</thead>
<tbody>
<row>
<entry>
box(circle
)</entry>
<entry>
box
</entry>
<entry>
<function>box</function>(<type>circle</type>
)</entry>
<entry>
<type>box</type>
</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>
<entry>
box(point, point
)</entry>
<entry>
box
</entry>
<entry>
<function>box</function>(<type>point</type>, <type>point</type>
)</entry>
<entry>
<type>box</type>
</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>
<entry>
box(polygon
)</entry>
<entry>
box
</entry>
<entry>
<function>box</function>(<type>polygon</type>
)</entry>
<entry>
<type>box</type>
</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>
<entry>
circle(box
)</entry>
<entry>
circle
</entry>
<entry>
<function>circle</function>(<type>box</type>
)</entry>
<entry>
<type>circle</type>
</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>
<entry>
circle(point, double precision
)</entry>
<entry>
circle
</entry>
<entry>
<function>circle</function>(<type>point</type>, <type>double precision</type>
)</entry>
<entry>
<type>circle</type>
</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>
<entry>
lseg(box
)</entry>
<entry>
lseg
</entry>
<entry>
<function>lseg</function>(<type>box</type>
)</entry>
<entry>
<type>lseg</type>
</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>
<entry>
lseg(point, point
)</entry>
<entry>
lseg
</entry>
<entry>
<function>lseg</function>(<type>point</type>, <type>point</type>
)</entry>
<entry>
<type>lseg</type>
</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>
<entry>
path(polygon
)</entry>
<entry>
point
</entry>
<entry>
<function>path</function>(<type>polygon</type>
)</entry>
<entry>
<type>point</type>
</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>
<entry>
point(circle
)</entry>
<entry>
point
</entry>
<entry>
<function>point</function>(<type>circle</type>
)</entry>
<entry>
<type>point</type>
</entry>
<entry>center</entry>
<entry>
point(circle '((0,0),2.0)')
</entry>
<entry>
<literal>point(circle '((0,0),2.0)')</literal>
</entry>
</row>
<row>
<entry>
point(lseg, lseg
)</entry>
<entry>
point
</entry>
<entry>
<function>point</function>(<type>lseg</type>, <type>lseg</type>
)</entry>
<entry>
<type>point</type>
</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>
<entry>
point(polygon
)</entry>
<entry>
point
</entry>
<entry>
<function>point</function>(<type>polygon</type>
)</entry>
<entry>
<type>point</type>
</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>
<entry>
polygon(box
)</entry>
<entry>
polygon
</entry>
<entry>
<function>polygon</function>(<type>box</type>
)</entry>
<entry>
<type>polygon</type>
</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>
<entry>
polygon(circle
)</entry>
<entry>
polygon
</entry>
<entry>
<function>polygon</function>(<type>circle</type>
)</entry>
<entry>
<type>polygon</type>
</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>
<entry>
polygon(<replaceable class="parameter">npts</replaceable>, circle
)</entry>
<entry>
polygon
</entry>
<entry>
<function>polygon</function>(<replaceable class="parameter">npts</replaceable>, <type>circle</type>
)</entry>
<entry>
<type>polygon</type>
</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>
<entry>
polygon(path
)</entry>
<entry>
polygon
</entry>
<entry>
<function>polygon</function>(<type>path</type>
)</entry>
<entry>
<type>polygon</type>
</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>
</tbody>
</tgroup>
...
...
@@ -3298,52 +3304,52 @@ Not defined by this name. Implements the intersection operator '#'
<ROW>
<ENTRY> < </ENTRY>
<ENTRY>Less than</ENTRY>
<ENTRY>
inet '192.168.1.5' < inet '192.168.1.6'
</ENTRY>
<ENTRY>
<literal>inet '192.168.1.5' < inet '192.168.1.6'</literal>
</ENTRY>
</ROW>
<ROW>
<ENTRY> <= </ENTRY>
<ENTRY>Less than or equal</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>
<ENTRY> = </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>
<ENTRY> >= </ENTRY>
<ENTRY>Greater or equal</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>
<ENTRY> > </ENTRY>
<ENTRY>Greater</ENTRY>
<ENTRY>
inet '192.168.1.5' > inet '192.168.1.4'
</ENTRY>
<ENTRY>
<literal>inet '192.168.1.5' > inet '192.168.1.4'</literal>
</ENTRY>
</ROW>
<ROW>
<ENTRY> <> </ENTRY>
<ENTRY>Not equal</ENTRY>
<ENTRY>
inet '192.168.1.5' <> inet '192.168.1.4'
</ENTRY>
<ENTRY>
<literal>inet '192.168.1.5' <> inet '192.168.1.4'</literal>
</ENTRY>
</ROW>
<ROW>
<ENTRY> << </ENTRY>
<ENTRY>is contained within</ENTRY>
<ENTRY>
inet '192.168.1.5' << inet '192.168.1/24'
</ENTRY>
<ENTRY>
<literal>inet '192.168.1.5' << inet '192.168.1/24'</literal>
</ENTRY>
</ROW>
<ROW>
<ENTRY> <<= </ENTRY>
<ENTRY>is contained within or equals</ENTRY>
<ENTRY>
inet '192.168.1/24' <<= inet '192.168.1/24'
</ENTRY>
<ENTRY>
<literal>inet '192.168.1/24' <<= inet '192.168.1/24'</literal>
</ENTRY>
</ROW>
<ROW>
<ENTRY> >> </ENTRY>
<ENTRY>contains</ENTRY>
<ENTRY>
inet'192.168.1/24' >> inet '192.168.1.5'
</ENTRY>
<ENTRY>
<literal>inet'192.168.1/24' >> inet '192.168.1.5'</literal>
</ENTRY>
</ROW>
<ROW>
<ENTRY> >>= </ENTRY>
<ENTRY>contains or equals</ENTRY>
<ENTRY>
inet '192.168.1/24' >>= inet '192.168.1/24'
</ENTRY>
<ENTRY>
<literal>inet '192.168.1/24' >>= inet '192.168.1/24'</literal>
</ENTRY>
</ROW>
</TBODY>
</TGROUP>
...
...
@@ -3374,60 +3380,60 @@ Not defined by this name. Implements the intersection operator '#'
</thead>
<tbody>
<row>
<entry>
broadcast(inet
)</entry>
<entry>
inet
</entry>
<entry>
<function>broadcast</function>(<type>inet</type>
)</entry>
<entry>
<type>inet</type>
</entry>
<entry>broadcast address for network</entry>
<entry>
broadcast('192.168.1.5/24')
</entry>
<entry>
192.168.1.255/24
</entry>
<entry>
<literal>broadcast('192.168.1.5/24')</literal>
</entry>
<entry>
<literal>192.168.1.255/24</literal>
</entry>
</row>
<row>
<entry>
host(inet
)</entry>
<entry>
text
</entry>
<entry>
<function>host</function>(<type>inet</type>
)</entry>
<entry>
<type>text</type>
</entry>
<entry>extract IP address as text</entry>
<entry>
host('192.168.1.5/24')
</entry>
<entry>
192.168.1.5
</entry>
<entry>
<literal>host('192.168.1.5/24')</literal>
</entry>
<entry>
<literal>192.168.1.5</literal>
</entry>
</row>
<row>
<entry>
masklen(inet
)</entry>
<entry>
integer
</entry>
<entry>
<function>masklen</function>(<type>inet</type>
)</entry>
<entry>
<type>integer</type>
</entry>
<entry>extract netmask length</entry>
<entry>
masklen('192.168.1.5/24')
</entry>
<entry>
24
</entry>
<entry>
<literal>masklen('192.168.1.5/24')</literal>
</entry>
<entry>
<literal>24</literal>
</entry>
</row>
<row>
<entry>
set_masklen(inet,integer
)</entry>
<entry>
inet
</entry>
<entry>
<function>set_masklen</function>(<type>inet</type>,<type>integer</type>
)</entry>
<entry>
<type>inet</type>
</entry>
<entry>set netmask length for inet value</entry>
<entry>
set_masklen('192.168.1.5/24',16)
</entry>
<entry>
192.168.1.5/16
</entry>
<entry>
<literal>set_masklen('192.168.1.5/24',16)</literal>
</entry>
<entry>
<literal>192.168.1.5/16</literal>
</entry>
</row>
<row>
<entry>
netmask(inet
)</entry>
<entry>
inet
</entry>
<entry>
<function>netmask</function>(<type>inet</type>
)</entry>
<entry>
<type>inet</type>
</entry>
<entry>construct netmask for network</entry>
<entry>
netmask('192.168.1.5/24')
</entry>
<entry>
255.255.255.0
</entry>
<entry>
<literal>netmask('192.168.1.5/24')</literal>
</entry>
<entry>
<literal>255.255.255.0</literal>
</entry>
</row>
<row>
<entry>
network(inet
)</entry>
<entry>
cidr
</entry>
<entry>
<function>network</function>(<type>inet</type>
)</entry>
<entry>
<type>cidr</type>
</entry>
<entry>extract network part of address</entry>
<entry>
network('192.168.1.5/24')
</entry>
<entry>
192.168.1.0/24
</entry>
<entry>
<literal>network('192.168.1.5/24')</literal>
</entry>
<entry>
<literal>192.168.1.0/24</literal>
</entry>
</row>
<row>
<entry>
text(inet
)</entry>
<entry>
text
</entry>
<entry>
<function>text</function>(<type>inet</type>
)</entry>
<entry>
<type>text</type>
</entry>
<entry>extract IP address and masklen as text</entry>
<entry>
text(inet '192.168.1.5')
</entry>
<entry>
192.168.1.5/32
</entry>
<entry>
<literal>text(inet '192.168.1.5')</literal>
</entry>
<entry>
<literal>192.168.1.5/32</literal>
</entry>
</row>
<row>
<entry>
abbrev(inet
)</entry>
<entry>
text
</entry>
<entry>
<function>abbrev</function>(<type>inet</type>
)</entry>
<entry>
<type>text</type>
</entry>
<entry>extract abbreviated display as text</entry>
<entry>
abbrev(cidr '10.1.0.0/16')
</entry>
<entry>
10.1/16
</entry>
<entry>
<literal>abbrev(cidr '10.1.0.0/16')</literal>
</entry>
<entry>
<literal>10.1/16</literal>
</entry>
</row>
</tbody>
</tgroup>
...
...
@@ -3438,8 +3444,8 @@ Not defined by this name. Implements the intersection operator '#'
<type>cidr</type> values as well. The <function>host</>(),
<function>text</>(), and <function>abbrev</>() functions are primarily
intended to offer alternative display formats. You can cast a text
field to inet using normal casting syntax:
inet(fieldname)
or
fieldname::inet
.
field to inet using normal casting syntax:
<literal>inet(expression)</literal>
or
<literal>colname::inet</literal>
.
</para>
<para>
...
...
@@ -3457,11 +3463,11 @@ Not defined by this name. Implements the intersection operator '#'
</thead>
<tbody>
<row>
<entry>
trunc(macaddr
)</entry>
<entry>
macaddr
</entry>
<entry>
<function>trunc</function>(<type>macaddr</type>
)</entry>
<entry>
<type>macaddr</type>
</entry>
<entry>set last 3 bytes to zero</entry>
<entry>
trunc(macaddr '12:34:56:78:90:ab')
</entry>
<entry>
12:34:56:00:00:00
</entry>
<entry>
<literal>trunc(macaddr '12:34:56:78:90:ab')</literal>
</entry>
<entry>
<literal>12:34:56:00:00:00</literal>
</entry>
</row>
</tbody>
</tgroup>
...
...
@@ -3722,18 +3728,18 @@ SELECT NULLIF(value, '(none)') ...
<tbody>
<row>
<entry>
has_table_privilege
(<parameter>user</parameter>,
<entry>
<function>has_table_privilege</function>
(<parameter>user</parameter>,
<parameter>table</parameter>,
<parameter>access</parameter>)
</entry>
<entry>
boolean
</>
<entry>
<type>boolean</type>
</>
<entry>does user have access to table</>
</row>
<row>
<entry>
has_table_privilege
(<parameter>table</parameter>,
<entry>
<function>has_table_privilege</function>
(<parameter>table</parameter>,
<parameter>access</parameter>)
</entry>
<entry>
boolean
</>
<entry>
<type>boolean</type>
</>
<entry>does current user have access to table</>
</row>
</tbody>
...
...
@@ -3747,7 +3753,7 @@ SELECT NULLIF(value, '(none)') ...
<para>
<function>has_table_privilege</> determines whether a user
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
by name or by OID. (Thus, there are actually six variants of
<function>has_table_privilege</>, which can be distinguished by
...
...
@@ -3811,13 +3817,13 @@ SELECT NULLIF(value, '(none)') ...
</row>
<row>
<entry>
COUNT
(*)</entry>
<entry>
<function>count</function>
(*)</entry>
<entry>number of input values</entry>
<entry>The return value is of type <type>bigint</type>.</entry>
</row>
<row>
<entry>
COUNT
(<replaceable class="parameter">expression</replaceable>)</entry>
<entry>
<function>count</function>
(<replaceable class="parameter">expression</replaceable>)</entry>
<entry>
Counts the input values for which the value of <replaceable
class="parameter">expression</replaceable> is not NULL.
...
...
@@ -3826,7 +3832,7 @@ SELECT NULLIF(value, '(none)') ...
</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>
Available for all numeric, string, and date/time types. The
...
...
@@ -3835,7 +3841,7 @@ SELECT NULLIF(value, '(none)') ...
</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>
Available for all numeric, string, and date/time types. The
...
...
@@ -3844,7 +3850,7 @@ SELECT NULLIF(value, '(none)') ...
</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>
<indexterm>
...
...
@@ -3860,7 +3866,7 @@ SELECT NULLIF(value, '(none)') ...
</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>
Summation is available on the following data types:
...
...
@@ -3876,7 +3882,7 @@ SELECT NULLIF(value, '(none)') ...
</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>
<indexterm>
...
...
doc/src/sgml/history.sgml
View file @
84956e71
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/history.sgml,v 1.1
3 2001/02/03 19:03:26
petere Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/history.sgml,v 1.1
4 2001/09/09 17:21:59
petere Exp $
-->
<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
California at Berkeley. With over a decade of
development behind it, <productname>PostgreSQL</productname>
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
user-defined types and functions), and having a wide range of
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
Finally,
<ulink url="http://www.illustra.com/">Illustra Information Technologies</ulink>
(since merged into
<ulink url="http://www.informix.com/">
Informix
</ulink>)
<ulink url="http://www.informix.com/">
<productname>Informix</productname>
</ulink>)
picked up
the code and commercialized it.
<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
<para>
A new front-end library, <filename>libpgtcl</filename>,
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>
programs with the <productname>Postgres95</productname> backend.
</para>
...
...
@@ -211,7 +211,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/history.sgml,v 1.13 2001/02/03 19:03:26 pet
<itemizedlist>
<listitem>
<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
and enables hot backups from pg_dump while the database stays available for
queries.
...
...
doc/src/sgml/indices.sgml
View file @
84956e71
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/indices.sgml,v 1.2
2 2001/08/24 14:07:48
petere Exp $ -->
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/indices.sgml,v 1.2
3 2001/09/09 17:21:59
petere Exp $ -->
<chapter id="indexes">
<title id="indexes-title">Indexes</title>
...
...
@@ -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
efficient, you'll have to resort to the means your
<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>
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
...
...
@@ -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
some useful way. For those who are into database theory, the problems
are basically analogous to the corresponding materialized view
problems, albeit with different cost parameters and formula
e
. These
problems, albeit with different cost parameters and formula
s
. These
are, in the general case, hard problems for the standard ordinal
<acronym>SQL</acronym>
types; they're super-hard problems with black-box extension types,
...
...
doc/src/sgml/inherit.sgml
View file @
84956e71
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/Attic/inherit.sgml,v 1.1
3 2001/01/13 23:58:55
petere Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/Attic/inherit.sgml,v 1.1
4 2001/09/09 17:21:59
petere Exp $
-->
<chapter id="inherit">
...
...
@@ -37,7 +37,7 @@ CREATE TABLE capitals (
<note>
<para>
The inheritance hierarchy is a
a
ctually a directed acyclic graph.
The inheritance hierarchy is actually a directed acyclic graph.
</para>
</note>
</para>
...
...
@@ -100,7 +100,7 @@ SELECT name, altitude
<para>
In some cases you may wish to know which table a particular tuple
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:
<programlisting>
...
...
doc/src/sgml/legal.sgml
View file @
84956e71
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/legal.sgml,v 1.1
0 2001/02/03 19:03:27
petere Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/legal.sgml,v 1.1
1 2001/09/09 17:21:59
petere Exp $
-->
<copyright>
...
...
@@ -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
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
PROVIDED HEREUNDER IS ON AN "AS-IS" BASIS, AND THE UNIVERSITY OF
CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINT
AI
NANCE, SUPPORT,
CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINT
E
NANCE, SUPPORT,
UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
</para>
...
...
doc/src/sgml/manage.sgml
View file @
84956e71
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/Attic/manage.sgml,v 1.1
3 2001/02/04 15:28:18
petere Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/Attic/manage.sgml,v 1.1
4 2001/09/09 17:21:59
petere Exp $
-->
<Chapter Id="manage">
<Title>Managing a Database</Title>
<Note>
<Para>
This section is currently a thinly disguised copy of the
Tutorial. Needs to be augmented.
<comment>
This section is currently a thinly disguised copy of the
Tutorial. Needs to be augmented.
- thomas 1998-01-12
</Para>
</Note>
</comment>
<Para>
Although the <FirstTerm>site administrator</FirstTerm> is responsible for overall management
...
...
@@ -89,9 +87,9 @@ ERROR: CREATE DATABASE: Permission denied.
Alternate database locations are created and referenced by an environment variable
which gives the absolute path to the intended storage location.
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
regarding preconfigured alternate database locations.
regarding preconfigured alternat
iv
e database locations.
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
to avoid confusion
...
...
@@ -101,7 +99,7 @@ ERROR: CREATE DATABASE: Permission denied.
<Note>
<Para>
In previous versions of <ProductName>Postgres</ProductName>,
it was also permiss
a
ble to use an absolute path name to specify
it was also permiss
i
ble to use an absolute path name to specify
an alternate storage location.
Although the environment variable style of specification
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.
</ListItem>
<ListItem>
<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
from C and get answers and status messages back to
your program. This interface is discussed further
...
...
@@ -213,7 +211,7 @@ mydb=>
</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
workspace maintained by the terminal monitor.
The <Application>psql</Application> program responds to escape codes that begin
...
...
@@ -235,7 +233,7 @@ mydb=> \g
terminate your query with a semicolon, the "<literal>\g</literal>" is not
necessary.
<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:
<ProgramListing>
mydb=> \i fileName
...
...
@@ -247,7 +245,7 @@ mydb=> \q
</ProgramListing>
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.)
White space (i.e., spaces, tabs and newlines) may be
used freely in <Acronym>SQL</Acronym> queries. Single-line comments are denoted by
...
...
doc/src/sgml/mvcc.sgml
View file @
84956e71
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/mvcc.sgml,v 2.1
6 2001/07/09 22:18:33 tgl
Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/mvcc.sgml,v 2.1
7 2001/09/09 17:21:59 petere
Exp $
-->
<chapter id="mvcc">
...
...
@@ -593,7 +593,7 @@ ERROR: Can't serialize access due to concurrent update
<variablelist>
<varlistentry>
<term>
GiST
and R-Tree indexes
<acronym>GiST</acronym>
and R-Tree indexes
</term>
<listitem>
<para>
...
...
doc/src/sgml/notation.sgml
View file @
84956e71
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/notation.sgml,v 1.1
4 2001/02/03 19:03:27
petere Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/notation.sgml,v 1.1
5 2001/09/09 17:21:59
petere Exp $
-->
<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
<para>
Examples will show commands executed from various accounts and programs.
Commands executed from a Unix shell may be prece
e
ded 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
accounts such as
root or postgres
are specially flagged and explained.
<acronym>SQL</acronym> commands may be prece
e
ded with
accounts such as
<systemitem>root</> or <systemitem>postgres</>
are specially flagged and explained.
<acronym>SQL</acronym> commands may be preceded with
<quote><literal>=></literal></quote>
or will have no leading prompt, depending on the context.
</para>
...
...
@@ -49,7 +49,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/notation.sgml,v 1.14 2001/02/03 19:03:27 pe
<note>
<para>
The notation for
flagging commands is not universally consist
a
nt throughout the
flagging commands is not universally consist
e
nt throughout the
documentation set.
Please report problems to the documentation mailing list
<email>pgsql-docs@postgresql.org</email>.
...
...
doc/src/sgml/perform.sgml
View file @
84956e71
<!--
$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">
...
...
@@ -109,9 +109,9 @@ Seq Scan on tenk1 (cost=0.00..333.00 rows=10000 width=148)
select * from pg_class where relname = 'tenk1';
</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
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>).
</para>
...
...
@@ -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
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,
so it wins despite the fact that each individual fetch is more expensive
than reading a whole disk page sequentially.
...
...
@@ -169,7 +169,7 @@ NOTICE: QUERY PLAN:
Index Scan using tenk1_unique1 on tenk1 (cost=0.00..173.44 rows=1 width=148)
</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.
</para>
...
...
@@ -190,18 +190,18 @@ Nested Loop (cost=0.00..269.11 rows=47 width=296)
</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
because we are applying the "unique1 < 50" WHERE clause at that node.
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
outer-scan tuple
's unique2 value is plugged into the inner index
scan
to produce an index
qual
like
outer-scan tuple
is plugged into the inner index
scan
to produce an index
qualification
like
"t2.unique2 = <replaceable>constant</replaceable>". So we get the
same inner-scan plan and costs that we'd get from, say,
"
explain select
* from tenk2 where unique2 = 42
". The loop node's costs
are then set
on the basis of the
outer scan's cost
, plus one repetition of the
same inner-scan plan and costs that we'd get from, say,
<literal>
explain select
* from tenk2 where unique2 = 42
</literal>. The costs of the loop node
are then set
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
time for join processing.
</para>
...
...
@@ -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
so can only be applied at the join point, not to either input scan.
For example, if we added "WHERE ... AND t1.hundred < t2.hundred",
that
'
d decrease the output row count of the join node, but not change
that
woul
d decrease the output row count of the join node, but not change
either input scan.
</para>
...
...
@@ -237,13 +237,13 @@ Hash Join (cost=173.44..557.03 rows=47 width=296)
(cost=0.00..173.32 rows=47 width=148)
</programlisting>
This plan proposes to extract the 50 interesting rows of
tenk1
using ye same olde indexscan, stash them into an in-memory hash table,
and then do a sequential scan of
tenk2
, probing into the hash table
for possible matches of "t1.unique2 = t2.unique2" at each
tenk2
tuple.
The cost to read
tenk1
and set up the hash table is entirely start-up
This plan proposes to extract the 50 interesting rows of
<classname>tenk1</classname>
using ye same olde index
scan, stash them into an in-memory 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
<classname>tenk2</classname>
tuple.
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
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
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.
...
...
@@ -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
<productname>Postgres</productname> planner will switch from exhaustive
search to a <firstterm>genetic</firstterm> probabilistic search
through a limited number of possibilities. (The switchover threshold is
set by the
GEQO_THRESHOLD
run-time
through a limited number of possibilities. (The switch
-
over threshold is
set by the
<varname>GEQO_THRESHOLD</varname>
run-time
parameter described in the <citetitle>Administrator's Guide</citetitle>.)
The genetic search takes less time, but it won't
necessarily find the best possible plan.
...
...
doc/src/sgml/problems.sgml
View file @
84956e71
<!--
$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">
...
...
@@ -137,10 +137,10 @@ $Header: /cvsroot/pgsql/doc/src/sgml/problems.sgml,v 2.7 2001/03/24 03:40:44 tgl
query.
You are encouraged to
minimize the size of your example, but this is not absolutely necessary.
If the bug is reproduc
ea
ble, we will find it either way.
If the bug is reproduc
i
ble, we will find it either way.
</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
web server to reproduce your problem. In any case remember to provide
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
The output you expected is very important to state. If you just write
"This command gives me that output." or "This is not
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.
Especially refrain from merely saying that "This is not what SQL says/Oracle
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
<para>
Any command line options and other start-up options, including concerned
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
to find out how that is done.
</para>
...
...
@@ -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
in the source directory or at the
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
snapshot, mention that, including its date and time.
</para>
...
...
doc/src/sgml/queries.sgml
View file @
84956e71
<!-- $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">
<title>Queries</title>
...
...
@@ -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
subquery, a table join, or complex combinations of these. If more
than one table reference is listed in the FROM clause they are
CROSS JOIN
ed (see below) to form the derived table that may then
cross-join
ed (see below) to form the derived table that may then
be subject to transformations by the WHERE, GROUP BY, and HAVING
clauses and is finally the result of the overall table expression.
</para>
...
...
@@ -150,7 +150,7 @@ FROM <replaceable>table_reference</replaceable> <optional>, <replaceable>table_r
</varlistentry>
<varlistentry>
<term>Qualified
JOIN
s</term>
<term>Qualified
join
s</term>
<listitem>
<indexterm>
...
...
@@ -166,7 +166,7 @@ FROM <replaceable>table_reference</replaceable> <optional>, <replaceable>table_r
<para>
The words <token>INNER</token> and <token>OUTER</token> are
optional for all
JOIN
s. <token>INNER</token> is the default;
optional for all
join
s. <token>INNER</token> is the default;
<token>LEFT</token>, <token>RIGHT</token>, and
<token>FULL</token> imply an OUTER JOIN.
</para>
...
...
@@ -281,7 +281,7 @@ FROM <replaceable>table_reference</replaceable> <optional>, <replaceable>table_r
<para>
Joins of all types can be chained together or nested: either
or both of <replaceable>T1</replaceable> and
<replaceable>T2</replaceable> may be
JOIN
ed tables. Parentheses
<replaceable>T2</replaceable> may be
join
ed tables. Parentheses
may be used around JOIN clauses to control the join order. In the
absence of parentheses, JOIN clauses nest left-to-right.
</para>
...
...
@@ -479,7 +479,7 @@ FROM a NATURAL JOIN b WHERE b.val > 5
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
products. For outer joins there is no choice in any case: they
must be done in the FROM clause. A
n 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
determines the addition of rows (for unmatched input rows) as well
as the removal of rows from the final result.
...
...
@@ -505,16 +505,18 @@ FROM FDT WHERE
</programlisting>
<para>
In the examples above, FDT is the table derived in the FROM
clause. Rows that do not meet the search condition of the where
clause are eliminated from FDT. Notice the use of scalar
subqueries as value expressions. Just like
any other query, the subqueries can employ complex table
expressions. Notice how FDT is referenced in the subqueries.
Qualifying C1 as FDT.C1 is only necessary if C1 is also the name of a
column in the derived 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.
In the examples above, <literal>FDT</literal> is the table derived
in the FROM clause. Rows that do not meet the search condition of
the where clause are eliminated from
<literal>FDT</literal>. Notice the use of scalar subqueries as
value expressions. Just like any other query, the subqueries can
employ complex table expressions. Notice how
<literal>FDT</literal> is referenced in the subqueries.
Qualifying <literal>C1</> as <literal>FDT.C1</> is only necessary
if <literal>C1</> is also the name of a column in the derived
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>
</sect2>
...
...
@@ -569,7 +571,7 @@ SELECT pid, p.name, (sum(s.units) * p.price) AS sales
FROM products p LEFT JOIN sales s USING ( pid )
GROUP BY pid, p.name, p.price;
</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
list. The column s.units does not have to be in the GROUP BY list
since it is only used in an aggregate expression
...
...
@@ -868,12 +870,12 @@ SELECT a, b FROM table1 ORDER BY a + b;
SELECT a AS b FROM table1 ORDER BY a;
</programlisting>
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>
Each column specification may be followed by an optional
ASC
or
DESC to set the sort direction. ASC
is default. Ascending order
Each column specification may be followed by an optional
<token>ASC</token>
or
<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
in terms of the <literal><</literal> operator. Similarly,
descending order is determined with the <literal>></literal>
...
...
doc/src/sgml/syntax.sgml
View file @
84956e71
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/syntax.sgml,v 1.4
5 2001/08/26 21:17:12 tgl
Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/syntax.sgml,v 1.4
6 2001/09/09 17:21:59 petere
Exp $
-->
<chapter id="sql-syntax">
...
...
@@ -462,7 +462,7 @@ CAST ( '<replaceable>string</replaceable>' AS <replaceable>type</replaceable> )
<listitem>
<para>
"$" (dollar) cannot be a single-character operator, although it
can be part of a multi-character operator name.
can be part of a multi
ple
-character operator name.
</para>
</listitem>
...
...
@@ -476,7 +476,7 @@ CAST ( '<replaceable>string</replaceable>' AS <replaceable>type</replaceable> )
<listitem>
<para>
A multi-character operator name cannot end in "+" or "-",
A multi
ple
-character operator name cannot end in "+" or "-",
unless the name also contains at least one of these characters:
<literallayout>
~ ! @ # % ^ & | ` ? $
...
...
@@ -600,7 +600,7 @@ CAST ( '<replaceable>string</replaceable>' AS <replaceable>type</replaceable> )
<para>
Alternatively, C-style block comments can be used:
<programlisting>
/* multi
-
line comment
/* multiline comment
* with nesting: /* nested block comment */
*/
</programlisting>
...
...
@@ -634,7 +634,7 @@ CAST ( '<replaceable>string</replaceable>' AS <replaceable>type</replaceable> )
<variablelist>
<varlistentry>
<term>
oid
</term>
<term>
<structfield>oid</>
</term>
<listitem>
<para>
<indexterm>
...
...
@@ -649,20 +649,22 @@ CAST ( '<replaceable>string</replaceable>' AS <replaceable>type</replaceable> )
</varlistentry>
<varlistentry>
<term>
tableoid
</term>
<term>
<structfield>tableoid</>
</term>
<listitem>
<para>
The OID of the table containing this row. This attribute is
particularly handy for queries that select from inheritance
hierarchies, since without it, it's difficult to tell which
individual table a row came from. The tableoid can be joined
against the OID attribute of pg_class to obtain the table name.
individual table a row came from. The
<structfield>tableoid</structfield> can be joined against the
<structfield>oid</structfield> column of
<classname>pg_class</classname> to obtain the table name.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
xmin
</term>
<term>
<structfield>xmin</>
</term>
<listitem>
<para>
The identity (transaction ID) of the inserting transaction for
...
...
@@ -673,7 +675,7 @@ CAST ( '<replaceable>string</replaceable>' AS <replaceable>type</replaceable> )
</varlistentry>
<varlistentry>
<term>
cmin
</term>
<term>
<structfield>cmin</>
</term>
<listitem>
<para>
The command identifier (starting at zero) within the inserting
...
...
@@ -683,7 +685,7 @@ CAST ( '<replaceable>string</replaceable>' AS <replaceable>type</replaceable> )
</varlistentry>
<varlistentry>
<term>
xmax
</term>
<term>
<structfield>xmax</>
</term>
<listitem>
<para>
The identity (transaction ID) of the deleting transaction,
...
...
@@ -696,7 +698,7 @@ CAST ( '<replaceable>string</replaceable>' AS <replaceable>type</replaceable> )
</varlistentry>
<varlistentry>
<term>
cmax
</term>
<term>
<structfield>cmax</>
</term>
<listitem>
<para>
The command identifier within the deleting transaction, or zero.
...
...
@@ -705,16 +707,16 @@ CAST ( '<replaceable>string</replaceable>' AS <replaceable>type</replaceable> )
</varlistentry>
<varlistentry>
<term>
ctid
</term>
<term>
<structfield>ctid</>
</term>
<listitem>
<para>
The tuple ID of the tuple within its table. This is a pair
(block number, tuple index within block) that identifies the
physical location of the tuple. Note that although the
ctid
can be used to locate the tuple very quickly, a row's
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
<structfield>ctid</structfield>
will change each time it is updated or moved by <command>VACUUM
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
be used to identify logical rows.
</para>
...
...
@@ -731,9 +733,9 @@ CAST ( '<replaceable>string</replaceable>' AS <replaceable>type</replaceable> )
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
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
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.)
</para>
...
...
doc/src/sgml/typeconv.sgml
View file @
84956e71
...
...
@@ -150,8 +150,8 @@ extended user-defined types to use these same features transparently.
<para>
An additional heuristic is provided in the parser to allow better guesses
at proper behavior for <acronym>SQL</acronym> standard types. There are
several basic <firstterm>type categories</firstterm> defined:
boolean
,
numeric, string, bitstring, datetime, timespan, geometric, network
,
several basic <firstterm>type categories</firstterm> defined:
<type>boolean</type>
,
<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
a <firstterm>preferred type</firstterm> which is preferentially selected
when there is ambiguity.
...
...
@@ -273,7 +273,7 @@ If only one candidate remains, use it; else continue to the next step.
</step>
<step performance="required">
<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,
select "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).
Otherwise, if all the remaining candidates accept the same type category,
select that category; otherwise fail because
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;
furthermore, if any candidate accepts a preferred type at a given argument
position, discard candidates that accept non-preferred types for that
...
...
@@ -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
are specified in the query. So, the parser looks for all candidate operators
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
"preferred type" for strings, <type>text</type>, is used as the specific
type to resolve the unknown literals to.
...
...
@@ -440,7 +440,7 @@ will try to oblige.
<step performance="required">
<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
this step.)
</para></step>
...
...
@@ -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,
select that category; otherwise fail because
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;
furthermore, if any candidate accepts a preferred type at a given argument
position, discard candidates that accept non-preferred types for that
...
...
@@ -512,10 +512,10 @@ then fail.
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
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
datatype. When these conditions are met, the function argument is coerced
to the named datatype.
data
type. When these conditions are met, the function argument is coerced
to the named data
type.
</para>
</step>
</procedure>
...
...
@@ -527,7 +527,7 @@ to the named datatype.
<title>Factorial Function</title>
<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
to <type>int4</type>:
...
...
@@ -554,7 +554,7 @@ tgl=> select int4fac(int4(int2 '4'));
<title>Substring Function</title>
<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>.
</para>
...
...
@@ -679,8 +679,8 @@ tgl=> SELECT * FROM vv;
What's really happened here is that the two unknown literals are resolved
to text by default, allowing the <literal>||</literal> operator to be
resolved as text concatenation. Then the text result of the operator
is coerced to
varchar
to match the target column type. (But, since the
parser knows that text and
varchar
are binary-compatible, this coercion
is coerced to
<type>varchar</type>
to match the target column type. (But, since the
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
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.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment