#
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/doc/src/sgml/Makefile,v 1.36 2001/04/20 15:52:33 thomas Exp $
+# $Header: /cvsroot/pgsql/doc/src/sgml/Makefile,v 1.37 2001/05/12 22:51:34 petere Exp $
#
#----------------------------------------------------------------------------
ALLBOOKS = admin developer programmer reference tutorial user
-ALLSGML := $(wildcard $(srcdir)/*.sgml $(srcdir)/ref/*.sgml)
+ALLSGML := $(wildcard $(srcdir)/*.sgml $(srcdir)/ref/*.sgml) bookindex.sgml setindex.sgml
-
-catalog: Makefile $(top_builddir)/src/Makefile.global
- (echo "PUBLIC \"-//Norman Walsh//DOCUMENT DocBook HTML Stylesheet//EN\" \"$(DOCBOOKSTYLE)/html/docbook.dsl\""; \
- echo "PUBLIC \"-//Norman Walsh//DOCUMENT DocBook Print Stylesheet//EN\" \"$(DOCBOOKSTYLE)/print/docbook.dsl\"") > $@
-
-ifeq "$(origin DOCBOOKSTYLE)" "command line"
-.PHONY: catalog
-endif
+CATALOG = $(DOCBOOKSTYLE)/catalog
##
## HTML
##
-JADE.html = $(JADE) $(JADEFLAGS) $(SGMLINCLUDE) -d stylesheet.dsl -i output-html -t sgml
+JADE.html = $(JADE) $(JADEFLAGS) $(SGMLINCLUDE) -c $(CATALOG) -d stylesheet.dsl -i output-html -t sgml
-postgres.html: postgres.sgml $(ALLSGML) stylesheet.dsl catalog
+postgres.html: postgres.sgml $(ALLSGML) stylesheet.dsl
@rm -f *.html
$(JADE.html) $<
ln -sf $@ index.html
-$(addsuffix .html, $(ALLBOOKS)): %.html: %.sgml $(ALLSGML) stylesheet.dsl catalog
+$(addsuffix .html, $(ALLBOOKS)): %.html: %.sgml $(ALLSGML) stylesheet.dsl
@rm -f *.html
$(JADE.html) book-decl.sgml $<
ln -sf $@ index.html
+COLLATEINDEX = $(PERL) $(DOCBOOKSTYLE)/bin/collateindex.pl -f -g -t 'Index'
+
+ifeq (,$(wildcard HTML.index))
+bookindex.sgml:
+ $(COLLATEINDEX) -o $@ -N
+setindex.sgml:
+ $(COLLATEINDEX) -x -o $@ -N
+else
+bookindex.sgml: HTML.index
+ $(COLLATEINDEX) -i 'bookindex' -o $@ $<
+setindex.sgml: HTML.index
+ $(COLLATEINDEX) -i 'setindex' -x -o $@ $<
+endif
+
##
## Print
##
# RTF to allow minor editing for hardcopy
-$(addsuffix .rtf, $(ALLBOOKS)): %.rtf: %.sgml $(ALLSGML) stylesheet.dsl catalog
- $(JADE) $(JADEFLAGS) $(SGMLINCLUDE) -d stylesheet.dsl -t rtf -V rtf-backend -i output-print book-decl.sgml $<
+$(addsuffix .rtf, $(ALLBOOKS)): %.rtf: %.sgml $(ALLSGML) stylesheet.dsl
+ $(JADE) $(JADEFLAGS) $(SGMLINCLUDE) -c $(CATALOG) -d stylesheet.dsl -t rtf -V rtf-backend -i output-print book-decl.sgml $<
# TeX and DVI
-$(addsuffix .tex, $(ALLBOOKS)): %.tex: %.sgml $(ALLSGML) stylesheet.dsl catalog
- $(JADE) $(JADEFLAGS) $(SGMLINCLUDE) -d stylesheet.dsl -t tex -V tex-backend -i output-print book-decl.sgml $<
+$(addsuffix .tex, $(ALLBOOKS)): %.tex: %.sgml $(ALLSGML) stylesheet.dsl
+ $(JADE) $(JADEFLAGS) $(SGMLINCLUDE) -c $(CATALOG) -d stylesheet.dsl -t tex -V tex-backend -i output-print book-decl.sgml $<
%.dvi: %.tex
jadetex $<
## Semi-automatic generation of some text files.
##
-JADE.text = $(JADE) $(JADEFLAGS) $(SGMLINCLUDE) -d stylesheet.dsl -i output-text -t sgml
+JADE.text = $(JADE) $(JADEFLAGS) $(SGMLINCLUDE) -c $(CATALOG) -d stylesheet.dsl -i output-text -t sgml
INSTALL HISTORY: % : %.html
@echo "|";\
##
clean distclean maintainer-clean:
- rm -f catalog
# HTML
rm -f HTML.manifest *.html
# man
rm -rf *.1 *.$(DEFAULTSECTION) man1 man$(DEFAULTSECTION) manpage.refs manpage.links manpage.log
# print
rm -f *.rtf *.tex *.dvi *.aux *.log *.ps *.pdf
+# index
+ rm -f HTML.index bookindex.sgml setindex.sgml
<!--
-$Header: /cvsroot/pgsql/doc/src/sgml/Attic/admin.sgml,v 1.33 2001/02/04 15:28:18 petere Exp $
+$Header: /cvsroot/pgsql/doc/src/sgml/Attic/admin.sgml,v 1.34 2001/05/12 22:51:34 petere Exp $
-->
<book id="admin">
<![%single-book;[
&biblio;
+ &bookindex;
]]>
</book>
-<!-- $Header: /cvsroot/pgsql/doc/src/sgml/array.sgml,v 1.10 2001/01/26 23:40:39 petere Exp $ -->
+<!-- $Header: /cvsroot/pgsql/doc/src/sgml/array.sgml,v 1.11 2001/05/12 22:51:34 petere Exp $ -->
<chapter id="arrays">
<title>Arrays</title>
+ <indexterm>
+ <primary>arrays</primary>
+ </indexterm>
+
<para>
<productname>Postgres</productname> allows columns of a table to be
defined as variable-length multi-dimensional arrays. Arrays of any
-<!-- $Header: /cvsroot/pgsql/doc/src/sgml/client-auth.sgml,v 1.10 2001/03/15 20:01:32 tgl Exp $ -->
+<!-- $Header: /cvsroot/pgsql/doc/src/sgml/client-auth.sgml,v 1.11 2001/05/12 22:51:34 petere Exp $ -->
<chapter id="client-authentication">
<title>Client Authentication</title>
+ <indexterm zone="client-authentication">
+ <primary>client authentication</primary>
+ </indexterm>
+
<para>
When a client application connects to the database server, it specifies which
<productname>Postgres</productname> user name it wants to connect as,
<sect1 id="pg-hba.conf">
<title>The <filename>pg_hba.conf</filename> file</title>
+ <indexterm zone="pg-hba.conf">
+ <primary>pg_hba.conf</primary>
+ </indexterm>
+
<para>
Client authentication is controlled by the file
<filename>pg_hba.conf</filename> in the $PGDATA directory, e.g.,
<sect2>
<title>Password authentication</title>
+
+ <indexterm>
+ <primary>password</primary>
+ </indexterm>
+
<para>
<productname>Postgres</> database passwords are separate from any
operating system user passwords. Ordinarily, the password for each
<sect2 id="kerberos-auth">
<title>Kerberos authentication</title>
+ <indexterm zone="kerberos-auth">
+ <primary>Kerberos</primary>
+ </indexterm>
+
<para>
<productname>Kerberos</productname> is an industry-standard secure
authentication system suitable for distributed computing over a
<sect2>
<title>Ident-based authentication</title>
+ <indexterm>
+ <primary>ident</primary>
+ </indexterm>
+
<para>
The <quote>Identification Protocol</quote> is described in
<citetitle>RFC 1413</citetitle>. Virtually every Unix-like
</para>
<para>
+ <indexterm><primary>pg_ident.conf</primary></indexterm>
Ident maps are held in the file <filename>pg_ident.conf</filename>
in the data directory, which contains lines of the general form:
<synopsis>
<!--
-$Header: /cvsroot/pgsql/doc/src/sgml/datatype.sgml,v 1.52 2001/03/24 23:03:26 petere Exp $
+$Header: /cvsroot/pgsql/doc/src/sgml/datatype.sgml,v 1.53 2001/05/12 22:51:34 petere Exp $
-->
<chapter id="datatype">
<title id="datatype-title">Data Types</title>
+ <indexterm zone="datatype">
+ <primary>data types</primary>
+ </indexterm>
+
+ <indexterm>
+ <primary>types</primary>
+ <see>data types</see>
+ </indexterm>
+
<para>
<productname>Postgres</productname> has a rich set of native data
types available to users.
<sect1 id="datatype-numeric">
<title>Numeric Types</title>
+ <indexterm zone="datatype-numeric">
+ <primary>data types</primary>
+ <secondary>numeric</secondary>
+ </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>
Numeric types consist of two-, four-, and eight-byte integers,
four- and eight-byte
<sect2 id="datatype-serial">
<title>The Serial Type</title>
+ <indexterm zone="datatype-serial">
+ <primary>serial</primary>
+ </indexterm>
+
+ <indexterm>
+ <primary>auto-increment</primary>
+ <see>serial</see>
+ </indexterm>
+
+ <indexterm>
+ <primary>sequences</primary>
+ <secondary>and serial type</secondary>
+ </indexterm>
+
<para>
The <type>serial</type> type is a special-case type constructed by
<productname>Postgres</productname> from other existing components.
<sect1 id="datatype-character">
<title>Character Types</title>
+ <indexterm zone="datatype-character">
+ <primary>character strings</primary>
+ <secondary>data types</secondary>
+ </indexterm>
+
+ <indexterm>
+ <primary>strings</primary>
+ <see>character strings</see>
+ </indexterm>
+
+ <indexterm>
+ <primary>text</primary>
+ <see>character strings</see>
+ </indexterm>
+
<para>
<acronym>SQL</acronym> defines two primary character types:
<type>character</type> and <type>character varying</type>.
<sect3>
<title>date</title>
+
+ <indexterm>
+ <primary>date</primary>
+ <secondary>data type</secondary>
+ </indexterm>
+
<para>
The following are possible inputs for the <type>date</type> type.
<sect3>
<title>time [ without time zone ]</title>
+ <indexterm>
+ <primary>time</primary>
+ <secondary>data type</secondary>
+ </indexterm>
+
<para>
Per SQL99, this type can be referenced as <type>time</type> and
as <type>time without time zone</type>.
<sect3>
<title>timestamp</title>
+ <indexterm>
+ <primary>timestamp</primary>
+ <secondary>data type</secondary>
+ </indexterm>
+
<para>
Valid input for the <type>timestamp</type> type consists of a concatenation
of a date and a time, followed by an optional <literal>AD</literal> or
<sect3>
<title>interval</title>
+ <indexterm>
+ <primary>interval</primary>
+ </indexterm>
+
<para>
<type>interval</type>s can be specified with the following syntax:
<sect3>
<title>Special values</title>
+ <indexterm>
+ <primary>time</primary>
+ <secondary>current</secondary>
+ </indexterm>
+
+ <indexterm>
+ <primary>date</primary>
+ <secondary>current</secondary>
+ </indexterm>
+
<para>
The following <acronym>SQL</acronym>-compatible functions can be used as date or time
input for the corresponding data type: <literal>CURRENT_DATE</literal>,
<sect2 id="datatype-datetime-output">
<title>Date/Time Output</title>
+ <indexterm>
+ <primary>date</primary>
+ <secondary>output format</secondary>
+ <seealso>Formatting</seealso>
+ </indexterm>
+
+ <indexterm>
+ <primary>time</primary>
+ <secondary>output format</secondary>
+ <seealso>Formatting</seealso>
+ </indexterm>
+
<para>
Output formats can be set to one of the four styles
ISO-8601, <acronym>SQL</acronym> (Ingres), traditional
<sect2 id="datatype-timezones">
<title>Time Zones</title>
+ <indexterm zone="datatype-timezones">
+ <primary>time zones</primary>
+ </indexterm>
+
<para>
<productname>Postgres</productname> endeavors to be compatible with
<acronym>SQL92</acronym> definitions for typical usage.
<sect1 id="datatype-boolean">
<title>Boolean Type</title>
+ <indexterm zone="datatype-boolean">
+ <primary>Boolean</primary>
+ <secondary>data type</secondary>
+ </indexterm>
+
+ <indexterm zone="datatype-boolean">
+ <primary>true</primary>
+ </indexterm>
+
+ <indexterm zone="datatype-boolean">
+ <primary>false</primary>
+ </indexterm>
+
<para>
<productname>Postgres</productname> provides the
<acronym>SQL99</acronym> type <type>boolean</type>.
<sect2>
<title>Point</title>
+ <indexterm>
+ <primary>point</primary>
+ </indexterm>
+
<para>
Points are the fundamental two-dimensional building block for geometric types.
</para>
<sect2>
<title>Line Segment</title>
+ <indexterm>
+ <primary>line</primary>
+ </indexterm>
+
<para>
Line segments (<type>lseg</type>) are represented by pairs of points.
</para>
<sect2>
<title>Box</title>
+ <indexterm>
+ <primary>box (data type)</primary>
+ </indexterm>
+
<para>
Boxes are represented by pairs of points that are opposite
corners of the box.
<sect2>
<title>Path</title>
+ <indexterm>
+ <primary>path (data type)</primary>
+ </indexterm>
+
<para>
Paths are represented by connected sets of points. Paths can be "open", where
the first and last points in the set are not connected, and "closed",
<sect2>
<title>Polygon</title>
+ <indexterm>
+ <primary>polygon</primary>
+ </indexterm>
+
<para>
Polygons are represented by sets of points. Polygons should probably be
considered equivalent to closed paths, but are stored differently
<sect2>
<title>Circle</title>
+ <indexterm>
+ <primary>circle</primary>
+ </indexterm>
+
<para>
Circles are represented by a center point and a radius.
</para>
<sect1 id="datatype-net-types">
<title>Network Address Data Types</title>
+ <indexterm zone="datatype-net-types">
+ <primary>network</primary>
+ <secondary>addresses</secondary>
+ </indexterm>
+
<para>
<productname>Postgres</> offers data types to store IP and MAC
addresses. It is preferable to use these types over plain text
<sect2 id="datatype-inet">
<title><type>inet</type></title>
+ <indexterm>
+ <primary>inet (data type)</primary>
+ </indexterm>
+
<para>
The <type>inet</type> type holds an IP host address, and
optionally the identity of the subnet it is in, all in one field.
<sect2 id="datatype-cidr">
<title><type>cidr</></title>
+ <indexterm>
+ <primary>cidr</primary>
+ </indexterm>
+
<para>
The <type>cidr</type> type holds an IP network specification.
Input and output formats follow Classless Internet Domain Routing
<sect2 id="datatype-macaddr">
<title><type>macaddr</></>
+ <indexterm>
+ <primary>macaddr (data type)</primary>
+ </indexterm>
+
+ <indexterm>
+ <primary>MAC address</primary>
+ <see>macaddr</see>
+ </indexterm>
+
<para>
The <type>macaddr</> type stores MAC addresses, i.e., Ethernet
card hardware addresses (although MAC addresses are used for
<sect1 id="datatype-bit">
<title>Bit String Types</title>
+ <indexterm zone="datatype-bit">
+ <primary>bit strings</primary>
+ <secondary>data type</secondary>
+ </indexterm>
+
<para>
Bit strings are strings of 1's and 0's. They can be used to store
or visualize bit masks. There are two SQL bit types:
<!--
-$Header: /cvsroot/pgsql/doc/src/sgml/datetime.sgml,v 2.17 2001/02/12 14:21:27 momjian Exp $
+$Header: /cvsroot/pgsql/doc/src/sgml/datetime.sgml,v 2.18 2001/05/12 22:51:34 petere Exp $
Date/time details
-->
<sect1 id="timezones">
<title>Time Zones</title>
+ <indexterm zone="timezones">
+ <primary>time zones</primary>
+ </indexterm>
+
<para>
<productname>Postgres</productname> must have internal tabular
information for time zone decoding, since there is no *nix standard
-<!-- $Header: /cvsroot/pgsql/doc/src/sgml/filelist.sgml,v 1.11 2001/05/12 17:49:32 petere Exp $ -->
+<!-- $Header: /cvsroot/pgsql/doc/src/sgml/filelist.sgml,v 1.12 2001/05/12 22:51:34 petere Exp $ -->
<!entity history SYSTEM "history.sgml">
<!entity info SYSTEM "info.sgml">
<!entity problems SYSTEM "problems.sgml">
<!entity y2k SYSTEM "y2k.sgml">
+<!entity bookindex SYSTEM "bookindex.sgml">
+<!entity setindex SYSTEM "setindex.sgml">
+
<!-- tutorial -->
<!entity advanced SYSTEM "advanced.sgml">
<!entity arch SYSTEM "arch.sgml">
-<!-- $Header: /cvsroot/pgsql/doc/src/sgml/func.sgml,v 1.57 2001/04/20 15:52:33 thomas Exp $ -->
+<!-- $Header: /cvsroot/pgsql/doc/src/sgml/func.sgml,v 1.58 2001/05/12 22:51:34 petere Exp $ -->
<chapter id="functions">
<title>Functions and Operators</title>
+ <indexterm zone="functions">
+ <primary>functions</primary>
+ </indexterm>
+
+ <indexterm zone="functions">
+ <primary>operators</primary>
+ </indexterm>
+
<para>
<productname>Postgres</productname> provides a large number of
functions and operators for the built-in data types. Users can also
<sect1 id="functions-logical">
<title>Logical Operators</title>
+ <indexterm zone="functions-logical">
+ <primary>operators</primary>
+ <secondary>logical</secondary>
+ </indexterm>
+
+ <indexterm>
+ <primary>Boolean</primary>
+ <secondary>operators</secondary>
+ <see>operators, logical</see>
+ </indexterm>
+
<para>
The usual logical operators are available:
+ <indexterm>
+ <primary>and</primary>
+ <secondary>operator</secondary>
+ </indexterm>
+
+ <indexterm>
+ <primary>or</primary>
+ <secondary>operator</secondary>
+ </indexterm>
+
+ <indexterm>
+ <primary>not</primary>
+ <secondary>operator</secondary>
+ </indexterm>
+
<simplelist>
<member>AND</member>
<member>OR</member>
<sect1 id="functions-comparison">
<title>Comparison Operators</title>
+ <indexterm zone="functions-comparison">
+ <primary>comparison</primary>
+ <secondary>operators</secondary>
+ </indexterm>
+
<table>
<title>Comparison Operators</TITLE>
<tgroup cols="2">
</para>
<para>
+ <indexterm>
+ <primary>between</primary>
+ </indexterm>
In addition to the comparison operators, the special
<token>BETWEEN</token> construct is available.
<synopsis>
<row>
<entry> <parameter>string</parameter> <literal>||</literal> <parameter>string</parameter> </entry>
<entry> <type>text</type> </entry>
- <entry>string concatenation</entry>
+ <entry>
+ string concatenation
+ <indexterm>
+ <primary>character strings</primary>
+ <secondary>concatenation</secondary>
+ </indexterm>
+ </entry>
<entry>'Postgre' || 'SQL'</entry>
<entry>PostgreSQL</entry>
</row>
<row>
<entry>char_length(<parameter>string</parameter>) or character_length(<parameter>string</parameter>)</entry>
<entry><type>integer</type></entry>
- <entry>length of string</entry>
+ <entry>
+ length of string
+ <indexterm>
+ <primary>character strings</primary>
+ <secondary>length</secondary>
+ </indexterm>
+ <indexterm>
+ <primary>length</primary>
+ <secondary>character strings</secondary>
+ <see>character strings, length</see>
+ </indexterm>
+ </entry>
<entry>char_length('jose')</entry>
<entry>4</entry>
</row>
<row>
<entry>substring(<parameter>string</parameter> <optional>from <type>integer</type></optional> <optional>for <type>integer</type></optional>)</entry>
<entry><type>text</type></entry>
- <entry>extract substring</entry>
+ <entry>
+ extract substring
+ <indexterm>
+ <primary>substring</primary>
+ </indexterm>
+ </entry>
<entry>substring('Thomas' from 2 for 3)</entry>
<entry>oma</entry>
</row>
<sect2 id="functions-like">
<title>Pattern Matching with <function>LIKE</function></title>
+ <indexterm>
+ <primary>like</primary>
+ </indexterm>
+
<synopsis>
<replaceable>string</replaceable> LIKE <replaceable>pattern</replaceable> <optional> ESCAPE <replaceable>escape-character</replaceable> </optional>
<replaceable>string</replaceable> NOT LIKE <replaceable>pattern</replaceable> <optional> ESCAPE <replaceable>escape-character</replaceable> </optional>
<sect2 id="functions-regexp">
<title><acronym>POSIX</acronym> Regular Expressions</title>
+ <indexterm zone="functions-regexp">
+ <primary>regular expressions</primary>
+ <seealso>pattern matching</seealso>
+ </indexterm>
+
<table>
<title>Regular Expression Match Operators</title>
<sect1 id="functions-formatting">
<title>Formatting Functions</title>
+ <indexterm zone="functions-formatting">
+ <primary>formatting</primary>
+ </indexterm>
+
<note>
<title>Author</title>
<para>
<listitem>
<para>
- If you want to
- have a double quote in the output you must precede it with a
- backslash, for example <literal>'\\"YYYY
- Month\\"'</literal>. <!-- " font-lock sanity :-) -->
+ If you want to have a double quote in the output you must
+ precede it with a backslash, for example <literal>'\\"YYYY
+ Month\\"'</literal>. <!-- "" font-lock sanity :-) -->
</para>
</listitem>
<sect2 id="functions-datetime-current">
<title>Current Date/Time</title>
+ <indexterm>
+ <primary>date</primary>
+ <secondary>current</secondary>
+ </indexterm>
+
+ <indexterm>
+ <primary>time</primary>
+ <secondary>current</secondary>
+ </indexterm>
+
<para>
The following functions are available to obtain the current date and/or
time:
<sect1 id="functions-conditional">
<title>Conditional Expressions</title>
+ <indexterm>
+ <primary>case</primary>
+ </indexterm>
+
+ <indexterm>
+ <primary>conditionals</primary>
+ </indexterm>
+
<para>
This section describes the <acronym>SQL</acronym>-compliant conditional expressions
available in <productname>Postgres</productname>.
<bridgehead renderas="sect2">NULLIF</bridgehead>
+ <indexterm>
+ <primary>nullif</primary>
+ </indexterm>
+
<synopsis>
<function>NULLIF</function>(<replaceable>value1</replaceable>, <replaceable>value2</replaceable>)
</synopsis>
</tgroup>
</table>
+ <indexterm zone="functions-misc">
+ <primary>user</primary>
+ <secondary>current</secondary>
+ </indexterm>
+
<para>
The <function>session_user</> is the user that initiated a database
connection and is fixed for the duration of that connection. The
<entry>AVG(<replaceable class="parameter">expression</replaceable>)</entry>
<entry>the average (arithmetic mean) of all input values</entry>
<entry>
+ <indexterm>
+ <primary>average</primary>
+ <secondary>function</secondary>
+ </indexterm>
Finding the average value is available on the following data
types: <type>smallint</type>, <type>integer</type>,
<type>bigint</type>, <type>real</type>, <type>double
<entry>STDDEV(<replaceable class="parameter">expression</replaceable>)</entry>
<entry>the sample standard deviation of the input values</entry>
<entry>
+ <indexterm>
+ <primary>standard deviation</primary>
+ </indexterm>
Finding the standard deviation is available on the following
data types: <type>smallint</type>, <type>integer</type>,
<type>bigint</type>, <type>real</type>, <type>double
<entry>VARIANCE(<replaceable class="parameter">expression</replaceable>)</entry>
<entry>the sample variance of the input values</entry>
<entry>
+ <indexterm>
+ <primary>variance</primary>
+ </indexterm>
The variance is the square of the standard deviation. The
supported data types are the same.
</entry>
-<!-- $Header: /cvsroot/pgsql/doc/src/sgml/indices.sgml,v 1.15 2001/05/07 00:43:14 tgl Exp $ -->
+<!-- $Header: /cvsroot/pgsql/doc/src/sgml/indices.sgml,v 1.16 2001/05/12 22:51:34 petere Exp $ -->
<chapter id="indices">
<title id="indices-title">Indices</title>
+ <indexterm zone="indices">
+ <primary>indices</primary>
+ </indexterm>
+
+ <indexterm>
+ <primary>indexes</primary>
+ <see>indices</see>
+ </indexterm>
+
<para>
Indices are a common way to enhance database performance. An index
allows the database server to find and retrieve specific rows much
<para>
<productname>Postgres</productname> provides several index types:
B-tree, R-tree, and Hash. Each index type is more appropriate for
- a particular query type because of the algorithm it uses. By
+ a particular query type because of the algorithm it uses.
+ <indexterm>
+ <primary>indices</primary>
+ <secondary>B-tree</secondary>
+ </indexterm>
+ <indexterm>
+ <primary>B-tree</primary>
+ <see>indices</see>
+ </indexterm>
+ By
default, the <command>CREATE INDEX</command> command will create a
B-tree index, which fits the most common situations. In
particular, the <productname>Postgres</productname> query optimizer
</para>
<para>
+ <indexterm>
+ <primary>indices</primary>
+ <secondary>R-tree</secondary>
+ </indexterm>
+ <indexterm>
+ <primary>R-tree</primary>
+ <see>indices</see>
+ </indexterm>
R-tree indices are especially suited for spacial data. To create
an R-tree index, use a command of the form
<synopsis>
</para>
<para>
+ <indexterm>
+ <primary>indices</primary>
+ <secondary>hash</secondary>
+ </indexterm>
+ <indexterm>
+ <primary>hash</primary>
+ <see>indices</see>
+ </indexterm>
The query optimizer will consider using a hash index whenever an
indexed column is involved in a comparison using the
<literal>=</literal> operator. The following command is used to
<sect1 id="indices-multicolumn">
<title>Multi-Column Indices</title>
+ <indexterm zone="indices-multicolumn">
+ <primary>indices</primary>
+ <secondary>multi-column</secondary>
+ </indexterm>
+
<para>
An index can be defined on more than one column. For example, if
you have a table of this form:
<sect1 id="indices-unique">
<title>Unique Indices</title>
+ <indexterm zone="indices-unique">
+ <primary>indices</primary>
+ <secondary>unique</secondary>
+ </indexterm>
+
<para>
Indexes may also be used to enforce uniqueness of a column's value,
or the uniqueness of the combined values of more than one column.
<sect1 id="indices-functional">
<title>Functional Indices</title>
+ <indexterm zone="indices-functional">
+ <primary>indices</primary>
+ <secondary>on functions</secondary>
+ </indexterm>
+
<para>
For a <firstterm>functional index</firstterm>, an index is defined
on the result of a function applied to one or more columns of a
<sect1 id="partial-index">
<title id="partial-index-title">Partial Indices</title>
+ <indexterm zone="partial-index">
+ <primary>indices</primary>
+ <secondary>partial</secondary>
+ </indexterm>
+
<note>
<title>Author</title>
<para>
<chapter id="install-win32">
<title>Installation on <productname>Windows</productname></title>
+ <indexterm>
+ <primary>installation</primary>
+ <secondary>on Windows</secondary>
+ </indexterm>
+
<abstract>
<para>
Build, installation, and use instructions for
-<!-- $Header: /cvsroot/pgsql/doc/src/sgml/installation.sgml,v 1.47 2001/05/09 19:41:57 momjian Exp $ -->
+<!-- $Header: /cvsroot/pgsql/doc/src/sgml/installation.sgml,v 1.48 2001/05/12 22:51:35 petere Exp $ -->
<chapter id="installation">
<title><![%flattext-install-include[<productname>PostgreSQL</>]]>
Installation Instructions</title>
+ <indexterm zone="installation">
+ <primary>installation</primary>
+ </indexterm>
+
<sect1 id="install-short">
<title>Short Version</title>
The following prerequisites exist for building <productname>PostgreSQL</>:
<itemizedlist>
<listitem>
+ <indexterm>
+ <primary>make</primary>
+ </indexterm>
+
<para>
<acronym>GNU</> <application>make</> is required; other
<application>make</> programs will <emphasis>not</> work.
</listitem>
<listitem>
+ <indexterm>
+ <primary>readline</primary>
+ </indexterm>
+
<para>
The <acronym>GNU</> <productname>Readline</> library for comfortable
line editing and command history retrieval will automatically be used
</listitem>
<listitem>
+ <indexterm>
+ <primary>flex</primary>
+ </indexterm>
+ <indexterm>
+ <primary>bison</primary>
+ </indexterm>
+ <indexterm>
+ <primary>yacc</primary>
+ </indexterm>
+
<para>
<application>Flex</> and <application>Bison</> are
<emphasis>not</> required when building from a released source
</listitem>
<listitem>
+ <indexterm>
+ <primary>installation</primary>
+ <secondary>on Windows</secondary>
+ </indexterm>
<para>
To build on <productname>Windows NT</> or <productname>Windows
2000</> you need the <productname>Cygwin</> and
<sect1 id="install-upgrading">
<title>If You Are Upgrading</title>
+ <indexterm zone="install-upgrading">
+ <primary>upgrading</primary>
+ </indexterm>
+
<para>
The internal data storage format changes with new releases of
<productname>PostgreSQL</>. Therefore, if you are upgrading an
</step>
<step>
+ <indexterm>
+ <primary>pg_dumpall</primary>
+ </indexterm>
+
<para>
To dump your database installation, type:
<screen>
<step id="configure">
<title>Configuration</>
+
+ <indexterm zone="configure">
+ <primary>configure</primary>
+ </indexterm>
+
<para>
The first step of the installation procedure is to configure the
source tree for your system and choose the options you would like.
</varlistentry>
<varlistentry>
+ <indexterm>
+ <primary>OpenSSL</primary>
+ <seealso>SSL</seealso>
+ </indexterm>
+
<term>--with-openssl=<replaceable>DIRECTORY</></term>
<listitem>
<para>
<step>
<title>Regression Tests</title>
+ <indexterm>
+ <primary>regression test</primary>
+ </indexterm>
+
<para>
If you want to test the newly built server before you install it,
you can run the regression tests at this point. The regression
<sect2>
<title>Shared Libraries</title>
+
+ <indexterm>
+ <primary>shared libraries</primary>
+ </indexterm>
+
<para>
On some systems that have shared libraries (which most systems do)
you need to tell your system how to find the newly installed
<sect2>
<title>Environment Variables</title>
+
+ <indexterm>
+ <primary><envar>PATH</envar></primary>
+ </indexterm>
+
<para>
If you installed into <filename>/usr/local/pgsql</> or some other
location that is not searched for programs by default, you need to
</para>
<para>
+ <indexterm>
+ <primary><envar>MANPATH</envar></primary>
+ <seealso>man pages</seealso>
+ </indexterm>
To enable your system to find the <application>man</>
documentation, you need to add a line like the following to a
shell start-up file:
<appendix id="sql-keywords-appendix">
<title><acronym>SQL</acronym> Key Words</title>
+ <indexterm zone="sql-keywords-appendix">
+ <primary>key words</primary>
+ <secondary>list of</secondary>
+ </indexterm>
+
<para>
<xref linkend="keywords-table"> lists all tokens that are key words
in the SQL standard and in <productname>PostgreSQL</productname>
-<Chapter Id="pgtcl">
-<Title>pgtcl - TCL Binding Library</Title>
+<chapter id="pgtcl">
+ <title>pgtcl - Tcl Binding Library</title>
+
+ <indexterm zone="pgtcl">
+ <primary>libpgtcl</primary>
+ </indexterm>
+
+ <indexterm zone="pgtcl">
+ <primary>Tcl</primary>
+ </indexterm>
<Para>
<literal>pgtcl</literal> is a tcl package for front-end programs
<!--
-$Header: /cvsroot/pgsql/doc/src/sgml/libpq.sgml,v 1.62 2001/05/01 10:48:57 petere Exp $
+$Header: /cvsroot/pgsql/doc/src/sgml/libpq.sgml,v 1.63 2001/05/12 22:51:35 petere Exp $
-->
<chapter id="libpq">
<title>libpq - C Library</title>
+ <indexterm zone="libpq">
+ <primary>libpq</primary>
+ </indexterm>
+
<para>
<filename>libpq</filename> is the <acronym>C</acronym>
application programmer's interface to
<sect1 id="libpq-copy">
<title>Functions Associated with the COPY Command</title>
+<indexterm zone="libpq-copy">
+ <primary>COPY</primary>
+ <secondary>with libpq</secondary>
+</indexterm>
+
<para>
The COPY command in <productname>Postgres</productname> has options to read from
or write to the network connection used by <filename>libpq</filename>.
<sect1 id="libpq-envars">
<title>Environment Variables</title>
+<indexterm zone="libpq-envars">
+ <primary>environment variables</primary>
+</indexterm>
+
<para>
The following environment variables can be used to select default
connection parameter values, which will be used by <function>PQconnectdb</function> or
<itemizedlist>
<listitem>
<para>
+<indexterm>
+ <primary><envar>PGHOST</envar></primary>
+</indexterm>
<envar>PGHOST</envar> sets the default server name.
If this begins with a slash, it specifies Unix-domain communication
rather than TCP/IP communication; the value is the name of the
</listitem>
<listitem>
<para>
+<indexterm>
+ <primary><envar>PGPORT</envar></primary>
+</indexterm>
<envar>PGPORT</envar> sets the default TCP port number or Unix-domain
socket file extension for communicating with the
<productname>Postgres</productname> backend.
</listitem>
<listitem>
<para>
+<indexterm>
+ <primary><envar>PGDATABASE</envar></primary>
+</indexterm>
<envar>PGDATABASE</envar> sets the default
<productname>Postgres</productname> database name.
</para>
</listitem>
<listitem>
<para>
+<indexterm>
+ <primary><envar>PGUSER</envar></primary>
+</indexterm>
<envar>PGUSER</envar>
sets the username used to connect to the database and for authentication.
</para>
</listitem>
<listitem>
<para>
+<indexterm>
+ <primary><envar>PGPASSWORD</envar></primary>
+</indexterm>
<envar>PGPASSWORD</envar>
sets the password used if the backend demands password authentication.
</para>
<sect1 id="libpq-threading">
<title>Threading Behavior</title>
+<indexterm zone="libpq-threading">
+ <primary>threads</primary>
+ <secondary>with libpq</secondary>
+</indexterm>
+
<para>
<filename>libpq</filename> is thread-safe as of
<productname>Postgres</productname> 7.0, so long as no two threads
<!--
-$Header: /cvsroot/pgsql/doc/src/sgml/mvcc.sgml,v 2.13 2001/04/20 15:52:33 thomas Exp $
+$Header: /cvsroot/pgsql/doc/src/sgml/mvcc.sgml,v 2.14 2001/05/12 22:51:35 petere Exp $
-->
<chapter id="mvcc">
<title>Multi-Version Concurrency Control</title>
+ <indexterm>
+ <primary>concurrency</primary>
+ </indexterm>
+
<abstract>
<para>
Multi-Version Concurrency Control
<varlistentry>
<term>
dirty reads
+ <indexterm><primary>dirty reads</primary></indexterm>
</term>
<listitem>
<para>
<varlistentry>
<term>
non-repeatable reads
+ <indexterm><primary>non-repeatable reads</primary></indexterm>
</term>
<listitem>
<para>
<varlistentry>
<term>
phantom read
+ <indexterm><primary>phantom reads</primary></indexterm>
</term>
<listitem>
<para>
</para>
<para>
+ <indexterm>
+ <primary>isolation levels</primary>
+ </indexterm>
The four isolation levels and the corresponding behaviors are described below.
<table tocentry="1">
<sect1 id="xact-read-committed">
<title>Read Committed Isolation Level</title>
+ <indexterm>
+ <primary>isolation levels</primary>
+ <secondary>read committed</secondary>
+ </indexterm>
+
<para>
<firstterm>Read Committed</firstterm>
is the default isolation level in <productname>Postgres</productname>.
<sect1 id="xact-serializable">
<title>Serializable Isolation Level</title>
+ <indexterm>
+ <primary>isolation levels</primary>
+ <secondary>read serializable</secondary>
+ </indexterm>
+
<para>
<firstterm>Serializable</firstterm> provides the highest transaction
isolation. This level emulates serial transaction execution,
<sect1 id="locking-tables">
<title>Locking and Tables</title>
+ <indexterm>
+ <primary>locking</primary>
+ </indexterm>
+
<para>
<productname>Postgres</productname>
provides various lock modes to control concurrent
<!--
-$Header: /cvsroot/pgsql/doc/src/sgml/Attic/odbc.sgml,v 1.21 2001/01/20 20:59:28 petere Exp $
+$Header: /cvsroot/pgsql/doc/src/sgml/Attic/odbc.sgml,v 1.22 2001/05/12 22:51:35 petere Exp $
-->
<chapter id="odbc">
<title>ODBC Interface</title>
+ <indexterm zone="odbc">
+ <primary>ODBC</primary>
+ </indexterm>
+
<note>
<para>
Background information originally by Tim Goeke
(or any <acronym>ODBC</> driver) is that there must exist a
<firstterm>driver manager</> on the system where the
<acronym>ODBC</> driver is to be used. There exists a free
- <acronym>ODBC</> driver for Unix called <productname>iODBC</>
- which can be obtained via <ulink
+ <acronym>ODBC</> driver for Unix called
+ <indexterm><primary>iODBC</primary></indexterm>
+ <productname>iODBC</> which can be obtained via <ulink
url="http://www.iodbc.org">http://www.iodbc.org</ulink>.
Instructions for installing <productname>iODBC</> are contained in
the <productname>iODBC</> distribution. Having said that, any
<sect1 id="odbc-applixware">
<title>ApplixWare</title>
+ <indexterm zone="odbc-applixware">
+ <primary>ApplixWare</primary>
+ </indexterm>
+
<para>
<productname>ApplixWare</productname> has an
<acronym>ODBC</acronym> database interface
<!--
-$Header: /cvsroot/pgsql/doc/src/sgml/plperl.sgml,v 2.7 2000/12/22 18:57:50 petere Exp $
+$Header: /cvsroot/pgsql/doc/src/sgml/plperl.sgml,v 2.8 2001/05/12 22:51:35 petere Exp $
-->
<chapter id="plperl">
<title>PL/Perl - Perl Procedural Language</title>
+ <indexterm zone="plperl">
+ <primary>PL/Perl</primary>
+ </indexterm>
+
+ <indexterm zone="plperl">
+ <primary>Perl</primary>
+ </indexterm>
+
<para>
PL/Perl allows you to write functions in the Perl programming
language that may be used in SQL queries as if they were built into
In order to build and install PL/Perl if you are installing
<productname>Postgres</productname> from source then the
<option>--with-perl</option> must be supplied to the
+ <indexterm><primary><filename>configure</filename></primary></indexterm>
<filename>configure</filename> script. PL/Perl requires that, when
<productname>Perl</productname> was installed, the
+ <indexterm><primary>libperl</primary></indexterm>
<filename>libperl</filename> library was build as a shared object.
At the time of this writing, this is almost never the case in the
Perl packages that are distributed with the operating systems. A
<!--
-$Header: /cvsroot/pgsql/doc/src/sgml/Attic/plsql.sgml,v 2.30 2001/05/11 06:10:44 tgl Exp $
+$Header: /cvsroot/pgsql/doc/src/sgml/Attic/plsql.sgml,v 2.31 2001/05/12 22:51:35 petere Exp $
-->
<chapter id="plpgsql">
<title>PL/pgSQL - <acronym>SQL</acronym> Procedural Language</title>
+ <indexterm zone="plpgsql">
+ <primary>PL/pgSQL</primary>
+ </indexterm>
+
<para>
PL/pgSQL is a loadable procedural language for the
<productname>Postgres</productname> database system.
<title>Porting from Oracle PL/SQL</title>
+ <indexterm>
+ <primary>Oracle</primary>
+ </indexterm>
+
+ <indexterm>
+ <primary>PL/SQL</primary>
+ </indexterm>
+
<note>
<title>Author</title>
<para>
<!--
-$Header: /cvsroot/pgsql/doc/src/sgml/pltcl.sgml,v 2.9 2001/04/30 22:22:34 tgl Exp $
+$Header: /cvsroot/pgsql/doc/src/sgml/pltcl.sgml,v 2.10 2001/05/12 22:51:35 petere Exp $
-->
<chapter id="pltcl">
<title>PL/Tcl - TCL Procedural Language</title>
+ <indexterm zone="pltcl">
+ <primary>PL/Tcl</primary>
+ </indexterm>
+
+ <indexterm zone="pltcl">
+ <primary>Tcl</primary>
+ </indexterm>
+
<para>
PL/Tcl is a loadable procedural language for the
<productname>Postgres</productname> database system
<sect2>
<title>Trigger Procedures in PL/Tcl</title>
+ <indexterm>
+ <primary>triggers</primary>
+ <secondary>in PL/Tcl</secondary>
+ </indexterm>
+
<para>
Trigger procedures are defined in <productname>Postgres</productname>
as functions without
<variablelist>
<varlistentry>
+ <indexterm>
+ <primary>elog</primary>
+ </indexterm>
<term>elog <replaceable>level</replaceable> <replaceable>msg</replaceable></term>
<listitem>
<para>
<!--
-$Header: /cvsroot/pgsql/doc/src/sgml/postgres.sgml,v 1.45 2001/02/03 19:03:27 petere Exp $
+$Header: /cvsroot/pgsql/doc/src/sgml/postgres.sgml,v 1.46 2001/05/12 22:51:35 petere Exp $
-->
<!doctype set PUBLIC "-//OASIS//DTD DocBook V3.1//EN" [
&programmer;
&reference;
&developer;
+ &setindex;
</set>
<!--
-$Header: /cvsroot/pgsql/doc/src/sgml/Attic/programmer.sgml,v 1.37 2001/05/12 17:49:32 petere Exp $
+$Header: /cvsroot/pgsql/doc/src/sgml/Attic/programmer.sgml,v 1.38 2001/05/12 22:51:35 petere Exp $
PostgreSQL Programmer's Guide.
-->
&xindex;
&indexcost;
&gist;
-
-<!-- reference -->
-
-<!--
-The func-ref chapter is not currently useful.
-Disable it until we put in some info.
-- thomas 1998-10-27
-&func-ref;
--->
-
- &trigger;
- &spi;
+ &trigger;
+ &spi;
</part>
<part id="programmer-pl">
<![%single-book;[
&biblio;
+ &bookindex;
]]>
</book>
-<!-- $Header: /cvsroot/pgsql/doc/src/sgml/queries.sgml,v 1.6 2001/03/24 23:03:26 petere Exp $ -->
+<!-- $Header: /cvsroot/pgsql/doc/src/sgml/queries.sgml,v 1.7 2001/05/12 22:51:35 petere Exp $ -->
<chapter id="queries">
<title>Queries</title>
<sect3 id="queries-join">
<title>Joined Tables</title>
+ <indexterm zone="queries-join">
+ <primary>joins</primary>
+ </indexterm>
+
<para>
A joined table is a table derived from two other (real or
derived) tables according to the rules of the particular join
<term>CROSS JOIN</term>
<listitem>
+ <indexterm>
+ <primary>joins</primary>
+ <secondary>cross</secondary>
+ </indexterm>
<synopsis>
<replaceable>T1</replaceable> CROSS JOIN <replaceable>T2</replaceable>
</synopsis>
<term>Qualified JOINs</term>
<listitem>
+ <indexterm>
+ <primary>joins</primary>
+ <secondary>outer</secondary>
+ </indexterm>
+
<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> USING ( <replaceable>join column list</replaceable> )
</para>
<para>
+ <indexterm>
+ <primary>joins</primary>
+ <secondary>natural</secondary>
+ </indexterm>
Finally, NATURAL is a shorthand form of USING: it forms a USING
list consisting of exactly those column names that appear in both
input tables. As with USING, these columns appear only once in
<term>LEFT OUTER JOIN</term>
<listitem>
+ <indexterm>
+ <primary>joins</primary>
+ <secondary>left</secondary>
+ </indexterm>
+
<para>
First, an INNER JOIN is performed. Then, for each row in T1
that does not satisfy the join condition with any row in
<sect3 id="queries-subqueries">
<title>Subqueries</title>
+ <indexterm zone="queries-subqueries">
+ <primary>subqueries</primary>
+ </indexterm>
+
<para>
Subqueries specifying a derived table must be enclosed in
parentheses and <emphasis>must</emphasis> be named using an AS
<sect3 id="queries-table-aliases">
<title>Table and Column Aliases</title>
+ <indexterm zone="queries-table-aliases">
+ <primary>label</primary>
+ <secondary>table</secondary>
+ </indexterm>
+
+ <indexterm>
+ <primary>alias</primary>
+ <see>label</see>
+ </indexterm>
+
<para>
A temporary name can be given to tables and complex table
references to be used for references to the derived table in
<sect2 id="queries-where">
<title>WHERE clause</title>
+ <indexterm zone="queries-where">
+ <primary>where</primary>
+ </indexterm>
+
<para>
The syntax of the WHERE clause is
<synopsis>
<sect2 id="queries-group">
<title>GROUP BY and HAVING clauses</title>
+ <indexterm zone="queries-group">
+ <primary>group</primary>
+ </indexterm>
+
<para>
After passing the WHERE filter, the derived input table may be
subject to grouping, using the GROUP BY clause, and elimination of
<sect1 id="queries-select-lists">
<title>Select Lists</title>
+ <indexterm>
+ <primary>select</primary>
+ <secondary>select list</secondary>
+ </indexterm>
+
<para>
As shown in the previous section,
the table expression in the <command>SELECT</command> command
<sect2 id="queries-column-labels">
<title>Column Labels</title>
+ <indexterm zone="queries-column-labels">
+ <primary>label</primary>
+ <secondary>column</secondary>
+ </indexterm>
+
<para>
The entries in the select list can be assigned names for further
processing. The <quote>further processing</quote> in this case is
<sect2 id="queries-distinct">
<title>DISTINCT</title>
+ <indexterm zone="queries-distinct">
+ <primary>distinct</primary>
+ </indexterm>
+
<para>
After the select list has been processed, the result table may
optionally be subject to the elimination of duplicates. The
<sect1 id="queries-union">
<title>Combining Queries</title>
+ <indexterm zone="queries-union">
+ <primary>union</primary>
+ </indexterm>
+ <indexterm zone="queries-union">
+ <primary>intersection</primary>
+ </indexterm>
+ <indexterm zone="queries-union">
+ <primary>except</primary>
+ </indexterm>
+
<para>
The results of two queries can be combined using the set operations
union, intersection, and difference. The syntax is
<sect1 id="queries-order">
<title>Sorting Rows</title>
+
+ <indexterm zone="queries-order">
+ <primary>sorting</primary>
+ <secondary>query results</secondary>
+ </indexterm>
<para>
After a query has produced an output table (after the select list
<sect1 id="queries-limit">
<title>LIMIT and OFFSET</title>
+ <indexterm zone="queries-limit">
+ <primary>limit</primary>
+ </indexterm>
+
+ <indexterm zone="queries-limit">
+ <primary>offset</primary>
+ <secondary>with query results</secondary>
+ </indexterm>
+
<synopsis>
SELECT <replaceable>select_list</replaceable> FROM <replaceable>table_expression</replaceable> <optional>ORDER BY <replaceable>sort_spec</replaceable></optional> <optional>LIMIT { <replaceable>number</replaceable> | ALL }</optional> <optional>OFFSET <replaceable>number</replaceable></optional>
</synopsis>
<Chapter Id="rules">
<Title>The <ProductName>Postgres</ProductName> Rule System</Title>
+ <indexterm zone="rules">
+ <primary>rules</primary>
+ </indexterm>
+
<note>
<title>Author</title>
<para>
<!--
-$Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.65 2001/05/08 21:09:47 momjian Exp $
+$Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.66 2001/05/12 22:51:35 petere Exp $
-->
<Chapter Id="runtime">
<sect1 id="postgres-user">
<title>The Postgres user account</title>
+ <indexterm>
+ <primary>postgres user</primary>
+ </indexterm>
+
<para>
As with any other server daemon that is connected to the world at
large, it is advisable to run Postgres under a separate user
<sect1 id="creating-cluster">
<title>Creating a database cluster</title>
+ <indexterm>
+ <primary>database cluster</primary>
+ </indexterm>
+
+ <indexterm>
+ <primary>data area</primary>
+ <see>database cluster</see>
+ </indexterm>
+
<para>
Before you can do anything, you must initialize a database storage
area on disk. We call this a <firstterm>database
<tip>
<para>
+ <indexterm>
+ <primary><envar>PGDATA</envar></primary>
+ </indexterm>
As an alternative to the <option>-D</option> option, you can set
the environment variable <envar>PGDATA</envar>.
</para>
<title>Starting the database server</title>
<para>
+ <indexterm>
+ <primary>postmaster</primary>
+ </indexterm>
Before anyone can access the database you must start the database
server. The database server is called
<firstterm>postmaster</firstterm>.
</para>
<para>
+ <indexterm>
+ <primary>TCP/IP</primary>
+ </indexterm>
The postmaster also takes a number of other command line options.
For more information see the reference page and below under runtime
configuration. In particular, in order for the postmaster to accept
</para>
<para>
+ <indexterm>
+ <primary>pg_ctl</primary>
+ </indexterm>
This shell syntax can get tedious quickly. Therefore the shell
script wrapper <application>pg_ctl</application> is provided that
encapsulates some of the tasks. E.g.,
<sect1 id="runtime-config">
<Title>Run-time configuration</Title>
+ <indexterm>
+ <primary>configuration</primary>
+ <secondary>server</secondary>
+ </indexterm>
+
<para>
There are a lot of configuration parameters that affect the
behavior of the database system in some way or other. Here we
</para>
<para>
+ <indexterm>
+ <primary>SIGHUP</primary>
+ </indexterm>
The configuration file is reread whenever the postmaster receives
a SIGHUP signal. This signal is also propagated to all running
backend processes, so that running sessions get the new default.
</varlistentry>
<varlistentry>
+ <indexterm>
+ <primary>index scan</primary>
+ </indexterm>
+
<term>ENABLE_INDEXSCAN (<type>boolean</type>)</term>
<listitem>
<para>
</varlistentry>
<varlistentry>
+ <indexterm>
+ <primary>sequential scan</primary>
+ </indexterm>
+
<term>ENABLE_SEQSCAN (<type>boolean</type>)</term>
<listitem>
<para>
</varlistentry>
<varlistentry>
+ <indexterm>
+ <primary>genetic query optimization</primary>
+ </indexterm>
+ <indexterm>
+ <primary>GEQO</primary>
+ <see>genetic query optimization</see>
+ </indexterm>
+
<term>GEQO (<type>boolean</type>)</term>
<listitem>
<para>
<para>
<variablelist>
<varlistentry>
+ <indexterm>
+ <primary>deadlock</primary>
+ <secondary>timeout</secondary>
+ </indexterm>
+
<term>DEADLOCK_TIMEOUT (<type>integer</type>)</term>
<listitem>
<para>
</varlistentry>
<varlistentry>
+ <indexterm>
+ <primary>fsync</primary>
+ </indexterm>
+
<term>FSYNC (<type>boolean</type>)</term>
<listitem>
<para>
</varlistentry>
<varlistentry>
+ <indexterm>
+ <primary>SSL</primary>
+ </indexterm>
+
<term>SSL (<type>boolean</type>)</term>
<listitem>
<para>
<sect2 id="sysvipc">
<title>Shared Memory and Semaphores</title>
+ <indexterm zone="sysvipc">
+ <primary>shared memory</primary>
+ </indexterm>
+
+ <indexterm zone="sysvipc">
+ <primary>semaphores</primary>
+ </indexterm>
+
<para>
Shared memory and semaphores are collectively referred to as
<quote>System V IPC</> (together with message queues, which are
<para>
+ <indexterm><primary>SHMMAX</primary></indexterm>
The most important shared memory parameter is <varname>SHMMAX</>,
the maximum size, in bytes, that a shared memory segment can have.
If you get an error message from <function>shmget</> along the
<sect1 id="ssl-tcp">
<title>Secure TCP/IP Connections with SSL</title>
+ <indexterm zone="ssl-tcp">
+ <primary>SSL</primary>
+ </indexterm>
+
<para>
<productname>PostgreSQL</> has native support for connections over
<acronym>SSL</> to encrypt
<sect1 id="ssh-tunnels">
<title>Secure TCP/IP Connections with SSH tunnels</title>
+ <indexterm zone="ssh-tunnels">
+ <primary>ssh</primary>
+ </indexterm>
+
<note>
<title>Acknowledgement</title>
<para>
-<!-- $Header: /cvsroot/pgsql/doc/src/sgml/stylesheet.dsl,v 1.7 2001/03/10 16:05:35 petere Exp $ -->
+<!-- $Header: /cvsroot/pgsql/doc/src/sgml/stylesheet.dsl,v 1.8 2001/05/12 22:51:35 petere Exp $ -->
<!DOCTYPE style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN" [
<!-- must turn on one of these with -i on the jade command line -->
(define %html-header-tags%
(list (list "META" '("NAME" "creation") (list "CONTENT" (time->string (time) #t)))))
+(define html-index #t)
+
]]> <!-- %output-html -->
<![ %output-print; [
<!--
-$Header: /cvsroot/pgsql/doc/src/sgml/syntax.sgml,v 1.41 2001/02/25 16:05:21 petere Exp $
+$Header: /cvsroot/pgsql/doc/src/sgml/syntax.sgml,v 1.42 2001/05/12 22:51:35 petere Exp $
-->
<chapter id="sql-syntax">
<title>SQL Syntax</title>
+ <indexterm zone="sql-syntax">
+ <primary>syntax</primary>
+ <secondary>SQL</secondary>
+ </indexterm>
+
<abstract>
<para>
A description of the general syntax of SQL.
<sect2 id="sql-syntax-identifiers">
<title>Identifiers and Key Words</title>
+ <indexterm zone="sql-syntax-identifiers">
+ <primary>identifiers</primary>
+ </indexterm>
+
+ <indexterm zone="sql-syntax-identifiers">
+ <primary>key words</primary>
+ <secondary>syntax</secondary>
+ </indexterm>
+
<para>
Tokens such as <token>SELECT</token>, <token>UPDATE</token>, or
<token>VALUES</token> in the example above are examples of
</para>
<para>
+ <indexterm>
+ <primary>case sensitivity</primary>
+ <secondary>SQL commands</secondary>
+ </indexterm>
Identifier and key word names are case insensitive. Therefore
<programlisting>
UPDATE MY_TABLE SET A = 5;
</para>
<para>
+ <indexterm>
+ <primary>quotes</primary>
+ <secondary>and identifiers</secondary>
+ </indexterm>
There is a second kind of identifier: the <firstterm>delimited
identifier</firstterm> or <firstterm>quoted
identifier</firstterm>. It is formed by enclosing an arbitrary
<sect2 id="sql-syntax-constants">
<title>Constants</title>
+ <indexterm zone="sql-syntax-constants">
+ <primary>constants</primary>
+ </indexterm>
+
<para>
There are four kinds of <firstterm>implicitly typed
constants</firstterm> in <productname>Postgres</productname>:
<sect3 id="sql-syntax-strings">
<title>String Constants</title>
+ <indexterm zone="sql-syntax-strings">
+ <primary>character strings</primary>
+ <secondary>constants</secondary>
+ </indexterm>
+
<para>
+ <indexterm>
+ <primary>quotes</primary>
+ <secondary>escaping</secondary>
+ </indexterm>
A string constant in SQL is an arbitrary sequence of characters
bounded by single quotes (<quote>'</quote>), e.g., <literal>'This
is a string'</literal>. SQL allows single quotes to be embedded
<sect3 id="sql-syntax-bit-strings">
<title>Bit String Constants</title>
+ <indexterm zone="sql-syntax-bit-strings">
+ <primary>bit strings</primary>
+ <secondary>constants</secondary>
+ </indexterm>
+
<para>
Bit string constants look like string constants with a
<literal>B</literal> (upper or lower case) immediately before the
<sect3>
<title>Floating Point Constants</title>
+ <indexterm>
+ <primary>floating point</primary>
+ <secondary>constants</secondary>
+ </indexterm>
+
<para>
Floating point constants are accepted in these general forms:
<synopsis>
<sect3 id="sql-syntax-constants-generic">
<title>Constants of Other Types</title>
+ <indexterm>
+ <primary>data types</primary>
+ <secondary>constants</secondary>
+ </indexterm>
+
<para>
A constant of an <emphasis>arbitrary</emphasis> type can be
entered using any one of the following notations:
<sect3>
<title>Array constants</title>
+ <indexterm>
+ <primary>arrays</primary>
+ <secondary>constants</secondary>
+ </indexterm>
+
<para>
The general format of an array constant is the following:
<synopsis>
<sect2 id="sql-syntax-operators">
<title>Operators</title>
+ <indexterm zone="sql-syntax-operators">
+ <primary>operators</primary>
+ <secondary>syntax</secondary>
+ </indexterm>
+
<para>
An operator is a sequence of up to <symbol>NAMEDATALEN</symbol>-1
(31 by default) characters from the following list:
<sect2 id="sql-syntax-comments">
<title>Comments</title>
+ <indexterm zone="sql-syntax-comments">
+ <primary>comments</primary>
+ <secondary>in SQL</secondary>
+ </indexterm>
+
<para>
A comment is an arbitrary sequence of characters beginning with
double dashes and extending to the end of the line, e.g.:
is either a user-defined column of a given table or one of the
following system-defined columns:
+ <indexterm>
+ <primary>columns</primary>
+ <secondary>system columns</secondary>
+ </indexterm>
+
<variablelist>
<varlistentry>
<term>oid</term>
<listitem>
<para>
+ <indexterm>
+ <primary>OID</primary>
+ </indexterm>
The unique identifier (object ID) of a row. This is a serial number
that is added by Postgres to all rows automatically. OIDs are not
reused and are 32-bit quantities.
<sect2 id="syntax-aggregates">
<title>Aggregate Expressions</title>
+ <indexterm zone="syntax-aggregates">
+ <primary>aggregate functions</primary>
+ </indexterm>
+
<para>
An <firstterm>aggregate expression</firstterm> represents the
application of an aggregate function across the rows selected by a
<sect1 id="sql-precedence">
<title>Lexical Precedence</title>
+ <indexterm zone="sql-precedence">
+ <primary>operators</primary>
+ <secondary>precedence</secondary>
+ </indexterm>
+
<para>
The precedence and associativity of the operators is hard-wired
into the parser. Most operators have the same precedence and are
<!--
-$Header: /cvsroot/pgsql/doc/src/sgml/Attic/user.sgml,v 1.28 2001/02/04 15:28:18 petere Exp $
+$Header: /cvsroot/pgsql/doc/src/sgml/Attic/user.sgml,v 1.29 2001/05/12 22:51:36 petere Exp $
-->
<book id="user">
&biblio;
+ <![%single-book;[
+ &bookindex;
+ ]]>
+
</book>
<!-- Keep this comment at the end of the file
<!--
-$Header: /cvsroot/pgsql/doc/src/sgml/xaggr.sgml,v 1.11 2001/03/24 23:03:26 petere Exp $
+$Header: /cvsroot/pgsql/doc/src/sgml/xaggr.sgml,v 1.12 2001/05/12 22:51:36 petere Exp $
-->
<chapter id="xaggr">
<title>Extending <acronym>SQL</acronym>: Aggregates</title>
+ <indexterm zone="xaggr">
+ <primary>aggregate functions</primary>
+ <secondary>extending</secondary>
+ </indexterm>
+
<para>
Aggregate functions in <productname>Postgres</productname>
are expressed as <firstterm>state values</firstterm>
<chapter id="xtypes">
<title>Extending <acronym>SQL</acronym>: Types</title>
+
+ <indexterm zone="xtypes">
+ <primary>data types</primary>
+ <secondary>extending</secondary>
+ </indexterm>
+
<para>
As previously mentioned, there are two kinds of types
in <productname>Postgres</productname>: base types (defined in a programming language)