Commit c326d8f4 authored by Peter Eisentraut's avatar Peter Eisentraut

Add/edit index entries.

parent cf8e9169
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/advanced.sgml,v 1.34 2003/03/25 16:15:35 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/advanced.sgml,v 1.35 2003/08/31 17:32:18 petere Exp $
--> -->
<chapter id="tutorial-advanced"> <chapter id="tutorial-advanced">
...@@ -142,7 +142,7 @@ ERROR: &lt;unnamed&gt; referential integrity violation - key referenced from we ...@@ -142,7 +142,7 @@ ERROR: &lt;unnamed&gt; referential integrity violation - key referenced from we
<title>Transactions</title> <title>Transactions</title>
<indexterm zone="tutorial-transactions"> <indexterm zone="tutorial-transactions">
<primary>transactions</primary> <primary>transaction</primary>
</indexterm> </indexterm>
<para> <para>
......
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/array.sgml,v 1.30 2003/08/19 06:06:43 tgl Exp $ --> <!-- $Header: /cvsroot/pgsql/doc/src/sgml/array.sgml,v 1.31 2003/08/31 17:32:18 petere Exp $ -->
<sect1 id="arrays"> <sect1 id="arrays">
<title>Arrays</title> <title>Arrays</title>
<indexterm> <indexterm>
<primary>arrays</primary> <primary>array</primary>
</indexterm> </indexterm>
<para> <para>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/backup.sgml,v 2.29 2003/08/17 22:05:13 tgl Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/backup.sgml,v 2.30 2003/08/31 17:32:18 petere Exp $
--> -->
<chapter id="backup"> <chapter id="backup">
<title>Backup and Restore</title> <title>Backup and Restore</title>
...@@ -285,13 +285,15 @@ pg_dump -Fc <replaceable class="parameter">dbname</replaceable> > <replaceable c ...@@ -285,13 +285,15 @@ pg_dump -Fc <replaceable class="parameter">dbname</replaceable> > <replaceable c
</para> </para>
<para> <para>
For reasons of backward compatibility, <application>pg_dump</> does For reasons of backward compatibility, <application>pg_dump</>
not dump large objects by default. To dump large objects you must use does not dump large objects by default.<indexterm><primary>large
either the custom or the TAR output format, and use the <option>-b</> option in object</primary><secondary>backup</secondary></indexterm> To dump
<application>pg_dump</>. See the reference pages for details. large objects you must use either the custom or the TAR output
The directory <filename>contrib/pg_dumplo</> of the format, and use the <option>-b</> option in
<productname>PostgreSQL</> source tree also contains a program that can <application>pg_dump</>. See the reference pages for details. The
dump large objects. directory <filename>contrib/pg_dumplo</> of the
<productname>PostgreSQL</> source tree also contains a program
that can dump large objects.
</para> </para>
<para> <para>
...@@ -371,7 +373,15 @@ tar -cf backup.tar /usr/local/pgsql/data ...@@ -371,7 +373,15 @@ tar -cf backup.tar /usr/local/pgsql/data
<sect1 id="migration"> <sect1 id="migration">
<title>Migration between releases</title> <title>Migration between releases</title>
<indexterm zone="migration"><primary>upgrading</></>
<indexterm zone="migration">
<primary>upgrading</primary>
</indexterm>
<indexterm zone="migration">
<primary>version</primary>
<secondary>compatibility</secondary>
</indexterm>
<para> <para>
As a general rule, the internal data storage format is subject to As a general rule, the internal data storage format is subject to
......
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/charset.sgml,v 2.37 2003/08/04 04:03:03 tgl Exp $ --> <!-- $Header: /cvsroot/pgsql/doc/src/sgml/charset.sgml,v 2.38 2003/08/31 17:32:18 petere Exp $ -->
<chapter id="charset"> <chapter id="charset">
<title>Localization</> <title>Localization</>
...@@ -197,7 +197,7 @@ initdb --locale=sv_SE ...@@ -197,7 +197,7 @@ initdb --locale=sv_SE
<listitem> <listitem>
<para> <para>
Sort order in queries using <command>ORDER BY</> Sort order in queries using <command>ORDER BY</>
<indexterm><primary>ORDER BY</></> <indexterm><primary>ORDER BY</><secondary>and locales</></indexterm>
</para> </para>
</listitem> </listitem>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/client-auth.sgml,v 1.55 2003/08/17 04:39:11 momjian Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/client-auth.sgml,v 1.56 2003/08/31 17:32:18 petere Exp $
--> -->
<chapter id="client-authentication"> <chapter id="client-authentication">
...@@ -576,6 +576,7 @@ local db1,db2,@demodbs all md5 ...@@ -576,6 +576,7 @@ local db1,db2,@demodbs all md5
</indexterm> </indexterm>
<indexterm> <indexterm>
<primary>password</primary> <primary>password</primary>
<secondary>authentication</secondary>
</indexterm> </indexterm>
<para> <para>
...@@ -865,6 +866,10 @@ omicron bryanh guest1 ...@@ -865,6 +866,10 @@ omicron bryanh guest1
<sect2 id="auth-pam"> <sect2 id="auth-pam">
<title>PAM Authentication</title> <title>PAM Authentication</title>
<indexterm zone="auth-pam">
<primary>PAM</primary>
</indexterm>
<para> <para>
This authentication method operates similarly to This authentication method operates similarly to
<literal>password</literal> except that it uses PAM (Pluggable <literal>password</literal> except that it uses PAM (Pluggable
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/datatype.sgml,v 1.122 2003/08/09 22:50:21 tgl Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/datatype.sgml,v 1.123 2003/08/31 17:32:18 petere Exp $
--> -->
<chapter id="datatype"> <chapter id="datatype">
<title id="datatype-title">Data Types</title> <title id="datatype-title">Data Types</title>
<indexterm zone="datatype"> <indexterm zone="datatype">
<primary>data types</primary> <primary>data type</primary>
</indexterm> </indexterm>
<indexterm> <indexterm>
<primary>types</primary> <primary>type</primary>
<see>data types</see> <see>data type</see>
</indexterm> </indexterm>
<para> <para>
...@@ -279,68 +279,10 @@ $Header: /cvsroot/pgsql/doc/src/sgml/datatype.sgml,v 1.122 2003/08/09 22:50:21 t ...@@ -279,68 +279,10 @@ $Header: /cvsroot/pgsql/doc/src/sgml/datatype.sgml,v 1.122 2003/08/09 22:50:21 t
<title>Numeric Types</title> <title>Numeric Types</title>
<indexterm zone="datatype-numeric"> <indexterm zone="datatype-numeric">
<primary>data types</primary> <primary>data type</primary>
<secondary>numeric</secondary> <secondary>numeric</secondary>
</indexterm> </indexterm>
<indexterm zone="datatype-numeric">
<primary>integer</primary>
</indexterm>
<indexterm zone="datatype-numeric">
<primary>smallint</primary>
</indexterm>
<indexterm zone="datatype-numeric">
<primary>bigint</primary>
</indexterm>
<indexterm>
<primary>int4</primary>
<see>integer</see>
</indexterm>
<indexterm>
<primary>int2</primary>
<see>smallint</see>
</indexterm>
<indexterm>
<primary>int8</primary>
<see>bigint</see>
</indexterm>
<indexterm zone="datatype-numeric">
<primary>numeric (data type)</primary>
</indexterm>
<indexterm>
<primary>decimal</primary>
<see>numeric</see>
</indexterm>
<indexterm zone="datatype-numeric">
<primary>real</primary>
</indexterm>
<indexterm zone="datatype-numeric">
<primary>double precision</primary>
</indexterm>
<indexterm>
<primary>float4</primary>
<see>real</see>
</indexterm>
<indexterm>
<primary>float8</primary>
<see>double precision</see>
</indexterm>
<indexterm zone="datatype-numeric">
<primary>floating point</primary>
</indexterm>
<para> <para>
Numeric types consist of two-, four-, and eight-byte integers, Numeric types consist of two-, four-, and eight-byte integers,
four- and eight-byte floating-point numbers, and fixed-precision four- and eight-byte floating-point numbers, and fixed-precision
...@@ -434,6 +376,33 @@ $Header: /cvsroot/pgsql/doc/src/sgml/datatype.sgml,v 1.122 2003/08/09 22:50:21 t ...@@ -434,6 +376,33 @@ $Header: /cvsroot/pgsql/doc/src/sgml/datatype.sgml,v 1.122 2003/08/09 22:50:21 t
<sect2 id="datatype-int"> <sect2 id="datatype-int">
<title>Integer Types</title> <title>Integer Types</title>
<indexterm zone="datatype-int">
<primary>integer</primary>
</indexterm>
<indexterm zone="datatype-int">
<primary>smallint</primary>
</indexterm>
<indexterm zone="datatype-int">
<primary>bigint</primary>
</indexterm>
<indexterm>
<primary>int4</primary>
<see>integer</see>
</indexterm>
<indexterm>
<primary>int2</primary>
<see>smallint</see>
</indexterm>
<indexterm>
<primary>int8</primary>
<see>bigint</see>
</indexterm>
<para> <para>
The types <type>smallint</type>, <type>integer</type>, and The types <type>smallint</type>, <type>integer</type>, and
<type>bigint</type> store whole numbers, that is, numbers without <type>bigint</type> store whole numbers, that is, numbers without
...@@ -495,6 +464,15 @@ $Header: /cvsroot/pgsql/doc/src/sgml/datatype.sgml,v 1.122 2003/08/09 22:50:21 t ...@@ -495,6 +464,15 @@ $Header: /cvsroot/pgsql/doc/src/sgml/datatype.sgml,v 1.122 2003/08/09 22:50:21 t
<sect2 id="datatype-numeric-decimal"> <sect2 id="datatype-numeric-decimal">
<title>Arbitrary Precision Numbers</title> <title>Arbitrary Precision Numbers</title>
<indexterm zone="datatype-numeric-decimal">
<primary>numeric (data type)</primary>
</indexterm>
<indexterm>
<primary>decimal</primary>
<see>numeric</see>
</indexterm>
<para> <para>
The type <type>numeric</type> can store numbers with up to 1000 The type <type>numeric</type> can store numbers with up to 1000
digits of precision and perform calculations exactly. It is digits of precision and perform calculations exactly. It is
...@@ -562,6 +540,28 @@ NUMERIC ...@@ -562,6 +540,28 @@ NUMERIC
<sect2 id="datatype-float"> <sect2 id="datatype-float">
<title>Floating-Point Types</title> <title>Floating-Point Types</title>
<indexterm zone="datatype-float">
<primary>real</primary>
</indexterm>
<indexterm zone="datatype-float">
<primary>double precision</primary>
</indexterm>
<indexterm>
<primary>float4</primary>
<see>real</see>
</indexterm>
<indexterm>
<primary>float8</primary>
<see>double precision</see>
</indexterm>
<indexterm zone="datatype-float">
<primary>floating point</primary>
</indexterm>
<para> <para>
The data types <type>real</type> and <type>double The data types <type>real</type> and <type>double
precision</type> are inexact, variable-precision numeric types. precision</type> are inexact, variable-precision numeric types.
...@@ -675,7 +675,7 @@ NUMERIC ...@@ -675,7 +675,7 @@ NUMERIC
</indexterm> </indexterm>
<indexterm> <indexterm>
<primary>sequences</primary> <primary>sequence</primary>
<secondary>and serial type</secondary> <secondary>and serial type</secondary>
</indexterm> </indexterm>
...@@ -807,18 +807,33 @@ CREATE TABLE <replaceable class="parameter">tablename</replaceable> ( ...@@ -807,18 +807,33 @@ CREATE TABLE <replaceable class="parameter">tablename</replaceable> (
<title>Character Types</title> <title>Character Types</title>
<indexterm zone="datatype-character"> <indexterm zone="datatype-character">
<primary>character strings</primary> <primary>character string</primary>
<secondary>data types</secondary> <secondary>data types</secondary>
</indexterm> </indexterm>
<indexterm> <indexterm>
<primary>strings</primary> <primary>string</primary>
<see>character strings</see> <see>character string</see>
</indexterm> </indexterm>
<indexterm> <indexterm zone="datatype-character">
<primary>character</primary>
</indexterm>
<indexterm zone="datatype-character">
<primary>character varying</primary>
</indexterm>
<indexterm zone="datatype-character">
<primary>text</primary> <primary>text</primary>
<see>character strings</see> </indexterm>
<indexterm zone="datatype-character">
<primary>char</primary>
</indexterm>
<indexterm zone="datatype-character">
<primary>varchar</primary>
</indexterm> </indexterm>
<table id="datatype-character-table"> <table id="datatype-character-table">
...@@ -1020,6 +1035,15 @@ SELECT b, char_length(b) FROM test2; ...@@ -1020,6 +1035,15 @@ SELECT b, char_length(b) FROM test2;
<sect1 id="datatype-binary"> <sect1 id="datatype-binary">
<title>Binary Data Types</title> <title>Binary Data Types</title>
<indexterm zone="datatype-binary">
<primary>binary data</primary>
</indexterm>
<indexterm zone="datatype-binary">
<primary>bytea</primary>
</indexterm>
<para> <para>
The <type>bytea</type> data type allows storage of binary strings; The <type>bytea</type> data type allows storage of binary strings;
see <xref linkend="datatype-binary-table">. see <xref linkend="datatype-binary-table">.
...@@ -1210,6 +1234,34 @@ SELECT b, char_length(b) FROM test2; ...@@ -1210,6 +1234,34 @@ SELECT b, char_length(b) FROM test2;
<sect1 id="datatype-datetime"> <sect1 id="datatype-datetime">
<title>Date/Time Types</title> <title>Date/Time Types</title>
<indexterm zone="datatype-datetime">
<primary>date</primary>
</indexterm>
<indexterm zone="datatype-datetime">
<primary>time</primary>
</indexterm>
<indexterm zone="datatype-datetime">
<primary>time without time zone</primary>
</indexterm>
<indexterm zone="datatype-datetime">
<primary>time with time zone</primary>
</indexterm>
<indexterm zone="datatype-datetime">
<primary>timestamp</primary>
</indexterm>
<indexterm zone="datatype-datetime">
<primary>timestamp with time zone</primary>
</indexterm>
<indexterm zone="datatype-datetime">
<primary>timestamp without time zone</primary>
</indexterm>
<indexterm zone="datatype-datetime">
<primary>interval</primary>
</indexterm>
<indexterm zone="datatype-datetime">
<primary>time span</primary>
</indexterm>
<para> <para>
<productname>PostgreSQL</productname> supports the full set of <productname>PostgreSQL</productname> supports the full set of
<acronym>SQL</acronym> date and time types, shown in <xref <acronym>SQL</acronym> date and time types, shown in <xref
...@@ -1387,7 +1439,6 @@ SELECT b, char_length(b) FROM test2; ...@@ -1387,7 +1439,6 @@ SELECT b, char_length(b) FROM test2;
<indexterm> <indexterm>
<primary>date</primary> <primary>date</primary>
<secondary>data type</secondary>
</indexterm> </indexterm>
<para> <para>
...@@ -1461,15 +1512,12 @@ SELECT b, char_length(b) FROM test2; ...@@ -1461,15 +1512,12 @@ SELECT b, char_length(b) FROM test2;
<indexterm> <indexterm>
<primary>time</primary> <primary>time</primary>
<secondary>data type</secondary>
</indexterm> </indexterm>
<indexterm> <indexterm>
<primary>time without time zone</primary> <primary>time without time zone</primary>
<secondary>time</secondary>
</indexterm> </indexterm>
<indexterm> <indexterm>
<primary>time with time zone</primary> <primary>time with time zone</primary>
<secondary>data type</secondary>
</indexterm> </indexterm>
<para> <para>
...@@ -1587,17 +1635,14 @@ SELECT b, char_length(b) FROM test2; ...@@ -1587,17 +1635,14 @@ SELECT b, char_length(b) FROM test2;
<indexterm> <indexterm>
<primary>timestamp</primary> <primary>timestamp</primary>
<secondary>data type</secondary>
</indexterm> </indexterm>
<indexterm> <indexterm>
<primary>timestamp with time zone</primary> <primary>timestamp with time zone</primary>
<secondary>data type</secondary>
</indexterm> </indexterm>
<indexterm> <indexterm>
<primary>timestamp without time zone</primary> <primary>timestamp without time zone</primary>
<secondary>data type</secondary>
</indexterm> </indexterm>
<para> <para>
...@@ -1797,13 +1842,13 @@ January 8 04:05:06 1999 PST ...@@ -1797,13 +1842,13 @@ January 8 04:05:06 1999 PST
<indexterm> <indexterm>
<primary>date</primary> <primary>date</primary>
<secondary>output format</secondary> <secondary>output format</secondary>
<seealso>Formatting</seealso> <seealso>formatting</seealso>
</indexterm> </indexterm>
<indexterm> <indexterm>
<primary>time</primary> <primary>time</primary>
<secondary>output format</secondary> <secondary>output format</secondary>
<seealso>Formatting</seealso> <seealso>formatting</seealso>
</indexterm> </indexterm>
<para> <para>
...@@ -1924,7 +1969,7 @@ January 8 04:05:06 1999 PST ...@@ -1924,7 +1969,7 @@ January 8 04:05:06 1999 PST
<title>Time Zones</title> <title>Time Zones</title>
<indexterm zone="datatype-timezones"> <indexterm zone="datatype-timezones">
<primary>time zones</primary> <primary>time zone</primary>
</indexterm> </indexterm>
<para> <para>
...@@ -2265,7 +2310,11 @@ SELECT * FROM test1 WHERE a; ...@@ -2265,7 +2310,11 @@ SELECT * FROM test1 WHERE a;
<title>Line Segments</title> <title>Line Segments</title>
<indexterm> <indexterm>
<primary>line</primary> <primary>lseg</primary>
</indexterm>
<indexterm>
<primary>line segment</primary>
</indexterm> </indexterm>
<para> <para>
...@@ -2293,6 +2342,10 @@ SELECT * FROM test1 WHERE a; ...@@ -2293,6 +2342,10 @@ SELECT * FROM test1 WHERE a;
<primary>box (data type)</primary> <primary>box (data type)</primary>
</indexterm> </indexterm>
<indexterm>
<primary>rectangle</primary>
</indexterm>
<para> <para>
Boxes are represented by pairs of points that are opposite Boxes are represented by pairs of points that are opposite
corners of the box. corners of the box.
...@@ -2431,7 +2484,7 @@ SELECT * FROM test1 WHERE a; ...@@ -2431,7 +2484,7 @@ SELECT * FROM test1 WHERE a;
<indexterm zone="datatype-net-types"> <indexterm zone="datatype-net-types">
<primary>network</primary> <primary>network</primary>
<secondary>addresses</secondary> <secondary>data types</secondary>
</indexterm> </indexterm>
<para> <para>
...@@ -2708,7 +2761,7 @@ SELECT * FROM test1 WHERE a; ...@@ -2708,7 +2761,7 @@ SELECT * FROM test1 WHERE a;
<title>Bit String Types</title> <title>Bit String Types</title>
<indexterm zone="datatype-bit"> <indexterm zone="datatype-bit">
<primary>bit strings</primary> <primary>bit string</primary>
<secondary>data type</secondary> <secondary>data type</secondary>
</indexterm> </indexterm>
...@@ -3045,11 +3098,6 @@ SELECT * FROM test; ...@@ -3045,11 +3098,6 @@ SELECT * FROM test;
</thead> </thead>
<tbody> <tbody>
<row>
<entry><type>record</></entry>
<entry>Identifies a function returning an unspecified row type.</entry>
</row>
<row> <row>
<entry><type>any</></entry> <entry><type>any</></entry>
<entry>Indicates that a function accepts any input data type whatever.</entry> <entry>Indicates that a function accepts any input data type whatever.</entry>
...@@ -3058,23 +3106,24 @@ SELECT * FROM test; ...@@ -3058,23 +3106,24 @@ SELECT * FROM test;
<row> <row>
<entry><type>anyarray</></entry> <entry><type>anyarray</></entry>
<entry>Indicates that a function accepts any array data type <entry>Indicates that a function accepts any array data type
(see <xref linkend="types-polymorphic">).</entry> (see <xref linkend="extend-types-polymorphic">).</entry>
</row> </row>
<row> <row>
<entry><type>anyelement</></entry> <entry><type>anyelement</></entry>
<entry>Indicates that a function accepts any data type <entry>Indicates that a function accepts any data type
(see <xref linkend="types-polymorphic">).</entry> (see <xref linkend="extend-types-polymorphic">).</entry>
</row> </row>
<row> <row>
<entry><type>void</></entry> <entry><type>cstring</></entry>
<entry>Indicates that a function returns no value.</entry> <entry>Indicates that a function accepts or returns a null-terminated C string.</entry>
</row> </row>
<row> <row>
<entry><type>trigger</></entry> <entry><type>internal</></entry>
<entry>A trigger function is declared to return <type>trigger.</></entry> <entry>Indicates that a function accepts or returns a server-internal
data type.</entry>
</row> </row>
<row> <row>
...@@ -3083,14 +3132,18 @@ SELECT * FROM test; ...@@ -3083,14 +3132,18 @@ SELECT * FROM test;
</row> </row>
<row> <row>
<entry><type>cstring</></entry> <entry><type>record</></entry>
<entry>Indicates that a function accepts or returns a null-terminated C string.</entry> <entry>Identifies a function returning an unspecified row type.</entry>
</row> </row>
<row> <row>
<entry><type>internal</></entry> <entry><type>trigger</></entry>
<entry>Indicates that a function accepts or returns a server-internal <entry>A trigger function is declared to return <type>trigger.</></entry>
data type.</entry> </row>
<row>
<entry><type>void</></entry>
<entry>Indicates that a function returns no value.</entry>
</row> </row>
<row> <row>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/datetime.sgml,v 2.33 2003/08/25 23:30:25 tgl Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/datetime.sgml,v 2.34 2003/08/31 17:32:18 petere Exp $
--> -->
<appendix id="datetime-appendix"> <appendix id="datetime-appendix">
...@@ -364,7 +364,8 @@ $Header: /cvsroot/pgsql/doc/src/sgml/datetime.sgml,v 2.33 2003/08/25 23:30:25 tg ...@@ -364,7 +364,8 @@ $Header: /cvsroot/pgsql/doc/src/sgml/datetime.sgml,v 2.33 2003/08/25 23:30:25 tg
</para> </para>
<indexterm> <indexterm>
<primary>time zones</primary> <primary>time zone</primary>
<secondary>abbreviations</secondary>
</indexterm> </indexterm>
<para> <para>
......
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/ddl.sgml,v 1.17 2003/08/14 23:13:27 tgl Exp $ --> <!-- $Header: /cvsroot/pgsql/doc/src/sgml/ddl.sgml,v 1.18 2003/08/31 17:32:18 petere Exp $ -->
<chapter id="ddl"> <chapter id="ddl">
<title>Data Definition</title> <title>Data Definition</title>
...@@ -19,6 +19,18 @@ ...@@ -19,6 +19,18 @@
<sect1 id="ddl-basics"> <sect1 id="ddl-basics">
<title>Table Basics</title> <title>Table Basics</title>
<indexterm zone="ddl-basics">
<primary>table</primary>
</indexterm>
<indexterm>
<primary>row</primary>
</indexterm>
<indexterm>
<primary>column</primary>
</indexterm>
<para> <para>
A table in a relational database is much like a table on paper: It A table in a relational database is much like a table on paper: It
consists of rows and columns. The number and order of the columns consists of rows and columns. The number and order of the columns
...@@ -60,6 +72,11 @@ ...@@ -60,6 +72,11 @@
containing both date and time. containing both date and time.
</para> </para>
<indexterm>
<primary>table</primary>
<secondary>creating</secondary>
</indexterm>
<para> <para>
To create a table, you use the aptly named <literal>CREATE To create a table, you use the aptly named <literal>CREATE
TABLE</literal> command. In this command you specify at least a TABLE</literal> command. In this command you specify at least a
...@@ -114,6 +131,11 @@ CREATE TABLE products ( ...@@ -114,6 +131,11 @@ CREATE TABLE products (
highly unusual and often a questionable design. highly unusual and often a questionable design.
</para> </para>
<indexterm>
<primary>table</primary>
<secondary>removing</secondary>
</indexterm>
<para> <para>
If you no longer need a table, you can remove it using the If you no longer need a table, you can remove it using the
<command>DROP TABLE</command> command. For example: <command>DROP TABLE</command> command. For example:
...@@ -156,8 +178,8 @@ DROP TABLE products; ...@@ -156,8 +178,8 @@ DROP TABLE products;
</para> </para>
<indexterm> <indexterm>
<primary>columns</primary> <primary>column</primary>
<secondary>system columns</secondary> <secondary>system column</secondary>
</indexterm> </indexterm>
<variablelist> <variablelist>
...@@ -167,6 +189,7 @@ DROP TABLE products; ...@@ -167,6 +189,7 @@ DROP TABLE products;
<para> <para>
<indexterm> <indexterm>
<primary>OID</primary> <primary>OID</primary>
<secondary>column</secondary>
</indexterm> </indexterm>
The object identifier (object ID) of a row. This is a serial The object identifier (object ID) of a row. This is a serial
number that is automatically added by number that is automatically added by
...@@ -182,6 +205,10 @@ DROP TABLE products; ...@@ -182,6 +205,10 @@ DROP TABLE products;
<varlistentry> <varlistentry>
<term><structfield>tableoid</></term> <term><structfield>tableoid</></term>
<listitem> <listitem>
<indexterm>
<primary>tableoid</primary>
</indexterm>
<para> <para>
The OID of the table containing this row. This column is The OID of the table containing this row. This column is
particularly handy for queries that select from inheritance particularly handy for queries that select from inheritance
...@@ -197,6 +224,10 @@ DROP TABLE products; ...@@ -197,6 +224,10 @@ DROP TABLE products;
<varlistentry> <varlistentry>
<term><structfield>xmin</></term> <term><structfield>xmin</></term>
<listitem> <listitem>
<indexterm>
<primary>xmin</primary>
</indexterm>
<para> <para>
The identity (transaction ID) of the inserting transaction for The identity (transaction ID) of the inserting transaction for
this tuple. (Note: In this context, a tuple is an individual this tuple. (Note: In this context, a tuple is an individual
...@@ -209,6 +240,10 @@ DROP TABLE products; ...@@ -209,6 +240,10 @@ DROP TABLE products;
<varlistentry> <varlistentry>
<term><structfield>cmin</></term> <term><structfield>cmin</></term>
<listitem> <listitem>
<indexterm>
<primary>cmin</primary>
</indexterm>
<para> <para>
The command identifier (starting at zero) within the inserting The command identifier (starting at zero) within the inserting
transaction. transaction.
...@@ -219,6 +254,10 @@ DROP TABLE products; ...@@ -219,6 +254,10 @@ DROP TABLE products;
<varlistentry> <varlistentry>
<term><structfield>xmax</></term> <term><structfield>xmax</></term>
<listitem> <listitem>
<indexterm>
<primary>xmax</primary>
</indexterm>
<para> <para>
The identity (transaction ID) of the deleting transaction, or The identity (transaction ID) of the deleting transaction, or
zero for an undeleted tuple. It is possible for this column to zero for an undeleted tuple. It is possible for this column to
...@@ -232,6 +271,10 @@ DROP TABLE products; ...@@ -232,6 +271,10 @@ DROP TABLE products;
<varlistentry> <varlistentry>
<term><structfield>cmax</></term> <term><structfield>cmax</></term>
<listitem> <listitem>
<indexterm>
<primary>cmax</primary>
</indexterm>
<para> <para>
The command identifier within the deleting transaction, or zero. The command identifier within the deleting transaction, or zero.
</para> </para>
...@@ -241,6 +284,10 @@ DROP TABLE products; ...@@ -241,6 +284,10 @@ DROP TABLE products;
<varlistentry> <varlistentry>
<term><structfield>ctid</></term> <term><structfield>ctid</></term>
<listitem> <listitem>
<indexterm>
<primary>ctid</primary>
</indexterm>
<para> <para>
The physical location of the tuple within its table. Note that The physical location of the tuple within its table. Note that
although the <structfield>ctid</structfield> can be used to although the <structfield>ctid</structfield> can be used to
...@@ -292,6 +339,10 @@ DROP TABLE products; ...@@ -292,6 +339,10 @@ DROP TABLE products;
<sect1 id="ddl-default"> <sect1 id="ddl-default">
<title>Default Values</title> <title>Default Values</title>
<indexterm zone="ddl-default">
<primary>default value</primary>
</indexterm>
<para> <para>
A column can be assigned a default value. When a new row is A column can be assigned a default value. When a new row is
created and no values are specified for some of the columns, the created and no values are specified for some of the columns, the
...@@ -302,6 +353,7 @@ DROP TABLE products; ...@@ -302,6 +353,7 @@ DROP TABLE products;
</para> </para>
<para> <para>
<indexterm><primary>null value</primary><secondary>default value</secondary></indexterm>
If no default value is declared explicitly, the null value is the If no default value is declared explicitly, the null value is the
default value. This usually makes sense because a null value can default value. This usually makes sense because a null value can
be thought to represent unknown data. be thought to represent unknown data.
...@@ -329,6 +381,10 @@ CREATE TABLE products ( ...@@ -329,6 +381,10 @@ CREATE TABLE products (
<sect1 id="ddl-constraints"> <sect1 id="ddl-constraints">
<title>Constraints</title> <title>Constraints</title>
<indexterm zone="ddl-constraints">
<primary>constraint</primary>
</indexterm>
<para> <para>
Data types are a way to limit the kind of data that can be stored Data types are a way to limit the kind of data that can be stored
in a table. For many applications, however, the constraint they in a table. For many applications, however, the constraint they
...@@ -351,6 +407,15 @@ CREATE TABLE products ( ...@@ -351,6 +407,15 @@ CREATE TABLE products (
<sect2> <sect2>
<title>Check Constraints</title> <title>Check Constraints</title>
<indexterm>
<primary>check constraint</primary>
</indexterm>
<indexterm>
<primary>constraint</primary>
<secondary>check</secondary>
</indexterm>
<para> <para>
A check constraint is the most generic constraint type. It allows A check constraint is the most generic constraint type. It allows
you to specify that the value in a certain column must satisfy an you to specify that the value in a certain column must satisfy an
...@@ -375,6 +440,11 @@ CREATE TABLE products ( ...@@ -375,6 +440,11 @@ CREATE TABLE products (
would not make too much sense. would not make too much sense.
</para> </para>
<indexterm>
<primary>constraint</primary>
<secondary>name</secondary>
</indexterm>
<para> <para>
You can also give the constraint a separate name. This clarifies You can also give the constraint a separate name. This clarifies
error messages and allows you to refer to the constraint when you error messages and allows you to refer to the constraint when you
...@@ -444,6 +514,11 @@ CREATE TABLE products ( ...@@ -444,6 +514,11 @@ CREATE TABLE products (
It's a matter of taste. It's a matter of taste.
</para> </para>
<indexterm>
<primary>null value</primary>
<secondary sortas="check constraints">with check constraints</secondary>
</indexterm>
<para> <para>
It should be noted that a check constraint is satisfied if the It should be noted that a check constraint is satisfied if the
check expression evaluates to true or the null value. Since most check expression evaluates to true or the null value. Since most
...@@ -457,6 +532,15 @@ CREATE TABLE products ( ...@@ -457,6 +532,15 @@ CREATE TABLE products (
<sect2> <sect2>
<title>Not-Null Constraints</title> <title>Not-Null Constraints</title>
<indexterm>
<primary>not-null constraint</primary>
</indexterm>
<indexterm>
<primary>constraint</primary>
<secondary>NOT NULL</secondary>
</indexterm>
<para> <para>
A not-null constraint simply specifies that a column must not A not-null constraint simply specifies that a column must not
assume the null value. A syntax example: assume the null value. A syntax example:
...@@ -526,6 +610,15 @@ CREATE TABLE products ( ...@@ -526,6 +610,15 @@ CREATE TABLE products (
<sect2> <sect2>
<title>Unique Constraints</title> <title>Unique Constraints</title>
<indexterm>
<primary>unique constraint</primary>
</indexterm>
<indexterm>
<primary>constraint</primary>
<secondary>unique</secondary>
</indexterm>
<para> <para>
Unique constraints ensure that the data contained in a column or a Unique constraints ensure that the data contained in a column or a
group of columns is unique with respect to all the rows in the group of columns is unique with respect to all the rows in the
...@@ -573,6 +666,11 @@ CREATE TABLE products ( ...@@ -573,6 +666,11 @@ CREATE TABLE products (
</programlisting> </programlisting>
</para> </para>
<indexterm>
<primary>null value</primary>
<secondary sortas="unique constraints">with unique constraints</secondary>
</indexterm>
<para> <para>
In general, a unique constraint is violated when there are (at In general, a unique constraint is violated when there are (at
least) two rows in the table where the values of each of the least) two rows in the table where the values of each of the
...@@ -591,6 +689,15 @@ CREATE TABLE products ( ...@@ -591,6 +689,15 @@ CREATE TABLE products (
<sect2> <sect2>
<title>Primary Keys</title> <title>Primary Keys</title>
<indexterm>
<primary>primary key</primary>
</indexterm>
<indexterm>
<primary>constraint</primary>
<secondary>primary key</secondary>
</indexterm>
<para> <para>
Technically, a primary key constraint is simply a combination of a Technically, a primary key constraint is simply a combination of a
unique constraint and a not-null constraint. So, the following unique constraint and a not-null constraint. So, the following
...@@ -649,6 +756,19 @@ CREATE TABLE example ( ...@@ -649,6 +756,19 @@ CREATE TABLE example (
<sect2 id="ddl-constraints-fk"> <sect2 id="ddl-constraints-fk">
<title>Foreign Keys</title> <title>Foreign Keys</title>
<indexterm>
<primary>foreign key</primary>
</indexterm>
<indexterm>
<primary>constraint</primary>
<secondary>foreign key</secondary>
</indexterm>
<indexterm>
<primary>referential integrity</primary>
</indexterm>
<para> <para>
A foreign key constraint specifies that the values in a column (or A foreign key constraint specifies that the values in a column (or
a group of columns) must match the values appearing in some row a group of columns) must match the values appearing in some row
...@@ -749,6 +869,16 @@ CREATE TABLE order_items ( ...@@ -749,6 +869,16 @@ CREATE TABLE order_items (
the last table. the last table.
</para> </para>
<indexterm>
<primary>CASCADE</primary>
<secondary>foreign key action</secondary>
</indexterm>
<indexterm>
<primary>RESTRICT</primary>
<secondary>foreign key action</secondary>
</indexterm>
<para> <para>
We know that the foreign keys disallow creation of orders that We know that the foreign keys disallow creation of orders that
do not relate to any products. But what if a product is removed do not relate to any products. But what if a product is removed
...@@ -998,6 +1128,11 @@ SET SQL_Inheritance TO OFF; ...@@ -998,6 +1128,11 @@ SET SQL_Inheritance TO OFF;
<sect1 id="ddl-alter"> <sect1 id="ddl-alter">
<title>Modifying Tables</title> <title>Modifying Tables</title>
<indexterm zone="ddl-alter">
<primary>table</primary>
<secondary>modifying</secondary>
</indexterm>
<para> <para>
When you create a table and you realize that you made a mistake, or When you create a table and you realize that you made a mistake, or
the requirements of the application changed, then you can drop the the requirements of the application changed, then you can drop the
...@@ -1042,6 +1177,11 @@ SET SQL_Inheritance TO OFF; ...@@ -1042,6 +1177,11 @@ SET SQL_Inheritance TO OFF;
<sect2> <sect2>
<title>Adding a Column</title> <title>Adding a Column</title>
<indexterm>
<primary>column</primary>
<secondary>adding</secondary>
</indexterm>
<para> <para>
To add a column, use this command: To add a column, use this command:
<programlisting> <programlisting>
...@@ -1070,6 +1210,11 @@ ALTER TABLE products ADD COLUMN description text CHECK (description &lt;&gt; '') ...@@ -1070,6 +1210,11 @@ ALTER TABLE products ADD COLUMN description text CHECK (description &lt;&gt; '')
<sect2> <sect2>
<title>Removing a Column</title> <title>Removing a Column</title>
<indexterm>
<primary>column</primary>
<secondary>removing</secondary>
</indexterm>
<para> <para>
To remove a column, use this command: To remove a column, use this command:
<programlisting> <programlisting>
...@@ -1081,6 +1226,11 @@ ALTER TABLE products DROP COLUMN description; ...@@ -1081,6 +1226,11 @@ ALTER TABLE products DROP COLUMN description;
<sect2> <sect2>
<title>Adding a Constraint</title> <title>Adding a Constraint</title>
<indexterm>
<primary>constraint</primary>
<secondary>adding</secondary>
</indexterm>
<para> <para>
To add a constraint, the table constraint syntax is used. For example: To add a constraint, the table constraint syntax is used. For example:
<programlisting> <programlisting>
...@@ -1104,6 +1254,11 @@ ALTER TABLE products ALTER COLUMN product_no SET NOT NULL; ...@@ -1104,6 +1254,11 @@ ALTER TABLE products ALTER COLUMN product_no SET NOT NULL;
<sect2> <sect2>
<title>Removing a Constraint</title> <title>Removing a Constraint</title>
<indexterm>
<primary>constraint</primary>
<secondary>removing</secondary>
</indexterm>
<para> <para>
To remove a constraint you need to know its name. If you gave it To remove a constraint you need to know its name. If you gave it
a name then that's easy. Otherwise the system assigned a a name then that's easy. Otherwise the system assigned a
...@@ -1127,6 +1282,11 @@ ALTER TABLE products ALTER COLUMN product_no DROP NOT NULL; ...@@ -1127,6 +1282,11 @@ ALTER TABLE products ALTER COLUMN product_no DROP NOT NULL;
<sect2> <sect2>
<title>Changing the Default</title> <title>Changing the Default</title>
<indexterm>
<primary>default value</primary>
<secondary>changing</secondary>
</indexterm>
<para> <para>
To set a new default for a column, use a command like this: To set a new default for a column, use a command like this:
<programlisting> <programlisting>
...@@ -1146,6 +1306,11 @@ ALTER TABLE products ALTER COLUMN price DROP DEFAULT; ...@@ -1146,6 +1306,11 @@ ALTER TABLE products ALTER COLUMN price DROP DEFAULT;
<sect2> <sect2>
<title>Renaming a Column</title> <title>Renaming a Column</title>
<indexterm>
<primary>column</primary>
<secondary>renaming</secondary>
</indexterm>
<para> <para>
To rename a column: To rename a column:
<programlisting> <programlisting>
...@@ -1157,6 +1322,11 @@ ALTER TABLE products RENAME COLUMN product_no TO product_number; ...@@ -1157,6 +1322,11 @@ ALTER TABLE products RENAME COLUMN product_no TO product_number;
<sect2> <sect2>
<title>Renaming a Table</title> <title>Renaming a Table</title>
<indexterm>
<primary>table</primary>
<secondary>renaming</secondary>
</indexterm>
<para> <para>
To rename a table: To rename a table:
<programlisting> <programlisting>
...@@ -1169,6 +1339,15 @@ ALTER TABLE products RENAME TO items; ...@@ -1169,6 +1339,15 @@ ALTER TABLE products RENAME TO items;
<sect1 id="ddl-priv"> <sect1 id="ddl-priv">
<title>Privileges</title> <title>Privileges</title>
<indexterm zone="ddl-priv">
<primary>privilege</primary>
</indexterm>
<indexterm>
<primary>permission</primary>
<see>privilege</see>
</indexterm>
<para> <para>
When you create a database object, you become its owner. By When you create a database object, you become its owner. By
default, only the owner of an object can do anything with the default, only the owner of an object can do anything with the
...@@ -1241,12 +1420,8 @@ REVOKE ALL ON accounts FROM PUBLIC; ...@@ -1241,12 +1420,8 @@ REVOKE ALL ON accounts FROM PUBLIC;
<sect1 id="ddl-schemas"> <sect1 id="ddl-schemas">
<title>Schemas</title> <title>Schemas</title>
<indexterm> <indexterm zone="ddl-schemas">
<primary>schemas</primary> <primary>schema</primary>
</indexterm>
<indexterm>
<primary>namespaces</primary>
</indexterm> </indexterm>
<para> <para>
...@@ -1313,6 +1488,11 @@ REVOKE ALL ON accounts FROM PUBLIC; ...@@ -1313,6 +1488,11 @@ REVOKE ALL ON accounts FROM PUBLIC;
<sect2 id="ddl-schemas-create"> <sect2 id="ddl-schemas-create">
<title>Creating a Schema</title> <title>Creating a Schema</title>
<indexterm zone="ddl-schemas-create">
<primary>schema</primary>
<secondary>creating</secondary>
</indexterm>
<para> <para>
To create a separate schema, use the command <literal>CREATE To create a separate schema, use the command <literal>CREATE
SCHEMA</literal>. Give the schema a name of your choice. For SCHEMA</literal>. Give the schema a name of your choice. For
...@@ -1323,11 +1503,11 @@ CREATE SCHEMA myschema; ...@@ -1323,11 +1503,11 @@ CREATE SCHEMA myschema;
</para> </para>
<indexterm> <indexterm>
<primary>qualified names</primary> <primary>qualified name</primary>
</indexterm> </indexterm>
<indexterm> <indexterm>
<primary>names</primary> <primary>name</primary>
<secondary>qualified</secondary> <secondary>qualified</secondary>
</indexterm> </indexterm>
...@@ -1359,6 +1539,11 @@ CREATE TABLE myschema.mytable ( ...@@ -1359,6 +1539,11 @@ CREATE TABLE myschema.mytable (
the following chapters. the following chapters.
</para> </para>
<indexterm>
<primary>schema</primary>
<secondary>removing</secondary>
</indexterm>
<para> <para>
To drop a schema if it's empty (all objects in it have been To drop a schema if it's empty (all objects in it have been
dropped), use dropped), use
...@@ -1394,6 +1579,11 @@ CREATE SCHEMA <replaceable>schemaname</replaceable> AUTHORIZATION <replaceable>u ...@@ -1394,6 +1579,11 @@ CREATE SCHEMA <replaceable>schemaname</replaceable> AUTHORIZATION <replaceable>u
<sect2 id="ddl-schemas-public"> <sect2 id="ddl-schemas-public">
<title>The Public Schema</title> <title>The Public Schema</title>
<indexterm zone="ddl-schemas-public">
<primary>schema</primary>
<secondary>public</secondary>
</indexterm>
<para> <para>
In the previous sections we created tables without specifying any In the previous sections we created tables without specifying any
schema names. By default, such tables (and other objects) are schema names. By default, such tables (and other objects) are
...@@ -1417,11 +1607,11 @@ CREATE TABLE public.products ( ... ); ...@@ -1417,11 +1607,11 @@ CREATE TABLE public.products ( ... );
</indexterm> </indexterm>
<indexterm> <indexterm>
<primary>unqualified names</primary> <primary>unqualified name</primary>
</indexterm> </indexterm>
<indexterm> <indexterm>
<primary>names</primary> <primary>name</primary>
<secondary>unqualified</secondary> <secondary>unqualified</secondary>
</indexterm> </indexterm>
...@@ -1437,6 +1627,11 @@ CREATE TABLE public.products ( ... ); ...@@ -1437,6 +1627,11 @@ CREATE TABLE public.products ( ... );
in other schemas in the database. in other schemas in the database.
</para> </para>
<indexterm>
<primary>schema</primary>
<secondary>current</secondary>
</indexterm>
<para> <para>
The first schema named in the search path is called the current schema. The first schema named in the search path is called the current schema.
Aside from being the first schema searched, it is also the schema in Aside from being the first schema searched, it is also the schema in
...@@ -1444,6 +1639,10 @@ CREATE TABLE public.products ( ... ); ...@@ -1444,6 +1639,10 @@ CREATE TABLE public.products ( ... );
command does not specify a schema name. command does not specify a schema name.
</para> </para>
<indexterm>
<primary>search_path</primary>
</indexterm>
<para> <para>
To show the current search path, use the following command: To show the current search path, use the following command:
<programlisting> <programlisting>
...@@ -1523,6 +1722,11 @@ SELECT 3 OPERATOR(pg_catalog.+) 4; ...@@ -1523,6 +1722,11 @@ SELECT 3 OPERATOR(pg_catalog.+) 4;
<sect2 id="ddl-schemas-priv"> <sect2 id="ddl-schemas-priv">
<title>Schemas and Privileges</title> <title>Schemas and Privileges</title>
<indexterm zone="ddl-schemas-priv">
<primary>privilege</primary>
<secondary sortas="schemas">for schemas</secondary>
</indexterm>
<para> <para>
By default, users cannot see the objects in schemas they do not By default, users cannot see the objects in schemas they do not
own. To allow that, the owner of the schema needs to grant the own. To allow that, the owner of the schema needs to grant the
...@@ -1550,9 +1754,14 @@ REVOKE CREATE ON SCHEMA public FROM PUBLIC; ...@@ -1550,9 +1754,14 @@ REVOKE CREATE ON SCHEMA public FROM PUBLIC;
</para> </para>
</sect2> </sect2>
<sect2> <sect2 id="ddl-schemas-catalog">
<title>The System Catalog Schema</title> <title>The System Catalog Schema</title>
<indexterm zone="ddl-schemas-catalog">
<primary>system catalog</primary>
<secondary>schema</secondary>
</indexterm>
<para> <para>
In addition to <literal>public</> and user-created schemas, each In addition to <literal>public</> and user-created schemas, each
database contains a <literal>pg_catalog</> schema, which contains database contains a <literal>pg_catalog</> schema, which contains
...@@ -1701,6 +1910,16 @@ REVOKE CREATE ON SCHEMA public FROM PUBLIC; ...@@ -1701,6 +1910,16 @@ REVOKE CREATE ON SCHEMA public FROM PUBLIC;
<sect1 id="ddl-depend"> <sect1 id="ddl-depend">
<title>Dependency Tracking</title> <title>Dependency Tracking</title>
<indexterm zone="ddl-depend">
<primary>CASCADE</primary>
<secondary sortas="DROP">with DROP</secondary>
</indexterm>
<indexterm zone="ddl-depend">
<primary>RESTRICT</primary>
<secondary sortas="DROP">with DROP</secondary>
</indexterm>
<para> <para>
When you create complex database structures involving many tables When you create complex database structures involving many tables
with foreign key constraints, views, triggers, functions, etc. you with foreign key constraints, views, triggers, functions, etc. you
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/dfunc.sgml,v 1.25 2003/04/10 01:22:44 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/dfunc.sgml,v 1.26 2003/08/31 17:32:18 petere Exp $
--> -->
<sect2 id="dfunc"> <sect2 id="dfunc">
...@@ -8,9 +8,11 @@ $Header: /cvsroot/pgsql/doc/src/sgml/dfunc.sgml,v 1.25 2003/04/10 01:22:44 peter ...@@ -8,9 +8,11 @@ $Header: /cvsroot/pgsql/doc/src/sgml/dfunc.sgml,v 1.25 2003/04/10 01:22:44 peter
<para> <para>
Before you are able to use your Before you are able to use your
<productname>PostgreSQL</productname> extension functions written in <productname>PostgreSQL</productname> extension functions written in
C, they must be compiled and linked in a special way to produce a file C, they must be compiled and linked in a special way to produce a
that can be dynamically loaded by the server. To be file that can be dynamically loaded by the server. To be precise, a
precise, a <firstterm>shared library</firstterm> needs to be created. <firstterm>shared library</firstterm> needs to be
created.<indexterm><primary>shared library</></indexterm>
</para> </para>
<para> <para>
...@@ -26,17 +28,18 @@ $Header: /cvsroot/pgsql/doc/src/sgml/dfunc.sgml,v 1.25 2003/04/10 01:22:44 peter ...@@ -26,17 +28,18 @@ $Header: /cvsroot/pgsql/doc/src/sgml/dfunc.sgml,v 1.25 2003/04/10 01:22:44 peter
</para> </para>
<para> <para>
<indexterm><primary>PIC</></> <indexterm><primary>PIC</></> Creating shared libraries is generally
Creating shared libraries is generally analogous to linking analogous to linking executables: first the source files are
executables: first the source files are compiled into object files, compiled into object files, then the object files are linked
then the object files are linked together. The object files need to together. The object files need to be created as
be created as <firstterm>position-independent code</firstterm> <firstterm>position-independent code</firstterm>
(<acronym>PIC</acronym>), which conceptually means that they can be (<acronym>PIC</acronym>),<indexterm><primary>PIC</></> which
placed at an arbitrary location in memory when they are loaded by the conceptually means that they can be placed at an arbitrary location
executable. (Object files intended for executables are usually not compiled in memory when they are loaded by the executable. (Object files
that way.) The command to link a shared library contains special intended for executables are usually not compiled that way.) The
flags to distinguish it from linking an executable. --- At least command to link a shared library contains special flags to
this is the theory. On some systems the practice is much uglier. distinguish it from linking an executable. --- At least this is the
theory. On some systems the practice is much uglier.
</para> </para>
<para> <para>
...@@ -57,7 +60,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/dfunc.sgml,v 1.25 2003/04/10 01:22:44 peter ...@@ -57,7 +60,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/dfunc.sgml,v 1.25 2003/04/10 01:22:44 peter
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term><systemitem class="osname">BSD/OS</></term> <term><systemitem class="osname">BSD/OS</></term>
<indexterm><primary>BSD/OS</></> <indexterm><primary>BSD/OS</><secondary>shared library</></>
<listitem> <listitem>
<para> <para>
The compiler flag to create <acronym>PIC</acronym> is The compiler flag to create <acronym>PIC</acronym> is
...@@ -75,7 +78,7 @@ ld -shared -o foo.so foo.o ...@@ -75,7 +78,7 @@ ld -shared -o foo.so foo.o
<varlistentry> <varlistentry>
<term><systemitem class="osname">FreeBSD</></term> <term><systemitem class="osname">FreeBSD</></term>
<indexterm><primary>FreeBSD</></> <indexterm><primary>FreeBSD</><secondary>shared library</></>
<listitem> <listitem>
<para> <para>
The compiler flag to create <acronym>PIC</acronym> is The compiler flag to create <acronym>PIC</acronym> is
...@@ -93,7 +96,7 @@ gcc -shared -o foo.so foo.o ...@@ -93,7 +96,7 @@ gcc -shared -o foo.so foo.o
<varlistentry> <varlistentry>
<term><systemitem class="osname">HP-UX</></term> <term><systemitem class="osname">HP-UX</></term>
<indexterm><primary>HP-UX</></> <indexterm><primary>HP-UX</><secondary>shared library</></>
<listitem> <listitem>
<para> <para>
The compiler flag of the system compiler to create The compiler flag of the system compiler to create
...@@ -120,7 +123,7 @@ ld -b -o foo.sl foo.o ...@@ -120,7 +123,7 @@ ld -b -o foo.sl foo.o
<varlistentry> <varlistentry>
<term><systemitem class="osname">IRIX</></term> <term><systemitem class="osname">IRIX</></term>
<indexterm><primary>IRIX</></> <indexterm><primary>IRIX</><secondary>shared library</></>
<listitem> <listitem>
<para> <para>
<acronym>PIC</acronym> is the default, no special compiler <acronym>PIC</acronym> is the default, no special compiler
...@@ -136,7 +139,7 @@ ld -shared -o foo.so foo.o ...@@ -136,7 +139,7 @@ ld -shared -o foo.so foo.o
<varlistentry> <varlistentry>
<term><systemitem class="osname">Linux</></term> <term><systemitem class="osname">Linux</></term>
<indexterm><primary>Linux</></> <indexterm><primary>Linux</><secondary>shared library</></>
<listitem> <listitem>
<para> <para>
The compiler flag to create <acronym>PIC</acronym> is The compiler flag to create <acronym>PIC</acronym> is
...@@ -155,7 +158,7 @@ cc -shared -o foo.so foo.o ...@@ -155,7 +158,7 @@ cc -shared -o foo.so foo.o
<varlistentry> <varlistentry>
<term><systemitem class="osname">MacOS X</></term> <term><systemitem class="osname">MacOS X</></term>
<indexterm><primary>MacOS X</></> <indexterm><primary>MacOS X</><secondary>shared library</></>
<listitem> <listitem>
<para> <para>
Here is an example. It assumes the developer tools are installed. Here is an example. It assumes the developer tools are installed.
...@@ -169,7 +172,7 @@ cc -bundle -flat_namespace -undefined suppress -o foo.so foo.o ...@@ -169,7 +172,7 @@ cc -bundle -flat_namespace -undefined suppress -o foo.so foo.o
<varlistentry> <varlistentry>
<term><systemitem class="osname">NetBSD</></term> <term><systemitem class="osname">NetBSD</></term>
<indexterm><primary>NetBSD</></> <indexterm><primary>NetBSD</><secondary>shared library</></>
<listitem> <listitem>
<para> <para>
The compiler flag to create <acronym>PIC</acronym> is The compiler flag to create <acronym>PIC</acronym> is
...@@ -187,7 +190,7 @@ gcc -shared -o foo.so foo.o ...@@ -187,7 +190,7 @@ gcc -shared -o foo.so foo.o
<varlistentry> <varlistentry>
<term><systemitem class="osname">OpenBSD</></term> <term><systemitem class="osname">OpenBSD</></term>
<indexterm><primary>OpenBSD</></> <indexterm><primary>OpenBSD</><secondary>shared library</></>
<listitem> <listitem>
<para> <para>
The compiler flag to create <acronym>PIC</acronym> is The compiler flag to create <acronym>PIC</acronym> is
...@@ -203,7 +206,7 @@ ld -Bshareable -o foo.so foo.o ...@@ -203,7 +206,7 @@ ld -Bshareable -o foo.so foo.o
<varlistentry> <varlistentry>
<term><systemitem class="osname">Solaris</></term> <term><systemitem class="osname">Solaris</></term>
<indexterm><primary>Solaris</></> <indexterm><primary>Solaris</><secondary>shared library</></>
<listitem> <listitem>
<para> <para>
The compiler flag to create <acronym>PIC</acronym> is The compiler flag to create <acronym>PIC</acronym> is
...@@ -227,7 +230,7 @@ gcc -G -o foo.so foo.o ...@@ -227,7 +230,7 @@ gcc -G -o foo.so foo.o
<varlistentry> <varlistentry>
<term><systemitem class="osname">Tru64 UNIX</></term> <term><systemitem class="osname">Tru64 UNIX</></term>
<indexterm><primary>Tru64 UNIX</></> <indexterm><primary>Tru64 UNIX</><secondary>shared library</></>
<indexterm><primary>Digital UNIX</><see>Tru64 UNIX</></> <indexterm><primary>Digital UNIX</><see>Tru64 UNIX</></>
<listitem> <listitem>
<para> <para>
...@@ -246,7 +249,7 @@ ld -shared -expect_unresolved '*' -o foo.so foo.o ...@@ -246,7 +249,7 @@ ld -shared -expect_unresolved '*' -o foo.so foo.o
<varlistentry> <varlistentry>
<term><systemitem class="osname">UnixWare</></term> <term><systemitem class="osname">UnixWare</></term>
<indexterm><primary>UnixWare</></> <indexterm><primary>UnixWare</><secondary>shared library</></>
<listitem> <listitem>
<para> <para>
The compiler flag to create <acronym>PIC</acronym> is <option>-K The compiler flag to create <acronym>PIC</acronym> is <option>-K
......
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/dml.sgml,v 1.5 2003/08/10 01:20:34 tgl Exp $ --> <!-- $Header: /cvsroot/pgsql/doc/src/sgml/dml.sgml,v 1.6 2003/08/31 17:32:18 petere Exp $ -->
<chapter id="dml"> <chapter id="dml">
<title>Data Manipulation</title> <title>Data Manipulation</title>
...@@ -20,6 +20,14 @@ ...@@ -20,6 +20,14 @@
<sect1 id="dml-insert"> <sect1 id="dml-insert">
<title>Inserting Data</title> <title>Inserting Data</title>
<indexterm zone="dml-insert">
<primary>inserting</primary>
</indexterm>
<indexterm zone="dml-insert">
<primary>INSERT</primary>
</indexterm>
<para> <para>
When a table is created, it contains no data. The first thing to When a table is created, it contains no data. The first thing to
do before a database can be of much use is to insert data. Data is do before a database can be of much use is to insert data. Data is
...@@ -98,6 +106,14 @@ INSERT INTO products DEFAULT VALUES; ...@@ -98,6 +106,14 @@ INSERT INTO products DEFAULT VALUES;
<sect1 id="dml-update"> <sect1 id="dml-update">
<title>Updating Data</title> <title>Updating Data</title>
<indexterm zone="dml-update">
<primary>updating</primary>
</indexterm>
<indexterm zone="dml-update">
<primary>UPDATE</primary>
</indexterm>
<para> <para>
The modification of data that is already in the database is The modification of data that is already in the database is
referred to as updating. You can update individual rows, all the referred to as updating. You can update individual rows, all the
...@@ -182,6 +198,14 @@ UPDATE mytable SET a = 5, b = 3, c = 1 WHERE a > 0; ...@@ -182,6 +198,14 @@ UPDATE mytable SET a = 5, b = 3, c = 1 WHERE a > 0;
<sect1 id="dml-delete"> <sect1 id="dml-delete">
<title>Deleting Data</title> <title>Deleting Data</title>
<indexterm zone="dml-delete">
<primary>deleting</primary>
</indexterm>
<indexterm zone="dml-delete">
<primary>DELETE</primary>
</indexterm>
<para> <para>
So far we have explained how to add data to tables and how to So far we have explained how to add data to tables and how to
change data. What remains is to discuss how to remove data that is change data. What remains is to discuss how to remove data that is
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ecpg.sgml,v 1.48 2003/08/07 04:17:21 momjian Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ecpg.sgml,v 1.49 2003/08/31 17:32:18 petere Exp $
--> -->
<chapter id="ecpg"> <chapter id="ecpg">
<title><application>ECPG</application> - Embedded <acronym>SQL</acronym> in C</title> <title><application>ECPG</application> - Embedded <acronym>SQL</acronym> in C</title>
<indexterm zone="ecpg"><primary>embedded SQL</primary><secondary>in C</secondary></indexterm> <indexterm zone="ecpg"><primary>embedded SQL</primary><secondary>in C</secondary></indexterm>
<indexterm zone="ecpg"><primary>C</primary></indexterm>
<indexterm zone="ecpg"><primary>ECPG</primary></indexterm>
<para> <para>
This chapter describes the embedded <acronym>SQL</acronym> package This chapter describes the embedded <acronym>SQL</acronym> package
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/extend.sgml,v 1.23 2003/08/09 22:50:21 tgl Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/extend.sgml,v 1.24 2003/08/31 17:32:18 petere Exp $
--> -->
<chapter id="extend"> <chapter id="extend">
...@@ -80,16 +80,25 @@ $Header: /cvsroot/pgsql/doc/src/sgml/extend.sgml,v 1.23 2003/08/09 22:50:21 tgl ...@@ -80,16 +80,25 @@ $Header: /cvsroot/pgsql/doc/src/sgml/extend.sgml,v 1.23 2003/08/09 22:50:21 tgl
</para> </para>
</sect1> </sect1>
<sect1 id="type-system"> <sect1 id="extend-type-system">
<title>The <productname>PostgreSQL</productname> Type System</title> <title>The <productname>PostgreSQL</productname> Type System</title>
<indexterm zone="type-system"> <indexterm zone="extend-type-system">
<primary>extending SQL</primary> <primary>base type</primary>
<secondary>types</secondary> </indexterm>
<indexterm zone="extend-type-system">
<primary>data type</primary>
<secondary>base</secondary>
</indexterm>
<indexterm zone="extend-type-system">
<primary>composite type</primary>
</indexterm> </indexterm>
<indexterm zone="type-system"> <indexterm zone="extend-type-system">
<primary>data types</primary> <primary>data type</primary>
<secondary>composite</secondary>
</indexterm> </indexterm>
<para> <para>
...@@ -138,15 +147,25 @@ $Header: /cvsroot/pgsql/doc/src/sgml/extend.sgml,v 1.23 2003/08/09 22:50:21 tgl ...@@ -138,15 +147,25 @@ $Header: /cvsroot/pgsql/doc/src/sgml/extend.sgml,v 1.23 2003/08/09 22:50:21 tgl
pseudo-types. pseudo-types.
</para> </para>
<sect2 id="types-polymorphic"> <sect2 id="extend-types-polymorphic">
<title>Polymorphic Types and Functions</title> <title>Polymorphic Types and Functions</title>
<indexterm> <indexterm zone="extend-types-polymorphic">
<primary>polymorphic types</primary> <primary>polymorphic type</primary>
</indexterm>
<indexterm zone="extend-types-polymorphic">
<primary>polymorphic function</primary>
</indexterm>
<indexterm zone="extend-types-polymorphic">
<primary>type</primary>
<secondary>polymorphic</secondary>
</indexterm> </indexterm>
<indexterm> <indexterm zone="extend-types-polymorphic">
<primary>polymorphic functions</primary> <primary>function</primary>
<secondary>polymorphic</secondary>
</indexterm> </indexterm>
<para> <para>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/func.sgml,v 1.168 2003/08/19 06:06:43 tgl Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/func.sgml,v 1.169 2003/08/31 17:32:18 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -7,11 +7,11 @@ PostgreSQL documentation ...@@ -7,11 +7,11 @@ PostgreSQL documentation
<title>Functions and Operators</title> <title>Functions and Operators</title>
<indexterm zone="functions"> <indexterm zone="functions">
<primary>functions</primary> <primary>function</primary>
</indexterm> </indexterm>
<indexterm zone="functions"> <indexterm zone="functions">
<primary>operators</primary> <primary>operator</primary>
</indexterm> </indexterm>
<para> <para>
...@@ -40,7 +40,7 @@ PostgreSQL documentation ...@@ -40,7 +40,7 @@ PostgreSQL documentation
<title>Logical Operators</title> <title>Logical Operators</title>
<indexterm zone="functions-logical"> <indexterm zone="functions-logical">
<primary>operators</primary> <primary>operator</primary>
<secondary>logical</secondary> <secondary>logical</secondary>
</indexterm> </indexterm>
...@@ -54,18 +54,27 @@ PostgreSQL documentation ...@@ -54,18 +54,27 @@ PostgreSQL documentation
The usual logical operators are available: The usual logical operators are available:
<indexterm> <indexterm>
<primary>and</primary> <primary>AND (operator)</primary>
<secondary>operator</secondary>
</indexterm> </indexterm>
<indexterm> <indexterm>
<primary>or</primary> <primary>OR (operator)</primary>
<secondary>operator</secondary>
</indexterm> </indexterm>
<indexterm> <indexterm>
<primary>not</primary> <primary>NOT (operator)</primary>
<secondary>operator</secondary> </indexterm>
<indexterm>
<primary>conjunction</primary>
</indexterm>
<indexterm>
<primary>disjunction</primary>
</indexterm>
<indexterm>
<primary>negation</primary>
</indexterm> </indexterm>
<simplelist> <simplelist>
...@@ -252,7 +261,7 @@ PostgreSQL documentation ...@@ -252,7 +261,7 @@ PostgreSQL documentation
<primary>between</primary> <primary>between</primary>
</indexterm> </indexterm>
In addition to the comparison operators, the special In addition to the comparison operators, the special
<token>BETWEEN</token> construct is available. <token>BETWEEN</token> construct is available.<indexterm><primary>BETWEEN</primary></indexterm>
<synopsis> <synopsis>
<replaceable>a</replaceable> BETWEEN <replaceable>x</replaceable> AND <replaceable>y</replaceable> <replaceable>a</replaceable> BETWEEN <replaceable>x</replaceable> AND <replaceable>y</replaceable>
</synopsis> </synopsis>
...@@ -284,6 +293,7 @@ PostgreSQL documentation ...@@ -284,6 +293,7 @@ PostgreSQL documentation
<replaceable>expression</replaceable> ISNULL <replaceable>expression</replaceable> ISNULL
<replaceable>expression</replaceable> NOTNULL <replaceable>expression</replaceable> NOTNULL
</synopsis> </synopsis>
<indexterm><primary>null value</primary><secondary>comparing</secondary></indexterm>
</para> </para>
<para> <para>
...@@ -847,7 +857,7 @@ PostgreSQL documentation ...@@ -847,7 +857,7 @@ PostgreSQL documentation
<entry> <entry>
String concatenation String concatenation
<indexterm> <indexterm>
<primary>character strings</primary> <primary>character string</primary>
<secondary>concatenation</secondary> <secondary>concatenation</secondary>
</indexterm> </indexterm>
</entry> </entry>
...@@ -869,12 +879,12 @@ PostgreSQL documentation ...@@ -869,12 +879,12 @@ PostgreSQL documentation
<entry> <entry>
Number of characters in string Number of characters in string
<indexterm> <indexterm>
<primary>character strings</primary> <primary>character string</primary>
<secondary>length</secondary> <secondary>length</secondary>
</indexterm> </indexterm>
<indexterm> <indexterm>
<primary>length</primary> <primary>length</primary>
<secondary>character strings</secondary> <secondary sortas="character string">of a character string</secondary>
<see>character strings, length</see> <see>character strings, length</see>
</indexterm> </indexterm>
</entry> </entry>
...@@ -1110,12 +1120,12 @@ PostgreSQL documentation ...@@ -1110,12 +1120,12 @@ PostgreSQL documentation
<entry> <entry>
Number of characters in string Number of characters in string
<indexterm> <indexterm>
<primary>character strings</primary> <primary>character string</primary>
<secondary>length</secondary> <secondary>length</secondary>
</indexterm> </indexterm>
<indexterm> <indexterm>
<primary>length</primary> <primary>length</primary>
<secondary>character strings</secondary> <secondary sortas="character string">of a character string</secondary>
<see>character strings, length</see> <see>character strings, length</see>
</indexterm> </indexterm>
</entry> </entry>
...@@ -1174,7 +1184,7 @@ PostgreSQL documentation ...@@ -1174,7 +1184,7 @@ PostgreSQL documentation
</row> </row>
<row> <row>
<entry><literal><function>quote_ident</function>(<parameter>string</parameter> text)</literal></entry> <entry><literal><function>quote_ident</function>(<parameter>string</parameter> text)</literal><indexterm><primary>quote_ident</></></entry>
<entry><type>text</type></entry> <entry><type>text</type></entry>
<entry> <entry>
Return the given string suitably quoted to be used as an identifier Return the given string suitably quoted to be used as an identifier
...@@ -1188,7 +1198,7 @@ PostgreSQL documentation ...@@ -1188,7 +1198,7 @@ PostgreSQL documentation
</row> </row>
<row> <row>
<entry><literal><function>quote_literal</function>(<parameter>string</parameter> text)</literal></entry> <entry><literal><function>quote_literal</function>(<parameter>string</parameter> text)</literal><indexterm><primary>quote_literal</></></entry>
<entry><type>text</type></entry> <entry><type>text</type></entry>
<entry> <entry>
Return the given string suitably quoted to be used as a string literal Return the given string suitably quoted to be used as a string literal
...@@ -2055,6 +2065,11 @@ PostgreSQL documentation ...@@ -2055,6 +2065,11 @@ PostgreSQL documentation
<sect1 id="functions-binarystring"> <sect1 id="functions-binarystring">
<title>Binary String Functions and Operators</title> <title>Binary String Functions and Operators</title>
<indexterm zone="functions-binarystring">
<primary>binary data</primary>
<secondary>functions</secondary>
</indexterm>
<para> <para>
This section describes functions and operators for examining and This section describes functions and operators for examining and
manipulating values of type <type>bytea</type>. manipulating values of type <type>bytea</type>.
...@@ -2092,7 +2107,7 @@ PostgreSQL documentation ...@@ -2092,7 +2107,7 @@ PostgreSQL documentation
<entry> <entry>
String concatenation String concatenation
<indexterm> <indexterm>
<primary>binary strings</primary> <primary>binary string</primary>
<secondary>concatenation</secondary> <secondary>concatenation</secondary>
</indexterm> </indexterm>
</entry> </entry>
...@@ -2243,12 +2258,12 @@ PostgreSQL documentation ...@@ -2243,12 +2258,12 @@ PostgreSQL documentation
<entry> <entry>
Length of binary string Length of binary string
<indexterm> <indexterm>
<primary>binary strings</primary> <primary>binary string</primary>
<secondary>length</secondary> <secondary>length</secondary>
</indexterm> </indexterm>
<indexterm> <indexterm>
<primary>length</primary> <primary>length</primary>
<secondary>binary strings</secondary> <secondary sortas="binary string">of a binary string</secondary>
<see>binary strings, length</see> <see>binary strings, length</see>
</indexterm> </indexterm>
</entry> </entry>
...@@ -2321,8 +2336,8 @@ PostgreSQL documentation ...@@ -2321,8 +2336,8 @@ PostgreSQL documentation
<sect2 id="functions-like"> <sect2 id="functions-like">
<title><function>LIKE</function></title> <title><function>LIKE</function></title>
<indexterm> <indexterm zone="functions-like">
<primary>like</primary> <primary>LIKE</primary>
</indexterm> </indexterm>
<synopsis> <synopsis>
...@@ -2420,12 +2435,12 @@ PostgreSQL documentation ...@@ -2420,12 +2435,12 @@ PostgreSQL documentation
Regular Expressions</title> Regular Expressions</title>
<indexterm zone="functions-sql99-regexp"> <indexterm zone="functions-sql99-regexp">
<primary>regular expressions</primary> <primary>regular expression</primary>
<!-- <seealso>pattern matching</seealso> breaks index build --> <!-- <seealso>pattern matching</seealso> breaks index build -->
</indexterm> </indexterm>
<indexterm> <indexterm>
<primary>similar to</primary> <primary>SIMILAR TO</primary>
</indexterm> </indexterm>
<indexterm> <indexterm>
...@@ -2547,7 +2562,7 @@ substring('foobar' from '#"o_b#"%' for '#') <lineannotation>NULL</lineannotat ...@@ -2547,7 +2562,7 @@ substring('foobar' from '#"o_b#"%' for '#') <lineannotation>NULL</lineannotat
<title><acronym>POSIX</acronym> Regular Expressions</title> <title><acronym>POSIX</acronym> Regular Expressions</title>
<indexterm zone="functions-posix-regexp"> <indexterm zone="functions-posix-regexp">
<primary>regular expressions</primary> <primary>regular expression</primary>
<seealso>pattern matching</seealso> <seealso>pattern matching</seealso>
</indexterm> </indexterm>
...@@ -3794,6 +3809,10 @@ substring('foobar' from 'o(.)b') <lineannotation>o</lineannotation> ...@@ -3794,6 +3809,10 @@ substring('foobar' from 'o(.)b') <lineannotation>o</lineannotation>
<primary>formatting</primary> <primary>formatting</primary>
</indexterm> </indexterm>
<indexterm zone="functions-formatting">
<primary>to_char</primary>
</indexterm>
<para> <para>
The <productname>PostgreSQL</productname> formatting functions The <productname>PostgreSQL</productname> formatting functions
provide a powerful set of tools for converting various data types provide a powerful set of tools for converting various data types
...@@ -6004,7 +6023,7 @@ SELECT TIMESTAMP 'now'; ...@@ -6004,7 +6023,7 @@ SELECT TIMESTAMP 'now';
<title>Sequence-Manipulation Functions</title> <title>Sequence-Manipulation Functions</title>
<indexterm> <indexterm>
<primary>sequences</primary> <primary>sequence</primary>
</indexterm> </indexterm>
<indexterm> <indexterm>
<primary>nextval</primary> <primary>nextval</primary>
...@@ -6167,11 +6186,11 @@ SELECT setval('foo', 42, false); <lineannotation>Next <function>nextval</> wi ...@@ -6167,11 +6186,11 @@ SELECT setval('foo', 42, false); <lineannotation>Next <function>nextval</> wi
<title>Conditional Expressions</title> <title>Conditional Expressions</title>
<indexterm> <indexterm>
<primary>case</primary> <primary>CASE</primary>
</indexterm> </indexterm>
<indexterm> <indexterm>
<primary>conditionals</primary> <primary>conditional expression</primary>
</indexterm> </indexterm>
<para> <para>
...@@ -6292,8 +6311,12 @@ SELECT a, ...@@ -6292,8 +6311,12 @@ SELECT a,
<sect2> <sect2>
<title><literal>COALESCE</></title> <title><literal>COALESCE</></title>
<indexterm>
<primary>COALESCE</primary>
</indexterm>
<synopsis> <synopsis>
<function>COALESCE</function>(<replaceable>value</replaceable> <optional>, ...</optional>) <function>coalesce</function>(<replaceable>value</replaceable> <optional>, ...</optional>)
</synopsis> </synopsis>
<para> <para>
...@@ -6502,7 +6525,8 @@ SET search_path TO <replaceable>schema</> <optional>, <replaceable>schema</>, .. ...@@ -6502,7 +6525,8 @@ SET search_path TO <replaceable>schema</> <optional>, <replaceable>schema</>, ..
<indexterm zone="functions-misc"> <indexterm zone="functions-misc">
<primary>configuration</primary> <primary>configuration</primary>
<secondary>server</secondary> <secondary sortas="server">of the server</secondary>
<tertiary>functions</tertiary>
</indexterm> </indexterm>
<para> <para>
...@@ -6539,6 +6563,11 @@ SELECT set_config('show_statement_stats', 'off', false); ...@@ -6539,6 +6563,11 @@ SELECT set_config('show_statement_stats', 'off', false);
</programlisting> </programlisting>
</para> </para>
<indexterm>
<primary>privilege</primary>
<secondary>querying</secondary>
</indexterm>
<para> <para>
<xref linkend="functions-misc-access-table"> lists functions that <xref linkend="functions-misc-access-table"> lists functions that
allow the user to query object access privileges programmatically. allow the user to query object access privileges programmatically.
...@@ -6971,6 +7000,11 @@ SELECT pg_type_is_visible('myschema.widget'::regtype); ...@@ -6971,6 +7000,11 @@ SELECT pg_type_is_visible('myschema.widget'::regtype);
<primary>col_description</primary> <primary>col_description</primary>
</indexterm> </indexterm>
<indexterm zone="functions-misc">
<primary>comment</primary>
<secondary sortas="database objects">about database objects</secondary>
</indexterm>
<para> <para>
The function shown in <xref The function shown in <xref
linkend="functions-misc-comment-table"> extract comments linkend="functions-misc-comment-table"> extract comments
...@@ -7272,6 +7306,11 @@ SELECT pg_type_is_visible('myschema.widget'::regtype); ...@@ -7272,6 +7306,11 @@ SELECT pg_type_is_visible('myschema.widget'::regtype);
<sect1 id="functions-aggregate"> <sect1 id="functions-aggregate">
<title>Aggregate Functions</title> <title>Aggregate Functions</title>
<indexterm zone="functions-aggregate">
<primary>aggregate function</primary>
<secondary>built-in</secondary>
</indexterm>
<para> <para>
<firstterm>Aggregate functions</firstterm> compute a single result <firstterm>Aggregate functions</firstterm> compute a single result
value from a set of input values. <xref value from a set of input values. <xref
...@@ -7300,7 +7339,6 @@ SELECT pg_type_is_visible('myschema.widget'::regtype); ...@@ -7300,7 +7339,6 @@ SELECT pg_type_is_visible('myschema.widget'::regtype);
<entry> <entry>
<indexterm> <indexterm>
<primary>average</primary> <primary>average</primary>
<secondary>function</secondary>
</indexterm> </indexterm>
<function>avg(<replaceable class="parameter">expression</replaceable>)</function> <function>avg(<replaceable class="parameter">expression</replaceable>)</function>
</entry> </entry>
...@@ -7482,31 +7520,31 @@ SELECT col FROM sometable ORDER BY col ASC LIMIT 1; ...@@ -7482,31 +7520,31 @@ SELECT col FROM sometable ORDER BY col ASC LIMIT 1;
<title>Subquery Expressions</title> <title>Subquery Expressions</title>
<indexterm> <indexterm>
<primary>exists</primary> <primary>EXISTS</primary>
</indexterm> </indexterm>
<indexterm> <indexterm>
<primary>in</primary> <primary>IN</primary>
</indexterm> </indexterm>
<indexterm> <indexterm>
<primary>not in</primary> <primary>NOT IN</primary>
</indexterm> </indexterm>
<indexterm> <indexterm>
<primary>any</primary> <primary>ANY</primary>
</indexterm> </indexterm>
<indexterm> <indexterm>
<primary>all</primary> <primary>ALL</primary>
</indexterm> </indexterm>
<indexterm> <indexterm>
<primary>some</primary> <primary>SOME</primary>
</indexterm> </indexterm>
<indexterm> <indexterm>
<primary>subqueries</primary> <primary>subquery</primary>
</indexterm> </indexterm>
<para> <para>
...@@ -7808,6 +7846,11 @@ SELECT col1 FROM tab1 ...@@ -7808,6 +7846,11 @@ SELECT col1 FROM tab1
<sect2> <sect2>
<title>Row-wise Comparison</title> <title>Row-wise Comparison</title>
<indexterm>
<primary>comparison</primary>
<secondary>of rows</secondary>
</indexterm>
<synopsis> <synopsis>
(<replaceable>expression</replaceable> <optional>, <replaceable>expression</replaceable> ...</optional>) <replaceable>operator</replaceable> (<replaceable>subquery</replaceable>) (<replaceable>expression</replaceable> <optional>, <replaceable>expression</replaceable> ...</optional>) <replaceable>operator</replaceable> (<replaceable>subquery</replaceable>)
</synopsis> </synopsis>
......
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/indices.sgml,v 1.42 2003/05/28 16:03:55 tgl Exp $ --> <!-- $Header: /cvsroot/pgsql/doc/src/sgml/indices.sgml,v 1.43 2003/08/31 17:32:19 petere Exp $ -->
<chapter id="indexes"> <chapter id="indexes">
<title id="indexes-title">Indexes</title> <title id="indexes-title">Indexes</title>
<indexterm zone="indexes"> <indexterm zone="indexes">
<primary>indexes</primary> <primary>index</primary>
</indexterm> </indexterm>
<para> <para>
...@@ -109,12 +109,12 @@ CREATE INDEX test1_id_index ON test1 (id); ...@@ -109,12 +109,12 @@ CREATE INDEX test1_id_index ON test1 (id);
B-tree, R-tree, GiST, and Hash. Each index type is more appropriate for B-tree, R-tree, GiST, and Hash. Each index type is more appropriate for
a particular query type because of the algorithm it uses. a particular query type because of the algorithm it uses.
<indexterm> <indexterm>
<primary>indexes</primary> <primary>index</primary>
<secondary>B-tree</secondary> <secondary>B-tree</secondary>
</indexterm> </indexterm>
<indexterm> <indexterm>
<primary>B-tree</primary> <primary>B-tree</primary>
<see>indexes</see> <see>index</see>
</indexterm> </indexterm>
By By
default, the <command>CREATE INDEX</command> command will create a default, the <command>CREATE INDEX</command> command will create a
...@@ -147,12 +147,12 @@ CREATE INDEX test1_id_index ON test1 (id); ...@@ -147,12 +147,12 @@ CREATE INDEX test1_id_index ON test1 (id);
<para> <para>
<indexterm> <indexterm>
<primary>indexes</primary> <primary>index</primary>
<secondary>R-tree</secondary> <secondary>R-tree</secondary>
</indexterm> </indexterm>
<indexterm> <indexterm>
<primary>R-tree</primary> <primary>R-tree</primary>
<see>indexes</see> <see>index</see>
</indexterm> </indexterm>
R-tree indexes are especially suited for spatial data. To create R-tree indexes are especially suited for spatial data. To create
an R-tree index, use a command of the form an R-tree index, use a command of the form
...@@ -178,12 +178,12 @@ CREATE INDEX <replaceable>name</replaceable> ON <replaceable>table</replaceable> ...@@ -178,12 +178,12 @@ CREATE INDEX <replaceable>name</replaceable> ON <replaceable>table</replaceable>
<para> <para>
<indexterm> <indexterm>
<primary>indexes</primary> <primary>index</primary>
<secondary>hash</secondary> <secondary>hash</secondary>
</indexterm> </indexterm>
<indexterm> <indexterm>
<primary>hash</primary> <primary>hash</primary>
<see>indexes</see> <see>index</see>
</indexterm> </indexterm>
The query planner will consider using a hash index whenever an The query planner will consider using a hash index whenever an
indexed column is involved in a comparison using the indexed column is involved in a comparison using the
...@@ -219,7 +219,7 @@ CREATE INDEX <replaceable>name</replaceable> ON <replaceable>table</replaceable> ...@@ -219,7 +219,7 @@ CREATE INDEX <replaceable>name</replaceable> ON <replaceable>table</replaceable>
<title>Multicolumn Indexes</title> <title>Multicolumn Indexes</title>
<indexterm zone="indexes-multicolumn"> <indexterm zone="indexes-multicolumn">
<primary>indexes</primary> <primary>index</primary>
<secondary>multicolumn</secondary> <secondary>multicolumn</secondary>
</indexterm> </indexterm>
...@@ -294,7 +294,7 @@ SELECT name FROM test2 WHERE major = <replaceable>constant</replaceable> OR mino ...@@ -294,7 +294,7 @@ SELECT name FROM test2 WHERE major = <replaceable>constant</replaceable> OR mino
<title>Unique Indexes</title> <title>Unique Indexes</title>
<indexterm zone="indexes-unique"> <indexterm zone="indexes-unique">
<primary>indexes</primary> <primary>index</primary>
<secondary>unique</secondary> <secondary>unique</secondary>
</indexterm> </indexterm>
...@@ -337,8 +337,8 @@ CREATE UNIQUE INDEX <replaceable>name</replaceable> ON <replaceable>table</repla ...@@ -337,8 +337,8 @@ CREATE UNIQUE INDEX <replaceable>name</replaceable> ON <replaceable>table</repla
<title>Indexes on Expressions</title> <title>Indexes on Expressions</title>
<indexterm zone="indexes-expressional"> <indexterm zone="indexes-expressional">
<primary>indexes</primary> <primary>index</primary>
<secondary>on expressions</secondary> <secondary sortas="expressions">on expressions</secondary>
</indexterm> </indexterm>
<para> <para>
...@@ -392,6 +392,10 @@ CREATE INDEX people_names ON people ((first_name || ' ' || last_name)); ...@@ -392,6 +392,10 @@ CREATE INDEX people_names ON people ((first_name || ' ' || last_name));
<sect1 id="indexes-opclass"> <sect1 id="indexes-opclass">
<title>Operator Classes</title> <title>Operator Classes</title>
<indexterm zone="indexes-opclass">
<primary>operator class</primary>
</indexterm>
<para> <para>
An index definition may specify an <firstterm>operator An index definition may specify an <firstterm>operator
class</firstterm> for each column of an index. class</firstterm> for each column of an index.
...@@ -492,7 +496,7 @@ SELECT am.amname AS index_method, ...@@ -492,7 +496,7 @@ SELECT am.amname AS index_method,
<title>Partial Indexes</title> <title>Partial Indexes</title>
<indexterm zone="indexes-partial"> <indexterm zone="indexes-partial">
<primary>indexes</primary> <primary>index</primary>
<secondary>partial</secondary> <secondary>partial</secondary>
</indexterm> </indexterm>
...@@ -709,6 +713,11 @@ CREATE UNIQUE INDEX tests_success_constraint ON tests (subject, target) ...@@ -709,6 +713,11 @@ CREATE UNIQUE INDEX tests_success_constraint ON tests (subject, target)
<sect1 id="indexes-examine"> <sect1 id="indexes-examine">
<title>Examining Index Usage</title> <title>Examining Index Usage</title>
<indexterm zone="indexes-examine">
<primary>index</primary>
<secondary>examining usage</secondary>
</indexterm>
<para> <para>
Although indexes in <productname>PostgreSQL</> do not need Although indexes in <productname>PostgreSQL</> do not need
maintenance and tuning, it is still important to check maintenance and tuning, it is still important to check
......
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/installation.sgml,v 1.138 2003/08/04 04:03:03 tgl Exp $ --> <!-- $Header: /cvsroot/pgsql/doc/src/sgml/installation.sgml,v 1.139 2003/08/31 17:32:19 petere Exp $ -->
<chapter id="installation"> <chapter id="installation">
<title><![%standalone-include[<productname>PostgreSQL</>]]> <title><![%standalone-include[<productname>PostgreSQL</>]]>
...@@ -383,6 +383,7 @@ JAVACMD=$JAVA_HOME/bin/java ...@@ -383,6 +383,7 @@ JAVACMD=$JAVA_HOME/bin/java
<para> <para>
<indexterm> <indexterm>
<primary>pg_dumpall</primary> <primary>pg_dumpall</primary>
<secondary>use during upgrade</secondary>
</indexterm> </indexterm>
To back up your database installation, type: To back up your database installation, type:
...@@ -875,8 +876,8 @@ JAVACMD=$JAVA_HOME/bin/java ...@@ -875,8 +876,8 @@ JAVACMD=$JAVA_HOME/bin/java
<term><option>--with-pam</option></term> <term><option>--with-pam</option></term>
<listitem> <listitem>
<para> <para>
Build with <acronym>PAM</> (Pluggable Authentication Modules) Build with <acronym>PAM</><indexterm><primary>PAM</></>
support. (Pluggable Authentication Modules) support.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -1163,7 +1164,7 @@ All of PostgreSQL is successfully made. Ready to install. ...@@ -1163,7 +1164,7 @@ All of PostgreSQL is successfully made. Ready to install.
<title>Shared Libraries</title> <title>Shared Libraries</title>
<indexterm> <indexterm>
<primary>shared libraries</primary> <primary>shared library</primary>
</indexterm> </indexterm>
<para> <para>
...@@ -1284,7 +1285,6 @@ set path = ( /usr/local/pgsql/bin $path ) ...@@ -1284,7 +1285,6 @@ set path = ( /usr/local/pgsql/bin $path )
<para> <para>
<indexterm> <indexterm>
<primary><envar>MANPATH</envar></primary> <primary><envar>MANPATH</envar></primary>
<seealso>man pages</seealso>
</indexterm> </indexterm>
To enable your system to find the <application>man</> To enable your system to find the <application>man</>
documentation, you need to add lines like the following to a documentation, you need to add lines like the following to a
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/Attic/jdbc.sgml,v 1.47 2003/08/07 05:06:40 barry Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/Attic/jdbc.sgml,v 1.48 2003/08/31 17:32:19 petere Exp $
--> -->
<chapter id="jdbc"> <chapter id="jdbc">
<title><acronym>JDBC</acronym> Interface</title> <title><acronym>JDBC</acronym> Interface</title>
<indexterm zone="jdbc">
<primary>JDBC</primary>
</indexterm>
<indexterm zone="jdbc">
<primary>Java</primary>
</indexterm>
<para> <para>
<acronym>JDBC</acronym> is a core <acronym>API</acronym> of Java 1.1 and later. <acronym>JDBC</acronym> is a core <acronym>API</acronym> of Java 1.1 and later.
It provides a standard set of It provides a standard set of
...@@ -66,6 +74,14 @@ $Header: /cvsroot/pgsql/doc/src/sgml/Attic/jdbc.sgml,v 1.47 2003/08/07 05:06:40 ...@@ -66,6 +74,14 @@ $Header: /cvsroot/pgsql/doc/src/sgml/Attic/jdbc.sgml,v 1.47 2003/08/07 05:06:40
<sect2 id="jdbc-classpath"> <sect2 id="jdbc-classpath">
<title>Setting up the Class Path</title> <title>Setting up the Class Path</title>
<indexterm zone="jdbc-classpath">
<primary>class path</primary>
</indexterm>
<indexterm zone="jdbc-classpath">
<primary>CLASSPATH</primary>
</indexterm>
<para> <para>
To use the driver, the JAR archive (named To use the driver, the JAR archive (named
<filename>postgresql.jar</filename> if you built from source, otherwise <filename>postgresql.jar</filename> if you built from source, otherwise
...@@ -316,6 +332,18 @@ db.close(); ...@@ -316,6 +332,18 @@ db.close();
<sect1 id="jdbc-query"> <sect1 id="jdbc-query">
<title>Issuing a Query and Processing the Result</title> <title>Issuing a Query and Processing the Result</title>
<indexterm zone="jdbc-query">
<primary>Statement</primary>
</indexterm>
<indexterm zone="jdbc-query">
<primary>PreparedStatement</primary>
</indexterm>
<indexterm zone="jdbc-query">
<primary>ResultSet</primary>
</indexterm>
<para> <para>
Any time you want to issue <acronym>SQL</acronym> statements to Any time you want to issue <acronym>SQL</acronym> statements to
the database, you require a <classname>Statement</classname> or the database, you require a <classname>Statement</classname> or
...@@ -681,6 +709,16 @@ st.close(); ...@@ -681,6 +709,16 @@ st.close();
<sect1 id="jdbc-binary-data"> <sect1 id="jdbc-binary-data">
<title>Storing Binary Data</title> <title>Storing Binary Data</title>
<indexterm zone="jdbc-binary-data">
<primary>bytea</primary>
<secondary sortas="JDBC">in JDBC</secondary>
</indexterm>
<indexterm zone="jdbc-binary-data">
<primary>large object</primary>
<secondary sortas="JDBC">in JDBC</secondary>
</indexterm>
<para> <para>
<application>PostgreSQL</application> provides two distinct ways to <application>PostgreSQL</application> provides two distinct ways to
store binary data. Binary data can be stored in a table using store binary data. Binary data can be stored in a table using
...@@ -2597,6 +2635,11 @@ public void unlink(int oid) throws SQLException ...@@ -2597,6 +2635,11 @@ public void unlink(int oid) throws SQLException
<sect1 id="jdbc-thread"> <sect1 id="jdbc-thread">
<title>Using the Driver in a Multithreaded or a Servlet Environment</title> <title>Using the Driver in a Multithreaded or a Servlet Environment</title>
<indexterm zone="jdbc-thread">
<primary>threads</primary>
<secondary sortas="JDBC">with JDBC</secondary>
</indexterm>
<para> <para>
A problem with many <acronym>JDBC</acronym> drivers is that only A problem with many <acronym>JDBC</acronym> drivers is that only
one thread can use a <classname>Connection</classname> at any one one thread can use a <classname>Connection</classname> at any one
...@@ -2645,6 +2688,15 @@ public void unlink(int oid) throws SQLException ...@@ -2645,6 +2688,15 @@ public void unlink(int oid) throws SQLException
<sect1 id="jdbc-datasource"> <sect1 id="jdbc-datasource">
<title>Connection Pools and Data Sources</title> <title>Connection Pools and Data Sources</title>
<indexterm zone="jdbc-datasource">
<primary>connection pool</primary>
<secondary sortas="JDBC">in JDBC</secondary>
</indexterm>
<indexterm zone="jdbc-datasource">
<primary>DataSource</primary>
</indexterm>
<para> <para>
<acronym>JDBC</> 2 introduced standard connection pooling features in an <acronym>JDBC</> 2 introduced standard connection pooling features in an
add-on <acronym>API</> known as the <acronym>JDBC</acronym> 2.0 Optional add-on <acronym>API</> known as the <acronym>JDBC</acronym> 2.0 Optional
...@@ -3029,7 +3081,11 @@ try { ...@@ -3029,7 +3081,11 @@ try {
</sect2> </sect2>
<sect2 id="jdbc-jndi"> <sect2 id="jdbc-jndi">
<title>Data Sources and <acronym>JNDI</acronym></title> <title>Data Sources and <acronym>JNDI</acronym></title>
<indexterm zone="jdbc-jndi">
<primary>JNDI</primary>
</indexterm>
<para> <para>
All the <literal>ConnectionPoolDataSource</literal> and All the <literal>ConnectionPoolDataSource</literal> and
......
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/keywords.sgml,v 2.9 2003/06/12 07:49:43 momjian Exp $ --> <!-- $Header: /cvsroot/pgsql/doc/src/sgml/keywords.sgml,v 2.10 2003/08/31 17:32:19 petere Exp $ -->
<appendix id="sql-keywords-appendix"> <appendix id="sql-keywords-appendix">
<title><acronym>SQL</acronym> Key Words</title> <title><acronym>SQL</acronym> Key Words</title>
<indexterm zone="sql-keywords-appendix"> <indexterm zone="sql-keywords-appendix">
<primary>key words</primary> <primary>key word</primary>
<secondary>list of</secondary> <secondary>list of</secondary>
</indexterm> </indexterm>
......
...@@ -125,8 +125,8 @@ ...@@ -125,8 +125,8 @@
<para> <para>
The <function>pg_lo_*</function> commands are interfaces to the The <function>pg_lo_*</function> commands are interfaces to the
large object features of large object features of
<ProductName>PostgreSQL</ProductName>.<indexterm><primary>Large <ProductName>PostgreSQL</ProductName>.<indexterm><primary>large
Object</></> The functions are designed to mimic the analogous file object</><secondary>in pgctl</></> The functions are designed to mimic the analogous file
system functions in the standard Unix file system interface. The system functions in the standard Unix file system interface. The
<function>pg_lo_*</function> commands should be used within a <function>pg_lo_*</function> commands should be used within a
<command>BEGIN</command>/<command>COMMIT</command> transaction <command>BEGIN</command>/<command>COMMIT</command> transaction
...@@ -1043,12 +1043,12 @@ pg_listen <parameter>conn</parameter> <parameter>notifyName</parameter> <optiona ...@@ -1043,12 +1043,12 @@ pg_listen <parameter>conn</parameter> <parameter>notifyName</parameter> <optiona
message bearing the given name arrives from the server. This message bearing the given name arrives from the server. This
occurs when any <productname>PostgreSQL</productname> client occurs when any <productname>PostgreSQL</productname> client
application issues a application issues a
<command>NOTIFY</command><indexterm><primary>NOTIFY</><secondary>in <command>NOTIFY</command><indexterm><primary>NOTIFY</><secondary
pgtcl</></> command referencing that name. The command string is sortas="pgtcl">in pgtcl</></> command referencing that name. The
executed from the Tcl idle loop. That is the normal idle state of command string is executed from the Tcl idle loop. That is the
an application written with Tk. In non-Tk Tcl shells, you can normal idle state of an application written with Tk. In non-Tk Tcl
execute <function>update</function> or <function>vwait</function> shells, you can execute <function>update</function> or
to cause the idle loop to be entered. <function>vwait</function> to cause the idle loop to be entered.
</para> </para>
<para> <para>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/libpq.sgml,v 1.132 2003/08/24 18:36:38 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/libpq.sgml,v 1.133 2003/08/31 17:32:19 petere Exp $
--> -->
<chapter id="libpq"> <chapter id="libpq">
...@@ -9,6 +9,10 @@ $Header: /cvsroot/pgsql/doc/src/sgml/libpq.sgml,v 1.132 2003/08/24 18:36:38 pete ...@@ -9,6 +9,10 @@ $Header: /cvsroot/pgsql/doc/src/sgml/libpq.sgml,v 1.132 2003/08/24 18:36:38 pete
<primary>libpq</primary> <primary>libpq</primary>
</indexterm> </indexterm>
<indexterm zone="libpq">
<primary>C</primary>
</indexterm>
<para> <para>
<application>libpq</application> is the <acronym>C</acronym> <application>libpq</application> is the <acronym>C</acronym>
application programmer's interface to application programmer's interface to
...@@ -31,9 +35,10 @@ $Header: /cvsroot/pgsql/doc/src/sgml/libpq.sgml,v 1.132 2003/08/24 18:36:38 pete ...@@ -31,9 +35,10 @@ $Header: /cvsroot/pgsql/doc/src/sgml/libpq.sgml,v 1.132 2003/08/24 18:36:38 pete
</para> </para>
<para> <para>
Client programs that use <application>libpq</application> must include the Client programs that use <application>libpq</application> must
header file <filename>libpq-fe.h</filename> and must link with the include the header file
<application>libpq</application> library. <filename>libpq-fe.h</filename><indexterm><primary>libpq-fe.h</></>
and must link with the <application>libpq</application> library.
</para> </para>
<sect1 id="libpq-connect"> <sect1 id="libpq-connect">
...@@ -45,17 +50,18 @@ $Header: /cvsroot/pgsql/doc/src/sgml/libpq.sgml,v 1.132 2003/08/24 18:36:38 pete ...@@ -45,17 +50,18 @@ $Header: /cvsroot/pgsql/doc/src/sgml/libpq.sgml,v 1.132 2003/08/24 18:36:38 pete
application program can have several backend connections open at application program can have several backend connections open at
one time. (One reason to do that is to access more than one one time. (One reason to do that is to access more than one
database.) Each connection is represented by a database.) Each connection is represented by a
<structname>PGconn</> object which is obtained from the function <structname>PGconn</><indexterm><primary>PGconn</></> object which
<function>PQconnectdb</> or <function>PQsetdbLogin</>. Note that is obtained from the function <function>PQconnectdb</> or
these functions will always return a non-null object pointer, <function>PQsetdbLogin</>. Note that these functions will always
unless perhaps there is too little memory even to allocate the return a non-null object pointer, unless perhaps there is too
<structname>PGconn</> object. The <function>PQstatus</> function little memory even to allocate the <structname>PGconn</> object.
should be called to check whether a connection was successfully The <function>PQstatus</> function should be called to check
made before queries are sent via the connection object. whether a connection was successfully made before queries are sent
via the connection object.
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term><function>PQconnectdb</function></term> <term><function>PQconnectdb</function><indexterm><primary>PQconnectdb</></></term>
<listitem> <listitem>
<para> <para>
Makes a new connection to the database server. Makes a new connection to the database server.
...@@ -93,12 +99,13 @@ PGconn *PQconnectdb(const char *conninfo); ...@@ -93,12 +99,13 @@ PGconn *PQconnectdb(const char *conninfo);
<term><literal>host</literal></term> <term><literal>host</literal></term>
<listitem> <listitem>
<para> <para>
Name of host to connect to. Name of host to connect to.<indexterm><primary>host name</></>
If this begins with a slash, it specifies Unix-domain communication If this begins with a slash, it specifies Unix-domain
rather than TCP/IP communication; the value is the name of the communication rather than TCP/IP communication; the value is the
directory in which the socket file is stored. name of the directory in which the socket file is stored. The
The default is to connect to a Unix-domain socket in default is to connect to a Unix-domain socket in
<filename>/tmp</filename>. <filename>/tmp</filename>.<indexterm><primary>Unix domain
socket</></>
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -144,8 +151,9 @@ PGconn *PQconnectdb(const char *conninfo); ...@@ -144,8 +151,9 @@ PGconn *PQconnectdb(const char *conninfo);
<term><literal>port</literal></term> <term><literal>port</literal></term>
<listitem> <listitem>
<para> <para>
Port number to connect to at the server host, Port number to connect to at the server host, or socket file
or socket file name extension for Unix-domain connections. name extension for Unix-domain
connections.<indexterm><primary>port</></>
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -209,44 +217,51 @@ PGconn *PQconnectdb(const char *conninfo); ...@@ -209,44 +217,51 @@ PGconn *PQconnectdb(const char *conninfo);
<varlistentry> <varlistentry>
<term><literal>sslmode</literal></term> <term><literal>sslmode</literal></term>
<listitem> <listitem>
<para> <para>
This option determines whether or with what priority an <acronym>SSL</> This option determines whether or with what priority an
connection will be negotiated with the server. There are four <acronym>SSL</> connection will be negotiated with the
modes: <literal>disable</> will attempt only an unencrypted server. There are four modes: <literal>disable</> will attempt
<acronym>SSL</> connection; <literal>allow</> will negotiate, only an unencrypted <acronym>SSL</> connection;
trying first a non-<acronym>SSL</> connection, then if that fails, <literal>allow</> will negotiate, trying first a
trying an <acronym>SSL</> connection; <literal>prefer</> non-<acronym>SSL</> connection, then if that fails, trying an
(the default) will negotiate, trying first an <acronym>SSL</> connection, <acronym>SSL</> connection; <literal>prefer</> (the default)
then if that fails, trying a regular non-<acronym>SSL</> connection; will negotiate, trying first an <acronym>SSL</> connection,
<literal>require</> will try only an <acronym>SSL</> connection. then if that fails, trying a regular non-<acronym>SSL</>
</para> connection; <literal>require</> will try only an
<para> <acronym>SSL</> connection.
If <productname>PostgreSQL</> is compiled without SSL support, </para>
using option <literal>require</> will cause an error, and options
<literal>allow</> and <literal>prefer</> will be tolerated but <para>
<application>libpq</> will be unable to negotiate an <acronym>SSL</> If <productname>PostgreSQL</> is compiled without SSL support,
connection. using option <literal>require</> will cause an error, and
</para> options <literal>allow</> and <literal>prefer</> will be
tolerated but <application>libpq</> will be unable to negotiate
an <acronym>SSL</>
connection.<indexterm><primary>SSL</><secondary
sortas="libpq">with libpq</></indexterm>
</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><literal>requiressl</literal></term> <term><literal>requiressl</literal></term>
<listitem> <listitem>
<para> <para>
This option is deprecated in favor of the <literal>sslmode</> This option is deprecated in favor of the <literal>sslmode</>
setting. setting.
</para> </para>
<para>
If set to 1, an <acronym>SSL</acronym> connection to the server is required <para>
(this is equivalent to <literal>sslmode</> <literal>require</>). If set to 1, an <acronym>SSL</acronym> connection to the server
<application>libpq</> will then refuse to connect if the server does not is required (this is equivalent to <literal>sslmode</>
accept an <acronym>SSL</acronym> connection. <literal>require</>). <application>libpq</> will then refuse
If set to 0 (default), <application>libpq</> will negotiate the connection to connect if the server does not accept an
type with the server (equivalent to <literal>sslmode</> <literal>prefer</>). <acronym>SSL</acronym> connection. If set to 0 (default),
This option is only available if <application>libpq</> will negotiate the connection type with
<productname>PostgreSQL</> is compiled with SSL support. the server (equivalent to <literal>sslmode</>
</para> <literal>prefer</>). This option is only available if
<productname>PostgreSQL</> is compiled with SSL support.
</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -274,7 +289,7 @@ PGconn *PQconnectdb(const char *conninfo); ...@@ -274,7 +289,7 @@ PGconn *PQconnectdb(const char *conninfo);
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><function>PQsetdbLogin</function></term> <term><function>PQsetdbLogin</function><indexterm><primary>PQsetdbLogin</></></term>
<listitem> <listitem>
<para> <para>
Makes a new connection to the database server. Makes a new connection to the database server.
...@@ -299,7 +314,7 @@ PGconn *PQsetdbLogin(const char *pghost, ...@@ -299,7 +314,7 @@ PGconn *PQsetdbLogin(const char *pghost,
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><function>PQsetdb</function></term> <term><function>PQsetdb</function><indexterm><primary>PQsetdb</></></term>
<listitem> <listitem>
<para> <para>
Makes a new connection to the database server. Makes a new connection to the database server.
...@@ -321,8 +336,8 @@ PGconn *PQsetdb(char *pghost, ...@@ -321,8 +336,8 @@ PGconn *PQsetdb(char *pghost,
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><function>PQconnectStart</function></term> <term><function>PQconnectStart</function><indexterm><primary>PQconnectStart</></></term>
<term><function>PQconnectPoll</function></term> <term><function>PQconnectPoll</function><indexterm><primary>PQconnectPoll</></></term>
<listitem> <listitem>
<para> <para>
<indexterm><primary>nonblocking connection</primary></indexterm> <indexterm><primary>nonblocking connection</primary></indexterm>
...@@ -515,7 +530,7 @@ switch(PQstatus(conn)) ...@@ -515,7 +530,7 @@ switch(PQstatus(conn))
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><function>PQconndefaults</function></term> <term><function>PQconndefaults</function><indexterm><primary>PQconndefaults</></></term>
<listitem> <listitem>
<para> <para>
Returns the default connection options. Returns the default connection options.
...@@ -560,7 +575,7 @@ typedef struct ...@@ -560,7 +575,7 @@ typedef struct
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><function>PQfinish</function></term> <term><function>PQfinish</function><indexterm><primary>PQfinish</></></term>
<listitem> <listitem>
<para> <para>
Closes the connection to the server. Also frees Closes the connection to the server. Also frees
...@@ -581,7 +596,7 @@ void PQfinish(PGconn *conn); ...@@ -581,7 +596,7 @@ void PQfinish(PGconn *conn);
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><function>PQreset</function></term> <term><function>PQreset</function><indexterm><primary>PQreset</></></term>
<listitem> <listitem>
<para> <para>
Resets the communication channel to the server. Resets the communication channel to the server.
...@@ -601,8 +616,8 @@ void PQreset(PGconn *conn); ...@@ -601,8 +616,8 @@ void PQreset(PGconn *conn);
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><function>PQresetStart</function></term> <term><function>PQresetStart</function><indexterm><primary>PQresetStart</></></term>
<term><function>PQresetPoll</function></term> <term><function>PQresetPoll</function><indexterm><primary>PQresetPoll</></></term>
<listitem> <listitem>
<para> <para>
Reset the communication channel to the server, in a nonblocking manner. Reset the communication channel to the server, in a nonblocking manner.
...@@ -665,7 +680,7 @@ These values are fixed for the life of the <structname>PGconn</> object. ...@@ -665,7 +680,7 @@ These values are fixed for the life of the <structname>PGconn</> object.
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term><function>PQdb</function></term> <term><function>PQdb</function><indexterm><primary>PQdb</></></term>
<listitem> <listitem>
<para> <para>
Returns the database name of the connection. Returns the database name of the connection.
...@@ -677,7 +692,7 @@ char *PQdb(const PGconn *conn); ...@@ -677,7 +692,7 @@ char *PQdb(const PGconn *conn);
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><function>PQuser</function></term> <term><function>PQuser</function><indexterm><primary>PQuser</></></term>
<listitem> <listitem>
<para> <para>
Returns the user name of the connection. Returns the user name of the connection.
...@@ -689,7 +704,7 @@ char *PQuser(const PGconn *conn); ...@@ -689,7 +704,7 @@ char *PQuser(const PGconn *conn);
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><function>PQpass</function></term> <term><function>PQpass</function><indexterm><primary>PQpass</></></term>
<listitem> <listitem>
<para> <para>
Returns the password of the connection. Returns the password of the connection.
...@@ -701,7 +716,7 @@ char *PQpass(const PGconn *conn); ...@@ -701,7 +716,7 @@ char *PQpass(const PGconn *conn);
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><function>PQhost</function></term> <term><function>PQhost</function><indexterm><primary>PQhost</></></term>
<listitem> <listitem>
<para> <para>
Returns the server host name of the connection. Returns the server host name of the connection.
...@@ -713,7 +728,7 @@ char *PQhost(const PGconn *conn); ...@@ -713,7 +728,7 @@ char *PQhost(const PGconn *conn);
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><function>PQport</function></term> <term><function>PQport</function><indexterm><primary>PQport</></></term>
<listitem> <listitem>
<para> <para>
Returns the port of the connection. Returns the port of the connection.
...@@ -725,13 +740,13 @@ char *PQport(const PGconn *conn); ...@@ -725,13 +740,13 @@ char *PQport(const PGconn *conn);
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><function>PQtty</function></term> <term><function>PQtty</function><indexterm><primary>PQtty</></></term>
<listitem> <listitem>
<para> <para>
Returns the debug <acronym>TTY</acronym> of the connection. Returns the debug <acronym>TTY</acronym> of the connection.
(This is obsolete, since the server no longer pays attention (This is obsolete, since the server no longer pays attention
to the <acronym>TTY</acronym> setting, but the function remains to the <acronym>TTY</acronym> setting, but the function remains
for backwards compatibility.) for backwards compatibility.)
<synopsis> <synopsis>
char *PQtty(const PGconn *conn); char *PQtty(const PGconn *conn);
</synopsis> </synopsis>
...@@ -740,7 +755,7 @@ char *PQtty(const PGconn *conn); ...@@ -740,7 +755,7 @@ char *PQtty(const PGconn *conn);
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><function>PQoptions</function></term> <term><function>PQoptions</function><indexterm><primary>PQoptions</></></term>
<listitem> <listitem>
<para> <para>
Returns the command-line options passed in the connection request. Returns the command-line options passed in the connection request.
...@@ -759,7 +774,7 @@ are executed on the <structname>PGconn</> object. ...@@ -759,7 +774,7 @@ are executed on the <structname>PGconn</> object.
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term><function>PQstatus</function></term> <term><function>PQstatus</function><indexterm><primary>PQstatus</></></term>
<listitem> <listitem>
<para> <para>
Returns the status of the connection. Returns the status of the connection.
...@@ -795,7 +810,7 @@ ConnStatusType PQstatus(const PGconn *conn); ...@@ -795,7 +810,7 @@ ConnStatusType PQstatus(const PGconn *conn);
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><function>PQtransactionStatus</function></term> <term><function>PQtransactionStatus</function><indexterm><primary>PQtransactionStatus</></></term>
<listitem> <listitem>
<para> <para>
Returns the current in-transaction status of the server. Returns the current in-transaction status of the server.
...@@ -823,7 +838,7 @@ deprecated and does not exist in later server versions. ...@@ -823,7 +838,7 @@ deprecated and does not exist in later server versions.
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><function>PQparameterStatus</function></term> <term><function>PQparameterStatus</function><indexterm><primary>PQparameterStatus</></></term>
<listitem> <listitem>
<para> <para>
Looks up a current parameter setting of the server. Looks up a current parameter setting of the server.
...@@ -861,7 +876,7 @@ will not be reflected by <function>PQparameterStatus</>.) ...@@ -861,7 +876,7 @@ will not be reflected by <function>PQparameterStatus</>.)
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><function>PQprotocolVersion</function></term> <term><function>PQprotocolVersion</function><indexterm><primary>PQprotocolVersion</></></term>
<listitem> <listitem>
<para> <para>
Interrogates the frontend/backend protocol being used. Interrogates the frontend/backend protocol being used.
...@@ -881,7 +896,7 @@ only protocol 2.0. (Protocol 1.0 is obsolete and not supported by libpq.) ...@@ -881,7 +896,7 @@ only protocol 2.0. (Protocol 1.0 is obsolete and not supported by libpq.)
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><function>PQerrorMessage</function></term> <term><function>PQerrorMessage</function><indexterm><primary>PQerrorMessage</></></term>
<listitem> <listitem>
<para> <para>
<indexterm><primary>error message</></> <indexterm><primary>error message</></>
...@@ -903,7 +918,7 @@ char *PQerrorMessage(const PGconn* conn); ...@@ -903,7 +918,7 @@ char *PQerrorMessage(const PGconn* conn);
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><function>PQsocket</function></term> <term><function>PQsocket</function><indexterm><primary>PQsocket</></></term>
<listitem> <listitem>
<para> <para>
Obtains the file descriptor number of the connection socket to Obtains the file descriptor number of the connection socket to
...@@ -919,11 +934,13 @@ int PQsocket(const PGconn *conn); ...@@ -919,11 +934,13 @@ int PQsocket(const PGconn *conn);
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><function>PQbackendPID</function></term> <term><function>PQbackendPID</function><indexterm><primary>PQbackendPID</></></term>
<listitem> <listitem>
<para> <para>
Returns the process <acronym>ID</acronym> of the backend server process Returns the process <acronym>ID</acronym>
handling this connection. (PID)<indexterm><primary>PID</><secondary>determining PID of
server process</><tertiary>in libpq</></> of the backend server
process handling this connection.
<synopsis> <synopsis>
int PQbackendPID(const PGconn *conn); int PQbackendPID(const PGconn *conn);
</synopsis> </synopsis>
...@@ -941,10 +958,10 @@ int PQbackendPID(const PGconn *conn); ...@@ -941,10 +958,10 @@ int PQbackendPID(const PGconn *conn);
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><function>PQgetssl</function></term> <term><function>PQgetssl</function><indexterm><primary>PQgetssl</></></term>
<listitem> <listitem>
<para> <para>
<indexterm><primary>SSL</></> <indexterm><primary>SSL</><secondary sortas="libpq">in libpq</secondary></indexterm>
Returns the SSL structure used in the connection, or null Returns the SSL structure used in the connection, or null
if SSL is not in use. if SSL is not in use.
<synopsis> <synopsis>
...@@ -985,7 +1002,7 @@ SQL queries and commands. ...@@ -985,7 +1002,7 @@ SQL queries and commands.
<para> <para>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term><function>PQexec</function></term> <term><function>PQexec</function><indexterm><primary>PQexec</></></term>
<listitem> <listitem>
<para> <para>
Submits a command to the server Submits a command to the server
...@@ -1001,8 +1018,8 @@ PGresult *PQexec(PGconn *conn, const char *command); ...@@ -1001,8 +1018,8 @@ PGresult *PQexec(PGconn *conn, const char *command);
out-of-memory conditions or serious errors such as inability out-of-memory conditions or serious errors such as inability
to send the command to the server. to send the command to the server.
If a null pointer is returned, it If a null pointer is returned, it
should be treated like a <symbol>PGRES_FATAL_ERROR</symbol> result. Use should be treated like a <symbol>PGRES_FATAL_ERROR</symbol> result. Use
<function>PQerrorMessage</function> to get more information about the error. <function>PQerrorMessage</function> to get more information about the error.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -1022,12 +1039,12 @@ condition. ...@@ -1022,12 +1039,12 @@ condition.
<para> <para>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term><function>PQexecParams</function></term> <term><function>PQexecParams</function><indexterm><primary>PQexecParams</></></term>
<listitem> <listitem>
<para> <para>
Submits a command to the server and waits for the result, Submits a command to the server and waits for the result,
with the ability to pass parameters separately from the SQL with the ability to pass parameters separately from the SQL
command text. command text.
<synopsis> <synopsis>
PGresult *PQexecParams(PGconn *conn, PGresult *PQexecParams(PGconn *conn,
const char *command, const char *command,
...@@ -1093,11 +1110,11 @@ but has some usefulness as an extra defense against SQL-injection attacks. ...@@ -1093,11 +1110,11 @@ but has some usefulness as an extra defense against SQL-injection attacks.
<para> <para>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term><function>PQexecPrepared</function></term> <term><function>PQexecPrepared</function><indexterm><primary>PQexecPrepared</></></term>
<listitem> <listitem>
<para> <para>
Sends a request to execute a prepared statement with given Sends a request to execute a prepared statement with given
parameters, and waits for the result. parameters, and waits for the result.
<synopsis> <synopsis>
PGresult *PQexecPrepared(PGconn *conn, PGresult *PQexecPrepared(PGconn *conn,
const char *stmtName, const char *stmtName,
...@@ -1138,16 +1155,19 @@ future release. ...@@ -1138,16 +1155,19 @@ future release.
</para> </para>
<para> <para>
The <structname>PGresult</structname> structure encapsulates the result The
returned by the server. <structname>PGresult</structname><indexterm><primary>PGresult</></>
<application>libpq</application> application programmers should be careful to structure encapsulates the result returned by the server.
maintain the <structname>PGresult</structname> abstraction. Use the accessor functions below to get <application>libpq</application> application programmers should be
at the contents of <structname>PGresult</structname>. Avoid directly referencing the fields of the careful to maintain the <structname>PGresult</structname> abstraction.
<structname>PGresult</structname> structure because they are subject to change in the future. Use the accessor functions below to get at the contents of
<structname>PGresult</structname>. Avoid directly referencing the
fields of the <structname>PGresult</structname> structure because they
are subject to change in the future.
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term><function>PQresultStatus</function></term> <term><function>PQresultStatus</function><indexterm><primary>PQresultStatus</></></term>
<listitem> <listitem>
<para> <para>
Returns the result status of the command. Returns the result status of the command.
...@@ -1238,11 +1258,11 @@ processor (see <xref linkend="libpq-notice-processing">). ...@@ -1238,11 +1258,11 @@ processor (see <xref linkend="libpq-notice-processing">).
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><function>PQresStatus</function></term> <term><function>PQresStatus</function><indexterm><primary>PQresStatus</></></term>
<listitem> <listitem>
<para> <para>
Converts the enumerated type returned by <function>PQresultStatus</> into Converts the enumerated type returned by <function>PQresultStatus</> into
a string constant describing the status code. a string constant describing the status code.
<synopsis> <synopsis>
char *PQresStatus(ExecStatusType status); char *PQresStatus(ExecStatusType status);
</synopsis> </synopsis>
...@@ -1251,7 +1271,7 @@ char *PQresStatus(ExecStatusType status); ...@@ -1251,7 +1271,7 @@ char *PQresStatus(ExecStatusType status);
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><function>PQresultErrorMessage</function></term> <term><function>PQresultErrorMessage</function><indexterm><primary>PQresultErrorMessage</></></term>
<listitem> <listitem>
<para> <para>
Returns the error message associated with the command, or an empty string Returns the error message associated with the command, or an empty string
...@@ -1276,7 +1296,7 @@ when you want to know the status from the latest operation on the connection. ...@@ -1276,7 +1296,7 @@ when you want to know the status from the latest operation on the connection.
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><function>PQresultErrorField</function></term> <term><function>PQresultErrorField</function><indexterm><primary>PQresultErrorField</></></term>
<listitem> <listitem>
<para> <para>
Returns an individual field of an error report. Returns an individual field of an error report.
...@@ -1427,7 +1447,7 @@ Note that error fields are only available from ...@@ -1427,7 +1447,7 @@ Note that error fields are only available from
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><function>PQclear</function></term> <term><function>PQclear</function><indexterm><primary>PQclear</></></term>
<listitem> <listitem>
<para> <para>
Frees the storage associated with a <structname>PGresult</structname>. Frees the storage associated with a <structname>PGresult</structname>.
...@@ -1449,7 +1469,7 @@ void PQclear(PQresult *res); ...@@ -1449,7 +1469,7 @@ void PQclear(PQresult *res);
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><function>PQmakeEmptyPGresult</function></term> <term><function>PQmakeEmptyPGresult</function><indexterm><primary>PQmakeEmptyPGresult</></></term>
<listitem> <listitem>
<para> <para>
Constructs an empty <structname>PGresult</structname> object with the given status. Constructs an empty <structname>PGresult</structname> object with the given status.
...@@ -1486,7 +1506,7 @@ values they will act as though the result has zero rows and zero columns. ...@@ -1486,7 +1506,7 @@ values they will act as though the result has zero rows and zero columns.
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term><function>PQntuples</function></term> <term><function>PQntuples</function><indexterm><primary>PQntuples</></></term>
<listitem> <listitem>
<para> <para>
Returns the number of rows (tuples) Returns the number of rows (tuples)
...@@ -1499,7 +1519,7 @@ int PQntuples(const PGresult *res); ...@@ -1499,7 +1519,7 @@ int PQntuples(const PGresult *res);
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><function>PQnfields</function></term> <term><function>PQnfields</function><indexterm><primary>PQnfields</></></term>
<listitem> <listitem>
<para> <para>
Returns the number of columns (fields) Returns the number of columns (fields)
...@@ -1512,7 +1532,7 @@ int PQnfields(const PGresult *res); ...@@ -1512,7 +1532,7 @@ int PQnfields(const PGresult *res);
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><function>PQfname</function></term> <term><function>PQfname</function><indexterm><primary>PQfname</></></term>
<listitem> <listitem>
<para> <para>
Returns the column name associated with the given column number. Returns the column name associated with the given column number.
...@@ -1530,7 +1550,7 @@ NULL is returned if the column number is out of range. ...@@ -1530,7 +1550,7 @@ NULL is returned if the column number is out of range.
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><function>PQfnumber</function></term> <term><function>PQfnumber</function><indexterm><primary>PQfnumber</></></term>
<listitem> <listitem>
<para> <para>
Returns the column number Returns the column number
...@@ -1548,7 +1568,7 @@ int PQfnumber(const PGresult *res, ...@@ -1548,7 +1568,7 @@ int PQfnumber(const PGresult *res,
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><function>PQftable</function></term> <term><function>PQftable</function><indexterm><primary>PQftable</></></term>
<listitem> <listitem>
<para> <para>
Returns the OID of the table from which the given column was fetched. Returns the OID of the table from which the given column was fetched.
...@@ -1577,7 +1597,7 @@ exactly which table is referenced. ...@@ -1577,7 +1597,7 @@ exactly which table is referenced.
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><function>PQftablecol</function></term> <term><function>PQftablecol</function><indexterm><primary>PQftablecol</></></term>
<listitem> <listitem>
<para> <para>
Returns the column number (within its table) of the column making up Returns the column number (within its table) of the column making up
...@@ -1598,7 +1618,7 @@ or when using pre-3.0 protocol. ...@@ -1598,7 +1618,7 @@ or when using pre-3.0 protocol.
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><function>PQfformat</function></term> <term><function>PQfformat</function><indexterm><primary>PQfformat</></></term>
<listitem> <listitem>
<para> <para>
Returns the format code indicating the format of the given column. Returns the format code indicating the format of the given column.
...@@ -1618,7 +1638,7 @@ for future definition.) ...@@ -1618,7 +1638,7 @@ for future definition.)
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><function>PQftype</function></term> <term><function>PQftype</function><indexterm><primary>PQftype</></></term>
<listitem> <listitem>
<para> <para>
Returns the data type associated with the Returns the data type associated with the
...@@ -1641,7 +1661,7 @@ in the source tree. ...@@ -1641,7 +1661,7 @@ in the source tree.
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><function>PQfmod</function></term> <term><function>PQfmod</function><indexterm><primary>PQfmod</></></term>
<listitem> <listitem>
<para> <para>
Returns the type modifier of the column Returns the type modifier of the column
...@@ -1663,7 +1683,7 @@ in which case the value is always -1. ...@@ -1663,7 +1683,7 @@ in which case the value is always -1.
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><function>PQfsize</function></term> <term><function>PQfsize</function><indexterm><primary>PQfsize</></></term>
<listitem> <listitem>
<para> <para>
Returns the size in bytes of the column Returns the size in bytes of the column
...@@ -1685,7 +1705,7 @@ A negative value indicates the data type is variable-length. ...@@ -1685,7 +1705,7 @@ A negative value indicates the data type is variable-length.
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><function>PQbinaryTuples</function></term> <term><function>PQbinaryTuples</function><indexterm><primary>PQbinaryTuples</></></term>
<listitem> <listitem>
<para> <para>
Returns 1 if the <structname>PGresult</> contains binary data Returns 1 if the <structname>PGresult</> contains binary data
...@@ -1707,11 +1727,11 @@ returns 1 only if all columns of the result are binary (format 1). ...@@ -1707,11 +1727,11 @@ returns 1 only if all columns of the result are binary (format 1).
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><function>PQgetvalue</function></term> <term><function>PQgetvalue</function><indexterm><primary>PQgetvalue</></></term>
<listitem> <listitem>
<para> <para>
Returns a single field value of one row Returns a single field value of one row
of a <structname>PGresult</structname>. of a <structname>PGresult</structname>.
Row and column numbers start at 0. Row and column numbers start at 0.
<synopsis> <synopsis>
char* PQgetvalue(const PGresult *res, char* PQgetvalue(const PGresult *res,
...@@ -1747,8 +1767,8 @@ be used past the lifetime of the <structname>PGresult</structname> structure i ...@@ -1747,8 +1767,8 @@ be used past the lifetime of the <structname>PGresult</structname> structure i
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><function>PQgetisnull</function></term> <term><function>PQgetisnull</function><indexterm><primary>PQgetisnull</></></term>
<listitem> <indexterm><primary>null value</><secondary sortas="libpq">in libpq</></indexterm><listitem>
<para> <para>
Tests a field for a null value. Tests a field for a null value.
Row and column numbers start at 0. Row and column numbers start at 0.
...@@ -1768,7 +1788,7 @@ will return an empty string, not a null pointer, for a null field.) ...@@ -1768,7 +1788,7 @@ will return an empty string, not a null pointer, for a null field.)
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><function>PQgetlength</function></term> <term><function>PQgetlength</function><indexterm><primary>PQgetlength</></></term>
<listitem> <listitem>
<para> <para>
Returns the actual length of a field value in bytes. Returns the actual length of a field value in bytes.
...@@ -1791,7 +1811,7 @@ on <function>PQfsize</function> to obtain the actual data length. ...@@ -1791,7 +1811,7 @@ on <function>PQfsize</function> to obtain the actual data length.
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><function>PQprint</function></term> <term><function>PQprint</function><indexterm><primary>PQprint</></></term>
<listitem> <listitem>
<para> <para>
Prints out all the rows and, optionally, the Prints out all the rows and, optionally, the
...@@ -1837,11 +1857,11 @@ results. ...@@ -1837,11 +1857,11 @@ results.
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term><function>PQcmdStatus</function></term> <term><function>PQcmdStatus</function><indexterm><primary>PQcmdStatus</></></term>
<listitem> <listitem>
<para> <para>
Returns the command status tag from the SQL command that Returns the command status tag from the SQL command that
generated the <structname>PGresult</structname>. generated the <structname>PGresult</structname>.
<synopsis> <synopsis>
char * PQcmdStatus(PGresult *res); char * PQcmdStatus(PGresult *res);
</synopsis> </synopsis>
...@@ -1854,10 +1874,10 @@ data such as the number of rows processed. ...@@ -1854,10 +1874,10 @@ data such as the number of rows processed.
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><function>PQcmdTuples</function></term> <term><function>PQcmdTuples</function><indexterm><primary>PQcmdTuples</></></term>
<listitem> <listitem>
<para> <para>
Returns the number of rows affected by the SQL command. Returns the number of rows affected by the SQL command.
<synopsis> <synopsis>
char * PQcmdTuples(PGresult *res); char * PQcmdTuples(PGresult *res);
</synopsis> </synopsis>
...@@ -1865,23 +1885,25 @@ char * PQcmdTuples(PGresult *res); ...@@ -1865,23 +1885,25 @@ char * PQcmdTuples(PGresult *res);
<para> <para>
If the <acronym>SQL</acronym> command that generated the If the <acronym>SQL</acronym> command that generated the
<structname>PGresult</structname> was <command>INSERT</>, <structname>PGresult</structname> was <command>INSERT</>,
<command>UPDATE</>, <command>DELETE</command>, <command>MOVE</>, <command>UPDATE</>, <command>DELETE</command>, <command>MOVE</>,
or <command>FETCH</>, this returns a or <command>FETCH</>, this returns a
string containing the number of rows affected. If the string containing the number of rows affected. If the
command was anything else, it returns the empty string. command was anything else, it returns the empty string.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><function>PQoidValue</function></term> <term><function>PQoidValue</function><indexterm><primary>PQoidValue</></></term>
<listitem> <listitem>
<para> <para>
Returns the OID of the inserted row, if the Returns the OID<indexterm><primary>OID</><secondary>in
<acronym>SQL</acronym> command was an <command>INSERT</command> libpq</></> of the inserted row, if the
that inserted exactly one row into a table that has OIDs. <acronym>SQL</acronym> command was an
Otherwise, returns <literal>InvalidOid</literal>. <command>INSERT</command> that inserted exactly one row into
a table that has OIDs. Otherwise, returns
<literal>InvalidOid</literal>.
<synopsis> <synopsis>
Oid PQoidValue(const PGresult *res); Oid PQoidValue(const PGresult *res);
</synopsis> </synopsis>
...@@ -1890,7 +1912,7 @@ Oid PQoidValue(const PGresult *res); ...@@ -1890,7 +1912,7 @@ Oid PQoidValue(const PGresult *res);
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><function>PQoidStatus</function></term> <term><function>PQoidStatus</function><indexterm><primary>PQoidStatus</></></term>
<listitem> <listitem>
<para> <para>
Returns a string with the OID of the inserted row, if the Returns a string with the OID of the inserted row, if the
...@@ -1918,6 +1940,7 @@ It is not thread-safe. ...@@ -1918,6 +1940,7 @@ It is not thread-safe.
<sect2 id="libpq-exec-escape-string"> <sect2 id="libpq-exec-escape-string">
<title>Escaping Strings for Inclusion in SQL Commands</title> <title>Escaping Strings for Inclusion in SQL Commands</title>
<indexterm zone="libpq-exec-escape-string"><primary>PQescapeString</></>
<indexterm zone="libpq-exec-escape-string"><primary>escaping strings</></> <indexterm zone="libpq-exec-escape-string"><primary>escaping strings</></>
<para> <para>
...@@ -1976,13 +1999,15 @@ strings overlap. ...@@ -1976,13 +1999,15 @@ strings overlap.
<sect2 id="libpq-exec-escape-bytea"> <sect2 id="libpq-exec-escape-bytea">
<title>Escaping Binary Strings for Inclusion in SQL Commands</title> <title>Escaping Binary Strings for Inclusion in SQL Commands</title>
<indexterm zone="libpq-exec-escape-bytea"> <indexterm zone="libpq-exec-escape-bytea">
<primary>escaping binary strings</primary> <primary>bytea</>
<secondary sortas="libpq">in libpq</>
</indexterm> </indexterm>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term><function>PQescapeBytea</function></term> <term><function>PQescapeBytea</function><indexterm><primary>PQescapeBytea</></></term>
<listitem> <listitem>
<para> <para>
Escapes binary data for use within an SQL command with the type Escapes binary data for use within an SQL command with the type
...@@ -2034,7 +2059,7 @@ unsigned char *PQescapeBytea(const unsigned char *from, ...@@ -2034,7 +2059,7 @@ unsigned char *PQescapeBytea(const unsigned char *from,
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><function>PQunescapeBytea</function></term> <term><function>PQunescapeBytea</function><indexterm><primary>PQunescapeBytea</></></term>
<listitem> <listitem>
<para> <para>
Converts an escaped string representation of binary data into binary Converts an escaped string representation of binary data into binary
...@@ -2061,7 +2086,7 @@ unsigned char *PQunescapeBytea(const unsigned char *from, size_t *to_length); ...@@ -2061,7 +2086,7 @@ unsigned char *PQunescapeBytea(const unsigned char *from, size_t *to_length);
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><function>PQfreemem</function></term> <term><function>PQfreemem</function><indexterm><primary>PQfreemem</></></term>
<listitem> <listitem>
<para> <para>
Frees memory allocated by <application>libpq</>. Frees memory allocated by <application>libpq</>.
...@@ -2134,32 +2159,32 @@ respectively. ...@@ -2134,32 +2159,32 @@ respectively.
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term><function>PQsendQuery</function></term> <term><function>PQsendQuery</function><indexterm><primary>PQsendQuery</></></term>
<listitem> <listitem>
<para> <para>
Submits a command to the server without Submits a command to the server without
waiting for the result(s). 1 is returned if the command was waiting for the result(s). 1 is returned if the command was
successfully dispatched and 0 if not (in which case, use successfully dispatched and 0 if not (in which case, use
<function>PQerrorMessage</> to get more information about the failure). <function>PQerrorMessage</> to get more information about the failure).
<synopsis> <synopsis>
int PQsendQuery(PGconn *conn, const char *command); int PQsendQuery(PGconn *conn, const char *command);
</synopsis> </synopsis>
After successfully calling <function>PQsendQuery</function>, call After successfully calling <function>PQsendQuery</function>, call
<function>PQgetResult</function> one or more <function>PQgetResult</function> one or more
times to obtain the results. <function>PQsendQuery</function> may not be called times to obtain the results. <function>PQsendQuery</function> may not be called
again (on the same connection) until <function>PQgetResult</function> has returned a null pointer, again (on the same connection) until <function>PQgetResult</function> has returned a null pointer,
indicating that the command is done. indicating that the command is done.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><function>PQsendQueryParams</function></term> <term><function>PQsendQueryParams</function><indexterm><primary>PQsendQueryParams</></></term>
<listitem> <listitem>
<para> <para>
Submits a command and separate parameters to the server without Submits a command and separate parameters to the server without
waiting for the result(s). waiting for the result(s).
<synopsis> <synopsis>
int PQsendQueryParams(PGconn *conn, int PQsendQueryParams(PGconn *conn,
const char *command, const char *command,
...@@ -2171,22 +2196,22 @@ int PQsendQueryParams(PGconn *conn, ...@@ -2171,22 +2196,22 @@ int PQsendQueryParams(PGconn *conn,
int resultFormat); int resultFormat);
</synopsis> </synopsis>
This is equivalent to <function>PQsendQuery</function> except that This is equivalent to <function>PQsendQuery</function> except that
query parameters can be specified separately from the query string. query parameters can be specified separately from the query string.
The function's parameters are handled identically to The function's parameters are handled identically to
<function>PQexecParams</function>. Like <function>PQexecParams</function>. Like
<function>PQexecParams</function>, it will not work on 2.0-protocol <function>PQexecParams</function>, it will not work on 2.0-protocol
connections, and it allows only one command in the query string. connections, and it allows only one command in the query string.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><function>PQsendQueryPrepared</function></term> <term><function>PQsendQueryPrepared</function><indexterm><primary>PQsendQueryPrepared</></></term>
<listitem> <listitem>
<para> <para>
Sends a request to execute a prepared statement with given Sends a request to execute a prepared statement with given
parameters, without waiting for the result(s). parameters, without waiting for the result(s).
<synopsis> <synopsis>
int PQsendQueryPrepared(PGconn *conn, int PQsendQueryPrepared(PGconn *conn,
const char *stmtName, const char *stmtName,
...@@ -2197,41 +2222,41 @@ int PQsendQueryPrepared(PGconn *conn, ...@@ -2197,41 +2222,41 @@ int PQsendQueryPrepared(PGconn *conn,
int resultFormat); int resultFormat);
</synopsis> </synopsis>
This is similar to <function>PQsendQueryParams</function>, but the This is similar to <function>PQsendQueryParams</function>, but the
command to be executed is specified by naming a previously-prepared command to be executed is specified by naming a previously-prepared
statement, instead of giving a query string. statement, instead of giving a query string.
The function's parameters are handled identically to The function's parameters are handled identically to
<function>PQexecPrepared</function>. Like <function>PQexecPrepared</function>. Like
<function>PQexecPrepared</function>, it will not work on 2.0-protocol <function>PQexecPrepared</function>, it will not work on 2.0-protocol
connections. connections.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><function>PQgetResult</function></term> <term><function>PQgetResult</function><indexterm><primary>PQgetResult</></></term>
<listitem> <listitem>
<para> <para>
Waits for the next result from a prior Waits for the next result from a prior
<function>PQsendQuery</function>, <function>PQsendQuery</function>,
<function>PQsendQueryParams</function>, or <function>PQsendQueryParams</function>, or
<function>PQsendQueryPrepared</function> call, <function>PQsendQueryPrepared</function> call,
and returns it. A null pointer is returned when the command is complete and returns it. A null pointer is returned when the command is complete
and there will be no more results. and there will be no more results.
<synopsis> <synopsis>
PGresult *PQgetResult(PGconn *conn); PGresult *PQgetResult(PGconn *conn);
</synopsis> </synopsis>
</para> </para>
<para> <para>
<function>PQgetResult</function> must be called repeatedly until it returns a null pointer, <function>PQgetResult</function> must be called repeatedly until it returns a null pointer,
indicating that the command is done. (If called when no command is indicating that the command is done. (If called when no command is
active, <function>PQgetResult</function> will just return a null pointer at once.) active, <function>PQgetResult</function> will just return a null pointer at once.)
Each non-null result from <function>PQgetResult</function> should be processed using Each non-null result from <function>PQgetResult</function> should be processed using
the same <structname>PGresult</> accessor functions previously described. the same <structname>PGresult</> accessor functions previously described.
Don't forget to free each result object with <function>PQclear</function> when done with it. Don't forget to free each result object with <function>PQclear</function> when done with it.
Note that <function>PQgetResult</function> will block only if a command is active and the Note that <function>PQgetResult</function> will block only if a command is active and the
necessary response data has not yet been read by <function>PQconsumeInput</function>. necessary response data has not yet been read by <function>PQconsumeInput</function>.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -2252,10 +2277,10 @@ more functions: ...@@ -2252,10 +2277,10 @@ more functions:
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term><function>PQconsumeInput</function></term> <term><function>PQconsumeInput</function><indexterm><primary>PQconsumeInput</></></term>
<listitem> <listitem>
<para> <para>
If input is available from the server, consume it. If input is available from the server, consume it.
<synopsis> <synopsis>
int PQconsumeInput(PGconn *conn); int PQconsumeInput(PGconn *conn);
</synopsis> </synopsis>
...@@ -2283,7 +2308,7 @@ application can thus use <function>PQconsumeInput</function> to clear the ...@@ -2283,7 +2308,7 @@ application can thus use <function>PQconsumeInput</function> to clear the
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><function>PQisBusy</function></term> <term><function>PQisBusy</function><indexterm><primary>PQisBusy</></></term>
<listitem> <listitem>
<para> <para>
Returns 1 if a command is busy, that is, <function>PQgetResult</function> would block Returns 1 if a command is busy, that is, <function>PQgetResult</function> would block
...@@ -2319,16 +2344,18 @@ if <function>PQisBusy</function> returns false (0). It can also call ...@@ -2319,16 +2344,18 @@ if <function>PQisBusy</function> returns false (0). It can also call
</para> </para>
<para> <para>
A client that uses <function>PQsendQuery</function>/<function>PQgetResult</function> A client that uses
can also attempt to cancel a command that is still being processed by the server. <function>PQsendQuery</function>/<function>PQgetResult</function> can
also attempt to cancel a command that is still being processed by the
server.<indexterm><primary>canceling</><secondary>SQL command</></>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term><function>PQrequestCancel</function></term> <term><function>PQrequestCancel</function><indexterm><primary>PQrequestCancel</></></term>
<listitem> <listitem>
<para> <para>
Requests that the server abandon Requests that the server abandon
processing of the current command. processing of the current command.
<synopsis> <synopsis>
int PQrequestCancel(PGconn *conn); int PQrequestCancel(PGconn *conn);
</synopsis> </synopsis>
...@@ -2377,7 +2404,7 @@ functions may be used. ...@@ -2377,7 +2404,7 @@ functions may be used.
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term><function>PQsetnonblocking</function></term> <term><function>PQsetnonblocking</function><indexterm><primary>PQsetnonblocking</></></term>
<listitem> <listitem>
<para> <para>
Sets the nonblocking status of the connection. Sets the nonblocking status of the connection.
...@@ -2407,7 +2434,7 @@ int PQsetnonblocking(PGconn *conn, int arg); ...@@ -2407,7 +2434,7 @@ int PQsetnonblocking(PGconn *conn, int arg);
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><function>PQisnonblocking</function></term> <term><function>PQisnonblocking</function><indexterm><primary>PQisnonblocking</></></term>
<listitem> <listitem>
<para> <para>
Returns the blocking status of the database connection. Returns the blocking status of the database connection.
...@@ -2424,7 +2451,7 @@ int PQisnonblocking(const PGconn *conn); ...@@ -2424,7 +2451,7 @@ int PQisnonblocking(const PGconn *conn);
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><function>PQflush</function></term> <term><function>PQflush</function><indexterm><primary>PQflush</></></term>
<listitem> <listitem>
<para> <para>
Attempts to flush any queued output data to the server. Attempts to flush any queued output data to the server.
...@@ -2453,6 +2480,8 @@ and then read the response as described above. ...@@ -2453,6 +2480,8 @@ and then read the response as described above.
<sect1 id="libpq-fastpath"> <sect1 id="libpq-fastpath">
<title>The Fast-Path Interface</title> <title>The Fast-Path Interface</title>
<indexterm zone="libpq-fastpath"><primary>fast path</></>
<para> <para>
<productname>PostgreSQL</productname> provides a fast-path interface to send <productname>PostgreSQL</productname> provides a fast-path interface to send
simple function calls to the server. simple function calls to the server.
...@@ -2468,8 +2497,8 @@ parameters and results substitutes for a fast-path function call. ...@@ -2468,8 +2497,8 @@ parameters and results substitutes for a fast-path function call.
</tip> </tip>
<para> <para>
The function <function>PQfn</function> requests execution of a server The function <function>PQfn</function><indexterm><primary>PQfn</></>
function via the fast-path interface: requests execution of a server function via the fast-path interface:
<synopsis> <synopsis>
PGresult* PQfn(PGconn* conn, PGresult* PQfn(PGconn* conn,
int fnid, int fnid,
...@@ -2535,7 +2564,10 @@ set-valued results when using this interface. ...@@ -2535,7 +2564,10 @@ set-valued results when using this interface.
<sect1 id="libpq-notify"> <sect1 id="libpq-notify">
<title>Asynchronous Notification</title> <title>Asynchronous Notification</title>
<indexterm zone="libpq-notify"><primary>NOTIFY</primary></indexterm> <indexterm zone="libpq-notify">
<primary>NOTIFY</primary>
<secondary>in libpq</secondary>
</indexterm>
<para> <para>
<productname>PostgreSQL</productname> offers asynchronous notification via the <productname>PostgreSQL</productname> offers asynchronous notification via the
...@@ -2551,9 +2583,11 @@ not necessary for there to be any associated table. ...@@ -2551,9 +2583,11 @@ not necessary for there to be any associated table.
</para> </para>
<para> <para>
<application>libpq</application> applications submit <command>LISTEN</command> and <command>UNLISTEN</command> <application>libpq</application> applications submit
commands as ordinary SQL commands. The arrival of <command>NOTIFY</command> <command>LISTEN</command> and <command>UNLISTEN</command> commands as
messages can subsequently be detected by calling <function>PQnotifies</function>. ordinary SQL commands. The arrival of <command>NOTIFY</command>
messages can subsequently be detected by calling
<function>PQnotifies</function>.<indexterm><primary>PQnotifies</></>
</para> </para>
<para> <para>
...@@ -2561,8 +2595,8 @@ The function <function>PQnotifies</function> ...@@ -2561,8 +2595,8 @@ The function <function>PQnotifies</function>
returns the next notification from a list of unhandled returns the next notification from a list of unhandled
notification messages received from the server. It returns a null pointer if notification messages received from the server. It returns a null pointer if
there are no pending notifications. Once a notification is there are no pending notifications. Once a notification is
returned from <function>PQnotifies</>, it is considered handled and will be returned from <function>PQnotifies</>, it is considered handled and will be
removed from the list of notifications. removed from the list of notifications.
<synopsis> <synopsis>
PGnotify* PQnotifies(PGconn *conn); PGnotify* PQnotifies(PGconn *conn);
...@@ -2688,7 +2722,7 @@ if any notifications came in during the processing of the command. ...@@ -2688,7 +2722,7 @@ if any notifications came in during the processing of the command.
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term><function>PQnfields</function></term> <term><function>PQnfields</function><indexterm><primary>PQnfields</><secondary>with COPY</></></term>
<listitem> <listitem>
<para> <para>
Returns the number of columns (fields) to be copied. Returns the number of columns (fields) to be copied.
...@@ -2697,30 +2731,30 @@ if any notifications came in during the processing of the command. ...@@ -2697,30 +2731,30 @@ if any notifications came in during the processing of the command.
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><function>PQbinaryTuples</function></term> <term><function>PQbinaryTuples</function><indexterm><primary>PQbinaryTuples</><secondary>with COPY</></></term>
<listitem> <listitem>
<para> <para>
0 indicates the overall copy format is textual (rows 0 indicates the overall copy format is textual (rows
separated by newlines, columns separated by separator separated by newlines, columns separated by separator
characters, etc). characters, etc).
1 indicates the overall copy format is binary. 1 indicates the overall copy format is binary.
See <xref linkend="sql-copy" endterm="sql-copy-title"> See <xref linkend="sql-copy" endterm="sql-copy-title">
for more information. for more information.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><function>PQfformat</function></term> <term><function>PQfformat</function><indexterm><primary>PQfformat</><secondary>with COPY</></></term>
<listitem> <listitem>
<para> <para>
Returns the format code (0 for text, 1 for binary) associated Returns the format code (0 for text, 1 for binary) associated
with each column of the copy operation. The per-column format with each column of the copy operation. The per-column format
codes will always be zero when the overall copy format is textual, codes will always be zero when the overall copy format is textual,
but the binary format can support both text and binary columns. but the binary format can support both text and binary columns.
(However, as of the current implementation of <command>COPY</>, (However, as of the current implementation of <command>COPY</>,
only binary columns appear in a binary copy; so the per-column only binary columns appear in a binary copy; so the per-column
formats always match the overall format at present.) formats always match the overall format at present.)
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -2745,7 +2779,7 @@ When using protocol 2.0, all these functions will return 0. ...@@ -2745,7 +2779,7 @@ When using protocol 2.0, all these functions will return 0.
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term><function>PQputCopyData</function></term> <term><function>PQputCopyData</function><indexterm><primary>PQputCopyData</></></term>
<listitem> <listitem>
<para> <para>
Sends data to the server during <literal>COPY_IN</> state. Sends data to the server during <literal>COPY_IN</> state.
...@@ -2776,7 +2810,7 @@ by the <command>COPY</> command; see ...@@ -2776,7 +2810,7 @@ by the <command>COPY</> command; see
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><function>PQputCopyEnd</function></term> <term><function>PQputCopyEnd</function><indexterm><primary>PQputCopyEnd</></></term>
<listitem> <listitem>
<para> <para>
Sends end-of-data indication to the server during <literal>COPY_IN</> state. Sends end-of-data indication to the server during <literal>COPY_IN</> state.
...@@ -2828,7 +2862,7 @@ operation. ...@@ -2828,7 +2862,7 @@ operation.
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term><function>PQgetCopyData</function></term> <term><function>PQgetCopyData</function><indexterm><primary>PQgetCopyData</></></term>
<listitem> <listitem>
<para> <para>
Receives data from the server during <literal>COPY_OUT</> state. Receives data from the server during <literal>COPY_OUT</> state.
...@@ -2897,7 +2931,7 @@ operation. ...@@ -2897,7 +2931,7 @@ operation.
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term><function>PQgetline</function></term> <term><function>PQgetline</function><indexterm><primary>PQgetline</></></term>
<listitem> <listitem>
<para> <para>
Reads a newline-terminated line of characters Reads a newline-terminated line of characters
...@@ -2933,7 +2967,7 @@ for a terminator line). ...@@ -2933,7 +2967,7 @@ for a terminator line).
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><function>PQgetlineAsync</function></term> <term><function>PQgetlineAsync</function><indexterm><primary>PQgetlineAsync</></></term>
<listitem> <listitem>
<para> <para>
Reads a row of COPY data Reads a row of COPY data
...@@ -2985,7 +3019,7 @@ than the room actually available.) ...@@ -2985,7 +3019,7 @@ than the room actually available.)
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><function>PQputline</function></term> <term><function>PQputline</function><indexterm><primary>PQputline</></></term>
<listitem> <listitem>
<para> <para>
Sends a null-terminated string to the server. Sends a null-terminated string to the server.
...@@ -3019,7 +3053,7 @@ having sent the actual data. ...@@ -3019,7 +3053,7 @@ having sent the actual data.
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><function>PQputnbytes</function></term> <term><function>PQputnbytes</function><indexterm><primary>PQputnbytes</></></term>
<listitem> <listitem>
<para> <para>
Sends a non-null-terminated string to the server. Sends a non-null-terminated string to the server.
...@@ -3040,7 +3074,7 @@ specified directly. Use this procedure when sending binary data. ...@@ -3040,7 +3074,7 @@ specified directly. Use this procedure when sending binary data.
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><function>PQendcopy</function></term> <term><function>PQendcopy</function><indexterm><primary>PQendcopy</></></term>
<listitem> <listitem>
<para> <para>
Synchronizes with the server. Synchronizes with the server.
...@@ -3099,7 +3133,7 @@ These functions control miscellaneous details of ...@@ -3099,7 +3133,7 @@ These functions control miscellaneous details of
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term><function>PQsetErrorVerbosity</function></term> <term><function>PQsetErrorVerbosity</function><indexterm><primary>PQsetErrorVerbosity</></></term>
<listitem> <listitem>
<para> <para>
Determines the verbosity of messages returned by Determines the verbosity of messages returned by
...@@ -3125,7 +3159,7 @@ ones. ...@@ -3125,7 +3159,7 @@ ones.
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><function>PQtrace</function></term> <term><function>PQtrace</function><indexterm><primary>PQtrace</></></term>
<listitem> <listitem>
<para> <para>
Enables tracing of the client/server communication to a debugging file stream. Enables tracing of the client/server communication to a debugging file stream.
...@@ -3137,7 +3171,7 @@ void PQtrace(PGconn *conn, FILE *stream); ...@@ -3137,7 +3171,7 @@ void PQtrace(PGconn *conn, FILE *stream);
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><function>PQuntrace</function></term> <term><function>PQuntrace</function><indexterm><primary>PQuntrace</></></term>
<listitem> <listitem>
<para> <para>
Disables tracing started by <function>PQtrace</function>. Disables tracing started by <function>PQtrace</function>.
...@@ -3154,6 +3188,11 @@ void PQuntrace(PGconn *conn); ...@@ -3154,6 +3188,11 @@ void PQuntrace(PGconn *conn);
<sect1 id="libpq-notice-processing"> <sect1 id="libpq-notice-processing">
<title>Notice Processing</title> <title>Notice Processing</title>
<indexterm zone="libpq-notice-processing">
<primary>notice processing</primary>
<secondary>in libpq</secondary>
</indexterm>
<para> <para>
Notice and warning messages generated by the server are not returned by the Notice and warning messages generated by the server are not returned by the
query execution functions, since they do not imply failure of the query. query execution functions, since they do not imply failure of the query.
...@@ -3174,10 +3213,10 @@ work in the notice receiver. ...@@ -3174,10 +3213,10 @@ work in the notice receiver.
<para> <para>
The function <function>PQsetNoticeReceiver</function> The function <function>PQsetNoticeReceiver</function>
<indexterm><primary>notice receiver</></> <indexterm><primary>notice receiver</></><indexterm><primary>PQsetNoticeReceiver</></>
sets or examines the current notice receiver for a connection object. sets or examines the current notice receiver for a connection object.
Similarly, <function>PQsetNoticeProcessor</function> Similarly, <function>PQsetNoticeProcessor</function>
<indexterm><primary>notice processor</></> <indexterm><primary>notice processor</></><indexterm><primary>PQsetNoticeProcessor</></>
sets or examines the current notice processor. sets or examines the current notice processor.
<synopsis> <synopsis>
...@@ -3255,7 +3294,7 @@ functions like <function>PQgetvalue</function>. ...@@ -3255,7 +3294,7 @@ functions like <function>PQgetvalue</function>.
<title>Environment Variables</title> <title>Environment Variables</title>
<indexterm zone="libpq-envars"> <indexterm zone="libpq-envars">
<primary>environment variables</primary> <primary>environment variable</primary>
</indexterm> </indexterm>
<para> <para>
...@@ -3544,11 +3583,12 @@ call <function>fe_setauthsvc</function> at all. ...@@ -3544,11 +3583,12 @@ call <function>fe_setauthsvc</function> at all.
</para> </para>
<para> <para>
<application>libpq</application> applications that use the <literal>crypt</literal> <application>libpq</application> applications that use the
authentication method rely on the <literal>crypt()</literal> operating <literal>crypt</literal> authentication method rely on the
system function, which is often not thread-safe. It is better to use the <literal>crypt()</literal> operating system function, which is often
<literal>md5</literal> method, which is thread-safe on all not thread-safe.<indexterm><primary>crypt</><secondary>thread
platforms. safety</></> It is better to use the <literal>md5</literal> method,
which is thread-safe on all platforms.
</para> </para>
</sect1> </sect1>
...@@ -3556,6 +3596,11 @@ platforms. ...@@ -3556,6 +3596,11 @@ platforms.
<sect1 id="libpq-build"> <sect1 id="libpq-build">
<title>Building <application>libpq</application> Programs</title> <title>Building <application>libpq</application> Programs</title>
<indexterm zone="libpq-build">
<primary>compiling</primary>
<secondary>libpq applications</secondary>
</indexterm>
<para> <para>
To build (i.e., compile and link) your <application>libpq</application> programs you need to To build (i.e., compile and link) your <application>libpq</application> programs you need to
do all of the following things: do all of the following things:
...@@ -3600,12 +3645,12 @@ CPPFLAGS += -I/usr/local/pgsql/include ...@@ -3600,12 +3645,12 @@ CPPFLAGS += -I/usr/local/pgsql/include
</para> </para>
<para> <para>
<indexterm><primary>pg_config</></>
If there is any chance that your program might be compiled by If there is any chance that your program might be compiled by
other users then you should not hardcode the directory location other users then you should not hardcode the directory location
like that. Instead, you can run the utility like that. Instead, you can run the utility
<command>pg_config</command> to find out where the header files <command>pg_config</command><indexterm><primary>pg_config</><secondary
are on the local system: sortas="libpq">with libpq</></> to find out where the header
files are on the local system:
<screen> <screen>
<prompt>$</prompt> pg_config --includedir <prompt>$</prompt> pg_config --includedir
<computeroutput>/usr/local/include</computeroutput> <computeroutput>/usr/local/include</computeroutput>
...@@ -3694,7 +3739,7 @@ testlibpq.o(.text+0xa4): undefined reference to `PQerrorMessage' ...@@ -3694,7 +3739,7 @@ testlibpq.o(.text+0xa4): undefined reference to `PQerrorMessage'
/* /*
* testlibpq.c * testlibpq.c
* *
* Test the C version of LIBPQ, the POSTGRES frontend library. * Test the C version of LIBPQ, the POSTGRES frontend library.
*/ */
#include &lt;stdio.h&gt; #include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt; #include &lt;stdlib.h&gt;
...@@ -3703,112 +3748,112 @@ testlibpq.o(.text+0xa4): undefined reference to `PQerrorMessage' ...@@ -3703,112 +3748,112 @@ testlibpq.o(.text+0xa4): undefined reference to `PQerrorMessage'
static void static void
exit_nicely(PGconn *conn) exit_nicely(PGconn *conn)
{ {
PQfinish(conn); PQfinish(conn);
exit(1); exit(1);
} }
int int
main(int argc, char **argv) main(int argc, char **argv)
{ {
const char *conninfo; const char *conninfo;
PGconn *conn; PGconn *conn;
PGresult *res; PGresult *res;
int nFields; int nFields;
int i, int i,
j; j;
/* /*
* If the user supplies a parameter on the command line, use it as * If the user supplies a parameter on the command line, use it as
* the conninfo string; otherwise default to setting dbname=template1 * the conninfo string; otherwise default to setting dbname=template1
* and using environment variables or defaults for all other connection * and using environment variables or defaults for all other connection
* parameters. * parameters.
*/ */
if (argc &gt; 1) if (argc &gt; 1)
conninfo = argv[1]; conninfo = argv[1];
else else
conninfo = "dbname = template1"; conninfo = "dbname = template1";
/* Make a connection to the database */ /* Make a connection to the database */
conn = PQconnectdb(conninfo); conn = PQconnectdb(conninfo);
/* Check to see that the backend connection was successfully made */ /* Check to see that the backend connection was successfully made */
if (PQstatus(conn) != CONNECTION_OK) if (PQstatus(conn) != CONNECTION_OK)
{ {
fprintf(stderr, "Connection to database '%s' failed.\n", PQdb(conn)); fprintf(stderr, "Connection to database '%s' failed.\n", PQdb(conn));
fprintf(stderr, "%s", PQerrorMessage(conn)); fprintf(stderr, "%s", PQerrorMessage(conn));
exit_nicely(conn); exit_nicely(conn);
} }
/* /*
* Our test case here involves using a cursor, for which we must be * Our test case here involves using a cursor, for which we must be
* inside a transaction block. We could do the whole thing with a * inside a transaction block. We could do the whole thing with a
* single PQexec() of "select * from pg_database", but that's too * single PQexec() of "select * from pg_database", but that's too
* trivial to make a good example. * trivial to make a good example.
*/ */
/* Start a transaction block */ /* Start a transaction block */
res = PQexec(conn, "BEGIN"); res = PQexec(conn, "BEGIN");
if (PQresultStatus(res) != PGRES_COMMAND_OK) if (PQresultStatus(res) != PGRES_COMMAND_OK)
{ {
fprintf(stderr, "BEGIN command failed: %s", PQerrorMessage(conn)); fprintf(stderr, "BEGIN command failed: %s", PQerrorMessage(conn));
PQclear(res); PQclear(res);
exit_nicely(conn); exit_nicely(conn);
} }
/* /*
* Should PQclear PGresult whenever it is no longer needed to avoid * Should PQclear PGresult whenever it is no longer needed to avoid
* memory leaks * memory leaks
*/ */
PQclear(res); PQclear(res);
/* /*
* Fetch rows from pg_database, the system catalog of databases * Fetch rows from pg_database, the system catalog of databases
*/ */
res = PQexec(conn, "DECLARE myportal CURSOR FOR select * from pg_database"); res = PQexec(conn, "DECLARE myportal CURSOR FOR select * from pg_database");
if (PQresultStatus(res) != PGRES_COMMAND_OK) if (PQresultStatus(res) != PGRES_COMMAND_OK)
{ {
fprintf(stderr, "DECLARE CURSOR failed: %s", PQerrorMessage(conn)); fprintf(stderr, "DECLARE CURSOR failed: %s", PQerrorMessage(conn));
PQclear(res); PQclear(res);
exit_nicely(conn); exit_nicely(conn);
} }
PQclear(res); PQclear(res);
res = PQexec(conn, "FETCH ALL in myportal"); res = PQexec(conn, "FETCH ALL in myportal");
if (PQresultStatus(res) != PGRES_TUPLES_OK) if (PQresultStatus(res) != PGRES_TUPLES_OK)
{ {
fprintf(stderr, "FETCH ALL failed: %s", PQerrorMessage(conn)); fprintf(stderr, "FETCH ALL failed: %s", PQerrorMessage(conn));
PQclear(res); PQclear(res);
exit_nicely(conn); exit_nicely(conn);
} }
/* first, print out the attribute names */ /* first, print out the attribute names */
nFields = PQnfields(res); nFields = PQnfields(res);
for (i = 0; i &lt; nFields; i++) for (i = 0; i &lt; nFields; i++)
printf("%-15s", PQfname(res, i)); printf("%-15s", PQfname(res, i));
printf("\n\n"); printf("\n\n");
/* next, print out the rows */ /* next, print out the rows */
for (i = 0; i &lt; PQntuples(res); i++) for (i = 0; i &lt; PQntuples(res); i++)
{ {
for (j = 0; j &lt; nFields; j++) for (j = 0; j &lt; nFields; j++)
printf("%-15s", PQgetvalue(res, i, j)); printf("%-15s", PQgetvalue(res, i, j));
printf("\n"); printf("\n");
} }
PQclear(res); PQclear(res);
/* close the portal ... we don't bother to check for errors ... */ /* close the portal ... we don't bother to check for errors ... */
res = PQexec(conn, "CLOSE myportal"); res = PQexec(conn, "CLOSE myportal");
PQclear(res); PQclear(res);
/* end the transaction */ /* end the transaction */
res = PQexec(conn, "END"); res = PQexec(conn, "END");
PQclear(res); PQclear(res);
/* close the connection to the database and cleanup */ /* close the connection to the database and cleanup */
PQfinish(conn); PQfinish(conn);
return 0; return 0;
} }
</programlisting> </programlisting>
</example> </example>
...@@ -3819,7 +3864,7 @@ main(int argc, char **argv) ...@@ -3819,7 +3864,7 @@ main(int argc, char **argv)
<programlisting> <programlisting>
/* /*
* testlibpq2.c * testlibpq2.c
* Test of the asynchronous notification interface * Test of the asynchronous notification interface
* *
* Start this program, then from psql in another window do * Start this program, then from psql in another window do
* NOTIFY TBL2; * NOTIFY TBL2;
...@@ -3850,102 +3895,102 @@ main(int argc, char **argv) ...@@ -3850,102 +3895,102 @@ main(int argc, char **argv)
static void static void
exit_nicely(PGconn *conn) exit_nicely(PGconn *conn)
{ {
PQfinish(conn); PQfinish(conn);
exit(1); exit(1);
} }
int int
main(int argc, char **argv) main(int argc, char **argv)
{ {
const char *conninfo; const char *conninfo;
PGconn *conn; PGconn *conn;
PGresult *res; PGresult *res;
PGnotify *notify; PGnotify *notify;
int nnotifies; int nnotifies;
/* /*
* If the user supplies a parameter on the command line, use it as * If the user supplies a parameter on the command line, use it as
* the conninfo string; otherwise default to setting dbname=template1 * the conninfo string; otherwise default to setting dbname=template1
* and using environment variables or defaults for all other connection * and using environment variables or defaults for all other connection
* parameters. * parameters.
*/ */
if (argc &gt; 1) if (argc &gt; 1)
conninfo = argv[1]; conninfo = argv[1];
else else
conninfo = "dbname = template1"; conninfo = "dbname = template1";
/* Make a connection to the database */ /* Make a connection to the database */
conn = PQconnectdb(conninfo); conn = PQconnectdb(conninfo);
/* Check to see that the backend connection was successfully made */ /* Check to see that the backend connection was successfully made */
if (PQstatus(conn) != CONNECTION_OK) if (PQstatus(conn) != CONNECTION_OK)
{ {
fprintf(stderr, "Connection to database '%s' failed.\n", PQdb(conn)); fprintf(stderr, "Connection to database '%s' failed.\n", PQdb(conn));
fprintf(stderr, "%s", PQerrorMessage(conn)); fprintf(stderr, "%s", PQerrorMessage(conn));
exit_nicely(conn); exit_nicely(conn);
} }
/* /*
* Issue LISTEN command to enable notifications from the rule's NOTIFY. * Issue LISTEN command to enable notifications from the rule's NOTIFY.
*/ */
res = PQexec(conn, "LISTEN TBL2"); res = PQexec(conn, "LISTEN TBL2");
if (PQresultStatus(res) != PGRES_COMMAND_OK) if (PQresultStatus(res) != PGRES_COMMAND_OK)
{ {
fprintf(stderr, "LISTEN command failed: %s", PQerrorMessage(conn)); fprintf(stderr, "LISTEN command failed: %s", PQerrorMessage(conn));
PQclear(res); PQclear(res);
exit_nicely(conn); exit_nicely(conn);
} }
/* /*
* should PQclear PGresult whenever it is no longer needed to avoid * should PQclear PGresult whenever it is no longer needed to avoid
* memory leaks * memory leaks
*/ */
PQclear(res); PQclear(res);
/* Quit after four notifies are received. */ /* Quit after four notifies are received. */
nnotifies = 0; nnotifies = 0;
while (nnotifies &lt; 4) while (nnotifies &lt; 4)
{ {
/* /*
* Sleep until something happens on the connection. We use select(2) * Sleep until something happens on the connection. We use select(2)
* to wait for input, but you could also use poll() or similar * to wait for input, but you could also use poll() or similar
* facilities. * facilities.
*/ */
int sock; int sock;
fd_set input_mask; fd_set input_mask;
sock = PQsocket(conn); sock = PQsocket(conn);
if (sock &lt; 0) if (sock &lt; 0)
break; /* shouldn't happen */ break; /* shouldn't happen */
FD_ZERO(&amp;input_mask); FD_ZERO(&amp;input_mask);
FD_SET(sock, &amp;input_mask); FD_SET(sock, &amp;input_mask);
if (select(sock + 1, &amp;input_mask, NULL, NULL, NULL) &lt; 0) if (select(sock + 1, &amp;input_mask, NULL, NULL, NULL) &lt; 0)
{ {
fprintf(stderr, "select() failed: %s\n", strerror(errno)); fprintf(stderr, "select() failed: %s\n", strerror(errno));
exit_nicely(conn); exit_nicely(conn);
} }
/* Now check for input */ /* Now check for input */
PQconsumeInput(conn); PQconsumeInput(conn);
while ((notify = PQnotifies(conn)) != NULL) while ((notify = PQnotifies(conn)) != NULL)
{ {
fprintf(stderr, fprintf(stderr,
"ASYNC NOTIFY of '%s' received from backend pid %d\n", "ASYNC NOTIFY of '%s' received from backend pid %d\n",
notify-&gt;relname, notify-&gt;be_pid); notify-&gt;relname, notify-&gt;be_pid);
PQfreemem(notify); PQfreemem(notify);
nnotifies++; nnotifies++;
} }
} }
fprintf(stderr, "Done.\n"); fprintf(stderr, "Done.\n");
/* close the connection to the database and cleanup */ /* close the connection to the database and cleanup */
PQfinish(conn); PQfinish(conn);
return 0; return 0;
} }
</programlisting> </programlisting>
</example> </example>
...@@ -3956,7 +4001,7 @@ main(int argc, char **argv) ...@@ -3956,7 +4001,7 @@ main(int argc, char **argv)
<programlisting> <programlisting>
/* /*
* testlibpq3.c * testlibpq3.c
* Test out-of-line parameters and binary I/O. * Test out-of-line parameters and binary I/O.
* *
* Before running this, populate a database with the following commands * Before running this, populate a database with the following commands
* (provided in src/test/examples/testlibpq3.sql): * (provided in src/test/examples/testlibpq3.sql):
...@@ -3988,125 +4033,125 @@ main(int argc, char **argv) ...@@ -3988,125 +4033,125 @@ main(int argc, char **argv)
static void static void
exit_nicely(PGconn *conn) exit_nicely(PGconn *conn)
{ {
PQfinish(conn); PQfinish(conn);
exit(1); exit(1);
} }
int int
main(int argc, char **argv) main(int argc, char **argv)
{ {
const char *conninfo; const char *conninfo;
PGconn *conn; PGconn *conn;
PGresult *res; PGresult *res;
const char *paramValues[1]; const char *paramValues[1];
int i, int i,
j; j;
int i_fnum, int i_fnum,
t_fnum, t_fnum,
b_fnum; b_fnum;
/* /*
* If the user supplies a parameter on the command line, use it as * If the user supplies a parameter on the command line, use it as
* the conninfo string; otherwise default to setting dbname=template1 * the conninfo string; otherwise default to setting dbname=template1
* and using environment variables or defaults for all other connection * and using environment variables or defaults for all other connection
* parameters. * parameters.
*/ */
if (argc &gt; 1) if (argc &gt; 1)
conninfo = argv[1]; conninfo = argv[1];
else else
conninfo = "dbname = template1"; conninfo = "dbname = template1";
/* Make a connection to the database */ /* Make a connection to the database */
conn = PQconnectdb(conninfo); conn = PQconnectdb(conninfo);
/* Check to see that the backend connection was successfully made */ /* Check to see that the backend connection was successfully made */
if (PQstatus(conn) != CONNECTION_OK) if (PQstatus(conn) != CONNECTION_OK)
{ {
fprintf(stderr, "Connection to database '%s' failed.\n", PQdb(conn)); fprintf(stderr, "Connection to database '%s' failed.\n", PQdb(conn));
fprintf(stderr, "%s", PQerrorMessage(conn)); fprintf(stderr, "%s", PQerrorMessage(conn));
exit_nicely(conn); exit_nicely(conn);
} }
/* /*
* The point of this program is to illustrate use of PQexecParams() * The point of this program is to illustrate use of PQexecParams()
* with out-of-line parameters, as well as binary transmission of * with out-of-line parameters, as well as binary transmission of
* results. By using out-of-line parameters we can avoid a lot of * results. By using out-of-line parameters we can avoid a lot of
* tedious mucking about with quoting and escaping. Notice how we * tedious mucking about with quoting and escaping. Notice how we
* don't have to do anything special with the quote mark in the * don't have to do anything special with the quote mark in the
* parameter value. * parameter value.
*/ */
/* Here is our out-of-line parameter value */ /* Here is our out-of-line parameter value */
paramValues[0] = "joe's place"; paramValues[0] = "joe's place";
res = PQexecParams(conn, res = PQexecParams(conn,
"SELECT * FROM test1 WHERE t = $1", "SELECT * FROM test1 WHERE t = $1",
1, /* one param */ 1, /* one param */
NULL, /* let the backend deduce param type */ NULL, /* let the backend deduce param type */
paramValues, paramValues,
NULL, /* don't need param lengths since text */ NULL, /* don't need param lengths since text */
NULL, /* default to all text params */ NULL, /* default to all text params */
1); /* ask for binary results */ 1); /* ask for binary results */
if (PQresultStatus(res) != PGRES_TUPLES_OK) if (PQresultStatus(res) != PGRES_TUPLES_OK)
{ {
fprintf(stderr, "SELECT failed: %s", PQerrorMessage(conn)); fprintf(stderr, "SELECT failed: %s", PQerrorMessage(conn));
PQclear(res); PQclear(res);
exit_nicely(conn); exit_nicely(conn);
} }
/* Use PQfnumber to avoid assumptions about field order in result */ /* Use PQfnumber to avoid assumptions about field order in result */
i_fnum = PQfnumber(res, "i"); i_fnum = PQfnumber(res, "i");
t_fnum = PQfnumber(res, "t"); t_fnum = PQfnumber(res, "t");
b_fnum = PQfnumber(res, "b"); b_fnum = PQfnumber(res, "b");
for (i = 0; i &lt; PQntuples(res); i++) for (i = 0; i &lt; PQntuples(res); i++)
{ {
char *iptr; char *iptr;
char *tptr; char *tptr;
char *bptr; char *bptr;
int blen; int blen;
int ival; int ival;
/* Get the field values (we ignore possibility they are null!) */ /* Get the field values (we ignore possibility they are null!) */
iptr = PQgetvalue(res, i, i_fnum); iptr = PQgetvalue(res, i, i_fnum);
tptr = PQgetvalue(res, i, t_fnum); tptr = PQgetvalue(res, i, t_fnum);
bptr = PQgetvalue(res, i, b_fnum); bptr = PQgetvalue(res, i, b_fnum);
/* /*
* The binary representation of INT4 is in network byte order, * The binary representation of INT4 is in network byte order,
* which we'd better coerce to the local byte order. * which we'd better coerce to the local byte order.
*/ */
ival = ntohl(*((uint32_t *) iptr)); ival = ntohl(*((uint32_t *) iptr));
/* /*
* The binary representation of TEXT is, well, text, and since * The binary representation of TEXT is, well, text, and since
* libpq was nice enough to append a zero byte to it, it'll work * libpq was nice enough to append a zero byte to it, it'll work
* just fine as a C string. * just fine as a C string.
* *
* The binary representation of BYTEA is a bunch of bytes, which * The binary representation of BYTEA is a bunch of bytes, which
* could include embedded nulls so we have to pay attention to * could include embedded nulls so we have to pay attention to
* field length. * field length.
*/ */
blen = PQgetlength(res, i, b_fnum); blen = PQgetlength(res, i, b_fnum);
printf("tuple %d: got\n", i); printf("tuple %d: got\n", i);
printf(" i = (%d bytes) %d\n", printf(" i = (%d bytes) %d\n",
PQgetlength(res, i, i_fnum), ival); PQgetlength(res, i, i_fnum), ival);
printf(" t = (%d bytes) '%s'\n", printf(" t = (%d bytes) '%s'\n",
PQgetlength(res, i, t_fnum), tptr); PQgetlength(res, i, t_fnum), tptr);
printf(" b = (%d bytes) ", blen); printf(" b = (%d bytes) ", blen);
for (j = 0; j &lt; blen; j++) for (j = 0; j &lt; blen; j++)
printf("\\%03o", bptr[j]); printf("\\%03o", bptr[j]);
printf("\n\n"); printf("\n\n");
} }
PQclear(res); PQclear(res);
/* close the connection to the database and cleanup */ /* close the connection to the database and cleanup */
PQfinish(conn); PQfinish(conn);
return 0; return 0;
} }
</programlisting> </programlisting>
</example> </example>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/lobj.sgml,v 1.29 2003/06/21 21:51:33 tgl Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/lobj.sgml,v 1.30 2003/08/31 17:32:19 petere Exp $
--> -->
<chapter id="largeObjects"> <chapter id="largeObjects">
...@@ -113,6 +113,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/lobj.sgml,v 1.29 2003/06/21 21:51:33 tgl Ex ...@@ -113,6 +113,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/lobj.sgml,v 1.29 2003/06/21 21:51:33 tgl Ex
<synopsis> <synopsis>
Oid lo_creat(PGconn *conn, int mode); Oid lo_creat(PGconn *conn, int mode);
</synopsis> </synopsis>
<indexterm><primary>lo_creat</></>
creates a new large object. creates a new large object.
<replaceable class="parameter">mode</replaceable> is a bit mask <replaceable class="parameter">mode</replaceable> is a bit mask
describing several different attributes of the new describing several different attributes of the new
...@@ -143,7 +144,8 @@ inv_oid = lo_creat(INV_READ|INV_WRITE); ...@@ -143,7 +144,8 @@ inv_oid = lo_creat(INV_READ|INV_WRITE);
<synopsis> <synopsis>
Oid lo_import(PGconn *conn, const char *filename); Oid lo_import(PGconn *conn, const char *filename);
</synopsis> </synopsis>
<replaceable class="parameter">filename</replaceable> <indexterm><primary>lo_import</></>
<replaceable class="parameter">filename</replaceable>
specifies the operating system name of specifies the operating system name of
the file to be imported as a large object. the file to be imported as a large object.
The return value is the OID that was assigned to the new large object. The return value is the OID that was assigned to the new large object.
...@@ -159,6 +161,7 @@ Oid lo_import(PGconn *conn, const char *filename); ...@@ -159,6 +161,7 @@ Oid lo_import(PGconn *conn, const char *filename);
<synopsis> <synopsis>
int lo_export(PGconn *conn, Oid lobjId, const char *filename); int lo_export(PGconn *conn, Oid lobjId, const char *filename);
</synopsis> </synopsis>
<indexterm><primary>lo_export</></>
The <parameter>lobjId</parameter> argument specifies the OID of the large The <parameter>lobjId</parameter> argument specifies the OID of the large
object to export and the <parameter>filename</parameter> argument specifies object to export and the <parameter>filename</parameter> argument specifies
the operating system name name of the file. the operating system name name of the file.
...@@ -173,6 +176,7 @@ int lo_export(PGconn *conn, Oid lobjId, const char *filename); ...@@ -173,6 +176,7 @@ int lo_export(PGconn *conn, Oid lobjId, const char *filename);
<synopsis> <synopsis>
int lo_open(PGconn *conn, Oid lobjId, int mode); int lo_open(PGconn *conn, Oid lobjId, int mode);
</synopsis> </synopsis>
<indexterm><primary>lo_open</></>
The <parameter>lobjId</parameter> argument specifies the OID of the large The <parameter>lobjId</parameter> argument specifies the OID of the large
object to open. The <parameter>mode</parameter> bits control whether the object to open. The <parameter>mode</parameter> bits control whether the
object is opened for reading (<symbol>INV_READ</>), writing (<symbol>INV_WRITE</symbol>), or object is opened for reading (<symbol>INV_READ</>), writing (<symbol>INV_WRITE</symbol>), or
...@@ -194,10 +198,13 @@ int lo_open(PGconn *conn, Oid lobjId, int mode); ...@@ -194,10 +198,13 @@ int lo_open(PGconn *conn, Oid lobjId, int mode);
<synopsis> <synopsis>
int lo_write(PGconn *conn, int fd, const char *buf, size_t len); int lo_write(PGconn *conn, int fd, const char *buf, size_t len);
</synopsis> </synopsis>
writes <parameter>len</parameter> bytes from <parameter>buf</parameter> to large object <parameter>fd</>. The <parameter>fd</parameter> <indexterm><primary>lo_write</></> writes
argument must have been returned by a previous <function>lo_open</function>. <parameter>len</parameter> bytes from <parameter>buf</parameter>
The number of bytes actually written is returned. In to large object <parameter>fd</>. The <parameter>fd</parameter>
the event of an error, the return value is negative. argument must have been returned by a previous
<function>lo_open</function>. The number of bytes actually
written is returned. In the event of an error, the return value
is negative.
</para> </para>
</sect2> </sect2>
...@@ -209,10 +216,13 @@ int lo_write(PGconn *conn, int fd, const char *buf, size_t len); ...@@ -209,10 +216,13 @@ int lo_write(PGconn *conn, int fd, const char *buf, size_t len);
<synopsis> <synopsis>
int lo_read(PGconn *conn, int fd, char *buf, size_t len); int lo_read(PGconn *conn, int fd, char *buf, size_t len);
</synopsis> </synopsis>
reads <parameter>len</parameter> bytes from large object <parameter>fd</parameter> into <parameter>buf</parameter>. The <parameter>fd</parameter> <indexterm><primary>lo_read</></> reads
argument must have been returned by a previous <function>lo_open</function>. <parameter>len</parameter> bytes from large object
The number of bytes actually read is returned. In <parameter>fd</parameter> into <parameter>buf</parameter>. The
the event of an error, the return value is negative. <parameter>fd</parameter> argument must have been returned by a
previous <function>lo_open</function>. The number of bytes
actually read is returned. In the event of an error, the return
value is negative.
</para> </para>
</sect2> </sect2>
...@@ -225,10 +235,14 @@ int lo_read(PGconn *conn, int fd, char *buf, size_t len); ...@@ -225,10 +235,14 @@ int lo_read(PGconn *conn, int fd, char *buf, size_t len);
<synopsis> <synopsis>
int lo_lseek(PGconn *conn, int fd, int offset, int whence); int lo_lseek(PGconn *conn, int fd, int offset, int whence);
</synopsis> </synopsis>
This function moves the current location pointer for the <indexterm><primary>lo_lseek</></> This function moves the
large object described by <parameter>fd</> to the new location specified current location pointer for the large object described by
by <parameter>offset</>. The valid values for <parameter>whence</> are <parameter>fd</> to the new location specified by
<symbol>SEEK_SET</> (seek from object start), <symbol>SEEK_CUR</> (seek from current position), and <symbol>SEEK_END</> (seek from object end). The return value is the new location pointer. <parameter>offset</>. The valid values for <parameter>whence</>
are <symbol>SEEK_SET</> (seek from object start),
<symbol>SEEK_CUR</> (seek from current position), and
<symbol>SEEK_END</> (seek from object end). The return value is
the new location pointer.
</para> </para>
</sect2> </sect2>
...@@ -241,7 +255,8 @@ int lo_lseek(PGconn *conn, int fd, int offset, int whence); ...@@ -241,7 +255,8 @@ int lo_lseek(PGconn *conn, int fd, int offset, int whence);
<synopsis> <synopsis>
int lo_tell(PGconn *conn, int fd); int lo_tell(PGconn *conn, int fd);
</synopsis> </synopsis>
If there is an error, the return value is negative. <indexterm><primary>lo_tell</></> If there is an error, the
return value is negative.
</para> </para>
</sect2> </sect2>
...@@ -253,9 +268,10 @@ int lo_tell(PGconn *conn, int fd); ...@@ -253,9 +268,10 @@ int lo_tell(PGconn *conn, int fd);
<synopsis> <synopsis>
int lo_close(PGconn *conn, int fd); int lo_close(PGconn *conn, int fd);
</synopsis> </synopsis>
where <parameter>fd</> is a large object descriptor returned by <indexterm><primary>lo_close</></> where <parameter>fd</> is a
<function>lo_open</function>. On success, <function>lo_close</function> large object descriptor returned by <function>lo_open</function>.
returns zero. On error, the return value is negative. On success, <function>lo_close</function> returns zero. On
error, the return value is negative.
</para> </para>
<para> <para>
...@@ -272,8 +288,10 @@ int lo_close(PGconn *conn, int fd); ...@@ -272,8 +288,10 @@ int lo_close(PGconn *conn, int fd);
<synopsis> <synopsis>
int lo_unlink(PGconn *conn, Oid lobjId); int lo_unlink(PGconn *conn, Oid lobjId);
</synopsis> </synopsis>
The <parameter>lobjId</parameter> argument specifies the OID of the large <indexterm><primary>lo_unlink</></> The
object to remove. In the event of an error, the return value is negative. <parameter>lobjId</parameter> argument specifies the OID of the
large object to remove. In the event of an error, the return
value is negative.
</para> </para>
</sect2> </sect2>
...@@ -284,11 +302,13 @@ int lo_unlink(PGconn *conn, Oid lobjId); ...@@ -284,11 +302,13 @@ int lo_unlink(PGconn *conn, Oid lobjId);
<title>Server-side Functions</title> <title>Server-side Functions</title>
<para> <para>
There are two built-in server-side functions, <function>lo_import</function> There are two built-in server-side functions,
and <function>lo_export</function>, for large object access, which are available for use <function>lo_import</function><indexterm><primary>lo_import</></>
in <acronym>SQL</acronym> and
commands. <function>lo_export</function>,<indexterm><primary>lo_export</></>
Here is an example of their use: for large object access, which are available for use in
<acronym>SQL</acronym> commands. Here is an example of their
use:
<programlisting> <programlisting>
CREATE TABLE image ( CREATE TABLE image (
name text, name text,
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/maintenance.sgml,v 1.23 2003/06/18 12:19:11 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/maintenance.sgml,v 1.24 2003/08/31 17:32:19 petere Exp $
--> -->
<chapter id="maintenance"> <chapter id="maintenance">
<title>Routine Database Maintenance Tasks</title> <title>Routine Database Maintenance Tasks</title>
<indexterm zone="maintenance">
<primary>maintenance</primary>
</indexterm>
<para> <para>
There are a few routine maintenance chores that must be performed on There are a few routine maintenance chores that must be performed on
a regular basis to keep a <productname>PostgreSQL</productname> a regular basis to keep a <productname>PostgreSQL</productname>
...@@ -158,6 +162,15 @@ $Header: /cvsroot/pgsql/doc/src/sgml/maintenance.sgml,v 1.23 2003/06/18 12:19:11 ...@@ -158,6 +162,15 @@ $Header: /cvsroot/pgsql/doc/src/sgml/maintenance.sgml,v 1.23 2003/06/18 12:19:11
<sect2 id="vacuum-for-statistics"> <sect2 id="vacuum-for-statistics">
<title>Updating planner statistics</title> <title>Updating planner statistics</title>
<indexterm zone="vacuum-for-statistics">
<primary>statistics</primary>
<secondary>of the planner</secondary>
</indexterm>
<indexterm zone="vacuum-for-statistics">
<primary>ANALYZE</primary>
</indexterm>
<para> <para>
The <productname>PostgreSQL</productname> query planner relies on The <productname>PostgreSQL</productname> query planner relies on
statistical information about the contents of tables in order to statistical information about the contents of tables in order to
...@@ -396,7 +409,8 @@ VACUUM ...@@ -396,7 +409,8 @@ VACUUM
<title>Log File Maintenance</title> <title>Log File Maintenance</title>
<indexterm zone="logfile-maintenance"> <indexterm zone="logfile-maintenance">
<primary>log files</primary> <primary>server log</primary>
<secondary>log file maintenance</secondary>
</indexterm> </indexterm>
<para> <para>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/manage-ag.sgml,v 2.27 2003/03/25 16:15:37 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/manage-ag.sgml,v 2.28 2003/08/31 17:32:19 petere Exp $
--> -->
<chapter id="managing-databases"> <chapter id="managing-databases">
...@@ -19,6 +19,10 @@ $Header: /cvsroot/pgsql/doc/src/sgml/manage-ag.sgml,v 2.27 2003/03/25 16:15:37 p ...@@ -19,6 +19,10 @@ $Header: /cvsroot/pgsql/doc/src/sgml/manage-ag.sgml,v 2.27 2003/03/25 16:15:37 p
<sect1 id="manage-ag-overview"> <sect1 id="manage-ag-overview">
<title>Overview</title> <title>Overview</title>
<indexterm zone="manage-ag-overview">
<primary>schema</primary>
</indexterm>
<para> <para>
A database is a named collection of <acronym>SQL</acronym> objects A database is a named collection of <acronym>SQL</acronym> objects
(<quote>database objects</quote>). Generally, every database (<quote>database objects</quote>). Generally, every database
...@@ -70,8 +74,8 @@ $Header: /cvsroot/pgsql/doc/src/sgml/manage-ag.sgml,v 2.27 2003/03/25 16:15:37 p ...@@ -70,8 +74,8 @@ $Header: /cvsroot/pgsql/doc/src/sgml/manage-ag.sgml,v 2.27 2003/03/25 16:15:37 p
</para> </para>
<para> <para>
Databases are created with the SQL command Databases are created with the SQL command <command>CREATE
<command>CREATE DATABASE</command>: DATABASE</command>:<indexterm><primary>CREATE DATABASE</></>
<synopsis> <synopsis>
CREATE DATABASE <replaceable>name</>; CREATE DATABASE <replaceable>name</>;
</synopsis> </synopsis>
...@@ -93,9 +97,10 @@ CREATE DATABASE <replaceable>name</>; ...@@ -93,9 +97,10 @@ CREATE DATABASE <replaceable>name</>;
question remains how the <emphasis>first</> database at any given question remains how the <emphasis>first</> database at any given
site can be created. The first database is always created by the site can be created. The first database is always created by the
<command>initdb</> command when the data storage area is <command>initdb</> command when the data storage area is
initialized. (See <xref linkend="creating-cluster">.) initialized. (See <xref linkend="creating-cluster">.) This
This database is called <literal>template1</>. So to create the database is called
first <quote>real</> database you can connect to <literal>template1</>.<indexterm><primary>template1</></> So to
create the first <quote>real</> database you can connect to
<literal>template1</>. <literal>template1</>.
</para> </para>
...@@ -112,7 +117,7 @@ CREATE DATABASE <replaceable>name</>; ...@@ -112,7 +117,7 @@ CREATE DATABASE <replaceable>name</>;
<para> <para>
As an extra convenience, there is also a program that you can As an extra convenience, there is also a program that you can
execute from the shell to create new databases, execute from the shell to create new databases,
<command>createdb</>. <command>createdb</>.<indexterm><primary>createdb</></>
<synopsis> <synopsis>
createdb <replaceable class="parameter">dbname</replaceable> createdb <replaceable class="parameter">dbname</replaceable>
...@@ -157,31 +162,33 @@ createdb -O <replaceable>username</> <replaceable>dbname</> ...@@ -157,31 +162,33 @@ createdb -O <replaceable>username</> <replaceable>dbname</>
<para> <para>
<command>CREATE DATABASE</> actually works by copying an existing <command>CREATE DATABASE</> actually works by copying an existing
database. By default, it copies the standard system database named database. By default, it copies the standard system database named
<literal>template1</>. Thus that database is the <quote>template</> <literal>template1</>.<indexterm><primary>template1</></> Thus that
from which new databases are made. If you add objects to database is the <quote>template</> from which new databases are
<literal>template1</>, these objects made. If you add objects to <literal>template1</>, these objects
will be copied into subsequently created user databases. This will be copied into subsequently created user databases. This
behavior allows site-local modifications to the standard set of behavior allows site-local modifications to the standard set of
objects in databases. For example, if you install the procedural objects in databases. For example, if you install the procedural
language <application>PL/pgSQL</> in <literal>template1</>, it will language <application>PL/pgSQL</> in <literal>template1</>, it will
automatically be available in user databases without any extra action automatically be available in user databases without any extra
being taken when those databases are made. action being taken when those databases are made.
</para> </para>
<para> <para>
There is a second standard system database named <literal>template0</>. There is a second standard system database named
This database contains the same data as the initial contents of <literal>template0</>.<indexterm><primary>template0</></> This
<literal>template1</>, that is, only the standard objects predefined by database contains the same data as the initial contents of
your version of <productname>PostgreSQL</productname>. <literal>template1</>, that is, only the standard objects
<literal>template0</> should never be changed predefined by your version of
after <command>initdb</>. By instructing <command>CREATE DATABASE</> to <productname>PostgreSQL</productname>. <literal>template0</>
copy <literal>template0</> instead of <literal>template1</>, you can should never be changed after <command>initdb</>. By instructing
create a <quote>virgin</> user database that contains none of the <command>CREATE DATABASE</> to copy <literal>template0</> instead
site-local additions in <literal>template1</>. This is particularly of <literal>template1</>, you can create a <quote>virgin</> user
handy when restoring a <literal>pg_dump</> dump: the dump script should database that contains none of the site-local additions in
be restored in a virgin database to ensure that one recreates the <literal>template1</>. This is particularly handy when restoring a
correct contents of the dumped database, without any conflicts with <literal>pg_dump</> dump: the dump script should be restored in a
additions that may now be present in <literal>template1</>. virgin database to ensure that one recreates the correct contents
of the dumped database, without any conflicts with additions that
may now be present in <literal>template1</>.
</para> </para>
<para> <para>
...@@ -214,7 +221,7 @@ createdb -T template0 <replaceable>dbname</> ...@@ -214,7 +221,7 @@ createdb -T template0 <replaceable>dbname</>
</para> </para>
<para> <para>
Two useful flags exist in <literal>pg_database</literal> for each Two useful flags exist in <literal>pg_database</literal><indexterm><primary>pg_database</></> for each
database: the columns <literal>datistemplate</literal> and database: the columns <literal>datistemplate</literal> and
<literal>datallowconn</literal>. <literal>datistemplate</literal> <literal>datallowconn</literal>. <literal>datistemplate</literal>
may be set to indicate that a database is intended as a template for may be set to indicate that a database is intended as a template for
...@@ -382,7 +389,8 @@ gmake CPPFLAGS=-DALLOW_ABSOLUTE_DBPATHS all ...@@ -382,7 +389,8 @@ gmake CPPFLAGS=-DALLOW_ABSOLUTE_DBPATHS all
<title>Destroying a Database</title> <title>Destroying a Database</title>
<para> <para>
Databases are destroyed with the command <command>DROP DATABASE</command>: Databases are destroyed with the command <command>DROP
DATABASE</command>:<indexterm><primary>DROP DATABASE</></>
<synopsis> <synopsis>
DROP DATABASE <replaceable>name</>; DROP DATABASE <replaceable>name</>;
</synopsis> </synopsis>
...@@ -403,7 +411,8 @@ DROP DATABASE <replaceable>name</>; ...@@ -403,7 +411,8 @@ DROP DATABASE <replaceable>name</>;
</para> </para>
<para> <para>
For convenience, there is also a shell program to drop databases: For convenience, there is also a shell program to drop
databases:<indexterm><primary>dropdb</></>
<synopsis> <synopsis>
dropdb <replaceable class="parameter">dbname</replaceable> dropdb <replaceable class="parameter">dbname</replaceable>
</synopsis> </synopsis>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/monitoring.sgml,v 1.20 2003/04/04 03:03:53 tgl Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/monitoring.sgml,v 1.21 2003/08/31 17:32:19 petere Exp $
--> -->
<chapter id="monitoring"> <chapter id="monitoring">
<title>Monitoring Database Activity</title> <title>Monitoring Database Activity</title>
<indexterm zone="monitoring">
<primary>monitoring</primary>
<secondary>database activity</secondary>
</indexterm>
<indexterm zone="monitoring">
<primary>database activity</primary>
<secondary>monitoring</secondary>
</indexterm>
<para> <para>
A database administrator frequently wonders, <quote>What is the system A database administrator frequently wonders, <quote>What is the system
doing right now?</quote> doing right now?</quote>
...@@ -589,6 +599,11 @@ SELECT pg_stat_get_backend_pid(s.backendid) AS procpid, ...@@ -589,6 +599,11 @@ SELECT pg_stat_get_backend_pid(s.backendid) AS procpid,
<sect1 id="monitoring-locks"> <sect1 id="monitoring-locks">
<title>Viewing Locks</title> <title>Viewing Locks</title>
<indexterm zone="monitoring-locks">
<primary>lock</primary>
<secondary>monitoring</secondary>
</indexterm>
<para> <para>
Another useful tool for monitoring database activity is the Another useful tool for monitoring database activity is the
<literal>pg_locks</literal> system table. It allows the <literal>pg_locks</literal> system table. It allows the
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/mvcc.sgml,v 2.35 2003/03/25 16:15:37 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/mvcc.sgml,v 2.36 2003/08/31 17:32:19 petere Exp $
--> -->
<chapter id="mvcc"> <chapter id="mvcc">
...@@ -22,6 +22,10 @@ $Header: /cvsroot/pgsql/doc/src/sgml/mvcc.sgml,v 2.35 2003/03/25 16:15:37 petere ...@@ -22,6 +22,10 @@ $Header: /cvsroot/pgsql/doc/src/sgml/mvcc.sgml,v 2.35 2003/03/25 16:15:37 petere
<sect1 id="mvcc-intro"> <sect1 id="mvcc-intro">
<title>Introduction</title> <title>Introduction</title>
<indexterm>
<primary>MVCC</primary>
</indexterm>
<para> <para>
Unlike traditional database systems which use locks for concurrency control, Unlike traditional database systems which use locks for concurrency control,
<productname>PostgreSQL</productname> <productname>PostgreSQL</productname>
...@@ -57,6 +61,10 @@ $Header: /cvsroot/pgsql/doc/src/sgml/mvcc.sgml,v 2.35 2003/03/25 16:15:37 petere ...@@ -57,6 +61,10 @@ $Header: /cvsroot/pgsql/doc/src/sgml/mvcc.sgml,v 2.35 2003/03/25 16:15:37 petere
<sect1 id="transaction-iso"> <sect1 id="transaction-iso">
<title>Transaction Isolation</title> <title>Transaction Isolation</title>
<indexterm>
<primary>transaction isolation</primary>
</indexterm>
<para> <para>
The <acronym>SQL</acronym> standard defines four levels of The <acronym>SQL</acronym> standard defines four levels of
transaction isolation in terms of three phenomena that must be transaction isolation in terms of three phenomena that must be
...@@ -108,7 +116,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/mvcc.sgml,v 2.35 2003/03/25 16:15:37 petere ...@@ -108,7 +116,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/mvcc.sgml,v 2.35 2003/03/25 16:15:37 petere
<para> <para>
<indexterm> <indexterm>
<primary>isolation levels</primary> <primary>transaction isolation level</primary>
</indexterm> </indexterm>
The four transaction isolation levels and the corresponding The four transaction isolation levels and the corresponding
behaviors are described in <xref linkend="mvcc-isolevel-table">. behaviors are described in <xref linkend="mvcc-isolevel-table">.
...@@ -206,7 +214,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/mvcc.sgml,v 2.35 2003/03/25 16:15:37 petere ...@@ -206,7 +214,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/mvcc.sgml,v 2.35 2003/03/25 16:15:37 petere
<title>Read Committed Isolation Level</title> <title>Read Committed Isolation Level</title>
<indexterm> <indexterm>
<primary>isolation levels</primary> <primary>transaction isolation level</primary>
<secondary>read committed</secondary> <secondary>read committed</secondary>
</indexterm> </indexterm>
...@@ -292,7 +300,7 @@ COMMIT; ...@@ -292,7 +300,7 @@ COMMIT;
<title>Serializable Isolation Level</title> <title>Serializable Isolation Level</title>
<indexterm> <indexterm>
<primary>isolation levels</primary> <primary>transaction isolation level</primary>
<secondary>serializable</secondary> <secondary>serializable</secondary>
</indexterm> </indexterm>
...@@ -376,7 +384,7 @@ ERROR: Can't serialize access due to concurrent update ...@@ -376,7 +384,7 @@ ERROR: Can't serialize access due to concurrent update
<title>Explicit Locking</title> <title>Explicit Locking</title>
<indexterm> <indexterm>
<primary>locking</primary> <primary>lock</primary>
</indexterm> </indexterm>
<para> <para>
...@@ -394,6 +402,10 @@ ERROR: Can't serialize access due to concurrent update ...@@ -394,6 +402,10 @@ ERROR: Can't serialize access due to concurrent update
<sect2 id="locking-tables"> <sect2 id="locking-tables">
<title>Table-Level Locks</title> <title>Table-Level Locks</title>
<indexterm zone="locking-tables">
<primary>LOCK</primary>
</indexterm>
<para> <para>
The list below shows the available lock modes and the contexts in The list below shows the available lock modes and the contexts in
which they are used automatically by which they are used automatically by
...@@ -644,6 +656,10 @@ ERROR: Can't serialize access due to concurrent update ...@@ -644,6 +656,10 @@ ERROR: Can't serialize access due to concurrent update
<sect2 id="locking-deadlocks"> <sect2 id="locking-deadlocks">
<title>Deadlocks</title> <title>Deadlocks</title>
<indexterm zone="locking-deadlocks">
<primary>deadlock</primary>
</indexterm>
<para> <para>
The use of explicit locking can increase the likelyhood of The use of explicit locking can increase the likelyhood of
<firstterm>deadlocks</>, wherein two (or more) transactions each <firstterm>deadlocks</>, wherein two (or more) transactions each
...@@ -813,6 +829,11 @@ UPDATE accounts SET balance = balance - 100.00 WHERE acctnum = 22222; ...@@ -813,6 +829,11 @@ UPDATE accounts SET balance = balance - 100.00 WHERE acctnum = 22222;
<sect1 id="locking-indexes"> <sect1 id="locking-indexes">
<title>Locking and Indexes</title> <title>Locking and Indexes</title>
<indexterm zone="locking-indexes">
<primary>index</primary>
<secondary>locks</secondary>
</indexterm>
<para> <para>
Though <productname>PostgreSQL</productname> Though <productname>PostgreSQL</productname>
provides nonblocking read/write access to table provides nonblocking read/write access to table
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/perform.sgml,v 1.30 2003/06/25 02:07:33 momjian Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/perform.sgml,v 1.31 2003/08/31 17:32:19 petere Exp $
--> -->
<chapter id="performance-tips"> <chapter id="performance-tips">
...@@ -15,6 +15,14 @@ $Header: /cvsroot/pgsql/doc/src/sgml/perform.sgml,v 1.30 2003/06/25 02:07:33 mom ...@@ -15,6 +15,14 @@ $Header: /cvsroot/pgsql/doc/src/sgml/perform.sgml,v 1.30 2003/06/25 02:07:33 mom
<sect1 id="using-explain"> <sect1 id="using-explain">
<title>Using <command>EXPLAIN</command></title> <title>Using <command>EXPLAIN</command></title>
<indexterm zone="using-explain">
<primary>EXPLAIN</primary>
</indexterm>
<indexterm zone="using-explain">
<primary>query plan</primary>
</indexterm>
<para> <para>
<productname>PostgreSQL</productname> devises a <firstterm>query <productname>PostgreSQL</productname> devises a <firstterm>query
plan</firstterm> for each query it is given. Choosing the right plan</firstterm> for each query it is given. Choosing the right
...@@ -336,6 +344,11 @@ EXPLAIN ANALYZE SELECT * FROM tenk1 t1, tenk2 t2 WHERE t1.unique1 &lt; 50 AND t1 ...@@ -336,6 +344,11 @@ EXPLAIN ANALYZE SELECT * FROM tenk1 t1, tenk2 t2 WHERE t1.unique1 &lt; 50 AND t1
<sect1 id="planner-stats"> <sect1 id="planner-stats">
<title>Statistics Used by the Planner</title> <title>Statistics Used by the Planner</title>
<indexterm zone="planner-stats">
<primary>statistics</primary>
<secondary>of the planner</secondary>
</indexterm>
<para> <para>
As we saw in the previous section, the query planner needs to estimate As we saw in the previous section, the query planner needs to estimate
the number of rows retrieved by a query in order to make good choices the number of rows retrieved by a query in order to make good choices
...@@ -381,6 +394,10 @@ SELECT relname, relkind, reltuples, relpages FROM pg_class WHERE relname LIKE 't ...@@ -381,6 +394,10 @@ SELECT relname, relkind, reltuples, relpages FROM pg_class WHERE relname LIKE 't
since it does not read every row of the table. since it does not read every row of the table.
</para> </para>
<indexterm>
<primary>pg_statistic</primary>
</indexterm>
<para> <para>
Most queries retrieve only a fraction of the rows in a table, due Most queries retrieve only a fraction of the rows in a table, due
to having <literal>WHERE</> clauses that restrict the rows to be examined. to having <literal>WHERE</> clauses that restrict the rows to be examined.
...@@ -393,6 +410,10 @@ SELECT relname, relkind, reltuples, relpages FROM pg_class WHERE relname LIKE 't ...@@ -393,6 +410,10 @@ SELECT relname, relkind, reltuples, relpages FROM pg_class WHERE relname LIKE 't
and are always approximate even when freshly updated. and are always approximate even when freshly updated.
</para> </para>
<indexterm>
<primary>pg_stats</primary>
</indexterm>
<para> <para>
Rather than look at <structname>pg_statistic</structname> directly, Rather than look at <structname>pg_statistic</structname> directly,
it's better to look at its view <structname>pg_stats</structname> it's better to look at its view <structname>pg_stats</structname>
...@@ -538,6 +559,11 @@ SELECT attname, n_distinct, most_common_vals FROM pg_stats WHERE tablename = 'ro ...@@ -538,6 +559,11 @@ SELECT attname, n_distinct, most_common_vals FROM pg_stats WHERE tablename = 'ro
<sect1 id="explicit-joins"> <sect1 id="explicit-joins">
<title>Controlling the Planner with Explicit <literal>JOIN</> Clauses</title> <title>Controlling the Planner with Explicit <literal>JOIN</> Clauses</title>
<indexterm zone="explicit-joins">
<primary>join</primary>
<secondary>controlling the order</secondary>
</indexterm>
<para> <para>
It is possible It is possible
to control the query planner to some extent by using the explicit <literal>JOIN</> to control the query planner to some extent by using the explicit <literal>JOIN</>
...@@ -700,6 +726,10 @@ SELECT * FROM x, y, a, b, c WHERE something AND somethingelse; ...@@ -700,6 +726,10 @@ SELECT * FROM x, y, a, b, c WHERE something AND somethingelse;
<sect2 id="disable-autocommit"> <sect2 id="disable-autocommit">
<title>Disable Autocommit</title> <title>Disable Autocommit</title>
<indexterm zone="disable-autocommit">
<primary>autocommit</primary>
</indexterm>
<para> <para>
Turn off autocommit and just do one commit at Turn off autocommit and just do one commit at
the end. (In plain SQL, this means issuing <command>BEGIN</command> the end. (In plain SQL, this means issuing <command>BEGIN</command>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/plperl.sgml,v 2.19 2003/04/07 01:29:25 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/plperl.sgml,v 2.20 2003/08/31 17:32:19 petere Exp $
--> -->
<chapter id="plperl"> <chapter id="plperl">
...@@ -73,11 +73,12 @@ CREATE FUNCTION perl_max (integer, integer) RETURNS integer AS ' ...@@ -73,11 +73,12 @@ CREATE FUNCTION perl_max (integer, integer) RETURNS integer AS '
</para> </para>
<para> <para>
If an SQL null value is passed to a function, the argument value If an SQL null value<indexterm><primary>null value</><secondary
will appear as <quote>undefined</> in Perl. The above function sortas="PL/Perl">in PL/Perl</></indexterm> is passed to a function,
definition will not behave very nicely with null inputs (in fact, the argument value will appear as <quote>undefined</> in Perl. The
it will act as though they are zeroes). We could add above function definition will not behave very nicely with null
<literal>STRICT</> to the function definition to make inputs (in fact, it will act as though they are zeroes). We could
add <literal>STRICT</> to the function definition to make
<productname>PostgreSQL</productname> do something more reasonable: <productname>PostgreSQL</productname> do something more reasonable:
if a null value is passed, the function will not be called at all, if a null value is passed, the function will not be called at all,
but will just return a null result automatically. Alternatively, but will just return a null result automatically. Alternatively,
...@@ -170,7 +171,7 @@ SELECT name, empcomp(employee) FROM employee; ...@@ -170,7 +171,7 @@ SELECT name, empcomp(employee) FROM employee;
mirror sites</ulink>). This module makes available a mirror sites</ulink>). This module makes available a
<acronym>DBI</>-compliant database-handle named <acronym>DBI</>-compliant database-handle named
<varname>$pg_dbh</varname> that can be used to perform queries <varname>$pg_dbh</varname> that can be used to perform queries
with normal <acronym>DBI</> syntax. with normal <acronym>DBI</> syntax.<indexterm><primary>DBI</></indexterm>
</para> </para>
<para> <para>
...@@ -180,7 +181,7 @@ SELECT name, empcomp(employee) FROM employee; ...@@ -180,7 +181,7 @@ SELECT name, empcomp(employee) FROM employee;
<varlistentry> <varlistentry>
<indexterm> <indexterm>
<primary>elog</primary> <primary>elog</primary>
<secondary>PL/Perl</secondary> <secondary>in PL/Perl</secondary>
</indexterm> </indexterm>
<term><function>elog</> <replaceable>level</replaceable>, <replaceable>msg</replaceable></term> <term><function>elog</> <replaceable>level</replaceable>, <replaceable>msg</replaceable></term>
...@@ -202,6 +203,11 @@ SELECT name, empcomp(employee) FROM employee; ...@@ -202,6 +203,11 @@ SELECT name, empcomp(employee) FROM employee;
<sect1 id="plperl-trusted"> <sect1 id="plperl-trusted">
<title>Trusted and Untrusted PL/Perl</title> <title>Trusted and Untrusted PL/Perl</title>
<indexterm zone="plperl-trusted">
<primary>trusted</primary>
<secondary>PL/Perl</secondary>
</indexterm>
<para> <para>
Normally, PL/Perl is installed as a <quote>trusted</> programming Normally, PL/Perl is installed as a <quote>trusted</> programming
language named <literal>plperl</>. In this setup, certain Perl language named <literal>plperl</>. In this setup, certain Perl
...@@ -231,13 +237,14 @@ CREATE FUNCTION badfunc() RETURNS integer AS ' ...@@ -231,13 +237,14 @@ CREATE FUNCTION badfunc() RETURNS integer AS '
<para> <para>
Sometimes it is desirable to write Perl functions that are not Sometimes it is desirable to write Perl functions that are not
restricted. For example, one might want a Perl function that restricted. For example, one might want a Perl function that sends
sends mail. To handle these cases, PL/Perl can also be installed mail. To handle these cases, PL/Perl can also be installed as an
as an <quote>untrusted</> language (usually called <quote>untrusted</> language (usually called
<application>PL/PerlU</application>). In this case the full Perl language is <application>PL/PerlU</application><indexterm><primary>PL/PerlU</></indexterm>).
available. If the <command>createlang</command> program is used to In this case the full Perl language is available. If the
install the language, the language name <literal>plperlu</literal> <command>createlang</command> program is used to install the
will select the untrusted PL/Perl variant. language, the language name <literal>plperlu</literal> will select
the untrusted PL/Perl variant.
</para> </para>
<para> <para>
...@@ -272,7 +279,9 @@ CREATE FUNCTION badfunc() RETURNS integer AS ' ...@@ -272,7 +279,9 @@ CREATE FUNCTION badfunc() RETURNS integer AS '
<listitem> <listitem>
<para> <para>
PL/Perl cannot be used to write trigger functions. PL/Perl cannot be used to write trigger
functions.<indexterm><primary>trigger</><secondary>in
PL/Perl</></indexterm>
</para> </para>
</listitem> </listitem>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/plpgsql.sgml,v 1.20 2003/08/09 22:50:22 tgl Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/plpgsql.sgml,v 1.21 2003/08/31 17:32:19 petere Exp $
--> -->
<chapter id="plpgsql"> <chapter id="plpgsql">
...@@ -63,20 +63,22 @@ $Header: /cvsroot/pgsql/doc/src/sgml/plpgsql.sgml,v 1.20 2003/08/09 22:50:22 tgl ...@@ -63,20 +63,22 @@ $Header: /cvsroot/pgsql/doc/src/sgml/plpgsql.sgml,v 1.20 2003/08/09 22:50:22 tgl
</para> </para>
<para> <para>
As each expression and <acronym>SQL</acronym> command is first used As each expression and <acronym>SQL</acronym> command is first
in the function, the <application>PL/pgSQL</> interpreter creates used in the function, the <application>PL/pgSQL</> interpreter
a prepared execution plan (using the <acronym>SPI</acronym> creates a prepared execution plan (using the
manager's <function>SPI_prepare</function> and <acronym>SPI</acronym> manager's <function>SPI_prepare</function>
<function>SPI_saveplan</function> functions). Subsequent visits and <function>SPI_saveplan</function>
to that expression or command reuse the prepared plan. Thus, a functions).<indexterm><primary>preparing a query</><secondary>in
function with conditional code that contains many statements for PL/pgSQL</></> Subsequent visits to that expression or command
which execution plans might be required will only prepare and save reuse the prepared plan. Thus, a function with conditional code
those plans that are really used during the lifetime of the that contains many statements for which execution plans might be
database connection. This can substantially reduce the total required will only prepare and save those plans that are really
amount of time required to parse, and generate execution plans for the used during the lifetime of the database connection. This can
statements in a <application>PL/pgSQL</> function. A disadvantage is substantially reduce the total amount of time required to parse,
that errors in a specific expression or command may not be detected and generate execution plans for the statements in a
until that part of the function is reached in execution. <application>PL/pgSQL</> function. A disadvantage is that errors
in a specific expression or command may not be detected until that
part of the function is reached in execution.
</para> </para>
<para> <para>
...@@ -196,7 +198,7 @@ END; ...@@ -196,7 +198,7 @@ END;
and return the <quote>polymorphic</> types and return the <quote>polymorphic</> types
<type>anyelement</type> and <type>anyarray</type>. The actual <type>anyelement</type> and <type>anyarray</type>. The actual
datatypes handled by a polymorphic function can vary from call to datatypes handled by a polymorphic function can vary from call to
call, as discussed in <xref linkend="types-polymorphic">. call, as discussed in <xref linkend="extend-types-polymorphic">.
An example is shown in <xref linkend="plpgsql-declaration-aliases">. An example is shown in <xref linkend="plpgsql-declaration-aliases">.
</para> </para>
...@@ -563,7 +565,7 @@ END; ...@@ -563,7 +565,7 @@ END;
or <type>anyarray</type>), a special parameter <literal>$0</literal> or <type>anyarray</type>), a special parameter <literal>$0</literal>
is created. Its datatype is the actual return type of the function, is created. Its datatype is the actual return type of the function,
as deduced from the actual input types (see <xref as deduced from the actual input types (see <xref
linkend="types-polymorphic">). linkend="extend-types-polymorphic">).
This allows the function to access its actual return type This allows the function to access its actual return type
as shown in <xref linkend="plpgsql-declaration-type">. as shown in <xref linkend="plpgsql-declaration-type">.
<literal>$0</literal> is initialized to NULL and can be modified by <literal>$0</literal> is initialized to NULL and can be modified by
...@@ -903,6 +905,11 @@ tax := subtotal * 0.06; ...@@ -903,6 +905,11 @@ tax := subtotal * 0.06;
<sect2 id="plpgsql-select-into"> <sect2 id="plpgsql-select-into">
<title><command>SELECT INTO</command></title> <title><command>SELECT INTO</command></title>
<indexterm zone="plpgsql-select-into">
<primary>SELECT INTO</primary>
<secondary>in PL/pgSQL</secondary>
</indexterm>
<para> <para>
The result of a <command>SELECT</command> command yielding multiple columns (but The result of a <command>SELECT</command> command yielding multiple columns (but
only one row) can be assigned to a record variable, row-type only one row) can be assigned to a record variable, row-type
...@@ -1097,14 +1104,16 @@ EXECUTE ''UPDATE tbl SET '' ...@@ -1097,14 +1104,16 @@ EXECUTE ''UPDATE tbl SET ''
<para> <para>
This example shows use of the functions This example shows use of the functions
<function>quote_ident(<type>text</type>)</function> and <function>quote_ident(<type>text</type>)</function> and
<function>quote_literal(<type>text</type>)</function>. <function>quote_literal(<type>text</type>)</function>.<indexterm><primary>quote_ident</><secondary>use
Variables containing column and table identifiers should be in
passed to function <function>quote_ident</function>. PL/pgSQL</></indexterm><indexterm><primary>quote_literal</><secondary>use
Variables containing values that should be literal strings in the in PL/pgSQL</></indexterm> Variables containing column and table
constructed command should be passed to identifiers should be passed to function
<function>quote_literal</function>. Both take the <function>quote_ident</function>. Variables containing values
appropriate steps to return the input text enclosed in double that should be literal strings in the constructed command should
or single quotes respectively, with any embedded special characters be passed to <function>quote_literal</function>. Both take the
appropriate steps to return the input text enclosed in double or
single quotes respectively, with any embedded special characters
properly escaped. properly escaped.
</para> </para>
...@@ -1517,6 +1526,11 @@ END IF; ...@@ -1517,6 +1526,11 @@ END IF;
<sect2 id="plpgsql-control-structures-loops"> <sect2 id="plpgsql-control-structures-loops">
<title>Simple Loops</title> <title>Simple Loops</title>
<indexterm zone="plpgsql-control-structures-loops">
<primary>loop</primary>
<secondary>in PL/pgSQL</secondary>
</indexterm>
<para> <para>
With the <literal>LOOP</>, <literal>EXIT</>, <literal>WHILE</>, With the <literal>LOOP</>, <literal>EXIT</>, <literal>WHILE</>,
and <literal>FOR</> statements, you can arrange for your and <literal>FOR</> statements, you can arrange for your
...@@ -1734,6 +1748,11 @@ END LOOP; ...@@ -1734,6 +1748,11 @@ END LOOP;
<sect1 id="plpgsql-cursors"> <sect1 id="plpgsql-cursors">
<title>Cursors</title> <title>Cursors</title>
<indexterm zone="plpgsql-cursors">
<primary>cursor</primary>
<secondary>in PL/pgSQL</secondary>
</indexterm>
<para> <para>
Rather than executing a whole query at once, it is possible to set Rather than executing a whole query at once, it is possible to set
up a <firstterm>cursor</> that encapsulates the query, and then read up a <firstterm>cursor</> that encapsulates the query, and then read
...@@ -2096,6 +2115,11 @@ RAISE EXCEPTION ''Inexistent ID --> %'', user_id; ...@@ -2096,6 +2115,11 @@ RAISE EXCEPTION ''Inexistent ID --> %'', user_id;
<sect1 id="plpgsql-trigger"> <sect1 id="plpgsql-trigger">
<title>Trigger Procedures</title> <title>Trigger Procedures</title>
<indexterm zone="plpgsql-trigger">
<primary>trigger</primary>
<secondary>in PL/pgSQL</secondary>
</indexterm>
<para> <para>
<application>PL/pgSQL</application> can be used to define trigger <application>PL/pgSQL</application> can be used to define trigger
procedures. A trigger procedure is created with the procedures. A trigger procedure is created with the
...@@ -2302,10 +2326,12 @@ CREATE TRIGGER emp_stamp BEFORE INSERT OR UPDATE ON emp ...@@ -2302,10 +2326,12 @@ CREATE TRIGGER emp_stamp BEFORE INSERT OR UPDATE ON emp
<indexterm zone="plpgsql-porting"> <indexterm zone="plpgsql-porting">
<primary>Oracle</primary> <primary>Oracle</primary>
<secondary>porting from PL/SQL to PL/pgSQL</secondary>
</indexterm> </indexterm>
<indexterm zone="plpgsql-porting"> <indexterm zone="plpgsql-porting">
<primary>PL/SQL</primary> <primary>PL/SQL (Oracle)</primary>
<secondary>porting to PL/pgSQL</secondary>
</indexterm> </indexterm>
<para> <para>
...@@ -2546,7 +2572,8 @@ END; ...@@ -2546,7 +2572,8 @@ END;
with <literal>OUT</> parameters and string manipulation. with <literal>OUT</> parameters and string manipulation.
<productname>PostgreSQL</> does not have an <productname>PostgreSQL</> does not have an
<function>instr</function> function, but you can work around it <function>instr</function> function, but you can work around it
using a combination of other functions. In <xref using a combination of other
functions.<indexterm><primary>instr</></indexterm> In <xref
linkend="plpgsql-porting-appendix"> there is a linkend="plpgsql-porting-appendix"> there is a
<application>PL/pgSQL</application> implementation of <application>PL/pgSQL</application> implementation of
<function>instr</function> that you can use to make your porting <function>instr</function> that you can use to make your porting
......
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/plpython.sgml,v 1.18 2003/07/01 13:52:29 tgl Exp $ --> <!-- $Header: /cvsroot/pgsql/doc/src/sgml/plpython.sgml,v 1.19 2003/08/31 17:32:19 petere Exp $ -->
<chapter id="plpython"> <chapter id="plpython">
<title>PL/Python - Python Procedural Language</title> <title>PL/Python - Python Procedural Language</title>
...@@ -68,9 +68,10 @@ def __plpython_procedure_myfunc_23456(): ...@@ -68,9 +68,10 @@ def __plpython_procedure_myfunc_23456():
<para> <para>
If you do not provide a return value, Python returns the default If you do not provide a return value, Python returns the default
<symbol>None</symbol>. The <symbol>None</symbol>. The language module translates Python's
language module translates Python's <symbol>None</symbol> into the <symbol>None</symbol> into the SQL null
SQL null value. value.<indexterm><primary>null value</><secondary
sortas="PL/Python">in PL/Python</></indexterm>
</para> </para>
<para> <para>
...@@ -87,7 +88,9 @@ def __plpython_procedure_myfunc_23456(): ...@@ -87,7 +88,9 @@ def __plpython_procedure_myfunc_23456():
The global dictionary <varname>SD</varname> is available to store The global dictionary <varname>SD</varname> is available to store
data between function calls. This variable is private static data. data between function calls. This variable is private static data.
The global dictionary <varname>GD</varname> is public data, The global dictionary <varname>GD</varname> is public data,
available to all Python functions within a session. Use with care. available to all Python functions within a session. Use with
care.<indexterm><primary>global data</><secondary>in
PL/Python</></indexterm>
</para> </para>
<para> <para>
...@@ -102,6 +105,11 @@ def __plpython_procedure_myfunc_23456(): ...@@ -102,6 +105,11 @@ def __plpython_procedure_myfunc_23456():
<sect1 id="plpython-trigger"> <sect1 id="plpython-trigger">
<title>Trigger Functions</title> <title>Trigger Functions</title>
<indexterm zone="plpython-trigger">
<primary>trigger</primary>
<secondary>in PL/Python</secondary>
</indexterm>
<para> <para>
When a function is used in a trigger, the dictionary When a function is used in a trigger, the dictionary
<literal>TD</literal> contains trigger-related values. The trigger <literal>TD</literal> contains trigger-related values. The trigger
...@@ -146,7 +154,8 @@ def __plpython_procedure_myfunc_23456(): ...@@ -146,7 +154,8 @@ def __plpython_procedure_myfunc_23456():
<literal>plpy.error("msg")</literal>, and <literal>plpy.error("msg")</literal>, and
<literal>plpy.fatal("msg")</literal>. They are mostly equivalent <literal>plpy.fatal("msg")</literal>. They are mostly equivalent
to calling <literal>elog(<replaceable>LEVEL</>, "msg")</literal> to calling <literal>elog(<replaceable>LEVEL</>, "msg")</literal>
from C code. <function>plpy.error</function> and from C code.<indexterm><primary>elog</><secondary>in
PL/Python</></indexterm> <function>plpy.error</function> and
<function>plpy.fatal</function> actually raise a Python exception <function>plpy.fatal</function> actually raise a Python exception
which, if uncaught, causes the PL/Python module to call which, if uncaught, causes the PL/Python module to call
<literal>elog(ERROR, msg)</literal> when the function handler <literal>elog(ERROR, msg)</literal> when the function handler
...@@ -187,10 +196,11 @@ foo = rv[i]["my_column"] ...@@ -187,10 +196,11 @@ foo = rv[i]["my_column"]
</para> </para>
<para> <para>
The second function, <function>plpy.prepare</function>, prepares the <indexterm><primary>preparing a query</><secondary>in PL/Python</></indexterm>
execution plan for a query. It is called with a query string and a The second function, <function>plpy.prepare</function>, prepares
list of parameter types, if you have parameter references in the the execution plan for a query. It is called with a query string
query. For example: and a list of parameter types, if you have parameter references in
the query. For example:
<programlisting> <programlisting>
plan = plpy.prepare("SELECT last_name FROM my_users WHERE first_name = $1", [ "text" ]) plan = plpy.prepare("SELECT last_name FROM my_users WHERE first_name = $1", [ "text" ])
</programlisting> </programlisting>
...@@ -235,7 +245,8 @@ CREATE FUNCTION usesavedplan() RETURNS trigger AS ' ...@@ -235,7 +245,8 @@ CREATE FUNCTION usesavedplan() RETURNS trigger AS '
</para> </para>
</sect1> </sect1>
<!-- NOT CURRENTLY SUPPORTED <![IGNORE[
<!-- NOT CURRENTLY SUPPORTED -->
<sect1 id="plpython-trusted"> <sect1 id="plpython-trusted">
<title>Restricted Environment</title> <title>Restricted Environment</title>
...@@ -259,6 +270,6 @@ CREATE FUNCTION usesavedplan() RETURNS trigger AS ' ...@@ -259,6 +270,6 @@ CREATE FUNCTION usesavedplan() RETURNS trigger AS '
</para> </para>
</sect1> </sect1>
--> ]]>
</chapter> </chapter>
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/pltcl.sgml,v 2.24 2003/06/22 16:17:00 tgl Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/pltcl.sgml,v 2.25 2003/08/31 17:32:19 petere Exp $
--> -->
<chapter id="pltcl"> <chapter id="pltcl">
...@@ -190,6 +190,11 @@ CREATE FUNCTION overpaid(employee) RETURNS boolean AS ' ...@@ -190,6 +190,11 @@ CREATE FUNCTION overpaid(employee) RETURNS boolean AS '
<sect1 id="pltcl-global"> <sect1 id="pltcl-global">
<title>Global Data in PL/Tcl</title> <title>Global Data in PL/Tcl</title>
<indexterm zone="pltcl-global">
<primary>global data</primary>
<secondary>in PL/Tcl</secondary>
</indexterm>
<para> <para>
Sometimes it Sometimes it
is useful to have some global data that is held between two is useful to have some global data that is held between two
...@@ -298,8 +303,10 @@ spi_exec -array C "SELECT * FROM pg_class" { ...@@ -298,8 +303,10 @@ spi_exec -array C "SELECT * FROM pg_class" {
<term><function>spi_prepare</function> <replaceable>query</replaceable> <replaceable>typelist</replaceable></term> <term><function>spi_prepare</function> <replaceable>query</replaceable> <replaceable>typelist</replaceable></term>
<listitem> <listitem>
<para> <para>
Prepares and saves a query plan for later execution. The saved plan Prepares and saves a query plan for later execution. The
will be retained for the life of the current session. saved plan will be retained for the life of the current
session.<indexterm><primary>preparing a query</><secondary>in
PL/Tcl</></>
</para> </para>
<para> <para>
The query may use parameters, that is, placeholders for The query may use parameters, that is, placeholders for
...@@ -437,7 +444,7 @@ SELECT 'doesn''t' AS ret ...@@ -437,7 +444,7 @@ SELECT 'doesn''t' AS ret
<varlistentry> <varlistentry>
<indexterm> <indexterm>
<primary>elog</primary> <primary>elog</primary>
<secondary>PL/Tcl</secondary> <secondary>in PL/Tcl</secondary>
</indexterm> </indexterm>
<term><function>elog</> <replaceable>level</replaceable> <replaceable>msg</replaceable></term> <term><function>elog</> <replaceable>level</replaceable> <replaceable>msg</replaceable></term>
<listitem> <listitem>
...@@ -466,7 +473,7 @@ SELECT 'doesn''t' AS ret ...@@ -466,7 +473,7 @@ SELECT 'doesn''t' AS ret
<title>Trigger Procedures in PL/Tcl</title> <title>Trigger Procedures in PL/Tcl</title>
<indexterm> <indexterm>
<primary>triggers</primary> <primary>trigger</primary>
<secondary>in PL/Tcl</secondary> <secondary>in PL/Tcl</secondary>
</indexterm> </indexterm>
......
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/queries.sgml,v 1.22 2003/08/14 23:13:27 tgl Exp $ --> <!-- $Header: /cvsroot/pgsql/doc/src/sgml/queries.sgml,v 1.23 2003/08/31 17:32:19 petere Exp $ -->
<chapter id="queries"> <chapter id="queries">
<title>Queries</title> <title>Queries</title>
<indexterm zone="queries">
<primary>query</primary>
</indexterm>
<indexterm zone="queries">
<primary>SELECT</primary>
</indexterm>
<para> <para>
The previous chapters explained how to create tables, how to fill The previous chapters explained how to create tables, how to fill
them with data, and how to manipulate that data. Now we finally them with data, and how to manipulate that data. Now we finally
...@@ -73,6 +81,10 @@ SELECT random(); ...@@ -73,6 +81,10 @@ SELECT random();
<sect1 id="queries-table-expressions"> <sect1 id="queries-table-expressions">
<title>Table Expressions</title> <title>Table Expressions</title>
<indexterm zone="queries-table-expressions">
<primary>table expression</primary>
</indexterm>
<para> <para>
A <firstterm>table expression</firstterm> computes a table. The A <firstterm>table expression</firstterm> computes a table. The
table expression contains a <literal>FROM</> clause that is table expression contains a <literal>FROM</> clause that is
...@@ -112,6 +124,10 @@ FROM <replaceable>table_reference</replaceable> <optional>, <replaceable>table_r ...@@ -112,6 +124,10 @@ FROM <replaceable>table_reference</replaceable> <optional>, <replaceable>table_r
overall table expression. overall table expression.
</para> </para>
<indexterm>
<primary>ONLY</primary>
</indexterm>
<para> <para>
When a table reference names a table that is the supertable of a When a table reference names a table that is the supertable of a
table inheritance hierarchy, the table reference produces rows of table inheritance hierarchy, the table reference produces rows of
...@@ -125,7 +141,7 @@ FROM <replaceable>table_reference</replaceable> <optional>, <replaceable>table_r ...@@ -125,7 +141,7 @@ FROM <replaceable>table_reference</replaceable> <optional>, <replaceable>table_r
<title>Joined Tables</title> <title>Joined Tables</title>
<indexterm zone="queries-join"> <indexterm zone="queries-join">
<primary>joins</primary> <primary>join</primary>
</indexterm> </indexterm>
<para> <para>
...@@ -141,10 +157,14 @@ FROM <replaceable>table_reference</replaceable> <optional>, <replaceable>table_r ...@@ -141,10 +157,14 @@ FROM <replaceable>table_reference</replaceable> <optional>, <replaceable>table_r
<term>Cross join</term> <term>Cross join</term>
<indexterm> <indexterm>
<primary>joins</primary> <primary>join</primary>
<secondary>cross</secondary> <secondary>cross</secondary>
</indexterm> </indexterm>
<indexterm>
<primary>cross join</primary>
</indexterm>
<listitem> <listitem>
<synopsis> <synopsis>
<replaceable>T1</replaceable> CROSS JOIN <replaceable>T2</replaceable> <replaceable>T1</replaceable> CROSS JOIN <replaceable>T2</replaceable>
...@@ -175,10 +195,14 @@ FROM <replaceable>table_reference</replaceable> <optional>, <replaceable>table_r ...@@ -175,10 +195,14 @@ FROM <replaceable>table_reference</replaceable> <optional>, <replaceable>table_r
<term>Qualified joins</term> <term>Qualified joins</term>
<indexterm> <indexterm>
<primary>joins</primary> <primary>join</primary>
<secondary>outer</secondary> <secondary>outer</secondary>
</indexterm> </indexterm>
<indexterm>
<primary>outer join</primary>
</indexterm>
<listitem> <listitem>
<synopsis> <synopsis>
<replaceable>T1</replaceable> { <optional>INNER</optional> | { LEFT | RIGHT | FULL } <optional>OUTER</optional> } JOIN <replaceable>T2</replaceable> ON <replaceable>boolean_expression</replaceable> <replaceable>T1</replaceable> { <optional>INNER</optional> | { LEFT | RIGHT | FULL } <optional>OUTER</optional> } JOIN <replaceable>T2</replaceable> ON <replaceable>boolean_expression</replaceable>
...@@ -227,9 +251,12 @@ FROM <replaceable>table_reference</replaceable> <optional>, <replaceable>table_r ...@@ -227,9 +251,12 @@ FROM <replaceable>table_reference</replaceable> <optional>, <replaceable>table_r
<para> <para>
<indexterm> <indexterm>
<primary>joins</primary> <primary>join</primary>
<secondary>natural</secondary> <secondary>natural</secondary>
</indexterm> </indexterm>
<indexterm>
<primary>natural join</primary>
</indexterm>
Finally, <literal>NATURAL</> is a shorthand form of Finally, <literal>NATURAL</> is a shorthand form of
<literal>USING</>: it forms a <literal>USING</> list <literal>USING</>: it forms a <literal>USING</> list
consisting of exactly those column names that appear in both consisting of exactly those column names that appear in both
...@@ -256,10 +283,14 @@ FROM <replaceable>table_reference</replaceable> <optional>, <replaceable>table_r ...@@ -256,10 +283,14 @@ FROM <replaceable>table_reference</replaceable> <optional>, <replaceable>table_r
<term><literal>LEFT OUTER JOIN</></term> <term><literal>LEFT OUTER JOIN</></term>
<indexterm> <indexterm>
<primary>joins</primary> <primary>join</primary>
<secondary>left</secondary> <secondary>left</secondary>
</indexterm> </indexterm>
<indexterm>
<primary>left join</primary>
</indexterm>
<listitem> <listitem>
<para> <para>
First, an inner join is performed. Then, for each row in First, an inner join is performed. Then, for each row in
...@@ -274,6 +305,15 @@ FROM <replaceable>table_reference</replaceable> <optional>, <replaceable>table_r ...@@ -274,6 +305,15 @@ FROM <replaceable>table_reference</replaceable> <optional>, <replaceable>table_r
<varlistentry> <varlistentry>
<term><literal>RIGHT OUTER JOIN</></term> <term><literal>RIGHT OUTER JOIN</></term>
<indexterm>
<primary>join</primary>
<secondary>right</secondary>
</indexterm>
<indexterm>
<primary>right join</primary>
</indexterm>
<listitem> <listitem>
<para> <para>
First, an inner join is performed. Then, for each row in First, an inner join is performed. Then, for each row in
...@@ -424,13 +464,13 @@ FROM <replaceable>table_reference</replaceable> <optional>, <replaceable>table_r ...@@ -424,13 +464,13 @@ FROM <replaceable>table_reference</replaceable> <optional>, <replaceable>table_r
<title>Table and Column Aliases</title> <title>Table and Column Aliases</title>
<indexterm zone="queries-table-aliases"> <indexterm zone="queries-table-aliases">
<primary>label</primary> <primary>alias</primary>
<secondary>table</secondary> <secondary>in the FROM clause</secondary>
</indexterm> </indexterm>
<indexterm> <indexterm>
<primary>alias</primary> <primary>label</primary>
<see>label</see> <see>alias</see>
</indexterm> </indexterm>
<para> <para>
...@@ -530,7 +570,7 @@ SELECT a.* FROM (my_table AS a JOIN your_table AS b ON ...) AS c ...@@ -530,7 +570,7 @@ SELECT a.* FROM (my_table AS a JOIN your_table AS b ON ...) AS c
<title>Subqueries</title> <title>Subqueries</title>
<indexterm zone="queries-subqueries"> <indexterm zone="queries-subqueries">
<primary>subqueries</primary> <primary>subquery</primary>
</indexterm> </indexterm>
<para> <para>
...@@ -556,6 +596,11 @@ FROM (SELECT * FROM table1) AS alias_name ...@@ -556,6 +596,11 @@ FROM (SELECT * FROM table1) AS alias_name
<indexterm zone="queries-tablefunctions"><primary>table function</></> <indexterm zone="queries-tablefunctions"><primary>table function</></>
<indexterm zone="queries-tablefunctions">
<primary>function</>
<secondary>in the FROM clause</>
</indexterm>
<para> <para>
Table functions are functions that produce a set of rows, made up Table functions are functions that produce a set of rows, made up
of either base data types (scalar types) or composite data types of either base data types (scalar types) or composite data types
...@@ -628,7 +673,7 @@ SELECT * ...@@ -628,7 +673,7 @@ SELECT *
<title>The WHERE Clause</title> <title>The WHERE Clause</title>
<indexterm zone="queries-where"> <indexterm zone="queries-where">
<primary>where</primary> <primary>WHERE</primary>
</indexterm> </indexterm>
<para> <para>
...@@ -716,7 +761,11 @@ SELECT ... FROM fdt WHERE EXISTS (SELECT c1 FROM t2 WHERE c2 > fdt.c1) ...@@ -716,7 +761,11 @@ SELECT ... FROM fdt WHERE EXISTS (SELECT c1 FROM t2 WHERE c2 > fdt.c1)
<title>The GROUP BY and HAVING Clauses</title> <title>The GROUP BY and HAVING Clauses</title>
<indexterm zone="queries-group"> <indexterm zone="queries-group">
<primary>group</primary> <primary>GROUP BY</primary>
</indexterm>
<indexterm zone="queries-group">
<primary>grouping</primary>
</indexterm> </indexterm>
<para> <para>
...@@ -827,6 +876,10 @@ SELECT product_id, p.name, (sum(s.units) * p.price) AS sales ...@@ -827,6 +876,10 @@ SELECT product_id, p.name, (sum(s.units) * p.price) AS sales
column names is also allowed. column names is also allowed.
</para> </para>
<indexterm>
<primary>HAVING</primary>
</indexterm>
<para> <para>
If a table has been grouped using a <literal>GROUP BY</literal> If a table has been grouped using a <literal>GROUP BY</literal>
clause, but then only certain groups are of interest, the clause, but then only certain groups are of interest, the
...@@ -884,7 +937,7 @@ SELECT product_id, p.name, (sum(s.units) * (p.price - p.cost)) AS profit ...@@ -884,7 +937,7 @@ SELECT product_id, p.name, (sum(s.units) * (p.price - p.cost)) AS profit
<title>Select Lists</title> <title>Select Lists</title>
<indexterm> <indexterm>
<primary>select</primary> <primary>SELECT</primary>
<secondary>select list</secondary> <secondary>select list</secondary>
</indexterm> </indexterm>
...@@ -901,6 +954,10 @@ SELECT product_id, p.name, (sum(s.units) * (p.price - p.cost)) AS profit ...@@ -901,6 +954,10 @@ SELECT product_id, p.name, (sum(s.units) * (p.price - p.cost)) AS profit
<sect2 id="queries-select-list-items"> <sect2 id="queries-select-list-items">
<title>Select-List Items</title> <title>Select-List Items</title>
<indexterm>
<primary>*</primary>
</indexterm>
<para> <para>
The simplest kind of select list is <literal>*</literal> which The simplest kind of select list is <literal>*</literal> which
emits all columns that the table expression produces. Otherwise, emits all columns that the table expression produces. Otherwise,
...@@ -944,8 +1001,8 @@ SELECT tbl1.a, tbl2.a, tbl1.b FROM ... ...@@ -944,8 +1001,8 @@ SELECT tbl1.a, tbl2.a, tbl1.b FROM ...
<title>Column Labels</title> <title>Column Labels</title>
<indexterm zone="queries-column-labels"> <indexterm zone="queries-column-labels">
<primary>label</primary> <primary>alias</primary>
<secondary>column</secondary> <secondary>in the select list</secondary>
</indexterm> </indexterm>
<para> <para>
...@@ -981,7 +1038,11 @@ SELECT a AS value, b + c AS sum FROM ... ...@@ -981,7 +1038,11 @@ SELECT a AS value, b + c AS sum FROM ...
<title>DISTINCT</title> <title>DISTINCT</title>
<indexterm zone="queries-distinct"> <indexterm zone="queries-distinct">
<primary>distinct</primary> <primary>DISTINCT</primary>
</indexterm>
<indexterm zone="queries-distinct">
<primary>duplicates</primary>
</indexterm> </indexterm>
<para> <para>
...@@ -997,6 +1058,8 @@ SELECT DISTINCT <replaceable>select_list</replaceable> ... ...@@ -997,6 +1058,8 @@ SELECT DISTINCT <replaceable>select_list</replaceable> ...
</para> </para>
<para> <para>
<indexterm><primary>null value</><secondary sortas="DISTINCT">in
DISTINCT</></indexterm>
Obviously, two rows are considered distinct if they differ in at Obviously, two rows are considered distinct if they differ in at
least one column value. Null values are considered equal in this least one column value. Null values are considered equal in this
comparison. comparison.
...@@ -1035,13 +1098,25 @@ SELECT DISTINCT ON (<replaceable>expression</replaceable> <optional>, <replaceab ...@@ -1035,13 +1098,25 @@ SELECT DISTINCT ON (<replaceable>expression</replaceable> <optional>, <replaceab
<title>Combining Queries</title> <title>Combining Queries</title>
<indexterm zone="queries-union"> <indexterm zone="queries-union">
<primary>union</primary> <primary>UNION</primary>
</indexterm>
<indexterm zone="queries-union">
<primary>INTERSECT</primary>
</indexterm>
<indexterm zone="queries-union">
<primary>EXCEPT</primary>
</indexterm>
<indexterm zone="queries-union">
<primary>set union</primary>
</indexterm>
<indexterm zone="queries-union">
<primary>set intersection</primary>
</indexterm> </indexterm>
<indexterm zone="queries-union"> <indexterm zone="queries-union">
<primary>intersection</primary> <primary>set difference</primary>
</indexterm> </indexterm>
<indexterm zone="queries-union"> <indexterm zone="queries-union">
<primary>except</primary> <primary>set operation</primary>
</indexterm> </indexterm>
<para> <para>
...@@ -1104,7 +1179,10 @@ SELECT DISTINCT ON (<replaceable>expression</replaceable> <optional>, <replaceab ...@@ -1104,7 +1179,10 @@ SELECT DISTINCT ON (<replaceable>expression</replaceable> <optional>, <replaceab
<indexterm zone="queries-order"> <indexterm zone="queries-order">
<primary>sorting</primary> <primary>sorting</primary>
<secondary>query results</secondary> </indexterm>
<indexterm zone="queries-order">
<primary>ORDER BY</primary>
</indexterm> </indexterm>
<para> <para>
...@@ -1173,12 +1251,11 @@ SELECT a AS b FROM table1 ORDER BY a; ...@@ -1173,12 +1251,11 @@ SELECT a AS b FROM table1 ORDER BY a;
<title>LIMIT and OFFSET</title> <title>LIMIT and OFFSET</title>
<indexterm zone="queries-limit"> <indexterm zone="queries-limit">
<primary>limit</primary> <primary>LIMIT</primary>
</indexterm> </indexterm>
<indexterm zone="queries-limit"> <indexterm zone="queries-limit">
<primary>offset</primary> <primary>OFFSET</primary>
<secondary>with query results</secondary>
</indexterm> </indexterm>
<para> <para>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/query.sgml,v 1.32 2003/06/24 23:27:24 momjian Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/query.sgml,v 1.33 2003/08/31 17:32:19 petere Exp $
--> -->
<chapter id="tutorial-sql"> <chapter id="tutorial-sql">
...@@ -87,7 +87,8 @@ $Header: /cvsroot/pgsql/doc/src/sgml/query.sgml,v 1.32 2003/06/24 23:27:24 momji ...@@ -87,7 +87,8 @@ $Header: /cvsroot/pgsql/doc/src/sgml/query.sgml,v 1.32 2003/06/24 23:27:24 momji
</para> </para>
<para> <para>
<indexterm><primary>cluster</primary></indexterm> <indexterm><primary>database cluster</primary></indexterm>
<indexterm><primary>cluster</primary><secondary>of databases</secondary><see>database cluster</see></indexterm>
Tables are grouped into databases, and a collection of databases Tables are grouped into databases, and a collection of databases
managed by a single <productname>PostgreSQL</productname> server managed by a single <productname>PostgreSQL</productname> server
...@@ -562,7 +563,7 @@ SELECT * ...@@ -562,7 +563,7 @@ SELECT *
<title>Aggregate Functions</title> <title>Aggregate Functions</title>
<indexterm zone="tutorial-agg"> <indexterm zone="tutorial-agg">
<primary>aggregate</primary> <primary>aggregate function</primary>
</indexterm> </indexterm>
<para> <para>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/abort.sgml,v 1.13 2003/04/26 23:56:51 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/abort.sgml,v 1.14 2003/08/31 17:32:21 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>abort the current transaction</refpurpose> <refpurpose>abort the current transaction</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-abort">
<primary>ABORT</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
ABORT [ WORK | TRANSACTION ] ABORT [ WORK | TRANSACTION ]
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/alter_aggregate.sgml,v 1.1 2003/06/27 14:45:25 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/alter_aggregate.sgml,v 1.2 2003/08/31 17:32:21 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>change the definition of an aggregate function</refpurpose> <refpurpose>change the definition of an aggregate function</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-alteraggregate">
<primary>ALTER AGGREGATE</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
ALTER AGGREGATE <replaceable>name</replaceable> ( <replaceable>type</replaceable> ) RENAME TO <replaceable>newname</replaceable> ALTER AGGREGATE <replaceable>name</replaceable> ( <replaceable>type</replaceable> ) RENAME TO <replaceable>newname</replaceable>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/alter_conversion.sgml,v 1.1 2003/06/27 14:45:25 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/alter_conversion.sgml,v 1.2 2003/08/31 17:32:21 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>change the definition of a conversion</refpurpose> <refpurpose>change the definition of a conversion</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-alterconversion">
<primary>ALTER CONVERSION</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
ALTER CONVERSION <replaceable>name</replaceable> RENAME TO <replaceable>newname</replaceable> ALTER CONVERSION <replaceable>name</replaceable> RENAME TO <replaceable>newname</replaceable>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/alter_database.sgml,v 1.7 2003/06/27 14:45:25 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/alter_database.sgml,v 1.8 2003/08/31 17:32:21 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>change a database</refpurpose> <refpurpose>change a database</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-alterdatabase">
<primary>ALTER DATABASE</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
ALTER DATABASE <replaceable class="PARAMETER">name</replaceable> SET <replaceable>variable</replaceable> { TO | = } { <replaceable>value</replaceable> | DEFAULT } ALTER DATABASE <replaceable class="PARAMETER">name</replaceable> SET <replaceable>variable</replaceable> { TO | = } { <replaceable>value</replaceable> | DEFAULT }
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/alter_domain.sgml,v 1.7 2003/01/06 00:31:44 tgl Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/alter_domain.sgml,v 1.8 2003/08/31 17:32:21 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -8,6 +8,7 @@ PostgreSQL documentation ...@@ -8,6 +8,7 @@ PostgreSQL documentation
<refentrytitle id="sql-alterdomain-title">ALTER DOMAIN</refentrytitle> <refentrytitle id="sql-alterdomain-title">ALTER DOMAIN</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo> <refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta> </refmeta>
<refnamediv> <refnamediv>
<refname> <refname>
ALTER DOMAIN ALTER DOMAIN
...@@ -16,6 +17,11 @@ PostgreSQL documentation ...@@ -16,6 +17,11 @@ PostgreSQL documentation
change the definition of a domain change the definition of a domain
</refpurpose> </refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-alterdomain">
<primary>ALTER DOMAIN</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<refsynopsisdivinfo> <refsynopsisdivinfo>
<date>2002-11-27</date> <date>2002-11-27</date>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/alter_function.sgml,v 1.1 2003/06/27 14:45:25 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/alter_function.sgml,v 1.2 2003/08/31 17:32:21 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>change the definition of a function</refpurpose> <refpurpose>change the definition of a function</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-alterfunction">
<primary>ALTER FUNCTION</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
ALTER FUNCTION <replaceable>name</replaceable> ( [ <replaceable class="parameter">type</replaceable> [, ...] ] ) RENAME TO <replaceable>newname</replaceable> ALTER FUNCTION <replaceable>name</replaceable> ( [ <replaceable class="parameter">type</replaceable> [, ...] ] ) RENAME TO <replaceable>newname</replaceable>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/alter_group.sgml,v 1.10 2003/06/27 14:45:25 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/alter_group.sgml,v 1.11 2003/08/31 17:32:21 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>change a user group</refpurpose> <refpurpose>change a user group</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-altergroup">
<primary>ALTER GROUP</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
ALTER GROUP <replaceable class="PARAMETER">groupname</replaceable> ADD USER <replaceable class="PARAMETER">username</replaceable> [, ... ] ALTER GROUP <replaceable class="PARAMETER">groupname</replaceable> ADD USER <replaceable class="PARAMETER">username</replaceable> [, ... ]
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/alter_language.sgml,v 1.1 2003/06/27 14:45:25 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/alter_language.sgml,v 1.2 2003/08/31 17:32:21 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>change the definition of a procedural language</refpurpose> <refpurpose>change the definition of a procedural language</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-alterlanguage">
<primary>ALTER LANGUAGE</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
ALTER LANGUAGE <replaceable>name</replaceable> RENAME TO <replaceable>newname</replaceable> ALTER LANGUAGE <replaceable>name</replaceable> RENAME TO <replaceable>newname</replaceable>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/alter_opclass.sgml,v 1.1 2003/06/27 14:45:26 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/alter_opclass.sgml,v 1.2 2003/08/31 17:32:21 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>change the definition of an operator class</refpurpose> <refpurpose>change the definition of an operator class</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-alteropclass">
<primary>ALTER OPERATOR CLASS</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
ALTER OPERATOR CLASS <replaceable>name</replaceable> USING <replaceable class="parameter">index_method</replaceable> RENAME TO <replaceable>newname</replaceable> ALTER OPERATOR CLASS <replaceable>name</replaceable> USING <replaceable class="parameter">index_method</replaceable> RENAME TO <replaceable>newname</replaceable>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/alter_schema.sgml,v 1.1 2003/06/27 14:45:26 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/alter_schema.sgml,v 1.2 2003/08/31 17:32:21 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>change the definition of a schema</refpurpose> <refpurpose>change the definition of a schema</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-alterschema">
<primary>ALTER SCHEMA</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
ALTER SCHEMA <replaceable>name</replaceable> RENAME TO <replaceable>newname</replaceable> ALTER SCHEMA <replaceable>name</replaceable> RENAME TO <replaceable>newname</replaceable>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/alter_sequence.sgml,v 1.2 2003/06/12 07:49:43 momjian Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/alter_sequence.sgml,v 1.3 2003/08/31 17:32:21 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -8,6 +8,7 @@ PostgreSQL documentation ...@@ -8,6 +8,7 @@ PostgreSQL documentation
<refentrytitle id="SQL-ALTERSEQUENCE-TITLE">ALTER SEQUENCE</refentrytitle> <refentrytitle id="SQL-ALTERSEQUENCE-TITLE">ALTER SEQUENCE</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo> <refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta> </refmeta>
<refnamediv> <refnamediv>
<refname> <refname>
ALTER SEQUENCE ALTER SEQUENCE
...@@ -16,6 +17,11 @@ PostgreSQL documentation ...@@ -16,6 +17,11 @@ PostgreSQL documentation
alter the definition of a sequence generator alter the definition of a sequence generator
</refpurpose> </refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-altersequence">
<primary>ALTER SEQUENCE</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<refsynopsisdivinfo> <refsynopsisdivinfo>
<date>1999-07-20</date> <date>1999-07-20</date>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/alter_table.sgml,v 1.59 2003/04/15 13:25:08 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/alter_table.sgml,v 1.60 2003/08/31 17:32:21 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>change the definition of a table</refpurpose> <refpurpose>change the definition of a table</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-altertable">
<primary>ALTER TABLE</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
ALTER TABLE [ ONLY ] <replaceable class="PARAMETER">table</replaceable> [ * ] ALTER TABLE [ ONLY ] <replaceable class="PARAMETER">table</replaceable> [ * ]
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/alter_trigger.sgml,v 1.4 2003/04/15 13:25:08 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/alter_trigger.sgml,v 1.5 2003/08/31 17:32:21 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>change the definition of a trigger</refpurpose> <refpurpose>change the definition of a trigger</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-altertrigger">
<primary>ALTER TRIGGER</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
ALTER TRIGGER <replaceable class="PARAMETER">trigger</replaceable> ON <replaceable class="PARAMETER">table</replaceable> ALTER TRIGGER <replaceable class="PARAMETER">trigger</replaceable> ON <replaceable class="PARAMETER">table</replaceable>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/alter_user.sgml,v 1.28 2003/06/27 14:45:26 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/alter_user.sgml,v 1.29 2003/08/31 17:32:21 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>change a database user account</refpurpose> <refpurpose>change a database user account</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-alteruser">
<primary>ALTER USER</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
ALTER USER <replaceable class="PARAMETER">username</replaceable> [ [ WITH ] <replaceable class="PARAMETER">option</replaceable> [ ... ] ] ALTER USER <replaceable class="PARAMETER">username</replaceable> [ [ WITH ] <replaceable class="PARAMETER">option</replaceable> [ ... ] ]
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/analyze.sgml,v 1.12 2003/04/15 13:25:08 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/analyze.sgml,v 1.13 2003/08/31 17:32:21 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>collect statistics about a database</refpurpose> <refpurpose>collect statistics about a database</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-analyze">
<primary>ANALYZE</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
ANALYZE [ VERBOSE ] [ <replaceable class="PARAMETER">table</replaceable> [ (<replaceable class="PARAMETER">column</replaceable> [, ...] ) ] ] ANALYZE [ VERBOSE ] [ <replaceable class="PARAMETER">table</replaceable> [ (<replaceable class="PARAMETER">column</replaceable> [, ...] ) ] ]
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/begin.sgml,v 1.24 2003/05/14 03:26:00 tgl Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/begin.sgml,v 1.25 2003/08/31 17:32:21 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>start a transaction block</refpurpose> <refpurpose>start a transaction block</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-begin">
<primary>BEGIN</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
BEGIN [ WORK | TRANSACTION ] BEGIN [ WORK | TRANSACTION ]
......
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/ref/checkpoint.sgml,v 1.9 2003/04/15 13:25:08 petere Exp $ --> <!-- $Header: /cvsroot/pgsql/doc/src/sgml/ref/checkpoint.sgml,v 1.10 2003/08/31 17:32:21 petere Exp $ -->
<refentry id="sql-checkpoint"> <refentry id="sql-checkpoint">
<refmeta> <refmeta>
...@@ -11,6 +11,10 @@ ...@@ -11,6 +11,10 @@
<refpurpose>force a transaction log checkpoint</refpurpose> <refpurpose>force a transaction log checkpoint</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-checkpoint">
<primary>CHECKPOINT</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
CHECKPOINT CHECKPOINT
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/close.sgml,v 1.16 2003/08/24 21:02:42 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/close.sgml,v 1.17 2003/08/31 17:32:21 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>close a cursor</refpurpose> <refpurpose>close a cursor</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-close">
<primary>CLOSE</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
CLOSE <replaceable class="PARAMETER">cursor</replaceable> CLOSE <replaceable class="PARAMETER">cursor</replaceable>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/cluster.sgml,v 1.26 2003/04/15 13:25:08 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/cluster.sgml,v 1.27 2003/08/31 17:32:21 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>cluster a table according to an index</refpurpose> <refpurpose>cluster a table according to an index</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-cluster">
<primary>CLUSTER</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
CLUSTER <replaceable class="PARAMETER">indexname</replaceable> ON <replaceable class="PARAMETER">tablename</replaceable> CLUSTER <replaceable class="PARAMETER">indexname</replaceable> ON <replaceable class="PARAMETER">tablename</replaceable>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/clusterdb.sgml,v 1.11 2003/08/17 04:46:59 momjian Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/clusterdb.sgml,v 1.12 2003/08/31 17:32:21 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -15,6 +15,10 @@ PostgreSQL documentation ...@@ -15,6 +15,10 @@ PostgreSQL documentation
<refpurpose>cluster a <productname>PostgreSQL</productname> database</refpurpose> <refpurpose>cluster a <productname>PostgreSQL</productname> database</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="app-clusterdb">
<primary>clusterdb</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<cmdsynopsis> <cmdsynopsis>
<command>clusterdb</command> <command>clusterdb</command>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/comment.sgml,v 1.21 2003/04/15 13:25:08 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/comment.sgml,v 1.22 2003/08/31 17:32:21 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>define or change the comment of an object</refpurpose> <refpurpose>define or change the comment of an object</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-comment">
<primary>COMMENT</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
COMMENT ON COMMENT ON
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/commit.sgml,v 1.15 2003/04/15 13:25:08 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/commit.sgml,v 1.16 2003/08/31 17:32:21 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>commit the current transaction</refpurpose> <refpurpose>commit the current transaction</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-commit">
<primary>COMMIT</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
COMMIT [ WORK | TRANSACTION ] COMMIT [ WORK | TRANSACTION ]
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/copy.sgml,v 1.47 2003/08/17 04:33:02 momjian Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/copy.sgml,v 1.48 2003/08/31 17:32:21 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>copy data between files and tables</refpurpose> <refpurpose>copy data between files and tables</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-copy">
<primary>COPY</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
COPY <replaceable class="parameter">table</replaceable> [ ( <replaceable class="parameter">column</replaceable> [, ...] ) ] COPY <replaceable class="parameter">table</replaceable> [ ( <replaceable class="parameter">column</replaceable> [, ...] ) ]
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_aggregate.sgml,v 1.26 2003/06/27 14:45:26 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/create_aggregate.sgml,v 1.27 2003/08/31 17:32:21 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>define a new aggregate function</refpurpose> <refpurpose>define a new aggregate function</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-createaggregate">
<primary>CREATE AGGREGATE</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
CREATE AGGREGATE <replaceable class="PARAMETER">name</replaceable> ( CREATE AGGREGATE <replaceable class="PARAMETER">name</replaceable> (
......
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/ref/create_cast.sgml,v 1.11 2003/04/22 10:08:08 petere Exp $ --> <!-- $Header: /cvsroot/pgsql/doc/src/sgml/ref/create_cast.sgml,v 1.12 2003/08/31 17:32:21 petere Exp $ -->
<refentry id="SQL-CREATECAST"> <refentry id="SQL-CREATECAST">
<refmeta> <refmeta>
...@@ -11,6 +11,10 @@ ...@@ -11,6 +11,10 @@
<refpurpose>define a user-defined cast</refpurpose> <refpurpose>define a user-defined cast</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-createcast">
<primary>CREATE CAST</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
CREATE CAST (<replaceable>sourcetype</replaceable> AS <replaceable>targettype</replaceable>) CREATE CAST (<replaceable>sourcetype</replaceable> AS <replaceable>targettype</replaceable>)
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_constraint.sgml,v 1.9 2003/04/22 10:08:08 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/create_constraint.sgml,v 1.10 2003/08/31 17:32:21 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>define a new constraint trigger</refpurpose> <refpurpose>define a new constraint trigger</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-createconstraint">
<primary>CREATE CONSTRAINT</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
CREATE CONSTRAINT TRIGGER <replaceable class="parameter">name</replaceable> CREATE CONSTRAINT TRIGGER <replaceable class="parameter">name</replaceable>
......
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/ref/create_conversion.sgml,v 1.10 2003/06/27 14:45:26 petere Exp $ --> <!-- $Header: /cvsroot/pgsql/doc/src/sgml/ref/create_conversion.sgml,v 1.11 2003/08/31 17:32:21 petere Exp $ -->
<refentry id="SQL-CREATECONVERSION"> <refentry id="SQL-CREATECONVERSION">
<refmeta> <refmeta>
...@@ -11,6 +11,10 @@ ...@@ -11,6 +11,10 @@
<refpurpose>define a user-defined conversion</refpurpose> <refpurpose>define a user-defined conversion</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-createconversion">
<primary>CREATE CONVERSION</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
CREATE [DEFAULT] CONVERSION <replaceable>name</replaceable> CREATE [DEFAULT] CONVERSION <replaceable>name</replaceable>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_database.sgml,v 1.34 2003/04/22 10:08:08 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/create_database.sgml,v 1.35 2003/08/31 17:32:22 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>create a new database</refpurpose> <refpurpose>create a new database</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-createdatabase">
<primary>CREATE DATABASE</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
CREATE DATABASE <replaceable class="PARAMETER">name</replaceable> CREATE DATABASE <replaceable class="PARAMETER">name</replaceable>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_domain.sgml,v 1.13 2003/04/22 10:08:08 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/create_domain.sgml,v 1.14 2003/08/31 17:32:22 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>define a new domain</refpurpose> <refpurpose>define a new domain</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-createdomain">
<primary>CREATE DOMAIN</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
CREATE DOMAIN <replaceable class="parameter">domainname</replaceable> [AS] <replaceable class="parameter">data_type</replaceable> CREATE DOMAIN <replaceable class="parameter">domainname</replaceable> [AS] <replaceable class="parameter">data_type</replaceable>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_function.sgml,v 1.48 2003/06/27 14:45:26 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/create_function.sgml,v 1.49 2003/08/31 17:32:22 petere Exp $
--> -->
<refentry id="SQL-CREATEFUNCTION"> <refentry id="SQL-CREATEFUNCTION">
...@@ -13,6 +13,10 @@ $Header: /cvsroot/pgsql/doc/src/sgml/ref/create_function.sgml,v 1.48 2003/06/27 ...@@ -13,6 +13,10 @@ $Header: /cvsroot/pgsql/doc/src/sgml/ref/create_function.sgml,v 1.48 2003/06/27
<refpurpose>define a new function</refpurpose> <refpurpose>define a new function</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-createfunction">
<primary>CREATE FUNCTION</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
CREATE [ OR REPLACE ] FUNCTION <replaceable class="parameter">name</replaceable> ( [ <replaceable class="parameter">argtype</replaceable> [, ...] ] ) CREATE [ OR REPLACE ] FUNCTION <replaceable class="parameter">name</replaceable> ( [ <replaceable class="parameter">argtype</replaceable> [, ...] ] )
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_group.sgml,v 1.11 2003/04/22 10:08:08 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/create_group.sgml,v 1.12 2003/08/31 17:32:22 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>define a new user group</refpurpose> <refpurpose>define a new user group</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-creategroup">
<primary>CREATE GROUP</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
CREATE GROUP <replaceable class="PARAMETER">name</replaceable> [ [ WITH ] <replaceable class="PARAMETER">option</replaceable> [ ... ] ] CREATE GROUP <replaceable class="PARAMETER">name</replaceable> [ [ WITH ] <replaceable class="PARAMETER">option</replaceable> [ ... ] ]
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_index.sgml,v 1.39 2003/05/28 16:03:55 tgl Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/create_index.sgml,v 1.40 2003/08/31 17:32:22 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>define a new index</refpurpose> <refpurpose>define a new index</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-createindex">
<primary>CREATE INDEX</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
CREATE [ UNIQUE ] INDEX <replaceable class="parameter">index_name</replaceable> ON <replaceable class="parameter">table</replaceable> [ USING <replaceable class="parameter">method</replaceable> ] CREATE [ UNIQUE ] INDEX <replaceable class="parameter">index_name</replaceable> ON <replaceable class="parameter">table</replaceable> [ USING <replaceable class="parameter">method</replaceable> ]
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_language.sgml,v 1.33 2003/06/27 14:45:26 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/create_language.sgml,v 1.34 2003/08/31 17:32:22 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>define a new procedural language</refpurpose> <refpurpose>define a new procedural language</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-createlanguage">
<primary>CREATE LANGUAGE</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
CREATE [ TRUSTED ] [ PROCEDURAL ] LANGUAGE <replaceable class="parameter">langname</replaceable> CREATE [ TRUSTED ] [ PROCEDURAL ] LANGUAGE <replaceable class="parameter">langname</replaceable>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_opclass.sgml,v 1.8 2003/06/27 14:45:26 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/create_opclass.sgml,v 1.9 2003/08/31 17:32:22 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>define a new operator class for indexes</refpurpose> <refpurpose>define a new operator class for indexes</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-createopclass">
<primary>CREATE OPERATOR CLASS</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
CREATE OPERATOR CLASS <replaceable class="parameter">name</replaceable> [ DEFAULT ] FOR TYPE <replaceable class="parameter">data_type</replaceable> USING <replaceable class="parameter">index_method</replaceable> AS CREATE OPERATOR CLASS <replaceable class="parameter">name</replaceable> [ DEFAULT ] FOR TYPE <replaceable class="parameter">data_type</replaceable> USING <replaceable class="parameter">index_method</replaceable> AS
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_operator.sgml,v 1.36 2003/08/17 22:09:00 tgl Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/create_operator.sgml,v 1.37 2003/08/31 17:32:22 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>define a new operator</refpurpose> <refpurpose>define a new operator</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-createoperator">
<primary>CREATE OPERATOR</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
CREATE OPERATOR <replaceable>name</replaceable> ( CREATE OPERATOR <replaceable>name</replaceable> (
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_rule.sgml,v 1.39 2003/04/22 10:08:08 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/create_rule.sgml,v 1.40 2003/08/31 17:32:22 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>define a new rewrite rule</refpurpose> <refpurpose>define a new rewrite rule</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-createrule">
<primary>CREATE RULE</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
CREATE [ OR REPLACE ] RULE <replaceable class="parameter">name</replaceable> AS ON <replaceable class="parameter">event</replaceable> CREATE [ OR REPLACE ] RULE <replaceable class="parameter">name</replaceable> AS ON <replaceable class="parameter">event</replaceable>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_schema.sgml,v 1.6 2003/06/27 14:45:26 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/create_schema.sgml,v 1.7 2003/08/31 17:32:22 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>define a new schema</refpurpose> <refpurpose>define a new schema</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-createschema">
<primary>CREATE SCHEMA</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
CREATE SCHEMA <replaceable class="parameter">schemaname</replaceable> [ AUTHORIZATION <replaceable class="parameter">username</replaceable> ] [ <replaceable class="parameter">schema_element</replaceable> [ ... ] ] CREATE SCHEMA <replaceable class="parameter">schemaname</replaceable> [ AUTHORIZATION <replaceable class="parameter">username</replaceable> ] [ <replaceable class="parameter">schema_element</replaceable> [ ... ] ]
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_sequence.sgml,v 1.33 2003/04/22 10:08:08 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/create_sequence.sgml,v 1.34 2003/08/31 17:32:22 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>define a new sequence generator</refpurpose> <refpurpose>define a new sequence generator</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-createsequence">
<primary>CREATE SEQUENCE</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
CREATE [ TEMPORARY | TEMP ] SEQUENCE <replaceable class="parameter">seqname</replaceable> [ INCREMENT [ BY ] <replaceable class="parameter">increment</replaceable> ] CREATE [ TEMPORARY | TEMP ] SEQUENCE <replaceable class="parameter">seqname</replaceable> [ INCREMENT [ BY ] <replaceable class="parameter">increment</replaceable> ]
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_table.sgml,v 1.70 2003/06/12 18:34:06 tgl Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/create_table.sgml,v 1.71 2003/08/31 17:32:22 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>define a new table</refpurpose> <refpurpose>define a new table</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-createtable">
<primary>CREATE TABLE</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } ] TABLE <replaceable class="PARAMETER">table_name</replaceable> ( CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } ] TABLE <replaceable class="PARAMETER">table_name</replaceable> (
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_table_as.sgml,v 1.14 2003/07/01 00:04:31 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/create_table_as.sgml,v 1.15 2003/08/31 17:32:22 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>create a new table from the results of a query</refpurpose> <refpurpose>create a new table from the results of a query</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-createtableas">
<primary>CREATE TABLE AS</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } ] TABLE <replaceable>table_name</replaceable> [ (<replaceable>column_name</replaceable> [, ...] ) ] CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } ] TABLE <replaceable>table_name</replaceable> [ (<replaceable>column_name</replaceable> [, ...] ) ]
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_trigger.sgml,v 1.34 2003/04/22 10:08:08 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/create_trigger.sgml,v 1.35 2003/08/31 17:32:22 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>define a new trigger</refpurpose> <refpurpose>define a new trigger</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-createtrigger">
<primary>CREATE TRIGGER</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
CREATE TRIGGER <replaceable class="PARAMETER">name</replaceable> { BEFORE | AFTER } { <replaceable class="PARAMETER">event</replaceable> [ OR ... ] } CREATE TRIGGER <replaceable class="PARAMETER">name</replaceable> { BEFORE | AFTER } { <replaceable class="PARAMETER">event</replaceable> [ OR ... ] }
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_type.sgml,v 1.43 2003/05/09 23:01:44 tgl Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/create_type.sgml,v 1.44 2003/08/31 17:32:22 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>define a new data type</refpurpose> <refpurpose>define a new data type</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-createtype">
<primary>CREATE TYPE</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
CREATE TYPE <replaceable class="parameter">typename</replaceable> AS CREATE TYPE <replaceable class="parameter">typename</replaceable> AS
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_user.sgml,v 1.26 2003/04/22 10:08:08 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/create_user.sgml,v 1.27 2003/08/31 17:32:22 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>define a new database user account</refpurpose> <refpurpose>define a new database user account</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-createuser">
<primary>CREATE USER</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
CREATE USER <replaceable class="PARAMETER">username</replaceable> [ [ WITH ] <replaceable class="PARAMETER">option</replaceable> [ ... ] ] CREATE USER <replaceable class="PARAMETER">username</replaceable> [ [ WITH ] <replaceable class="PARAMETER">option</replaceable> [ ... ] ]
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_view.sgml,v 1.22 2003/04/22 10:08:08 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/create_view.sgml,v 1.23 2003/08/31 17:32:22 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>define a new view</refpurpose> <refpurpose>define a new view</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-createview">
<primary>CREATE VIEW</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
CREATE [ OR REPLACE ] VIEW <replaceable class="PARAMETER">name</replaceable> [ ( <replaceable CREATE [ OR REPLACE ] VIEW <replaceable class="PARAMETER">name</replaceable> [ ( <replaceable
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/createdb.sgml,v 1.33 2003/05/26 17:50:09 momjian Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/createdb.sgml,v 1.34 2003/08/31 17:32:22 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -15,6 +15,10 @@ PostgreSQL documentation ...@@ -15,6 +15,10 @@ PostgreSQL documentation
<refpurpose>create a new <productname>PostgreSQL</productname> database</refpurpose> <refpurpose>create a new <productname>PostgreSQL</productname> database</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="app-createdb">
<primary>createdb</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<cmdsynopsis> <cmdsynopsis>
<command>createdb</command> <command>createdb</command>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/createlang.sgml,v 1.31 2003/03/24 14:32:51 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/createlang.sgml,v 1.32 2003/08/31 17:32:22 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -15,6 +15,10 @@ PostgreSQL documentation ...@@ -15,6 +15,10 @@ PostgreSQL documentation
<refpurpose>define a new <productname>PostgreSQL</productname> procedural language</refpurpose> <refpurpose>define a new <productname>PostgreSQL</productname> procedural language</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="app-createlang">
<primary>createlang</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<cmdsynopsis> <cmdsynopsis>
<command>createlang</command> <command>createlang</command>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/createuser.sgml,v 1.35 2003/08/17 04:46:59 momjian Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/createuser.sgml,v 1.36 2003/08/31 17:32:22 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -15,6 +15,10 @@ PostgreSQL documentation ...@@ -15,6 +15,10 @@ PostgreSQL documentation
<refpurpose>define a new <productname>PostgreSQL</productname> user account</refpurpose> <refpurpose>define a new <productname>PostgreSQL</productname> user account</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="app-createuser">
<primary>createuser</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<cmdsynopsis> <cmdsynopsis>
<command>createuser</command> <command>createuser</command>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/deallocate.sgml,v 1.2 2003/04/26 23:56:51 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/deallocate.sgml,v 1.3 2003/08/31 17:32:22 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>deallocate a prepared statement</refpurpose> <refpurpose>deallocate a prepared statement</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-deallocate">
<primary>DEALLOCATE</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
DEALLOCATE [ PREPARE ] <replaceable class="parameter">plan_name</replaceable> DEALLOCATE [ PREPARE ] <replaceable class="parameter">plan_name</replaceable>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/declare.sgml,v 1.25 2003/08/24 21:02:42 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/declare.sgml,v 1.26 2003/08/31 17:32:22 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>define a cursor</refpurpose> <refpurpose>define a cursor</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-declare">
<primary>DECLARE</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
DECLARE <replaceable class="parameter">cursorname</replaceable> [ BINARY ] [ INSENSITIVE ] [ [ NO ] SCROLL ] DECLARE <replaceable class="parameter">cursorname</replaceable> [ BINARY ] [ INSENSITIVE ] [ [ NO ] SCROLL ]
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/delete.sgml,v 1.17 2003/04/26 23:56:51 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/delete.sgml,v 1.18 2003/08/31 17:32:22 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>delete rows of a table</refpurpose> <refpurpose>delete rows of a table</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-delete">
<primary>DELETE</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
DELETE FROM [ ONLY ] <replaceable class="PARAMETER">table</replaceable> [ WHERE <replaceable class="PARAMETER">condition</replaceable> ] DELETE FROM [ ONLY ] <replaceable class="PARAMETER">table</replaceable> [ WHERE <replaceable class="PARAMETER">condition</replaceable> ]
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_aggregate.sgml,v 1.23 2003/06/27 14:45:26 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_aggregate.sgml,v 1.24 2003/08/31 17:32:22 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>remove a user-defined aggregate function</refpurpose> <refpurpose>remove a user-defined aggregate function</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-dropaggregate">
<primary>DROP AGGREGATE</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
DROP AGGREGATE <replaceable class="PARAMETER">name</replaceable> ( <replaceable class="PARAMETER">type</replaceable> ) [ CASCADE | RESTRICT ] DROP AGGREGATE <replaceable class="PARAMETER">name</replaceable> ( <replaceable class="PARAMETER">type</replaceable> ) [ CASCADE | RESTRICT ]
......
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_cast.sgml,v 1.3 2003/05/04 02:23:16 petere Exp $ --> <!-- $Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_cast.sgml,v 1.4 2003/08/31 17:32:22 petere Exp $ -->
<refentry id="SQL-DROPCAST"> <refentry id="SQL-DROPCAST">
<refmeta> <refmeta>
...@@ -11,6 +11,10 @@ ...@@ -11,6 +11,10 @@
<refpurpose>remove a user-defined cast</refpurpose> <refpurpose>remove a user-defined cast</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-dropcast">
<primary>DROP CAST</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
DROP CAST (<replaceable>sourcetype</replaceable> AS <replaceable>targettype</replaceable>) [ CASCADE | RESTRICT ] DROP CAST (<replaceable>sourcetype</replaceable> AS <replaceable>targettype</replaceable>) [ CASCADE | RESTRICT ]
......
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_conversion.sgml,v 1.5 2003/06/27 14:45:26 petere Exp $ --> <!-- $Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_conversion.sgml,v 1.6 2003/08/31 17:32:22 petere Exp $ -->
<refentry id="SQL-DROPCONVERSION"> <refentry id="SQL-DROPCONVERSION">
<refmeta> <refmeta>
...@@ -11,6 +11,10 @@ ...@@ -11,6 +11,10 @@
<refpurpose>remove a user-defined conversion</refpurpose> <refpurpose>remove a user-defined conversion</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-dropconversion">
<primary>DROP CONVERSION</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
DROP CONVERSION <replaceable>conversion_name</replaceable> [ CASCADE | RESTRICT ] DROP CONVERSION <replaceable>conversion_name</replaceable> [ CASCADE | RESTRICT ]
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_database.sgml,v 1.16 2003/05/04 02:23:16 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_database.sgml,v 1.17 2003/08/31 17:32:22 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>remove a database</refpurpose> <refpurpose>remove a database</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-dropdatabase">
<primary>DROP DATABASE</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
DROP DATABASE <replaceable class="PARAMETER">name</replaceable> DROP DATABASE <replaceable class="PARAMETER">name</replaceable>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_domain.sgml,v 1.10 2003/05/04 02:23:16 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_domain.sgml,v 1.11 2003/08/31 17:32:22 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>remove a domain</refpurpose> <refpurpose>remove a domain</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-dropdomain">
<primary>DROP DOMAIN</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
DROP DOMAIN <replaceable class="PARAMETER">domainname</replaceable> [, ...] [ CASCADE | RESTRICT ] DROP DOMAIN <replaceable class="PARAMETER">domainname</replaceable> [, ...] [ CASCADE | RESTRICT ]
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_function.sgml,v 1.25 2003/06/27 14:45:26 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_function.sgml,v 1.26 2003/08/31 17:32:22 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>remove a user-defined function</refpurpose> <refpurpose>remove a user-defined function</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-dropfunction">
<primary>DROP FUNCTION</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
DROP FUNCTION <replaceable class="parameter">name</replaceable> ( [ <replaceable class="parameter">type</replaceable> [, ...] ] ) [ CASCADE | RESTRICT ] DROP FUNCTION <replaceable class="parameter">name</replaceable> ( [ <replaceable class="parameter">type</replaceable> [, ...] ] ) [ CASCADE | RESTRICT ]
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_group.sgml,v 1.5 2003/05/04 02:23:16 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_group.sgml,v 1.6 2003/08/31 17:32:22 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>remove a user group</refpurpose> <refpurpose>remove a user group</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-dropgroup">
<primary>DROP GROUP</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
DROP GROUP <replaceable class="PARAMETER">name</replaceable> DROP GROUP <replaceable class="PARAMETER">name</replaceable>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_index.sgml,v 1.18 2003/06/24 23:29:25 momjian Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_index.sgml,v 1.19 2003/08/31 17:32:22 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>remove an index</refpurpose> <refpurpose>remove an index</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-dropindex">
<primary>DROP INDEX</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
DROP INDEX <replaceable class="PARAMETER">name</replaceable> [, ...] [ CASCADE | RESTRICT ] DROP INDEX <replaceable class="PARAMETER">name</replaceable> [, ...] [ CASCADE | RESTRICT ]
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_language.sgml,v 1.17 2003/06/27 14:45:26 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_language.sgml,v 1.18 2003/08/31 17:32:22 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>remove a user-defined procedural language</refpurpose> <refpurpose>remove a user-defined procedural language</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-droplanguage">
<primary>DROP LANGUAGE</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
DROP [ PROCEDURAL ] LANGUAGE <replaceable class="PARAMETER">name</replaceable> [ CASCADE | RESTRICT ] DROP [ PROCEDURAL ] LANGUAGE <replaceable class="PARAMETER">name</replaceable> [ CASCADE | RESTRICT ]
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_opclass.sgml,v 1.4 2003/06/27 14:45:26 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_opclass.sgml,v 1.5 2003/08/31 17:32:22 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>remove a user-defined operator class</refpurpose> <refpurpose>remove a user-defined operator class</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-dropopclass">
<primary>DROP OPERATOR CLASS</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
DROP OPERATOR CLASS <replaceable class="PARAMETER">name</replaceable> USING <replaceable class="PARAMETER">index_method</replaceable> [ CASCADE | RESTRICT ] DROP OPERATOR CLASS <replaceable class="PARAMETER">name</replaceable> USING <replaceable class="PARAMETER">index_method</replaceable> [ CASCADE | RESTRICT ]
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_operator.sgml,v 1.19 2003/05/04 02:23:16 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_operator.sgml,v 1.20 2003/08/31 17:32:22 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>remove a user-defined operator</refpurpose> <refpurpose>remove a user-defined operator</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-dropoperator">
<primary>DROP OPERATOR</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
DROP OPERATOR <replaceable class="PARAMETER">name</replaceable> ( <replaceable class="PARAMETER">lefttype</replaceable> | NONE , <replaceable class="PARAMETER">righttype</replaceable> | NONE ) [ CASCADE | RESTRICT ] DROP OPERATOR <replaceable class="PARAMETER">name</replaceable> ( <replaceable class="PARAMETER">lefttype</replaceable> | NONE , <replaceable class="PARAMETER">righttype</replaceable> | NONE ) [ CASCADE | RESTRICT ]
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_rule.sgml,v 1.17 2003/05/04 02:23:16 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_rule.sgml,v 1.18 2003/08/31 17:32:22 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>remove a rewrite rule</refpurpose> <refpurpose>remove a rewrite rule</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-droprule">
<primary>DROP RULE</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
DROP RULE <replaceable class="PARAMETER">name</replaceable> ON <replaceable class="PARAMETER">relation</replaceable> [ CASCADE | RESTRICT ] DROP RULE <replaceable class="PARAMETER">name</replaceable> ON <replaceable class="PARAMETER">relation</replaceable> [ CASCADE | RESTRICT ]
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_schema.sgml,v 1.3 2003/06/27 14:45:26 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_schema.sgml,v 1.4 2003/08/31 17:32:22 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>remove a schema</refpurpose> <refpurpose>remove a schema</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-dropschema">
<primary>DROP SCHEMA</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
DROP SCHEMA <replaceable class="PARAMETER">name</replaceable> [, ...] [ CASCADE | RESTRICT ] DROP SCHEMA <replaceable class="PARAMETER">name</replaceable> [, ...] [ CASCADE | RESTRICT ]
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_sequence.sgml,v 1.17 2003/05/04 02:23:16 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_sequence.sgml,v 1.18 2003/08/31 17:32:22 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>remove a sequence</refpurpose> <refpurpose>remove a sequence</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-dropsequence">
<primary>DROP SEQUENCE</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
DROP SEQUENCE <replaceable class="PARAMETER">name</replaceable> [, ...] [ CASCADE | RESTRICT ] DROP SEQUENCE <replaceable class="PARAMETER">name</replaceable> [, ...] [ CASCADE | RESTRICT ]
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_table.sgml,v 1.18 2003/05/04 02:23:16 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_table.sgml,v 1.19 2003/08/31 17:32:23 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>remove a table</refpurpose> <refpurpose>remove a table</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-droptable">
<primary>DROP TABLE</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
DROP TABLE <replaceable class="PARAMETER">name</replaceable> [, ...] [ CASCADE | RESTRICT ] DROP TABLE <replaceable class="PARAMETER">name</replaceable> [, ...] [ CASCADE | RESTRICT ]
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_trigger.sgml,v 1.15 2003/05/04 02:23:16 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_trigger.sgml,v 1.16 2003/08/31 17:32:23 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>remove a trigger</refpurpose> <refpurpose>remove a trigger</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-droptrigger">
<primary>DROP TRIGGER</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
DROP TRIGGER <replaceable class="PARAMETER">name</replaceable> ON <replaceable class="PARAMETER">table</replaceable> [ CASCADE | RESTRICT ] DROP TRIGGER <replaceable class="PARAMETER">name</replaceable> ON <replaceable class="PARAMETER">table</replaceable> [ CASCADE | RESTRICT ]
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_type.sgml,v 1.21 2003/05/04 02:23:16 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_type.sgml,v 1.22 2003/08/31 17:32:23 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>remove a user-defined data type</refpurpose> <refpurpose>remove a user-defined data type</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-droptype">
<primary>DROP TYPE</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
DROP TYPE <replaceable class="PARAMETER">typename</replaceable> [, ...] [ CASCADE | RESTRICT ] DROP TYPE <replaceable class="PARAMETER">typename</replaceable> [, ...] [ CASCADE | RESTRICT ]
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_user.sgml,v 1.16 2003/05/04 02:23:16 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_user.sgml,v 1.17 2003/08/31 17:32:23 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>remove a database user account</refpurpose> <refpurpose>remove a database user account</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-dropuser">
<primary>DROP USER</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
DROP USER <replaceable class="PARAMETER">name</replaceable> DROP USER <replaceable class="PARAMETER">name</replaceable>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_view.sgml,v 1.17 2003/05/04 02:23:16 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_view.sgml,v 1.18 2003/08/31 17:32:23 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>remove a view</refpurpose> <refpurpose>remove a view</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-dropview">
<primary>DROP VIEW</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
DROP VIEW <replaceable class="PARAMETER">name</replaceable> [, ...] [ CASCADE | RESTRICT ] DROP VIEW <replaceable class="PARAMETER">name</replaceable> [, ...] [ CASCADE | RESTRICT ]
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/dropdb.sgml,v 1.22 2003/05/26 17:50:09 momjian Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/dropdb.sgml,v 1.23 2003/08/31 17:32:23 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -15,6 +15,10 @@ PostgreSQL documentation ...@@ -15,6 +15,10 @@ PostgreSQL documentation
<refpurpose>remove a <productname>PostgreSQL</productname> database</refpurpose> <refpurpose>remove a <productname>PostgreSQL</productname> database</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="app-dropdb">
<primary>dropdb</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<cmdsynopsis> <cmdsynopsis>
<command>dropdb</command> <command>dropdb</command>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/droplang.sgml,v 1.23 2003/03/24 14:32:51 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/droplang.sgml,v 1.24 2003/08/31 17:32:23 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -15,6 +15,10 @@ PostgreSQL documentation ...@@ -15,6 +15,10 @@ PostgreSQL documentation
<refpurpose>remove a <productname>PostgreSQL</productname> procedural language</refpurpose> <refpurpose>remove a <productname>PostgreSQL</productname> procedural language</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="app-droplang">
<primary>droplang</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<cmdsynopsis> <cmdsynopsis>
<command>droplang</command> <command>droplang</command>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/dropuser.sgml,v 1.27 2003/08/17 04:46:59 momjian Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/dropuser.sgml,v 1.28 2003/08/31 17:32:23 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -15,6 +15,10 @@ PostgreSQL documentation ...@@ -15,6 +15,10 @@ PostgreSQL documentation
<refpurpose>remove a <productname>PostgreSQL</productname> user account</refpurpose> <refpurpose>remove a <productname>PostgreSQL</productname> user account</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="app-dropuser">
<primary>dropuser</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<cmdsynopsis> <cmdsynopsis>
<command>dropuser</command> <command>dropuser</command>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/ecpg-ref.sgml,v 1.26 2003/03/25 16:15:39 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/ecpg-ref.sgml,v 1.27 2003/08/31 17:32:23 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -15,6 +15,10 @@ PostgreSQL documentation ...@@ -15,6 +15,10 @@ PostgreSQL documentation
<refpurpose>embedded SQL C preprocessor</refpurpose> <refpurpose>embedded SQL C preprocessor</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="app-ecpg">
<primary>ecpg</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<cmdsynopsis> <cmdsynopsis>
<command>ecpg</command> <command>ecpg</command>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/end.sgml,v 1.9 2003/04/26 23:56:51 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/end.sgml,v 1.10 2003/08/31 17:32:23 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>commit the current transaction</refpurpose> <refpurpose>commit the current transaction</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-end">
<primary>END</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
END [ WORK | TRANSACTION ] END [ WORK | TRANSACTION ]
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/execute.sgml,v 1.5 2003/07/01 00:04:31 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/execute.sgml,v 1.6 2003/08/31 17:32:23 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>execute a prepared statement</refpurpose> <refpurpose>execute a prepared statement</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-execute">
<primary>EXECUTE</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
EXECUTE <replaceable class="PARAMETER">plan_name</replaceable> [ (<replaceable class="PARAMETER">parameter</replaceable> [, ...] ) ] EXECUTE <replaceable class="PARAMETER">plan_name</replaceable> [ (<replaceable class="PARAMETER">parameter</replaceable> [, ...] ) ]
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/explain.sgml,v 1.26 2003/04/26 23:56:51 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/explain.sgml,v 1.27 2003/08/31 17:32:23 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>show the execution plan of a statement</refpurpose> <refpurpose>show the execution plan of a statement</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-explain">
<primary>EXPLAIN</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
EXPLAIN [ ANALYZE ] [ VERBOSE ] <replaceable class="parameter">statement</replaceable> EXPLAIN [ ANALYZE ] [ VERBOSE ] <replaceable class="parameter">statement</replaceable>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/fetch.sgml,v 1.30 2003/08/24 21:02:43 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/fetch.sgml,v 1.31 2003/08/31 17:32:23 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>retrieve rows from a query using a cursor</refpurpose> <refpurpose>retrieve rows from a query using a cursor</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-fetch">
<primary>FETCH</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
FETCH [ <replaceable class="PARAMETER">direction</replaceable> { FROM | IN } ] <replaceable class="PARAMETER">cursor</replaceable> FETCH [ <replaceable class="PARAMETER">direction</replaceable> { FROM | IN } ] <replaceable class="PARAMETER">cursor</replaceable>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/grant.sgml,v 1.33 2003/04/26 23:56:51 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/grant.sgml,v 1.34 2003/08/31 17:32:23 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>define access privileges</refpurpose> <refpurpose>define access privileges</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-grant">
<primary>GRANT</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
GRANT { { SELECT | INSERT | UPDATE | DELETE | RULE | REFERENCES | TRIGGER } GRANT { { SELECT | INSERT | UPDATE | DELETE | RULE | REFERENCES | TRIGGER }
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/initdb.sgml,v 1.26 2003/03/25 16:15:41 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/initdb.sgml,v 1.27 2003/08/31 17:32:23 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -15,6 +15,10 @@ PostgreSQL documentation ...@@ -15,6 +15,10 @@ PostgreSQL documentation
<refpurpose>create a new <productname>PostgreSQL</productname> database cluster</refpurpose> <refpurpose>create a new <productname>PostgreSQL</productname> database cluster</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="app-initdb">
<primary>initdb</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<cmdsynopsis> <cmdsynopsis>
<command>initdb</command> <command>initdb</command>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/Attic/initlocation.sgml,v 1.20 2003/03/25 16:15:42 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/Attic/initlocation.sgml,v 1.21 2003/08/31 17:32:23 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -15,6 +15,10 @@ PostgreSQL documentation ...@@ -15,6 +15,10 @@ PostgreSQL documentation
<refpurpose>create a secondary <productname>PostgreSQL</productname> database storage area</refpurpose> <refpurpose>create a secondary <productname>PostgreSQL</productname> database storage area</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="app-initlocation">
<primary>initlocation</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<cmdsynopsis> <cmdsynopsis>
<command>initlocation</command> <command>initlocation</command>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/insert.sgml,v 1.23 2003/07/03 16:32:03 tgl Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/insert.sgml,v 1.24 2003/08/31 17:32:23 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>create new rows in a table</refpurpose> <refpurpose>create new rows in a table</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-insert">
<primary>INSERT</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
INSERT INTO <replaceable class="PARAMETER">table</replaceable> [ ( <replaceable class="PARAMETER">column</replaceable> [, ...] ) ] INSERT INTO <replaceable class="PARAMETER">table</replaceable> [ ( <replaceable class="PARAMETER">column</replaceable> [, ...] ) ]
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/Attic/ipcclean.sgml,v 1.8 2003/03/24 14:32:51 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/Attic/ipcclean.sgml,v 1.9 2003/08/31 17:32:23 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -15,6 +15,10 @@ PostgreSQL documentation ...@@ -15,6 +15,10 @@ PostgreSQL documentation
<refpurpose>remove shared memory and semaphores from an aborted <productname>PostgreSQL</productname> server</refpurpose> <refpurpose>remove shared memory and semaphores from an aborted <productname>PostgreSQL</productname> server</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="app-ipcclean">
<primary>ipcclean</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<cmdsynopsis> <cmdsynopsis>
<command>ipcclean</command> <command>ipcclean</command>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/listen.sgml,v 1.16 2003/04/26 23:56:51 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/listen.sgml,v 1.17 2003/08/31 17:32:23 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>listen for a notification</refpurpose> <refpurpose>listen for a notification</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-listen">
<primary>LISTEN</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
LISTEN <replaceable class="PARAMETER">name</replaceable> LISTEN <replaceable class="PARAMETER">name</replaceable>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/load.sgml,v 1.17 2003/04/26 23:56:51 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/load.sgml,v 1.18 2003/08/31 17:32:23 petere Exp $
--> -->
<refentry id="SQL-LOAD"> <refentry id="SQL-LOAD">
...@@ -13,6 +13,10 @@ $Header: /cvsroot/pgsql/doc/src/sgml/ref/load.sgml,v 1.17 2003/04/26 23:56:51 pe ...@@ -13,6 +13,10 @@ $Header: /cvsroot/pgsql/doc/src/sgml/ref/load.sgml,v 1.17 2003/04/26 23:56:51 pe
<refpurpose>load or reload a shared library file</refpurpose> <refpurpose>load or reload a shared library file</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-load">
<primary>LOAD</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
LOAD '<replaceable class="PARAMETER">filename</replaceable>' LOAD '<replaceable class="PARAMETER">filename</replaceable>'
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/lock.sgml,v 1.35 2003/04/26 23:56:51 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/lock.sgml,v 1.36 2003/08/31 17:32:23 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>lock a table</refpurpose> <refpurpose>lock a table</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-lock">
<primary>LOCK</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
LOCK [ TABLE ] <replaceable class="PARAMETER">name</replaceable> [, ...] [ IN <replaceable class="PARAMETER">lockmode</replaceable> MODE ] LOCK [ TABLE ] <replaceable class="PARAMETER">name</replaceable> [, ...] [ IN <replaceable class="PARAMETER">lockmode</replaceable> MODE ]
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/move.sgml,v 1.22 2003/05/04 02:23:16 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/move.sgml,v 1.23 2003/08/31 17:32:23 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>reposition a cursor</refpurpose> <refpurpose>reposition a cursor</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-move">
<primary>MOVE</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
MOVE [ <replaceable class="PARAMETER">direction</replaceable> { FROM | IN } ] <replaceable class="PARAMETER">cursor</replaceable> MOVE [ <replaceable class="PARAMETER">direction</replaceable> { FROM | IN } ] <replaceable class="PARAMETER">cursor</replaceable>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/notify.sgml,v 1.20 2003/04/26 23:56:51 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/notify.sgml,v 1.21 2003/08/31 17:32:23 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>generate a notification</refpurpose> <refpurpose>generate a notification</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-notify">
<primary>NOTIFY</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
NOTIFY <replaceable class="PARAMETER">name</replaceable> NOTIFY <replaceable class="PARAMETER">name</replaceable>
......
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_config-ref.sgml,v 1.15 2003/03/25 16:15:42 petere Exp $ --> <!-- $Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_config-ref.sgml,v 1.16 2003/08/31 17:32:23 petere Exp $ -->
<refentry id="app-pgconfig"> <refentry id="app-pgconfig">
<refmeta> <refmeta>
...@@ -12,6 +12,10 @@ ...@@ -12,6 +12,10 @@
<refpurpose>retrieve information about the installed version of <productname>PostgreSQL</></refpurpose> <refpurpose>retrieve information about the installed version of <productname>PostgreSQL</></refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="app-pgconfig">
<primary>pg_config</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<cmdsynopsis> <cmdsynopsis>
<command>pg_config</command> <command>pg_config</command>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_controldata.sgml,v 1.5 2003/03/24 14:32:51 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_controldata.sgml,v 1.6 2003/08/31 17:32:23 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -15,6 +15,10 @@ PostgreSQL documentation ...@@ -15,6 +15,10 @@ PostgreSQL documentation
<refpurpose>display control information of a <productname>PostgreSQL</productname> database cluster</refpurpose> <refpurpose>display control information of a <productname>PostgreSQL</productname> database cluster</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="app-pgcontroldata">
<primary>pg_controldata</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<cmdsynopsis> <cmdsynopsis>
<command>pg_controldata</command> <command>pg_controldata</command>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.22 2003/03/25 16:15:42 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.23 2003/08/31 17:32:23 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -15,6 +15,10 @@ PostgreSQL documentation ...@@ -15,6 +15,10 @@ PostgreSQL documentation
<refpurpose>start, stop, or restart a <productname>PostgreSQL</productname> server</refpurpose> <refpurpose>start, stop, or restart a <productname>PostgreSQL</productname> server</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="app-pg-ctl">
<primary>pg_ctl</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<cmdsynopsis> <cmdsynopsis>
<command>pg_ctl</command> <command>pg_ctl</command>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_dump.sgml,v 1.62 2003/06/11 16:29:42 tgl Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_dump.sgml,v 1.63 2003/08/31 17:32:23 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -18,6 +18,10 @@ PostgreSQL documentation ...@@ -18,6 +18,10 @@ PostgreSQL documentation
</refpurpose> </refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="app-pgdump">
<primary>pg_dump</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<cmdsynopsis> <cmdsynopsis>
<command>pg_dump</command> <command>pg_dump</command>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_dumpall.sgml,v 1.39 2003/05/30 23:55:10 tgl Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_dumpall.sgml,v 1.40 2003/08/31 17:32:24 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -15,6 +15,10 @@ PostgreSQL documentation ...@@ -15,6 +15,10 @@ PostgreSQL documentation
<refpurpose>extract a <productname>PostgreSQL</productname> database cluster into a script file</refpurpose> <refpurpose>extract a <productname>PostgreSQL</productname> database cluster into a script file</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="app-pg-dumpall">
<primary>pg_dumpall</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<cmdsynopsis> <cmdsynopsis>
<command>pg_dumpall</command> <command>pg_dumpall</command>
......
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_restore.sgml,v 1.40 2003/08/28 20:44:02 tgl Exp $ --> <!-- $Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_restore.sgml,v 1.41 2003/08/31 17:32:24 petere Exp $ -->
<refentry id="APP-PGRESTORE"> <refentry id="APP-PGRESTORE">
<refmeta> <refmeta>
...@@ -15,6 +15,10 @@ ...@@ -15,6 +15,10 @@
</refpurpose> </refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="app-pgrestore">
<primary>pg_restore</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<cmdsynopsis> <cmdsynopsis>
<command>pg_restore</command> <command>pg_restore</command>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/Attic/pgtclsh.sgml,v 1.8 2003/03/25 16:15:43 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/Attic/pgtclsh.sgml,v 1.9 2003/08/31 17:32:24 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -17,6 +17,10 @@ PostgreSQL documentation ...@@ -17,6 +17,10 @@ PostgreSQL documentation
</refpurpose> </refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="app-pgtclsh">
<primary>pgtclsh</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<cmdsynopsis> <cmdsynopsis>
<command>pgtclsh</command> <command>pgtclsh</command>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/Attic/pgtksh.sgml,v 1.8 2003/03/25 16:15:43 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/Attic/pgtksh.sgml,v 1.9 2003/08/31 17:32:24 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -17,6 +17,10 @@ PostgreSQL documentation ...@@ -17,6 +17,10 @@ PostgreSQL documentation
</refpurpose> </refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="app-pgtksh">
<primary>pgtksh</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<cmdsynopsis> <cmdsynopsis>
<command>pgtksh</command> <command>pgtksh</command>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/postgres-ref.sgml,v 1.34 2003/07/29 00:03:17 tgl Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/postgres-ref.sgml,v 1.35 2003/08/31 17:32:24 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -15,6 +15,10 @@ PostgreSQL documentation ...@@ -15,6 +15,10 @@ PostgreSQL documentation
<refpurpose>run a <productname>PostgreSQL</productname> server in single-user mode</refpurpose> <refpurpose>run a <productname>PostgreSQL</productname> server in single-user mode</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="app-postgres">
<primary>postgres (the program)</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<cmdsynopsis> <cmdsynopsis>
<!-- standalone call --> <!-- standalone call -->
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/postmaster.sgml,v 1.36 2003/03/25 16:15:43 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/postmaster.sgml,v 1.37 2003/08/31 17:32:24 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -15,6 +15,10 @@ PostgreSQL documentation ...@@ -15,6 +15,10 @@ PostgreSQL documentation
<refpurpose><productname>PostgreSQL</productname> multiuser database server</refpurpose> <refpurpose><productname>PostgreSQL</productname> multiuser database server</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="app-postmaster">
<primary>postmaster</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<cmdsynopsis> <cmdsynopsis>
<command>postmaster</command> <command>postmaster</command>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/prepare.sgml,v 1.5 2003/08/17 04:46:59 momjian Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/prepare.sgml,v 1.6 2003/08/31 17:32:24 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>prepare a statement for execution</refpurpose> <refpurpose>prepare a statement for execution</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-prepare">
<primary>PREPARE</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
PREPARE <replaceable class="PARAMETER">plan_name</replaceable> [ (<replaceable class="PARAMETER">datatype</replaceable> [, ...] ) ] AS <replaceable class="PARAMETER">statement</replaceable> PREPARE <replaceable class="PARAMETER">plan_name</replaceable> [ (<replaceable class="PARAMETER">datatype</replaceable> [, ...] ) ] AS <replaceable class="PARAMETER">statement</replaceable>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.94 2003/08/02 02:44:38 momjian Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.95 2003/08/31 17:32:24 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -17,6 +17,10 @@ PostgreSQL documentation ...@@ -17,6 +17,10 @@ PostgreSQL documentation
</refpurpose> </refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="app-psql">
<primary>psql</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<cmdsynopsis> <cmdsynopsis>
<command>psql</command> <command>psql</command>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/reindex.sgml,v 1.17 2003/04/26 23:56:51 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/reindex.sgml,v 1.18 2003/08/31 17:32:24 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>rebuild indexes</refpurpose> <refpurpose>rebuild indexes</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-reindex">
<primary>REINDEX</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
REINDEX { DATABASE | TABLE | INDEX } <replaceable class="PARAMETER">name</replaceable> [ FORCE ] REINDEX { DATABASE | TABLE | INDEX } <replaceable class="PARAMETER">name</replaceable> [ FORCE ]
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/reset.sgml,v 1.20 2003/05/04 02:23:16 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/reset.sgml,v 1.21 2003/08/31 17:32:24 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>restore the value of a run-time parameter to the default value</refpurpose> <refpurpose>restore the value of a run-time parameter to the default value</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-reset">
<primary>RESET</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
RESET <replaceable class="PARAMETER">parameter</replaceable> RESET <replaceable class="PARAMETER">parameter</replaceable>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/revoke.sgml,v 1.26 2003/04/26 23:56:51 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/revoke.sgml,v 1.27 2003/08/31 17:32:24 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>remove access privileges</refpurpose> <refpurpose>remove access privileges</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-revoke">
<primary>REVOKE</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
REVOKE [ GRANT OPTION FOR ] REVOKE [ GRANT OPTION FOR ]
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/rollback.sgml,v 1.14 2003/04/26 23:56:51 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/rollback.sgml,v 1.15 2003/08/31 17:32:24 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>abort the current transaction</refpurpose> <refpurpose>abort the current transaction</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-rollback">
<primary>ROLLBACK</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
ROLLBACK [ WORK | TRANSACTION ] ROLLBACK [ WORK | TRANSACTION ]
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/select.sgml,v 1.68 2003/08/17 22:09:00 tgl Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/select.sgml,v 1.69 2003/08/31 17:32:24 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>retrieve rows from a table or view</refpurpose> <refpurpose>retrieve rows from a table or view</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-select">
<primary>SELECT</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
SELECT [ ALL | DISTINCT [ ON ( <replaceable class="parameter">expression</replaceable> [, ...] ) ] ] SELECT [ ALL | DISTINCT [ ON ( <replaceable class="parameter">expression</replaceable> [, ...] ) ] ]
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/select_into.sgml,v 1.22 2003/05/04 02:23:16 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/select_into.sgml,v 1.23 2003/08/31 17:32:24 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>create a new table from the results of a query</refpurpose> <refpurpose>create a new table from the results of a query</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-selectinto">
<primary>SELECT INTO</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
SELECT [ ALL | DISTINCT [ ON ( <replaceable class="PARAMETER">expression</replaceable> [, ...] ) ] ] SELECT [ ALL | DISTINCT [ ON ( <replaceable class="PARAMETER">expression</replaceable> [, ...] ) ] ]
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/set.sgml,v 1.80 2003/07/29 00:03:17 tgl Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/set.sgml,v 1.81 2003/08/31 17:32:24 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>change a run-time parameter</refpurpose> <refpurpose>change a run-time parameter</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-set">
<primary>SET</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
SET [ SESSION | LOCAL ] <replaceable class="PARAMETER">variable</replaceable> { TO | = } { <replaceable class="PARAMETER">value</replaceable> | '<replaceable class="PARAMETER">value</replaceable>' | DEFAULT } SET [ SESSION | LOCAL ] <replaceable class="PARAMETER">variable</replaceable> { TO | = } { <replaceable class="PARAMETER">value</replaceable> | '<replaceable class="PARAMETER">value</replaceable>' | DEFAULT }
......
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/ref/set_constraints.sgml,v 1.6 2003/05/04 02:23:16 petere Exp $ --> <!-- $Header: /cvsroot/pgsql/doc/src/sgml/ref/set_constraints.sgml,v 1.7 2003/08/31 17:32:24 petere Exp $ -->
<refentry id="SQL-SET-CONSTRAINTS"> <refentry id="SQL-SET-CONSTRAINTS">
<refmeta> <refmeta>
<refentrytitle id="SQL-SET-CONSTRAINTS-title">SET CONSTRAINTS</refentrytitle> <refentrytitle id="SQL-SET-CONSTRAINTS-title">SET CONSTRAINTS</refentrytitle>
...@@ -10,6 +10,10 @@ ...@@ -10,6 +10,10 @@
<refpurpose>set the constraint mode of the current transaction</refpurpose> <refpurpose>set the constraint mode of the current transaction</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-set-constraints">
<primary>SET CONSTRAINTS</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
SET CONSTRAINTS { ALL | <replaceable class="parameter">constraint</replaceable> [, ...] } { DEFERRED | IMMEDIATE } SET CONSTRAINTS { ALL | <replaceable class="parameter">constraint</replaceable> [, ...] } { DEFERRED | IMMEDIATE }
......
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/ref/set_session_auth.sgml,v 1.9 2003/05/04 02:23:16 petere Exp $ --> <!-- $Header: /cvsroot/pgsql/doc/src/sgml/ref/set_session_auth.sgml,v 1.10 2003/08/31 17:32:24 petere Exp $ -->
<refentry id="SQL-SET-SESSION-AUTHORIZATION"> <refentry id="SQL-SET-SESSION-AUTHORIZATION">
<refmeta> <refmeta>
<refentrytitle id="sql-set-session-authorization-title">SET SESSION AUTHORIZATION</refentrytitle> <refentrytitle id="sql-set-session-authorization-title">SET SESSION AUTHORIZATION</refentrytitle>
...@@ -10,6 +10,10 @@ ...@@ -10,6 +10,10 @@
<refpurpose>set the session user identifier and the current user identifier of the current session</refpurpose> <refpurpose>set the session user identifier and the current user identifier of the current session</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-set-session-authorization">
<primary>SET SESSION AUTHORIZATION</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
SET [ SESSION | LOCAL ] SESSION AUTHORIZATION <replaceable class="parameter">username</replaceable> SET [ SESSION | LOCAL ] SESSION AUTHORIZATION <replaceable class="parameter">username</replaceable>
......
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/ref/set_transaction.sgml,v 1.14 2003/05/04 02:23:16 petere Exp $ --> <!-- $Header: /cvsroot/pgsql/doc/src/sgml/ref/set_transaction.sgml,v 1.15 2003/08/31 17:32:24 petere Exp $ -->
<refentry id="SQL-SET-TRANSACTION"> <refentry id="SQL-SET-TRANSACTION">
<refmeta> <refmeta>
<refentrytitle id="SQL-SET-TRANSACTION-TITLE">SET TRANSACTION</refentrytitle> <refentrytitle id="SQL-SET-TRANSACTION-TITLE">SET TRANSACTION</refentrytitle>
...@@ -10,6 +10,10 @@ ...@@ -10,6 +10,10 @@
<refpurpose>set the characteristics of the current transaction</refpurpose> <refpurpose>set the characteristics of the current transaction</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-set-transaction">
<primary>SET TRANSACTION</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
SET TRANSACTION SET TRANSACTION
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/show.sgml,v 1.30 2003/07/29 00:03:17 tgl Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/show.sgml,v 1.31 2003/08/31 17:32:24 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>show the value of a run-time parameter</refpurpose> <refpurpose>show the value of a run-time parameter</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-show">
<primary>SHOW</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
SHOW <replaceable class="PARAMETER">name</replaceable> SHOW <replaceable class="PARAMETER">name</replaceable>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/start_transaction.sgml,v 1.5 2003/04/26 23:56:51 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/start_transaction.sgml,v 1.6 2003/08/31 17:32:24 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>start a transaction block</refpurpose> <refpurpose>start a transaction block</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-start-transaction">
<primary>START TRANSACTION</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
START TRANSACTION [ ISOLATION LEVEL { READ COMMITTED | SERIALIZABLE } ] [ READ WRITE | READ ONLY ] START TRANSACTION [ ISOLATION LEVEL { READ COMMITTED | SERIALIZABLE } ] [ READ WRITE | READ ONLY ]
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/truncate.sgml,v 1.10 2003/04/26 23:56:51 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/truncate.sgml,v 1.11 2003/08/31 17:32:24 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>empty a table</refpurpose> <refpurpose>empty a table</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-truncate">
<primary>TRUNCATE</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
TRUNCATE [ TABLE ] <replaceable class="PARAMETER">name</replaceable> TRUNCATE [ TABLE ] <replaceable class="PARAMETER">name</replaceable>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/unlisten.sgml,v 1.21 2003/04/26 23:56:51 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/unlisten.sgml,v 1.22 2003/08/31 17:32:24 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>stop listening for a notification</refpurpose> <refpurpose>stop listening for a notification</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-unlisten">
<primary>UNLISTEN</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
UNLISTEN { <replaceable class="PARAMETER">name</replaceable> | * } UNLISTEN { <replaceable class="PARAMETER">name</replaceable> | * }
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/update.sgml,v 1.23 2003/07/03 16:32:12 tgl Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/update.sgml,v 1.24 2003/08/31 17:32:24 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>update rows of a table</refpurpose> <refpurpose>update rows of a table</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-update">
<primary>UPDATE</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
UPDATE [ ONLY ] <replaceable class="PARAMETER">table</replaceable> SET <replaceable class="PARAMETER">column</replaceable> = { <replaceable class="PARAMETER">expression</replaceable> | DEFAULT } [, ...] UPDATE [ ONLY ] <replaceable class="PARAMETER">table</replaceable> SET <replaceable class="PARAMETER">column</replaceable> = { <replaceable class="PARAMETER">expression</replaceable> | DEFAULT } [, ...]
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/vacuum.sgml,v 1.31 2003/04/26 23:56:51 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/vacuum.sgml,v 1.32 2003/08/31 17:32:24 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -14,6 +14,10 @@ PostgreSQL documentation ...@@ -14,6 +14,10 @@ PostgreSQL documentation
<refpurpose>garbage-collect and optionally analyze a database</refpurpose> <refpurpose>garbage-collect and optionally analyze a database</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="sql-vacuum">
<primary>VACUUM</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
VACUUM [ FULL ] [ FREEZE ] [ VERBOSE ] [ <replaceable class="PARAMETER">table</replaceable> ] VACUUM [ FULL ] [ FREEZE ] [ VERBOSE ] [ <replaceable class="PARAMETER">table</replaceable> ]
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/vacuumdb.sgml,v 1.30 2003/08/17 04:46:59 momjian Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/vacuumdb.sgml,v 1.31 2003/08/31 17:32:24 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -15,6 +15,10 @@ PostgreSQL documentation ...@@ -15,6 +15,10 @@ PostgreSQL documentation
<refpurpose>garbage-collect and analyze a <productname>PostgreSQL</productname> database</refpurpose> <refpurpose>garbage-collect and analyze a <productname>PostgreSQL</productname> database</refpurpose>
</refnamediv> </refnamediv>
<indexterm zone="app-vacuumdb">
<primary>vacuumdb</primary>
</indexterm>
<refsynopsisdiv> <refsynopsisdiv>
<cmdsynopsis> <cmdsynopsis>
<command>vacuumdb</command> <command>vacuumdb</command>
......
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/regress.sgml,v 1.32 2003/04/06 17:47:24 tgl Exp $ --> <!-- $Header: /cvsroot/pgsql/doc/src/sgml/regress.sgml,v 1.33 2003/08/31 17:32:19 petere Exp $ -->
<chapter id="regress"> <chapter id="regress">
<title id="regress-title">Regression Tests</title> <title id="regress-title">Regression Tests</title>
<indexterm zone="regress">
<primary>regression tests</primary>
</indexterm>
<indexterm zone="regress">
<primary>test</primary>
</indexterm>
<para> <para>
The regression tests are a comprehensive set of tests for the SQL The regression tests are a comprehensive set of tests for the SQL
implementation in <productname>PostgreSQL</productname>. They test implementation in <productname>PostgreSQL</productname>. They test
......
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/rules.sgml,v 1.28 2003/04/11 13:22:35 petere Exp $ --> <!-- $Header: /cvsroot/pgsql/doc/src/sgml/rules.sgml,v 1.29 2003/08/31 17:32:19 petere Exp $ -->
<Chapter Id="rules"> <Chapter Id="rules">
<Title>The Rule System</Title> <Title>The Rule System</Title>
<indexterm zone="rules"> <indexterm zone="rules">
<primary>rules</primary> <primary>rule</primary>
</indexterm> </indexterm>
<Para> <Para>
...@@ -35,6 +35,10 @@ ...@@ -35,6 +35,10 @@
<Sect1 id="querytree"> <Sect1 id="querytree">
<Title>The Query Tree</Title> <Title>The Query Tree</Title>
<indexterm zone="querytree">
<primary>query tree</primary>
</indexterm>
<Para> <Para>
To understand how the rule system works it is necessary to know To understand how the rule system works it is necessary to know
when it is invoked and what its input and results are. when it is invoked and what its input and results are.
...@@ -146,6 +150,7 @@ ...@@ -146,6 +150,7 @@
<Term> <Term>
the target list the target list
</Term> </Term>
<indexterm><primary>target list</></>
<ListItem> <ListItem>
<Para> <Para>
The target list is a list of expressions that define the The target list is a list of expressions that define the
...@@ -258,7 +263,16 @@ ...@@ -258,7 +263,16 @@
<Sect1 id="rules-views"> <Sect1 id="rules-views">
<Title>Views and the Rule System</Title> <Title>Views and the Rule System</Title>
<indexterm zone="rules-views"><primary>rules</><secondary>and views</></>
<indexterm zone="rules-views">
<primary>rule</primary>
<secondary>and views</secondary>
</indexterm>
<indexterm zone="rules-views">
<primary>view</>
<secondary>implementation through rules</>
</indexterm>
<Para> <Para>
Views in <ProductName>PostgreSQL</ProductName> are implemented Views in <ProductName>PostgreSQL</ProductName> are implemented
...@@ -286,9 +300,14 @@ CREATE RULE "_RETURN" AS ON SELECT TO myview DO INSTEAD ...@@ -286,9 +300,14 @@ CREATE RULE "_RETURN" AS ON SELECT TO myview DO INSTEAD
same thing: relations. same thing: relations.
</Para> </Para>
<Sect2> <Sect2 id="rules-select">
<Title>How <command>SELECT</command> Rules Work</Title> <Title>How <command>SELECT</command> Rules Work</Title>
<indexterm zone="rules-select">
<primary>rule</primary>
<secondary sortas="SELECT">for SELECT</secondary>
</indexterm>
<Para> <Para>
Rules <literal>ON SELECT</> are applied to all queries as the last step, even Rules <literal>ON SELECT</> are applied to all queries as the last step, even
if the command given is an <command>INSERT</command>, if the command given is an <command>INSERT</command>,
...@@ -736,7 +755,7 @@ SELECT t1.a, t2.b FROM t1, t2 WHERE t1.a = t2.a; ...@@ -736,7 +755,7 @@ SELECT t1.a, t2.b FROM t1, t2 WHERE t1.a = t2.a;
To resolve this problem, another entry is added to the target list To resolve this problem, another entry is added to the target list
in <command>UPDATE</command> (and also in in <command>UPDATE</command> (and also in
<command>DELETE</command>) statements: the current tuple ID <command>DELETE</command>) statements: the current tuple ID
(<acronym>CTID</>). This is a system column containing the (<acronym>CTID</>).<indexterm><primary>CTID</></> This is a system column containing the
file block number and position in the block for the row. Knowing file block number and position in the block for the row. Knowing
the table, the <acronym>CTID</> can be used to retrieve the the table, the <acronym>CTID</> can be used to retrieve the
original row of <literal>t1</> to be updated. After adding the <acronym>CTID</> original row of <literal>t1</> to be updated. After adding the <acronym>CTID</>
...@@ -817,6 +836,21 @@ SELECT t1.a, t2.b, t1.ctid FROM t1, t2 WHERE t1.a = t2.a; ...@@ -817,6 +836,21 @@ SELECT t1.a, t2.b, t1.ctid FROM t1, t2 WHERE t1.a = t2.a;
<Sect1 id="rules-update"> <Sect1 id="rules-update">
<Title>Rules on <command>INSERT</>, <command>UPDATE</>, and <command>DELETE</></Title> <Title>Rules on <command>INSERT</>, <command>UPDATE</>, and <command>DELETE</></Title>
<indexterm zone="rules-update">
<primary>rule</primary>
<secondary sortas="INSERT">for INSERT</secondary>
</indexterm>
<indexterm zone="rules-update">
<primary>rule</primary>
<secondary sortas="UPDATE">for UPDATE</secondary>
</indexterm>
<indexterm zone="rules-update">
<primary>rule</primary>
<secondary sortas="DELETE">for DELETE</secondary>
</indexterm>
<Para> <Para>
Rules that are defined on <command>INSERT</>, <command>UPDATE</>, Rules that are defined on <command>INSERT</>, <command>UPDATE</>,
and <command>DELETE</> are significantly different from the view rules and <command>DELETE</> are significantly different from the view rules
...@@ -1243,7 +1277,7 @@ SELECT shoelace_data.sl_name, 0, ...@@ -1243,7 +1277,7 @@ SELECT shoelace_data.sl_name, 0,
<Sect2 id="rules-update-views"> <Sect2 id="rules-update-views">
<Title>Cooperation with Views</Title> <Title>Cooperation with Views</Title>
<indexterm zone="rules-update-views"><primary>views</><secondary>updating</></> <indexterm zone="rules-update-views"><primary>view</><secondary>updating</></>
<Para> <Para>
A simple way to protect view relations from the mentioned A simple way to protect view relations from the mentioned
...@@ -1654,6 +1688,16 @@ SELECT * FROM shoelace; ...@@ -1654,6 +1688,16 @@ SELECT * FROM shoelace;
<Sect1 id="rules-privileges"> <Sect1 id="rules-privileges">
<Title>Rules and Privileges</Title> <Title>Rules and Privileges</Title>
<indexterm zone="rules-privileges">
<primary>privilege</primary>
<secondary sortas="Regeln">with rules</secondary>
</indexterm>
<indexterm zone="rules-privileges">
<primary>privilege</primary>
<secondary sortas="Sichten">with views</secondary>
</indexterm>
<Para> <Para>
Due to rewriting of queries by the <ProductName>PostgreSQL</ProductName> Due to rewriting of queries by the <ProductName>PostgreSQL</ProductName>
rule system, other tables/views than those used in the original rule system, other tables/views than those used in the original
...@@ -1796,6 +1840,16 @@ GRANT SELECT ON phone_number TO secretary; ...@@ -1796,6 +1840,16 @@ GRANT SELECT ON phone_number TO secretary;
<Sect1 id="rules-triggers"> <Sect1 id="rules-triggers">
<Title>Rules versus Triggers</Title> <Title>Rules versus Triggers</Title>
<indexterm zone="rules-triggers">
<primary>rule</primary>
<secondary sortas="Trigger">compared with triggers</secondary>
</indexterm>
<indexterm zone="rules-triggers">
<primary>trigger</primary>
<secondary sortas="Regeln">compared with rules</secondary>
</indexterm>
<Para> <Para>
Many things that can be done using triggers can also be Many things that can be done using triggers can also be
implemented using the <ProductName>PostgreSQL</ProductName> implemented using the <ProductName>PostgreSQL</ProductName>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.200 2003/08/17 22:19:10 tgl Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.201 2003/08/31 17:32:19 petere Exp $
--> -->
<Chapter Id="runtime"> <Chapter Id="runtime">
...@@ -69,7 +69,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.200 2003/08/17 22:19:10 tg ...@@ -69,7 +69,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.200 2003/08/17 22:19:10 tg
default, although locations such as default, although locations such as
<filename>/usr/local/pgsql/data</filename> or <filename>/usr/local/pgsql/data</filename> or
<filename>/var/lib/pgsql/data</filename> are popular. To initialize a <filename>/var/lib/pgsql/data</filename> are popular. To initialize a
database cluster, use the command <command>initdb</command>, which is database cluster, use the command <command>initdb</command>,<indexterm><primary>initdb</></> which is
installed with <productname>PostgreSQL</productname>. The desired installed with <productname>PostgreSQL</productname>. The desired
file system location of your database system is indicated by the file system location of your database system is indicated by the
<option>-D</option> option, for example <option>-D</option> option, for example
...@@ -120,11 +120,13 @@ postgres$ <userinput>initdb -D /usr/local/pgsql/data</userinput> ...@@ -120,11 +120,13 @@ postgres$ <userinput>initdb -D /usr/local/pgsql/data</userinput>
<para> <para>
However, while the directory contents are secure, the default However, while the directory contents are secure, the default
client authentication setup allows any local user to connect to the client authentication setup allows any local user to connect to the
database and even become the database superuser. If you do not trust database and even become the database superuser. If you do not
other local users, we recommend you use <command>initdb</command>'s trust other local users, we recommend you use
<option>-W</option> or <option>--pwprompt</option> option to assign a <command>initdb</command>'s <option>-W</option> or
password to the database superuser. After <command>initdb</command>, <option>--pwprompt</option> option to assign a password to the
modify the <filename>pg_hba.conf</filename> file to use <literal>md5</> or database superuser.<indexterm><primary>password</><secondary>of the
superuser</></indexterm> After <command>initdb</command>, modify
the <filename>pg_hba.conf</filename> file to use <literal>md5</> or
<literal>password</> instead of <literal>trust</> authentication <literal>password</> instead of <literal>trust</> authentication
<emphasis>before</> you start the server for the first time. (Other <emphasis>before</> you start the server for the first time. (Other
approaches include using <literal>ident</literal> authentication or approaches include using <literal>ident</literal> authentication or
...@@ -207,8 +209,9 @@ pg_ctl start -l logfile ...@@ -207,8 +209,9 @@ pg_ctl start -l logfile
<para> <para>
Normally, you will want to start the database server when the Normally, you will want to start the database server when the
computer boots. Autostart scripts are operating system-specific. computer boots.<indexterm><primary>booting</><secondary>starting
There are a few distributed with the server during</></> Autostart scripts are operating
system-specific. There are a few distributed with
<productname>PostgreSQL</productname> in the <productname>PostgreSQL</productname> in the
<filename>contrib/start-scripts</> directory. This may require root <filename>contrib/start-scripts</> directory. This may require root
privileges. privileges.
...@@ -240,7 +243,7 @@ su -c 'pg_ctl start -D /usr/local/pgsql/data -l serverlog' postgres ...@@ -240,7 +243,7 @@ su -c 'pg_ctl start -D /usr/local/pgsql/data -l serverlog' postgres
For <productname>FreeBSD</productname>, look at the file For <productname>FreeBSD</productname>, look at the file
<filename>contrib/start-scripts/freebsd</filename> in the <filename>contrib/start-scripts/freebsd</filename> in the
<productname>PostgreSQL</productname> source distribution. <productname>PostgreSQL</productname> source distribution.
<indexterm><primary>FreeBSD</></> <indexterm><primary>FreeBSD</><secondary>start script</secondary></>
</para> </para>
</listitem> </listitem>
...@@ -248,7 +251,7 @@ su -c 'pg_ctl start -D /usr/local/pgsql/data -l serverlog' postgres ...@@ -248,7 +251,7 @@ su -c 'pg_ctl start -D /usr/local/pgsql/data -l serverlog' postgres
<para> <para>
On <productname>OpenBSD</productname>, add the following lines On <productname>OpenBSD</productname>, add the following lines
to the file <filename>/etc/rc.local</filename>: to the file <filename>/etc/rc.local</filename>:
<indexterm><primary>OpenBSD</></> <indexterm><primary>OpenBSD</><secondary>start script</secondary></>
<programlisting> <programlisting>
if [ -x /usr/local/pgsql/bin/pg_ctl -a -x /usr/local/pgsql/bin/postmaster ]; then if [ -x /usr/local/pgsql/bin/pg_ctl -a -x /usr/local/pgsql/bin/postmaster ]; then
su - -c '/usr/local/pgsql/bin/pg_ctl start -l /var/postgresql/log -s' postgres su - -c '/usr/local/pgsql/bin/pg_ctl start -l /var/postgresql/log -s' postgres
...@@ -261,7 +264,7 @@ fi ...@@ -261,7 +264,7 @@ fi
<listitem> <listitem>
<para> <para>
On <productname>Linux</productname> systems either add On <productname>Linux</productname> systems either add
<indexterm><primary>Linux</></> <indexterm><primary>Linux</><secondary>start script</secondary></>
<programlisting> <programlisting>
/usr/local/pgsql/bin/pg_ctl start -l logfile -D /usr/local/pgsql/data /usr/local/pgsql/bin/pg_ctl start -l logfile -D /usr/local/pgsql/data
</programlisting> </programlisting>
...@@ -276,7 +279,7 @@ fi ...@@ -276,7 +279,7 @@ fi
On <productname>NetBSD</productname>, either use the On <productname>NetBSD</productname>, either use the
<productname>FreeBSD</productname> or <productname>FreeBSD</productname> or
<productname>Linux</productname> start scripts, depending on <productname>Linux</productname> start scripts, depending on
preference. <indexterm><primary>NetBSD</></> preference. <indexterm><primary>NetBSD</><secondary>start script</secondary></>
</para> </para>
</listitem> </listitem>
...@@ -285,7 +288,7 @@ fi ...@@ -285,7 +288,7 @@ fi
On <productname>Solaris</productname>, create a file called On <productname>Solaris</productname>, create a file called
<filename>/etc/init.d/postgresql</filename> that contains <filename>/etc/init.d/postgresql</filename> that contains
the following line: the following line:
<indexterm><primary>Solaris</></> <indexterm><primary>Solaris</><secondary>start script</secondary></>
<programlisting> <programlisting>
su - postgres -c "/usr/local/pgsql/bin/pg_ctl start -l logfile -D /usr/local/pgsql/data" su - postgres -c "/usr/local/pgsql/bin/pg_ctl start -l logfile -D /usr/local/pgsql/data"
</programlisting> </programlisting>
...@@ -441,7 +444,7 @@ psql: could not connect to server: Connection refused ...@@ -441,7 +444,7 @@ psql: could not connect to server: Connection refused
<indexterm> <indexterm>
<primary>configuration</primary> <primary>configuration</primary>
<secondary>server</secondary> <secondary>of the server</secondary>
</indexterm> </indexterm>
<para> <para>
...@@ -462,7 +465,7 @@ psql: could not connect to server: Connection refused ...@@ -462,7 +465,7 @@ psql: could not connect to server: Connection refused
<para> <para>
One way to set these options is to edit the file One way to set these options is to edit the file
<filename>postgresql.conf</filename> in the data directory. (A <filename>postgresql.conf</filename><indexterm><primary>postgresql.conf</></> in the data directory. (A
default file is installed there.) An example of what this file might default file is installed there.) An example of what this file might
look like is: look like is:
<programlisting> <programlisting>
...@@ -626,7 +629,7 @@ SET ENABLE_SEQSCAN TO OFF; ...@@ -626,7 +629,7 @@ SET ENABLE_SEQSCAN TO OFF;
<term><varname>TCPIP_SOCKET</varname> (<type>boolean</type>)</term> <term><varname>TCPIP_SOCKET</varname> (<type>boolean</type>)</term>
<listitem> <listitem>
<para> <para>
If this is true, then the server will accept TCP/IP connections. If this is true, then the server will accept TCP/IP connections.<indexterm><primary>TCP/IP</></>
Otherwise only local Unix domain socket connections are Otherwise only local Unix domain socket connections are
accepted. It is off by default. This option can only be set at accepted. It is off by default. This option can only be set at
server start. server start.
...@@ -781,7 +784,8 @@ SET ENABLE_SEQSCAN TO OFF; ...@@ -781,7 +784,8 @@ SET ENABLE_SEQSCAN TO OFF;
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term><varname>AUTHENTICATION_TIMEOUT</varname> (<type>integer</type>)</term> <term><varname>AUTHENTICATION_TIMEOUT</varname> (<type>integer</type>)</term>
<indexterm><primary>timeout</><secondary>authentication</></indexterm> <indexterm><primary>timeout</><secondary>client authentication</></indexterm>
<indexterm><primary>client authentication</><secondary>timeout during</></indexterm>
<listitem> <listitem>
<para> <para>
Maximum time to complete client authentication, in seconds. If a Maximum time to complete client authentication, in seconds. If a
...@@ -1514,8 +1518,17 @@ SET ENABLE_SEQSCAN TO OFF; ...@@ -1514,8 +1518,17 @@ SET ENABLE_SEQSCAN TO OFF;
<sect2 id="runtime-config-logging"> <sect2 id="runtime-config-logging">
<title>Error Reporting and Logging</title> <title>Error Reporting and Logging</title>
<indexterm zone="runtime-config-logging">
<primary>server log</primary>
</indexterm>
<sect3 id="runtime-config-logging-syslog"> <sect3 id="runtime-config-logging-syslog">
<title>Syslog</title> <title>Syslog</title>
<indexterm zone="runtime-config-logging-syslog">
<primary>syslog</primary>
</indexterm>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
...@@ -2137,7 +2150,7 @@ SET ENABLE_SEQSCAN TO OFF; ...@@ -2137,7 +2150,7 @@ SET ENABLE_SEQSCAN TO OFF;
<varlistentry> <varlistentry>
<term><varname>AUSTRALIAN_TIMEZONES</varname> (<type>boolean</type>)</term> <term><varname>AUSTRALIAN_TIMEZONES</varname> (<type>boolean</type>)</term>
<indexterm><primary>Australian time zones</></> <indexterm><primary>time zone</><secondary>Australian</></>
<listitem> <listitem>
<para> <para>
If set to true, <literal>ACST</literal>, If set to true, <literal>ACST</literal>,
...@@ -2154,8 +2167,8 @@ SET ENABLE_SEQSCAN TO OFF; ...@@ -2154,8 +2167,8 @@ SET ENABLE_SEQSCAN TO OFF;
<primary>significant digits</primary> <primary>significant digits</primary>
</indexterm> </indexterm>
<indexterm> <indexterm>
<primary>display</primary> <primary>floating-point</primary>
<secondary>of float numbers</secondary> <secondary>display</secondary>
</indexterm> </indexterm>
<term><varname>EXTRA_FLOAT_DIGITS</varname> (<type>integer</type>)</term> <term><varname>EXTRA_FLOAT_DIGITS</varname> (<type>integer</type>)</term>
...@@ -2175,7 +2188,7 @@ SET ENABLE_SEQSCAN TO OFF; ...@@ -2175,7 +2188,7 @@ SET ENABLE_SEQSCAN TO OFF;
<varlistentry> <varlistentry>
<term><varname>CLIENT_ENCODING</varname> (<type>string</type>)</term> <term><varname>CLIENT_ENCODING</varname> (<type>string</type>)</term>
<indexterm><primary>character set encoding</></> <indexterm><primary>character set</></>
<listitem> <listitem>
<para> <para>
Sets the client-side encoding (character set). Sets the client-side encoding (character set).
...@@ -2338,7 +2351,7 @@ dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir' ...@@ -2338,7 +2351,7 @@ dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir'
<varlistentry> <varlistentry>
<indexterm> <indexterm>
<primary>deadlock</primary> <primary>deadlock</primary>
<secondary>timeout</secondary> <secondary>timeout during</secondary>
</indexterm> </indexterm>
<indexterm> <indexterm>
<primary>timeout</primary> <primary>timeout</primary>
...@@ -2388,12 +2401,12 @@ dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir' ...@@ -2388,12 +2401,12 @@ dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir'
<title>Version and Platform Compatibility</title> <title>Version and Platform Compatibility</title>
<sect3 id="runtime-config-compatible-version"> <sect3 id="runtime-config-compatible-version">
<title>Previous Postgres Versions</title> <title>Previous PostgreSQL Versions</title>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term><varname>ADD_MISSING_FROM</varname> (<type>boolean</type>)</term> <term><varname>ADD_MISSING_FROM</varname> (<type>boolean</type>)</term>
<indexterm><primary>missing from</></> <indexterm><primary>FROM</><secondary>missing</></>
<listitem> <listitem>
<para> <para>
When <literal>true</>, tables that are referenced by a query will be When <literal>true</>, tables that are referenced by a query will be
...@@ -2913,7 +2926,7 @@ $ <userinput>postmaster -o '-S 1024 -s'</userinput> ...@@ -2913,7 +2926,7 @@ $ <userinput>postmaster -o '-S 1024 -s'</userinput>
<varlistentry> <varlistentry>
<term><systemitem class="osname">BSD/OS</></term> <term><systemitem class="osname">BSD/OS</></term>
<indexterm><primary>BSD/OS</></> <indexterm><primary>BSD/OS</><secondary>IPC configuration</></>
<listitem> <listitem>
<formalpara> <formalpara>
<title>Shared Memory</> <title>Shared Memory</>
...@@ -2974,9 +2987,9 @@ options "SEMMNS=240" ...@@ -2974,9 +2987,9 @@ options "SEMMNS=240"
<term><systemitem class="osname">FreeBSD</></term> <term><systemitem class="osname">FreeBSD</></term>
<term><systemitem class="osname">NetBSD</></term> <term><systemitem class="osname">NetBSD</></term>
<term><systemitem class="osname">OpenBSD</></term> <term><systemitem class="osname">OpenBSD</></term>
<indexterm><primary>FreeBSD</></> <indexterm><primary>FreeBSD</><secondary>IPC configuration</></>
<indexterm><primary>NetBSD</></> <indexterm><primary>NetBSD</><secondary>IPC configuration</></>
<indexterm><primary>OpenBSD</></> <indexterm><primary>OpenBSD</><secondary>IPC configuration</></>
<listitem> <listitem>
<para> <para>
The options <varname>SYSVSHM</> and <varname>SYSVSEM</> need The options <varname>SYSVSHM</> and <varname>SYSVSEM</> need
...@@ -3010,7 +3023,7 @@ options SEMMAP=256 ...@@ -3010,7 +3023,7 @@ options SEMMAP=256
<varlistentry> <varlistentry>
<term><systemitem class="osname">HP-UX</></term> <term><systemitem class="osname">HP-UX</></term>
<indexterm><primary>HP-UX</></> <indexterm><primary>HP-UX</><secondary>IPC configuration</></>
<listitem> <listitem>
<para> <para>
The default settings tend to suffice for normal installations. The default settings tend to suffice for normal installations.
...@@ -3031,7 +3044,7 @@ options SEMMAP=256 ...@@ -3031,7 +3044,7 @@ options SEMMAP=256
<varlistentry> <varlistentry>
<term><systemitem class="osname">Linux</></term> <term><systemitem class="osname">Linux</></term>
<indexterm><primary>Linux</></> <indexterm><primary>Linux</><secondary>IPC configuration</></>
<listitem> <listitem>
<para> <para>
The default shared memory limit (both The default shared memory limit (both
...@@ -3084,7 +3097,7 @@ sysctl -w vm.overcommit_memory=3 ...@@ -3084,7 +3097,7 @@ sysctl -w vm.overcommit_memory=3
<varlistentry> <varlistentry>
<term><systemitem class="osname">MacOS X</></term> <term><systemitem class="osname">MacOS X</></term>
<indexterm><primary>MacOS X</></> <indexterm><primary>MacOS X</><secondary>IPC configuration</></>
<listitem> <listitem>
<para> <para>
Edit the file Edit the file
...@@ -3104,7 +3117,7 @@ sysctl -w kern.sysv.shmall ...@@ -3104,7 +3117,7 @@ sysctl -w kern.sysv.shmall
<varlistentry> <varlistentry>
<term><systemitem class="osname">SCO OpenServer</></term> <term><systemitem class="osname">SCO OpenServer</></term>
<indexterm><primary>SCO OpenServer</></> <indexterm><primary>SCO OpenServer</><secondary>IPC configuration</></>
<listitem> <listitem>
<para> <para>
In the default configuration, only 512 kB of shared memory per In the default configuration, only 512 kB of shared memory per
...@@ -3132,7 +3145,7 @@ sysctl -w kern.sysv.shmall ...@@ -3132,7 +3145,7 @@ sysctl -w kern.sysv.shmall
<varlistentry> <varlistentry>
<term><systemitem class="osname">Solaris</></term> <term><systemitem class="osname">Solaris</></term>
<indexterm><primary>Solaris</></> <indexterm><primary>Solaris</><secondary>IPC configuration</></>
<listitem> <listitem>
<para> <para>
At least in version 2.6, the default maximum size of a shared At least in version 2.6, the default maximum size of a shared
...@@ -3165,7 +3178,7 @@ set semsys:seminfo_semmsl=32 ...@@ -3165,7 +3178,7 @@ set semsys:seminfo_semmsl=32
<varlistentry> <varlistentry>
<term><systemitem class="osname">UnixWare</></term> <term><systemitem class="osname">UnixWare</></term>
<indexterm><primary>UnixWare</></> <indexterm><primary>UnixWare</><secondary>IPC configuration</></>
<listitem> <listitem>
<para> <para>
On <productname>UnixWare</> 7, the maximum size for shared On <productname>UnixWare</> 7, the maximum size for shared
...@@ -3285,13 +3298,17 @@ default:\ ...@@ -3285,13 +3298,17 @@ default:\
<sect1 id="postmaster-shutdown"> <sect1 id="postmaster-shutdown">
<title>Shutting Down the Server</title> <title>Shutting Down the Server</title>
<indexterm zone="postmaster-shutdown">
<primary>shutdown</>
</indexterm>
<para> <para>
There are several ways to shut down the database server. You control There are several ways to shut down the database server. You control
the type of shutdown by sending different signals to the server the type of shutdown by sending different signals to the server
process. process.
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term><systemitem>SIGTERM</systemitem></term> <term><systemitem>SIGTERM</systemitem><indexterm><primary>SIGTERM</></></term>
<listitem> <listitem>
<para> <para>
After receiving <systemitem>SIGTERM</systemitem>, the server After receiving <systemitem>SIGTERM</systemitem>, the server
...@@ -3304,7 +3321,7 @@ default:\ ...@@ -3304,7 +3321,7 @@ default:\
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><systemitem>SIGINT</systemitem></term> <term><systemitem>SIGINT</systemitem><indexterm><primary>SIGINT</></></term>
<listitem> <listitem>
<para> <para>
The server disallows new connections and sends all existing The server disallows new connections and sends all existing
...@@ -3317,7 +3334,7 @@ default:\ ...@@ -3317,7 +3334,7 @@ default:\
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><systemitem>SIGQUIT</systemitem></term> <term><systemitem>SIGQUIT</systemitem><indexterm><primary>SIGQUIT</></></term>
<listitem> <listitem>
<para> <para>
This is the <firstterm>Immediate Shutdown</firstterm>, which This is the <firstterm>Immediate Shutdown</firstterm>, which
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/spi.sgml,v 1.26 2003/08/27 22:13:35 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/spi.sgml,v 1.27 2003/08/31 17:32:20 petere Exp $
--> -->
<chapter id="spi"> <chapter id="spi">
...@@ -1655,7 +1655,7 @@ char * SPI_getrelname(Relation <parameter>rel</parameter>) ...@@ -1655,7 +1655,7 @@ char * SPI_getrelname(Relation <parameter>rel</parameter>)
<para> <para>
<productname>PostgreSQL</productname> allocates memory within <productname>PostgreSQL</productname> allocates memory within
<firstterm>memory contexts</firstterm><indexterm><primary>memory <firstterm>memory contexts</firstterm><indexterm><primary>memory
context</primary></indexterm>, which provide a convenient method of context</primary><secondary>in SPI</secondary></indexterm>, which provide a convenient method of
managing allocations made in many different places that need to managing allocations made in many different places that need to
live for differing amounts of time. Destroying a context releases live for differing amounts of time. Destroying a context releases
all the memory that was allocated in it. Thus, it is not necessary all the memory that was allocated in it. Thus, it is not necessary
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/syntax.sgml,v 1.83 2003/08/19 06:06:48 tgl Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/syntax.sgml,v 1.84 2003/08/31 17:32:20 petere Exp $
--> -->
<chapter id="sql-syntax"> <chapter id="sql-syntax">
...@@ -26,6 +26,10 @@ $Header: /cvsroot/pgsql/doc/src/sgml/syntax.sgml,v 1.83 2003/08/19 06:06:48 tgl ...@@ -26,6 +26,10 @@ $Header: /cvsroot/pgsql/doc/src/sgml/syntax.sgml,v 1.83 2003/08/19 06:06:48 tgl
<sect1 id="sql-syntax-lexical"> <sect1 id="sql-syntax-lexical">
<title>Lexical Structure</title> <title>Lexical Structure</title>
<indexterm>
<primary>token</primary>
</indexterm>
<para> <para>
SQL input consists of a sequence of SQL input consists of a sequence of
<firstterm>commands</firstterm>. A command is composed of a <firstterm>commands</firstterm>. A command is composed of a
...@@ -80,12 +84,18 @@ INSERT INTO MY_TABLE VALUES (3, 'hi there'); ...@@ -80,12 +84,18 @@ INSERT INTO MY_TABLE VALUES (3, 'hi there');
<title>Identifiers and Key Words</title> <title>Identifiers and Key Words</title>
<indexterm zone="sql-syntax-identifiers"> <indexterm zone="sql-syntax-identifiers">
<primary>identifiers</primary> <primary>identifier</primary>
<secondary>syntax of</secondary>
</indexterm> </indexterm>
<indexterm zone="sql-syntax-identifiers"> <indexterm zone="sql-syntax-identifiers">
<primary>key words</primary> <primary>name</primary>
<secondary>syntax</secondary> <secondary>syntax of</secondary>
</indexterm>
<indexterm zone="sql-syntax-identifiers">
<primary>key word</primary>
<secondary>syntax of</secondary>
</indexterm> </indexterm>
<para> <para>
...@@ -121,6 +131,7 @@ INSERT INTO MY_TABLE VALUES (3, 'hi there'); ...@@ -121,6 +131,7 @@ INSERT INTO MY_TABLE VALUES (3, 'hi there');
</para> </para>
<para> <para>
<indexterm><primary>identifier</primary><secondary>length</secondary></indexterm>
The system uses no more than <symbol>NAMEDATALEN</symbol>-1 The system uses no more than <symbol>NAMEDATALEN</symbol>-1
characters of an identifier; longer names can be written in characters of an identifier; longer names can be written in
commands, but they will be truncated. By default, commands, but they will be truncated. By default,
...@@ -133,7 +144,7 @@ INSERT INTO MY_TABLE VALUES (3, 'hi there'); ...@@ -133,7 +144,7 @@ INSERT INTO MY_TABLE VALUES (3, 'hi there');
<para> <para>
<indexterm> <indexterm>
<primary>case sensitivity</primary> <primary>case sensitivity</primary>
<secondary>SQL commands</secondary> <secondary>of SQL commands</secondary>
</indexterm> </indexterm>
Identifier and key word names are case insensitive. Therefore Identifier and key word names are case insensitive. Therefore
<programlisting> <programlisting>
...@@ -152,7 +163,7 @@ UPDATE my_table SET a = 5; ...@@ -152,7 +163,7 @@ UPDATE my_table SET a = 5;
<para> <para>
<indexterm> <indexterm>
<primary>quotes</primary> <primary>quotation marks</primary>
<secondary>and identifiers</secondary> <secondary>and identifiers</secondary>
</indexterm> </indexterm>
There is a second kind of identifier: the <firstterm>delimited There is a second kind of identifier: the <firstterm>delimited
...@@ -207,7 +218,7 @@ UPDATE "my_table" SET "a" = 5; ...@@ -207,7 +218,7 @@ UPDATE "my_table" SET "a" = 5;
<title>Constants</title> <title>Constants</title>
<indexterm zone="sql-syntax-constants"> <indexterm zone="sql-syntax-constants">
<primary>constants</primary> <primary>constant</primary>
</indexterm> </indexterm>
<para> <para>
...@@ -224,13 +235,13 @@ UPDATE "my_table" SET "a" = 5; ...@@ -224,13 +235,13 @@ UPDATE "my_table" SET "a" = 5;
<title>String Constants</title> <title>String Constants</title>
<indexterm zone="sql-syntax-strings"> <indexterm zone="sql-syntax-strings">
<primary>character strings</primary> <primary>character string</primary>
<secondary>constants</secondary> <secondary>constant</secondary>
</indexterm> </indexterm>
<para> <para>
<indexterm> <indexterm>
<primary>quotes</primary> <primary>quotation marks</primary>
<secondary>escaping</secondary> <secondary>escaping</secondary>
</indexterm> </indexterm>
A string constant in SQL is an arbitrary sequence of characters A string constant in SQL is an arbitrary sequence of characters
...@@ -286,8 +297,8 @@ SELECT 'foo' 'bar'; ...@@ -286,8 +297,8 @@ SELECT 'foo' 'bar';
<title>Bit-String Constants</title> <title>Bit-String Constants</title>
<indexterm zone="sql-syntax-bit-strings"> <indexterm zone="sql-syntax-bit-strings">
<primary>bit strings</primary> <primary>bit string</primary>
<secondary>constants</secondary> <secondary>constant</secondary>
</indexterm> </indexterm>
<para> <para>
...@@ -316,8 +327,8 @@ SELECT 'foo' 'bar'; ...@@ -316,8 +327,8 @@ SELECT 'foo' 'bar';
<title>Numeric Constants</title> <title>Numeric Constants</title>
<indexterm> <indexterm>
<primary>numeric</primary> <primary>number</primary>
<secondary>constants</secondary> <secondary>constant</secondary>
</indexterm> </indexterm>
<para> <para>
...@@ -351,6 +362,9 @@ SELECT 'foo' 'bar'; ...@@ -351,6 +362,9 @@ SELECT 'foo' 'bar';
</para> </para>
<para> <para>
<indexterm><primary>integer</primary></indexterm>
<indexterm><primary>bigint</primary></indexterm>
<indexterm><primary>numeric</primary></indexterm>
A numeric constant that contains neither a decimal point nor an A numeric constant that contains neither a decimal point nor an
exponent is initially presumed to be type <type>integer</> if its exponent is initially presumed to be type <type>integer</> if its
value fits in type <type>integer</> (32 bits); otherwise it is value fits in type <type>integer</> (32 bits); otherwise it is
...@@ -363,13 +377,13 @@ SELECT 'foo' 'bar'; ...@@ -363,13 +377,13 @@ SELECT 'foo' 'bar';
<para> <para>
The initially assigned data type of a numeric constant is just a The initially assigned data type of a numeric constant is just a
starting point for the type resolution algorithms. In most starting point for the type resolution algorithms. In most cases
cases the constant will be automatically coerced to the most the constant will be automatically coerced to the most
appropriate type depending on context. When necessary, you appropriate type depending on context. When necessary, you can
can force a numeric value to be interpreted as a specific force a numeric value to be interpreted as a specific data type
data type by casting it. For example, you can force a numeric by casting it.<indexterm><primary>type cast</primary></indexterm>
value to be treated as type <type>real</> (<type>float4</>) For example, you can force a numeric value to be treated as type
by writing <type>real</> (<type>float4</>) by writing
<programlisting> <programlisting>
REAL '1.23' -- string style REAL '1.23' -- string style
...@@ -382,8 +396,8 @@ REAL '1.23' -- string style ...@@ -382,8 +396,8 @@ REAL '1.23' -- string style
<title>Constants of Other Types</title> <title>Constants of Other Types</title>
<indexterm> <indexterm>
<primary>data types</primary> <primary>data type</primary>
<secondary>constants</secondary> <secondary>constant</secondary>
</indexterm> </indexterm>
<para> <para>
...@@ -431,8 +445,8 @@ CAST ( '<replaceable>string</replaceable>' AS <replaceable>type</replaceable> ) ...@@ -431,8 +445,8 @@ CAST ( '<replaceable>string</replaceable>' AS <replaceable>type</replaceable> )
<title>Array constants</title> <title>Array constants</title>
<indexterm> <indexterm>
<primary>arrays</primary> <primary>array</primary>
<secondary>constants</secondary> <secondary>constant</secondary>
</indexterm> </indexterm>
<para> <para>
...@@ -468,7 +482,7 @@ CAST ( '<replaceable>string</replaceable>' AS <replaceable>type</replaceable> ) ...@@ -468,7 +482,7 @@ CAST ( '<replaceable>string</replaceable>' AS <replaceable>type</replaceable> )
<title>Operators</title> <title>Operators</title>
<indexterm zone="sql-syntax-operators"> <indexterm zone="sql-syntax-operators">
<primary>operators</primary> <primary>operator</primary>
<secondary>syntax</secondary> <secondary>syntax</secondary>
</indexterm> </indexterm>
...@@ -600,8 +614,8 @@ CAST ( '<replaceable>string</replaceable>' AS <replaceable>type</replaceable> ) ...@@ -600,8 +614,8 @@ CAST ( '<replaceable>string</replaceable>' AS <replaceable>type</replaceable> )
<title>Comments</title> <title>Comments</title>
<indexterm zone="sql-syntax-comments"> <indexterm zone="sql-syntax-comments">
<primary>comments</primary> <primary>comment</primary>
<secondary>in SQL</secondary> <secondary sortas="SQL">in SQL</secondary>
</indexterm> </indexterm>
<para> <para>
...@@ -636,7 +650,7 @@ CAST ( '<replaceable>string</replaceable>' AS <replaceable>type</replaceable> ) ...@@ -636,7 +650,7 @@ CAST ( '<replaceable>string</replaceable>' AS <replaceable>type</replaceable> )
<title>Lexical Precedence</title> <title>Lexical Precedence</title>
<indexterm zone="sql-precedence"> <indexterm zone="sql-precedence">
<primary>operators</primary> <primary>operator</primary>
<secondary>precedence</secondary> <secondary>precedence</secondary>
</indexterm> </indexterm>
...@@ -828,6 +842,20 @@ SELECT 3 OPERATOR(pg_catalog.+) 4; ...@@ -828,6 +842,20 @@ SELECT 3 OPERATOR(pg_catalog.+) 4;
<sect1 id="sql-expressions"> <sect1 id="sql-expressions">
<title>Value Expressions</title> <title>Value Expressions</title>
<indexterm zone="sql-expressions">
<primary>expression</primary>
<secondary>syntax</secondary>
</indexterm>
<indexterm zone="sql-expressions">
<primary>value expression</primary>
</indexterm>
<indexterm>
<primary>scalar</primary>
<see>expression</see>
</indexterm>
<para> <para>
Value expressions are used in a variety of contexts, such Value expressions are used in a variety of contexts, such
as in the target list of the <command>SELECT</command> command, as as in the target list of the <command>SELECT</command> command, as
...@@ -903,7 +931,9 @@ SELECT 3 OPERATOR(pg_catalog.+) 4; ...@@ -903,7 +931,9 @@ SELECT 3 OPERATOR(pg_catalog.+) 4;
<listitem> <listitem>
<para> <para>
Another value expression in parentheses, useful to group subexpressions and override precedence. Another value expression in parentheses, useful to group
subexpressions and override
precedence.<indexterm><primary>parenthesis</></>
</para> </para>
</listitem> </listitem>
</itemizedlist> </itemizedlist>
...@@ -927,6 +957,10 @@ SELECT 3 OPERATOR(pg_catalog.+) 4; ...@@ -927,6 +957,10 @@ SELECT 3 OPERATOR(pg_catalog.+) 4;
<sect2> <sect2>
<title>Column References</title> <title>Column References</title>
<indexterm>
<primary>column reference</primary>
</indexterm>
<para> <para>
A column can be referenced in the form A column can be referenced in the form
<synopsis> <synopsis>
...@@ -962,6 +996,15 @@ SELECT 3 OPERATOR(pg_catalog.+) 4; ...@@ -962,6 +996,15 @@ SELECT 3 OPERATOR(pg_catalog.+) 4;
<sect2> <sect2>
<title>Positional Parameters</title> <title>Positional Parameters</title>
<indexterm>
<primary>parameter</primary>
<secondary>syntax</secondary>
</indexterm>
<indexterm>
<primary>$</primary>
</indexterm>
<para> <para>
A positional parameter reference is used to indicate a value A positional parameter reference is used to indicate a value
that is supplied externally to an SQL statement. Parameters are that is supplied externally to an SQL statement. Parameters are
...@@ -993,6 +1036,11 @@ CREATE FUNCTION dept(text) RETURNS dept ...@@ -993,6 +1036,11 @@ CREATE FUNCTION dept(text) RETURNS dept
<sect2> <sect2>
<title>Operator Invocations</title> <title>Operator Invocations</title>
<indexterm>
<primary>operator</primary>
<secondary>invocation</secondary>
</indexterm>
<para> <para>
There are three possible syntaxes for an operator invocation: There are three possible syntaxes for an operator invocation:
<simplelist> <simplelist>
...@@ -1017,6 +1065,11 @@ CREATE FUNCTION dept(text) RETURNS dept ...@@ -1017,6 +1065,11 @@ CREATE FUNCTION dept(text) RETURNS dept
<sect2> <sect2>
<title>Function Calls</title> <title>Function Calls</title>
<indexterm>
<primary>function</primary>
<secondary>invocation</secondary>
</indexterm>
<para> <para>
The syntax for a function call is the name of a function The syntax for a function call is the name of a function
(possibly qualified with a schema name), followed by its argument list (possibly qualified with a schema name), followed by its argument list
...@@ -1044,7 +1097,8 @@ sqrt(2) ...@@ -1044,7 +1097,8 @@ sqrt(2)
<title>Aggregate Expressions</title> <title>Aggregate Expressions</title>
<indexterm zone="syntax-aggregates"> <indexterm zone="syntax-aggregates">
<primary>aggregate functions</primary> <primary>aggregate function</primary>
<secondary>invocation</secondary>
</indexterm> </indexterm>
<para> <para>
...@@ -1123,10 +1177,14 @@ sqrt(2) ...@@ -1123,10 +1177,14 @@ sqrt(2)
<sect2 id="sql-syntax-type-casts"> <sect2 id="sql-syntax-type-casts">
<title>Type Casts</title> <title>Type Casts</title>
<indexterm> <indexterm>
<primary>data types</primary> <primary>data type</primary>
<secondary>type casts</secondary> <secondary>type cast</secondary>
</indexterm> </indexterm>
<indexterm>
<primary>type cast</primary>
</indexterm>
<para> <para>
A type cast specifies a conversion from one data type to another. A type cast specifies a conversion from one data type to another.
...@@ -1193,6 +1251,10 @@ CAST ( <replaceable>expression</replaceable> AS <replaceable>type</replaceable> ...@@ -1193,6 +1251,10 @@ CAST ( <replaceable>expression</replaceable> AS <replaceable>type</replaceable>
<sect2 id="sql-syntax-scalar-subqueries"> <sect2 id="sql-syntax-scalar-subqueries">
<title>Scalar Subqueries</title> <title>Scalar Subqueries</title>
<indexterm>
<primary>subquery</primary>
</indexterm>
<para> <para>
A scalar subquery is an ordinary A scalar subquery is an ordinary
<command>SELECT</command> query in parentheses that returns exactly one <command>SELECT</command> query in parentheses that returns exactly one
...@@ -1221,10 +1283,10 @@ SELECT name, (SELECT max(pop) FROM cities WHERE cities.state = states.name) ...@@ -1221,10 +1283,10 @@ SELECT name, (SELECT max(pop) FROM cities WHERE cities.state = states.name)
<sect2 id="sql-syntax-array-constructors"> <sect2 id="sql-syntax-array-constructors">
<title>Array Constructors</title> <title>Array Constructors</title>
<indexterm> <indexterm>
<primary>arrays</primary> <primary>array</primary>
<secondary>constructors</secondary> <secondary>constructor</secondary>
</indexterm> </indexterm>
<para> <para>
An <firstterm>array constructor</> is an expression that builds an An <firstterm>array constructor</> is an expression that builds an
...@@ -1316,6 +1378,11 @@ SELECT ARRAY(SELECT oid FROM pg_proc WHERE proname LIKE 'bytea%'); ...@@ -1316,6 +1378,11 @@ SELECT ARRAY(SELECT oid FROM pg_proc WHERE proname LIKE 'bytea%');
<sect2 id="syntax-express-eval"> <sect2 id="syntax-express-eval">
<title>Expression Evaluation Rules</title> <title>Expression Evaluation Rules</title>
<indexterm>
<primary>expression</primary>
<secondary>order of evaluation</secondary>
</indexterm>
<para> <para>
The order of evaluation of subexpressions is not defined. In The order of evaluation of subexpressions is not defined. In
particular, the inputs of an operator or function are not necessarily particular, the inputs of an operator or function are not necessarily
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/trigger.sgml,v 1.29 2003/08/10 01:20:34 tgl Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/trigger.sgml,v 1.30 2003/08/31 17:32:20 petere Exp $
--> -->
<chapter id="triggers"> <chapter id="triggers">
<title>Triggers</title> <title>Triggers</title>
<indexterm zone="triggers">
<primary>trigger</primary>
</indexterm>
<para> <para>
This chapter describes how to write trigger functions. In This chapter describes how to write trigger functions. In
particular, it describes the C-language interface for trigger particular, it describes the C-language interface for trigger
...@@ -98,18 +102,20 @@ $Header: /cvsroot/pgsql/doc/src/sgml/trigger.sgml,v 1.29 2003/08/10 01:20:34 tgl ...@@ -98,18 +102,20 @@ $Header: /cvsroot/pgsql/doc/src/sgml/trigger.sgml,v 1.29 2003/08/10 01:20:34 tgl
<para> <para>
When a trigger is being defined, arguments can be specified for When a trigger is being defined, arguments can be specified for
it. The purpose of including arguments in the trigger definition it.<indexterm><primary>trigger</><secondary>arguments for trigger
is to allow different triggers with similar requirements to call functions</></indexterm> The purpose of including arguments in the
the same function. As an example, there could be a generalized trigger definition is to allow different triggers with similar
trigger function that takes as its arguments two column names and requirements to call the same function. As an example, there
puts the current user in one and the current time stamp in the could be a generalized trigger function that takes as its
other. Properly written, this trigger function would be arguments two column names and puts the current user in one and
independent of the specific table it is triggering on. So the the current time stamp in the other. Properly written, this
same function could be used for <command>INSERT</command> events trigger function would be independent of the specific table it is
on any table with suitable columns, to automatically track creation triggering on. So the same function could be used for
of records in a transaction table for example. It could also be <command>INSERT</command> events on any table with suitable
used to track last-update events if defined as an columns, to automatically track creation of records in a
<command>UPDATE</command> trigger. transaction table for example. It could also be used to track
last-update events if defined as an <command>UPDATE</command>
trigger.
</para> </para>
</sect1> </sect1>
...@@ -117,6 +123,11 @@ $Header: /cvsroot/pgsql/doc/src/sgml/trigger.sgml,v 1.29 2003/08/10 01:20:34 tgl ...@@ -117,6 +123,11 @@ $Header: /cvsroot/pgsql/doc/src/sgml/trigger.sgml,v 1.29 2003/08/10 01:20:34 tgl
<sect1 id="trigger-manager"> <sect1 id="trigger-manager">
<title>Interaction with the Trigger Manager</title> <title>Interaction with the Trigger Manager</title>
<indexterm zone="trigger-manager">
<primary>trigger</primary>
<secondary>in C</secondary>
</indexterm>
<para> <para>
This section describes the low-level details of the interface to a This section describes the low-level details of the interface to a
trigger function. This information is only needed when writing a trigger function. This information is only needed when writing a
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/typeconv.sgml,v 1.32 2003/08/14 23:13:27 tgl Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/typeconv.sgml,v 1.33 2003/08/31 17:32:20 petere Exp $
--> -->
<chapter Id="typeconv"> <chapter Id="typeconv">
<title>Type Conversion</title> <title>Type Conversion</title>
<indexterm zone="typeconv">
<primary>data type</primary>
<secondary>conversion</secondary>
</indexterm>
<para> <para>
<acronym>SQL</acronym> statements can, intentionally or not, require <acronym>SQL</acronym> statements can, intentionally or not, require
mixing of different data types in the same expression. mixing of different data types in the same expression.
...@@ -139,6 +144,11 @@ between the built-in types has been carefully crafted and is best not ...@@ -139,6 +144,11 @@ between the built-in types has been carefully crafted and is best not
altered.) altered.)
</para> </para>
<indexterm>
<primary>data type</primary>
<secondary>category</secondary>
</indexterm>
<para> <para>
An additional heuristic is provided in the parser to allow better guesses An additional heuristic is provided in the parser to allow better guesses
at proper behavior for <acronym>SQL</acronym> standard types. There are at proper behavior for <acronym>SQL</acronym> standard types. There are
...@@ -204,6 +214,11 @@ should use this new function and will no longer do the implicit conversion using ...@@ -204,6 +214,11 @@ should use this new function and will no longer do the implicit conversion using
<sect1 id="typeconv-oper"> <sect1 id="typeconv-oper">
<title>Operators</title> <title>Operators</title>
<indexterm zone="typeconv-oper">
<primary>operator</primary>
<secondary>type resolution in an invocation</secondary>
</indexterm>
<para> <para>
The specific operator to be used in an operator invocation is determined The specific operator to be used in an operator invocation is determined
by following by following
...@@ -452,6 +467,11 @@ SELECT CAST('20' AS int8) ! AS "factorial"; ...@@ -452,6 +467,11 @@ SELECT CAST('20' AS int8) ! AS "factorial";
<sect1 id="typeconv-func"> <sect1 id="typeconv-func">
<title>Functions</title> <title>Functions</title>
<indexterm zone="typeconv-func">
<primary>function</primary>
<secondary>type resolution in an invocation</secondary>
</indexterm>
<para> <para>
The specific function to be used in a function invocation is determined The specific function to be used in a function invocation is determined
according to the following steps. according to the following steps.
...@@ -755,8 +775,22 @@ padding spaces. ...@@ -755,8 +775,22 @@ padding spaces.
</sect1> </sect1>
<sect1 id="typeconv-union-case"> <sect1 id="typeconv-union-case">
<title><literal>UNION</literal>, <literal>CASE</literal>, and <title><literal>UNION</literal>, <literal>CASE</literal>, and <literal>ARRAY</literal> Constructs</title>
<literal>ARRAY</literal> Constructs</title>
<indexterm zone="typeconv-union-case">
<primary>UNION</primary>
<secondary>determination of result type</secondary>
</indexterm>
<indexterm zone="typeconv-union-case">
<primary>CASE</primary>
<secondary>determination of result type</secondary>
</indexterm>
<indexterm zone="typeconv-union-case">
<primary>ARRAY</primary>
<secondary>determination of result type</secondary>
</indexterm>
<para> <para>
SQL <literal>UNION</> constructs must match up possibly dissimilar types to SQL <literal>UNION</> constructs must match up possibly dissimilar types to
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/user-manag.sgml,v 1.21 2003/08/10 01:20:34 tgl Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/user-manag.sgml,v 1.22 2003/08/31 17:32:20 petere Exp $
--> -->
<chapter id="user-manag"> <chapter id="user-manag">
...@@ -22,6 +22,18 @@ $Header: /cvsroot/pgsql/doc/src/sgml/user-manag.sgml,v 1.21 2003/08/10 01:20:34 ...@@ -22,6 +22,18 @@ $Header: /cvsroot/pgsql/doc/src/sgml/user-manag.sgml,v 1.21 2003/08/10 01:20:34
<sect1 id="database-users"> <sect1 id="database-users">
<title>Database Users</title> <title>Database Users</title>
<indexterm zone="database-users">
<primary>user</primary>
</indexterm>
<indexterm>
<primary>CREATE USER</primary>
</indexterm>
<indexterm>
<primary>DROP USER</primary>
</indexterm>
<para> <para>
Database users are conceptually completely separate from Database users are conceptually completely separate from
operating system users. In practice it might be convenient to operating system users. In practice it might be convenient to
...@@ -41,6 +53,14 @@ DROP USER <replaceable>name</replaceable>; ...@@ -41,6 +53,14 @@ DROP USER <replaceable>name</replaceable>;
</synopsis> </synopsis>
</para> </para>
<indexterm>
<primary>createuser</primary>
</indexterm>
<indexterm>
<primary>dropuser</primary>
</indexterm>
<para> <para>
For convenience, the programs <command>createuser</command> For convenience, the programs <command>createuser</command>
and <command>dropuser</command> are provided as wrappers and <command>dropuser</command> are provided as wrappers
...@@ -99,7 +119,7 @@ dropuser <replaceable>name</replaceable> ...@@ -99,7 +119,7 @@ dropuser <replaceable>name</replaceable>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term>superuser</term> <term>superuser<indexterm><primary>superuser</></></term>
<listitem> <listitem>
<para> <para>
A database superuser bypasses all permission checks. Also, A database superuser bypasses all permission checks. Also,
...@@ -111,7 +131,7 @@ dropuser <replaceable>name</replaceable> ...@@ -111,7 +131,7 @@ dropuser <replaceable>name</replaceable>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>database creation</term> <term>database creation<indexterm><primary>database</><secondary>privilege to create</></></term>
<listitem> <listitem>
<para> <para>
A user must be explicitly given permission to create databases A user must be explicitly given permission to create databases
...@@ -123,7 +143,7 @@ dropuser <replaceable>name</replaceable> ...@@ -123,7 +143,7 @@ dropuser <replaceable>name</replaceable>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>password</term> <term>password<indexterm><primary>password</></></term>
<listitem> <listitem>
<para> <para>
A password is only significant if the client authentication A password is only significant if the client authentication
...@@ -140,7 +160,7 @@ dropuser <replaceable>name</replaceable> ...@@ -140,7 +160,7 @@ dropuser <replaceable>name</replaceable>
</variablelist> </variablelist>
A user's attributes can be modified after creation with A user's attributes can be modified after creation with
<command>ALTER USER</command>. <command>ALTER USER</command>.<indexterm><primary>ALTER USER</></>
See the reference pages for <command>CREATE USER</command> and See the reference pages for <command>CREATE USER</command> and
<command>ALTER USER</command> for details. <command>ALTER USER</command> for details.
</para> </para>
...@@ -166,6 +186,10 @@ ALTER USER myname SET enable_indexscan TO off; ...@@ -166,6 +186,10 @@ ALTER USER myname SET enable_indexscan TO off;
<sect1 id="groups"> <sect1 id="groups">
<title>Groups</title> <title>Groups</title>
<indexterm zone="groups">
<primary>group</primary>
</indexterm>
<para> <para>
As in Unix, groups are a way of logically grouping users to ease As in Unix, groups are a way of logically grouping users to ease
management of privileges: privileges can be granted to, or revoked management of privileges: privileges can be granted to, or revoked
...@@ -184,6 +208,22 @@ ALTER GROUP <replaceable>name</replaceable> DROP USER <replaceable>uname1</repla ...@@ -184,6 +208,22 @@ ALTER GROUP <replaceable>name</replaceable> DROP USER <replaceable>uname1</repla
<sect1 id="privileges"> <sect1 id="privileges">
<title>Privileges</title> <title>Privileges</title>
<indexterm zone="privileges">
<primary>privilege</primary>
</indexterm>
<indexterm zone="privileges">
<primary>owner</primary>
</indexterm>
<indexterm zone="privileges">
<primary>GRANT</primary>
</indexterm>
<indexterm zone="privileges">
<primary>REVOKE</primary>
</indexterm>
<comment>Being moved to the DDL chapter. Will eventually disappear here.</comment> <comment>Being moved to the DDL chapter. Will eventually disappear here.</comment>
<para> <para>
......
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/wal.sgml,v 1.23 2003/03/24 14:32:51 petere Exp $ --> <!-- $Header: /cvsroot/pgsql/doc/src/sgml/wal.sgml,v 1.24 2003/08/31 17:32:20 petere Exp $ -->
<chapter id="wal"> <chapter id="wal">
<title>Write-Ahead Logging (<acronym>WAL</acronym>)</title> <title>Write-Ahead Logging (<acronym>WAL</acronym>)</title>
<indexterm zone="wal">
<primary>WAL</primary>
</indexterm>
<indexterm>
<primary>transaction log</primary>
<see>WAL</see>
</indexterm>
<para> <para>
<firstterm>Write-Ahead Logging</firstterm> (<acronym>WAL</acronym>) <firstterm>Write-Ahead Logging</firstterm> (<acronym>WAL</acronym>)
is a standard approach to transaction logging. Its detailed is a standard approach to transaction logging. Its detailed
...@@ -24,6 +33,10 @@ ...@@ -24,6 +33,10 @@
<sect1 id="wal-benefits-now"> <sect1 id="wal-benefits-now">
<title>Benefits of <acronym>WAL</acronym></title> <title>Benefits of <acronym>WAL</acronym></title>
<indexterm zone="wal-benefits-now">
<primary>fsync</primary>
</indexterm>
<para> <para>
The first obvious benefit of using <acronym>WAL</acronym> is a The first obvious benefit of using <acronym>WAL</acronym> is a
significantly reduced number of disk writes, since only the log significantly reduced number of disk writes, since only the log
...@@ -86,7 +99,7 @@ ...@@ -86,7 +99,7 @@
<para> <para>
With UNDO, it will also be possible to implement With UNDO, it will also be possible to implement
<firstterm>savepoints</firstterm> to allow partial rollback of <firstterm>savepoints</firstterm><indexterm><primary>savepoint</></> to allow partial rollback of
invalid transaction operations (parser errors caused by mistyping invalid transaction operations (parser errors caused by mistyping
commands, insertion of duplicate primary/unique keys and so on) commands, insertion of duplicate primary/unique keys and so on)
with the ability to continue or commit valid operations made by with the ability to continue or commit valid operations made by
...@@ -133,7 +146,7 @@ ...@@ -133,7 +146,7 @@
</para> </para>
<para> <para>
<firstterm>Checkpoints</firstterm> are points in the sequence of <firstterm>Checkpoints</firstterm><indexterm><primary>checkpoint</></> are points in the sequence of
transactions at which it is guaranteed that the data files have transactions at which it is guaranteed that the data files have
been updated with all information logged before the checkpoint. At been updated with all information logged before the checkpoint. At
checkpoint time, all dirty data pages are flushed to disk and a checkpoint time, all dirty data pages are flushed to disk and a
...@@ -301,7 +314,7 @@ ...@@ -301,7 +314,7 @@
<para> <para>
The aim of <acronym>WAL</acronym>, to ensure that the log is The aim of <acronym>WAL</acronym>, to ensure that the log is
written before database records are altered, may be subverted by written before database records are altered, may be subverted by
disk drives that falsely report a successful write to the kernel, disk drives<indexterm><primary>disk drive</></> that falsely report a successful write to the kernel,
when, in fact, they have only cached the data and not yet stored it when, in fact, they have only cached the data and not yet stored it
on the disk. A power failure in such a situation may still lead to on the disk. A power failure in such a situation may still lead to
irrecoverable data corruption. Administrators should try to ensure irrecoverable data corruption. Administrators should try to ensure
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/xaggr.sgml,v 1.21 2003/08/09 22:50:22 tgl Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/xaggr.sgml,v 1.22 2003/08/31 17:32:20 petere Exp $
--> -->
<sect1 id="xaggr"> <sect1 id="xaggr">
<title>User-Defined Aggregates</title> <title>User-Defined Aggregates</title>
<indexterm zone="xaggr"> <indexterm zone="xaggr">
<primary>aggregate functions</primary> <primary>aggregate function</primary>
<secondary>extending</secondary> <secondary>user-defined</secondary>
</indexterm> </indexterm>
<para> <para>
...@@ -115,7 +115,7 @@ CREATE AGGREGATE avg ( ...@@ -115,7 +115,7 @@ CREATE AGGREGATE avg (
Aggregate functions may use polymorphic Aggregate functions may use polymorphic
state transition functions or final functions, so that the same functions state transition functions or final functions, so that the same functions
can be used to implement multiple aggregates. can be used to implement multiple aggregates.
See <xref linkend="types-polymorphic"> See <xref linkend="extend-types-polymorphic">
for an explanation of polymorphic functions. for an explanation of polymorphic functions.
Going a step further, the aggregate function itself may be specified Going a step further, the aggregate function itself may be specified
with a polymorphic base type and state type, allowing a single with a polymorphic base type and state type, allowing a single
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/xfunc.sgml,v 1.72 2003/08/10 01:20:34 tgl Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/xfunc.sgml,v 1.73 2003/08/31 17:32:20 petere Exp $
--> -->
<sect1 id="xfunc"> <sect1 id="xfunc">
<title>User-Defined Functions</title> <title>User-Defined Functions</title>
<indexterm zone="xfunc"><primary>function</></> <indexterm zone="xfunc">
<primary>function</primary>
<secondary>user-defined</secondary>
</indexterm>
<para> <para>
<productname>PostgreSQL</productname> provides four kinds of <productname>PostgreSQL</productname> provides four kinds of
...@@ -70,7 +73,11 @@ $Header: /cvsroot/pgsql/doc/src/sgml/xfunc.sgml,v 1.72 2003/08/10 01:20:34 tgl E ...@@ -70,7 +73,11 @@ $Header: /cvsroot/pgsql/doc/src/sgml/xfunc.sgml,v 1.72 2003/08/10 01:20:34 tgl E
<sect1 id="xfunc-sql"> <sect1 id="xfunc-sql">
<title>Query Language (<acronym>SQL</acronym>) Functions</title> <title>Query Language (<acronym>SQL</acronym>) Functions</title>
<indexterm zone="xfunc-sql"><primary>function</><secondary>SQL</></> <indexterm zone="xfunc-sql">
<primary>function</primary>
<secondary>user-defined</secondary>
<tertiary>in SQL</tertiary>
</indexterm>
<para> <para>
SQL functions execute an arbitrary list of SQL statements, returning SQL functions execute an arbitrary list of SQL statements, returning
...@@ -84,12 +91,12 @@ $Header: /cvsroot/pgsql/doc/src/sgml/xfunc.sgml,v 1.72 2003/08/10 01:20:34 tgl E ...@@ -84,12 +91,12 @@ $Header: /cvsroot/pgsql/doc/src/sgml/xfunc.sgml,v 1.72 2003/08/10 01:20:34 tgl E
</para> </para>
<para> <para>
<indexterm><primary>SETOF</><seealso>function</></> <indexterm><primary>SETOF</><seealso>function</></> Alternatively,
Alternatively, an SQL function may be declared to return a set, an SQL function may be declared to return a set, by specifying the
by specifying the function's return type function's return type as <literal>SETOF
as <literal>SETOF <replaceable>sometype</></literal>. In this case <replaceable>sometype</></literal>.<indexterm><primary>SETOF</></>
all rows of the last query's result are returned. Further details In this case all rows of the last query's result are returned.
appear below. Further details appear below.
</para> </para>
<para> <para>
...@@ -523,7 +530,7 @@ SELECT name, listchildren(name) FROM nodes; ...@@ -523,7 +530,7 @@ SELECT name, listchildren(name) FROM nodes;
<acronym>SQL</acronym> functions may be declared to accept and <acronym>SQL</acronym> functions may be declared to accept and
return the <quote>polymorphic</> types return the <quote>polymorphic</> types
<type>anyelement</type> and <type>anyarray</type>. <type>anyelement</type> and <type>anyarray</type>.
See <xref linkend="types-polymorphic"> for a more detailed explanation See <xref linkend="extend-types-polymorphic"> for a more detailed explanation
of polymorphic functions. Here is a polymorphic function of polymorphic functions. Here is a polymorphic function
<function>make_array</function> that builds up an array from two <function>make_array</function> that builds up an array from two
arbitrary data type elements: arbitrary data type elements:
...@@ -644,6 +651,12 @@ CREATE FUNCTION square_root(double precision) RETURNS double precision ...@@ -644,6 +651,12 @@ CREATE FUNCTION square_root(double precision) RETURNS double precision
<sect1 id="xfunc-c"> <sect1 id="xfunc-c">
<title>C-Language Functions</title> <title>C-Language Functions</title>
<indexterm zone="xfunc-sql">
<primary>function</primary>
<secondary>user-defined</secondary>
<tertiary>in C</tertiary>
</indexterm>
<para> <para>
User-defined functions can be written in C (or a language that can User-defined functions can be written in C (or a language that can
be made compatible with C, such as C++). Such functions are be made compatible with C, such as C++). Such functions are
...@@ -670,6 +683,10 @@ CREATE FUNCTION square_root(double precision) RETURNS double precision ...@@ -670,6 +683,10 @@ CREATE FUNCTION square_root(double precision) RETURNS double precision
<sect2 id="xfunc-c-dynload"> <sect2 id="xfunc-c-dynload">
<title>Dynamic Loading</title> <title>Dynamic Loading</title>
<indexterm zone="xfunc-c-dynload">
<primary>dynamic loading</primary>
</indexterm>
<para> <para>
The first time a user-defined function in a particular The first time a user-defined function in a particular
loadable object file is called in a session, loadable object file is called in a session,
...@@ -787,9 +804,14 @@ CREATE FUNCTION square_root(double precision) RETURNS double precision ...@@ -787,9 +804,14 @@ CREATE FUNCTION square_root(double precision) RETURNS double precision
</sect2> </sect2>
<sect2> <sect2 id="xfunc-c-basetype">
<title>Base Types in C-Language Functions</title> <title>Base Types in C-Language Functions</title>
<indexterm zone="xfunc-c-basetype">
<primary>data type</primary>
<secondary>internal organisation</secondary>
</indexterm>
<para> <para>
To know how to write C-language functions, you need to know how To know how to write C-language functions, you need to know how
PostgreSQL internally represents base data types and how they can PostgreSQL internally represents base data types and how they can
...@@ -1479,7 +1501,7 @@ concat_text(PG_FUNCTION_ARGS) ...@@ -1479,7 +1501,7 @@ concat_text(PG_FUNCTION_ARGS)
<listitem> <listitem>
<para> <para>
Use <literal>pg_config Use <literal>pg_config
--includedir-server</literal><indexterm><primary>pg_config</></> --includedir-server</literal><indexterm><primary>pg_config</><secondary>with user-defined C functions</></>
to find out where the <productname>PostgreSQL</> server header to find out where the <productname>PostgreSQL</> server header
files are installed on your system (or the system that your files are installed on your system (or the system that your
users will be running on). This option is new with users will be running on). This option is new with
...@@ -1498,7 +1520,7 @@ concat_text(PG_FUNCTION_ARGS) ...@@ -1498,7 +1520,7 @@ concat_text(PG_FUNCTION_ARGS)
<para> <para>
When allocating memory, use the When allocating memory, use the
<productname>PostgreSQL</productname> functions <productname>PostgreSQL</productname> functions
<function>palloc</function> and <function>pfree</function> <function>palloc</function><indexterm><primary>palloc</></> and <function>pfree</function><indexterm><primary>pfree</></>
instead of the corresponding C library functions instead of the corresponding C library functions
<function>malloc</function> and <function>free</function>. <function>malloc</function> and <function>free</function>.
The memory allocated by <function>palloc</function> will be The memory allocated by <function>palloc</function> will be
...@@ -2075,7 +2097,7 @@ CREATE OR REPLACE FUNCTION testpassbyval(integer, integer) RETURNS SETOF __testp ...@@ -2075,7 +2097,7 @@ CREATE OR REPLACE FUNCTION testpassbyval(integer, integer) RETURNS SETOF __testp
C-language functions may be declared to accept and C-language functions may be declared to accept and
return the <quote>polymorphic</> types return the <quote>polymorphic</> types
<type>anyelement</type> and <type>anyarray</type>. <type>anyelement</type> and <type>anyarray</type>.
See <xref linkend="types-polymorphic"> for a more detailed explanation See <xref linkend="extend-types-polymorphic"> for a more detailed explanation
of polymorphic functions. When function arguments or return types of polymorphic functions. When function arguments or return types
are defined as polymorphic types, the function author cannot know are defined as polymorphic types, the function author cannot know
in advance what data type it will be called with, or in advance what data type it will be called with, or
...@@ -2155,7 +2177,10 @@ CREATE FUNCTION make_array(anyelement) ...@@ -2155,7 +2177,10 @@ CREATE FUNCTION make_array(anyelement)
<sect1 id="xfunc-overload"> <sect1 id="xfunc-overload">
<title>Function Overloading</title> <title>Function Overloading</title>
<indexterm zone="xfunc-overload"><primary>overloading</></> <indexterm zone="xfunc-overload">
<primary>overloading</primary>
<secondary>functions</secondary>
</indexterm>
<para> <para>
More than one function may be defined with the same SQL name, so long More than one function may be defined with the same SQL name, so long
...@@ -2216,6 +2241,11 @@ CREATE FUNCTION test(int, int) RETURNS int ...@@ -2216,6 +2241,11 @@ CREATE FUNCTION test(int, int) RETURNS int
<sect1 id="xfunc-plhandler"> <sect1 id="xfunc-plhandler">
<title>Procedural Language Handlers</title> <title>Procedural Language Handlers</title>
<indexterm zone="xfunc-plhandler">
<primary>procedural language</primary>
<secondary>handler for</secondary>
</indexterm>
<para> <para>
All calls to functions that are written in a language other than All calls to functions that are written in a language other than
the current <quote>version 1</quote> interface for compiled the current <quote>version 1</quote> interface for compiled
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/xindex.sgml,v 1.31 2003/08/17 22:09:00 tgl Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/xindex.sgml,v 1.32 2003/08/31 17:32:21 petere Exp $
--> -->
<sect1 id="xindex"> <sect1 id="xindex">
<title>Interfacing Extensions To Indexes</title> <title>Interfacing Extensions To Indexes</title>
<indexterm zone="xindex">
<primary>index</primary>
<secondary>for user-defined data type</secondary>
</indexterm>
<para> <para>
The procedures described thus far let you define new types, new The procedures described thus far let you define new types, new
functions, and new operators. However, we cannot yet define an functions, and new operators. However, we cannot yet define an
...@@ -43,15 +48,18 @@ $Header: /cvsroot/pgsql/doc/src/sgml/xindex.sgml,v 1.31 2003/08/17 22:09:00 tgl ...@@ -43,15 +48,18 @@ $Header: /cvsroot/pgsql/doc/src/sgml/xindex.sgml,v 1.31 2003/08/17 22:09:00 tgl
<para> <para>
The routines for an index method do not directly know anything The routines for an index method do not directly know anything
about the data types that the index method will operate on. Instead, an about the data types that the index method will operate on.
<firstterm>operator class</> identifies the set of operations that the Instead, an <firstterm>operator
index method needs to use to work with a particular data type. class</><indexterm><primary>operator class</></indexterm>
Operator classes are so called because one thing they specify is the set identifies the set of operations that the index method needs to use
of <literal>WHERE</>-clause operators that can be used with an index (i.e., can be to work with a particular data type. Operator classes are so
converted into an index-scan qualification). An operator class may also called because one thing they specify is the set of
specify some <firstterm>support procedures</> that are needed by the <literal>WHERE</>-clause operators that can be used with an index
internal operations of the index method, but do not directly (i.e., can be converted into an index-scan qualification). An
correspond to any <literal>WHERE</>-clause operator that can be used with the index. operator class may also specify some <firstterm>support
procedures</> that are needed by the internal operations of the
index method, but do not directly correspond to any
<literal>WHERE</>-clause operator that can be used with the index.
</para> </para>
<para> <para>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/xoper.sgml,v 1.25 2003/08/17 22:09:00 tgl Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/xoper.sgml,v 1.26 2003/08/31 17:32:21 petere Exp $
--> -->
<sect1 id="xoper"> <sect1 id="xoper">
<title>User-defined Operators</title> <title>User-defined Operators</title>
<indexterm zone="xoper">
<primary>operator</primary>
<secondary>user-defined</secondary>
</indexterm>
<Para> <Para>
Every operator is <quote>syntactic sugar</quote> for a call to an Every operator is <quote>syntactic sugar</quote> for a call to an
underlying function that does the real work; so you must underlying function that does the real work; so you must
...@@ -18,9 +23,10 @@ $Header: /cvsroot/pgsql/doc/src/sgml/xoper.sgml,v 1.25 2003/08/17 22:09:00 tgl E ...@@ -18,9 +23,10 @@ $Header: /cvsroot/pgsql/doc/src/sgml/xoper.sgml,v 1.25 2003/08/17 22:09:00 tgl E
<Para> <Para>
<productname>PostgreSQL</productname> supports left unary, right <productname>PostgreSQL</productname> supports left unary, right
unary, and binary operators. Operators can be overloaded; that is, unary, and binary operators. Operators can be
the same operator name can be used for different operators that overloaded;<indexterm><primary>overloading</primary><secondary>operators</secondary></indexterm>
have different numbers and types of operands. When a query is that is, the same operator name can be used for different operators
that have different numbers and types of operands. When a query is
executed, the system determines the operator to call from the executed, the system determines the operator to call from the
number and types of the provided operands. number and types of the provided operands.
</Para> </Para>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/xplang.sgml,v 1.22 2003/06/30 18:31:42 tgl Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/xplang.sgml,v 1.23 2003/08/31 17:32:21 petere Exp $
--> -->
<chapter id="xplang"> <chapter id="xplang">
<title id="xplang-title">Procedural Languages</title> <title id="xplang-title">Procedural Languages</title>
<indexterm zone="xplang">
<primary>procedural language</primary>
</indexterm>
<para> <para>
<productname>PostgreSQL</productname> allows users to add new <productname>PostgreSQL</productname> allows users to add new
programming languages to be available for writing functions and programming languages to be available for writing functions and
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/xtypes.sgml,v 1.19 2003/08/10 01:20:34 tgl Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/xtypes.sgml,v 1.20 2003/08/31 17:32:21 petere Exp $
--> -->
<sect1 id="xtypes"> <sect1 id="xtypes">
<title>User-Defined Types</title> <title>User-Defined Types</title>
<indexterm zone="xtypes"> <indexterm zone="xtypes">
<primary>data types</primary> <primary>data type</primary>
<secondary>extending</secondary> <secondary>user-defined</secondary>
</indexterm> </indexterm>
<comment> <comment>
...@@ -34,13 +34,17 @@ $Header: /cvsroot/pgsql/doc/src/sgml/xtypes.sgml,v 1.19 2003/08/10 01:20:34 tgl ...@@ -34,13 +34,17 @@ $Header: /cvsroot/pgsql/doc/src/sgml/xtypes.sgml,v 1.19 2003/08/10 01:20:34 tgl
<indexterm> <indexterm>
<primary>output function</primary> <primary>output function</primary>
</indexterm> </indexterm>
A user-defined type must always have input and output functions. A user-defined type must always have input and output
functions.<indexterm><primary>input function</primary><secondary>of
a data type</secondary></indexterm><indexterm><primary>output
function</primary><secondary>of a data type</secondary></indexterm>
These functions determine how the type appears in strings (for input These functions determine how the type appears in strings (for input
by the user and output to the user) and how the type is organized in by the user and output to the user) and how the type is organized in
memory. The input function takes a null-terminated character string memory. The input function takes a null-terminated character string
as its argument and returns the internal (in memory) representation of as its argument and returns the internal (in memory) representation
the type. The output function takes the internal representation of of the type. The output function takes the internal representation
the type as argument and returns a null-terminated character string. of the type as argument and returns a null-terminated character
string.
</para> </para>
<para> <para>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment