diff --git a/doc/src/sgml/Makefile b/doc/src/sgml/Makefile
index b3c95e697835ab8bb9ffcdae02c6dda68f4809a4..e60ef8156c73e5d15acfc68bbe34f7a6d12ce7fe 100644
--- a/doc/src/sgml/Makefile
+++ b/doc/src/sgml/Makefile
@@ -8,7 +8,7 @@
 #
 #
 # 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 $
 #
 #----------------------------------------------------------------------------
 
@@ -49,16 +49,9 @@ vpath %.sgml ./ref
 
 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
 
 
 ##
@@ -84,30 +77,44 @@ man: $(ALLSGML)
 ## 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 $<
@@ -134,7 +141,7 @@ $(addsuffix .tex, $(ALLBOOKS)): %.tex: %.sgml $(ALLSGML) stylesheet.dsl catalog
 ## 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 "|";\
@@ -171,10 +178,11 @@ check-postgres: postgres.sgml
 ##
 
 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
diff --git a/doc/src/sgml/admin.sgml b/doc/src/sgml/admin.sgml
index f4ae0b182d4ff31a5f8edbeca4ca805c42267daf..b79146cb99f7a9303d0e9218edb0cb20a66021b0 100644
--- a/doc/src/sgml/admin.sgml
+++ b/doc/src/sgml/admin.sgml
@@ -1,5 +1,5 @@
 <!--
-$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">
@@ -38,6 +38,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/Attic/admin.sgml,v 1.33 2001/02/04 15:28:18
 
 <![%single-book;[
   &biblio;
+  &bookindex;
 ]]>
 </book>
 
diff --git a/doc/src/sgml/array.sgml b/doc/src/sgml/array.sgml
index df89e84d926139e756eb5f1bc7cb619b5848464d..2fe8ea8be1fd6bd611802a81db1ce748f66e8bc7 100644
--- a/doc/src/sgml/array.sgml
+++ b/doc/src/sgml/array.sgml
@@ -1,8 +1,12 @@
-<!-- $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
diff --git a/doc/src/sgml/client-auth.sgml b/doc/src/sgml/client-auth.sgml
index 4fe4b256aa26a83b201ed92ea18c31a5469b5401..7ba2a36e2c126fbb9e63a6127ae9746f4334789c 100644
--- a/doc/src/sgml/client-auth.sgml
+++ b/doc/src/sgml/client-auth.sgml
@@ -1,8 +1,12 @@
-<!-- $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,
@@ -42,6 +46,10 @@
  <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.,
@@ -333,6 +341,11 @@ host         all        192.168.0.0    255.255.0.0        ident     omicron
 
   <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
@@ -402,6 +415,10 @@ host         all        192.168.0.0    255.255.0.0        ident     omicron
   <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
@@ -505,6 +522,10 @@ host         all        192.168.0.0    255.255.0.0        ident     omicron
   <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
@@ -550,6 +571,7 @@ host         all        192.168.0.0    255.255.0.0        ident     omicron
    </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>
diff --git a/doc/src/sgml/datatype.sgml b/doc/src/sgml/datatype.sgml
index 2687a4295f06e53a5af37a3e5c755e37b5d0dc67..93f733e50fd38dab93905927496a1b46a48773f3 100644
--- a/doc/src/sgml/datatype.sgml
+++ b/doc/src/sgml/datatype.sgml
@@ -1,10 +1,19 @@
 <!--
-$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.
@@ -256,6 +265,69 @@ $Header: /cvsroot/pgsql/doc/src/sgml/datatype.sgml,v 1.52 2001/03/24 23:03:26 pe
   <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
@@ -348,6 +420,20 @@ $Header: /cvsroot/pgsql/doc/src/sgml/datatype.sgml,v 1.52 2001/03/24 23:03:26 pe
    <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.
@@ -449,6 +535,21 @@ CREATE TABLE <replaceable class="parameter">tablename</replaceable> (<replaceabl
   <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>. 
@@ -680,6 +781,12 @@ CREATE TABLE <replaceable class="parameter">tablename</replaceable> (<replaceabl
 
     <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.
 
@@ -852,6 +959,11 @@ CREATE TABLE <replaceable class="parameter">tablename</replaceable> (<replaceabl
     <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>.
@@ -969,6 +1081,11 @@ CREATE TABLE <replaceable class="parameter">tablename</replaceable> (<replaceabl
     <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
@@ -1024,6 +1141,10 @@ January 8 04:05:06 1999 PST
     <sect3>
      <title>interval</title>
 
+     <indexterm>
+      <primary>interval</primary>
+     </indexterm>
+
       <para>
        <type>interval</type>s can be specified with the following syntax:
 
@@ -1047,6 +1168,16 @@ January 8 04:05:06 1999 PST
     <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>,
@@ -1118,6 +1249,18 @@ January 8 04:05:06 1999 PST
    <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
@@ -1235,6 +1378,10 @@ January 8 04:05:06 1999 PST
    <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.
@@ -1374,6 +1521,19 @@ January 8 04:05:06 1999 PST
   <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>.
@@ -1536,6 +1696,10 @@ SELECT * FROM test1 WHERE a;
    <sect2>
     <title>Point</title>
 
+    <indexterm>
+     <primary>point</primary>
+    </indexterm>
+
     <para>
      Points are the fundamental two-dimensional building block for geometric types.
     </para>
@@ -1575,6 +1739,10 @@ SELECT * FROM test1 WHERE a;
    <sect2>
     <title>Line Segment</title>
 
+    <indexterm>
+     <primary>line</primary>
+    </indexterm>
+
     <para>
      Line segments (<type>lseg</type>) are represented by pairs of points.
     </para>
@@ -1607,6 +1775,10 @@ SELECT * FROM test1 WHERE a;
    <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.
@@ -1648,6 +1820,10 @@ SELECT * FROM test1 WHERE a;
    <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",
@@ -1697,6 +1873,10 @@ SELECT * FROM test1 WHERE a;
    <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 
@@ -1736,6 +1916,10 @@ SELECT * FROM test1 WHERE a;
    <sect2>
     <title>Circle</title>
 
+    <indexterm>
+     <primary>circle</primary>
+    </indexterm>
+
     <para>
      Circles are represented by a center point and a radius.
     </para>
@@ -1783,6 +1967,11 @@ SELECT * FROM test1 WHERE a;
   <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
@@ -1836,6 +2025,10 @@ SELECT * FROM test1 WHERE a;
    <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.
@@ -1862,6 +2055,10 @@ SELECT * FROM test1 WHERE a;
    <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
@@ -1973,6 +2170,15 @@ SELECT * FROM test1 WHERE a;
    <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
@@ -1999,6 +2205,11 @@ SELECT * FROM test1 WHERE a;
   <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:
diff --git a/doc/src/sgml/datetime.sgml b/doc/src/sgml/datetime.sgml
index fa33fd7f4b9154fa222e15cdb2b1abd30b913a27..96db86f34d9c8d0716497a10de98c01a7aa3ccc5 100644
--- a/doc/src/sgml/datetime.sgml
+++ b/doc/src/sgml/datetime.sgml
@@ -1,5 +1,5 @@
 <!--
-$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
 -->
 
@@ -9,6 +9,10 @@ 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
diff --git a/doc/src/sgml/filelist.sgml b/doc/src/sgml/filelist.sgml
index 5881fb9183f6f68db95845cf78b57050cf7af268..06035e754b6de80ed4c0287655adf12afb2e7ee9 100644
--- a/doc/src/sgml/filelist.sgml
+++ b/doc/src/sgml/filelist.sgml
@@ -1,4 +1,4 @@
-<!-- $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">
@@ -7,6 +7,9 @@
 <!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">
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index a22d1eb8d23e2c0787fc21c3271aed8ec0f11c30..4f1abbd89fabbbd4651b29066c3f1a50fb9d9346 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -1,8 +1,16 @@
-<!-- $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
@@ -28,9 +36,35 @@
  <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>
@@ -130,6 +164,11 @@
  <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">
@@ -193,6 +232,9 @@
   </para>
 
   <para>
+   <indexterm>
+    <primary>between</primary>
+   </indexterm>
    In addition to the comparison operators, the special
    <token>BETWEEN</token> construct is available.
 <synopsis>
@@ -722,7 +764,13 @@
      <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>
@@ -730,7 +778,18 @@
      <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>
@@ -762,7 +821,12 @@
      <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>
@@ -997,6 +1061,10 @@
   <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>
@@ -1081,6 +1149,11 @@
   <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>
 
@@ -1386,6 +1459,10 @@
   <sect1 id="functions-formatting">
    <title>Formatting Functions</title>
 
+   <indexterm zone="functions-formatting">
+    <primary>formatting</primary>
+   </indexterm>
+
    <note>
     <title>Author</title>
     <para>
@@ -1749,10 +1826,9 @@
 
      <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>
 
@@ -2654,6 +2730,16 @@ SELECT date_trunc('year', TIMESTAMP '2001-02-16 20:38:40');
   <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:
@@ -3297,6 +3383,14 @@ Not defined by this name. Implements the intersection operator '#'
  <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>.
@@ -3420,6 +3514,10 @@ SELECT COALESCE(description, short_description, '(none)') ...
 
  <bridgehead renderas="sect2">NULLIF</bridgehead>
 
+  <indexterm>
+   <primary>nullif</primary>
+  </indexterm>
+
 <synopsis>
 <function>NULLIF</function>(<replaceable>value1</replaceable>, <replaceable>value2</replaceable>)
 </synopsis>
@@ -3481,6 +3579,11 @@ SELECT NULLIF(value, '(none)') ...
     </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
@@ -3542,6 +3645,10 @@ SELECT NULLIF(value, '(none)') ...
       <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
@@ -3589,6 +3696,9 @@ SELECT NULLIF(value, '(none)') ...
       <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
@@ -3616,6 +3726,9 @@ SELECT NULLIF(value, '(none)') ...
       <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>
diff --git a/doc/src/sgml/indices.sgml b/doc/src/sgml/indices.sgml
index 42cab244ab8a1af0c53b14f536f9337e58b81e28..fa04c3cd91d8ee44864133c93871703bb6659a5e 100644
--- a/doc/src/sgml/indices.sgml
+++ b/doc/src/sgml/indices.sgml
@@ -1,8 +1,17 @@
-<!-- $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
@@ -102,7 +111,16 @@ CREATE INDEX test1_id_index ON test1 (id);
   <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
@@ -119,6 +137,14 @@ CREATE INDEX test1_id_index ON test1 (id);
   </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>
@@ -142,6 +168,14 @@ CREATE INDEX <replaceable>name</replaceable> ON <replaceable>table</replaceable>
   </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
@@ -177,6 +211,11 @@ CREATE INDEX <replaceable>name</replaceable> ON <replaceable>table</replaceable>
  <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:
@@ -246,6 +285,11 @@ SELECT name FROM test2 WHERE major = <replaceable>constant</replaceable> OR mino
  <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.
@@ -276,6 +320,11 @@ CREATE UNIQUE INDEX <replaceable>name</replaceable> ON <replaceable>table</repla
  <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
@@ -540,6 +589,11 @@ CREATE MEMSTORE ON <replaceable>table</replaceable> COLUMNS <replaceable>cols</r
   <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>
diff --git a/doc/src/sgml/install-win32.sgml b/doc/src/sgml/install-win32.sgml
index 50522700aa3f7ce53b07b6abe237f481b357fe94..3282a2e21afff2b9c5f9d372fda6e4b220b234aa 100644
--- a/doc/src/sgml/install-win32.sgml
+++ b/doc/src/sgml/install-win32.sgml
@@ -1,6 +1,11 @@
 <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
diff --git a/doc/src/sgml/installation.sgml b/doc/src/sgml/installation.sgml
index b033f8cf799463db7e20a3cd4bb4885e23afab4f..86b1205cc7e451f1bf5023fe7fb040368d2fa52d 100644
--- a/doc/src/sgml/installation.sgml
+++ b/doc/src/sgml/installation.sgml
@@ -1,9 +1,13 @@
-<!-- $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>
 
@@ -42,6 +46,10 @@ su - postgres
    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.
@@ -71,6 +79,10 @@ su - postgres
     </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
@@ -83,6 +95,16 @@ su - postgres
     </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
@@ -98,6 +120,10 @@ su - postgres
     </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
@@ -151,6 +177,10 @@ su - postgres
  <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
@@ -175,6 +205,10 @@ su - postgres
    </step>
 
    <step>
+    <indexterm>
+     <primary>pg_dumpall</primary>
+    </indexterm>
+
     <para>
      To dump your database installation, type:
 <screen>
@@ -268,6 +302,11 @@ su - postgres
 
   <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.
@@ -659,6 +698,11 @@ su - postgres
       </varlistentry>
 
       <varlistentry>
+       <indexterm>
+        <primary>OpenSSL</primary>
+        <seealso>SSL</seealso>
+       </indexterm>
+
        <term>--with-openssl=<replaceable>DIRECTORY</></term>
        <listitem>
         <para>
@@ -776,6 +820,10 @@ All of PostgreSQL is successfully made. Ready to install.
   <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
@@ -892,6 +940,11 @@ All of PostgreSQL is successfully made. Ready to install.
 
   <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
@@ -954,6 +1007,11 @@ libpq.so.2.1: cannot open shared object file: No such file or directory
 
   <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
@@ -972,6 +1030,10 @@ set path = ( /usr/local/pgsql/bin path )
    </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:
diff --git a/doc/src/sgml/keywords.sgml b/doc/src/sgml/keywords.sgml
index 3ee3b93e39c70d968a35d5614878c175c6e1436f..3b1b2eab77dcc8c1830abdfb6a667c24de74ec64 100644
--- a/doc/src/sgml/keywords.sgml
+++ b/doc/src/sgml/keywords.sgml
@@ -1,6 +1,11 @@
 <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>
diff --git a/doc/src/sgml/libpgtcl.sgml b/doc/src/sgml/libpgtcl.sgml
index c57766cd4230cb1dc0c408f2155d4ab739688bda..04c1b4ffa6a3e5a6c8d3d0f9bec509978a4fc9ba 100644
--- a/doc/src/sgml/libpgtcl.sgml
+++ b/doc/src/sgml/libpgtcl.sgml
@@ -1,5 +1,13 @@
-<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 
diff --git a/doc/src/sgml/libpq.sgml b/doc/src/sgml/libpq.sgml
index 23d794288710a24d730a870f2061a19b24ef3eb8..ee971acd11fff79bf8f044f25798f0bef9ea52c1 100644
--- a/doc/src/sgml/libpq.sgml
+++ b/doc/src/sgml/libpq.sgml
@@ -1,10 +1,14 @@
 <!--
-$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
@@ -1563,6 +1567,11 @@ if any notifications came in during the processing of the query.
 <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>.
@@ -1839,6 +1848,10 @@ routines like <function>PQgetvalue</function>.
 <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
@@ -1849,6 +1862,9 @@ application programs.
 <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
@@ -1857,6 +1873,9 @@ directory in which the socket file is stored (default "/tmp").
 </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.
@@ -1864,18 +1883,27 @@ socket file extension for communicating with the
 </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>
@@ -1957,6 +1985,11 @@ for information on correct values for these environment variables.
 <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
diff --git a/doc/src/sgml/mvcc.sgml b/doc/src/sgml/mvcc.sgml
index ee7778807a35e221b89089cebd3d2117677ee6d3..79567996d221f25f70c3e023d839c4827283610f 100644
--- a/doc/src/sgml/mvcc.sgml
+++ b/doc/src/sgml/mvcc.sgml
@@ -1,10 +1,14 @@
 <!--
-$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
@@ -55,6 +59,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/mvcc.sgml,v 2.13 2001/04/20 15:52:33 thomas
      <varlistentry>
       <term>
        dirty reads
+       <indexterm><primary>dirty reads</primary></indexterm>
       </term>
      <listitem>
       <para>
@@ -66,6 +71,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/mvcc.sgml,v 2.13 2001/04/20 15:52:33 thomas
      <varlistentry>
       <term>
        non-repeatable reads
+       <indexterm><primary>non-repeatable reads</primary></indexterm>
       </term>
      <listitem>
       <para>
@@ -79,6 +85,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/mvcc.sgml,v 2.13 2001/04/20 15:52:33 thomas
      <varlistentry>
       <term>
        phantom read
+       <indexterm><primary>phantom reads</primary></indexterm>
       </term>
      <listitem>
       <para>
@@ -92,6 +99,9 @@ $Header: /cvsroot/pgsql/doc/src/sgml/mvcc.sgml,v 2.13 2001/04/20 15:52:33 thomas
    </para>
 
    <para>
+    <indexterm>
+     <primary>isolation levels</primary>
+    </indexterm>
     The four isolation levels and the corresponding behaviors are described below.
 
     <table tocentry="1">
@@ -188,6 +198,11 @@ $Header: /cvsroot/pgsql/doc/src/sgml/mvcc.sgml,v 2.13 2001/04/20 15:52:33 thomas
   <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>. 
@@ -234,6 +249,11 @@ $Header: /cvsroot/pgsql/doc/src/sgml/mvcc.sgml,v 2.13 2001/04/20 15:52:33 thomas
   <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,
@@ -350,6 +370,10 @@ ERROR:  Can't serialize access due to concurrent update
   <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
diff --git a/doc/src/sgml/odbc.sgml b/doc/src/sgml/odbc.sgml
index fb732c70b7db56580927f48faad996c993bbb955..b15227f76ce3e7a45db3c3695b5900aefc5809e1 100644
--- a/doc/src/sgml/odbc.sgml
+++ b/doc/src/sgml/odbc.sgml
@@ -1,5 +1,5 @@
 <!--
-$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">
@@ -19,6 +19,10 @@ $Header: /cvsroot/pgsql/doc/src/sgml/Attic/odbc.sgml,v 1.21 2001/01/20 20:59:28
 
   <title>ODBC Interface</title>
 
+  <indexterm zone="odbc">
+   <primary>ODBC</primary>
+  </indexterm>
+
   <note>
    <para>
     Background information originally by Tim Goeke
@@ -80,8 +84,9 @@ $Header: /cvsroot/pgsql/doc/src/sgml/Attic/odbc.sgml,v 1.21 2001/01/20 20:59:28
     (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
@@ -296,6 +301,10 @@ InstallDir = /opt/applix/axdata/axshlib
   <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
diff --git a/doc/src/sgml/plperl.sgml b/doc/src/sgml/plperl.sgml
index 72dd215fcfc740a2471bda4ccfeff6c8ae59df01..dc4765f3957f9b602c13d16ade85066790a2dcaf 100644
--- a/doc/src/sgml/plperl.sgml
+++ b/doc/src/sgml/plperl.sgml
@@ -1,10 +1,18 @@
 <!--
-$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
@@ -29,8 +37,10 @@ $Header: /cvsroot/pgsql/doc/src/sgml/plperl.sgml,v 2.7 2000/12/22 18:57:50 peter
    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
diff --git a/doc/src/sgml/plsql.sgml b/doc/src/sgml/plsql.sgml
index 4e1314c8b9876474f178ed75e02ad428b1135668..559ba4aad1aba00007d28d2ecddb2a8e0101eadf 100644
--- a/doc/src/sgml/plsql.sgml
+++ b/doc/src/sgml/plsql.sgml
@@ -1,10 +1,14 @@
 <!--
-$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.
@@ -1690,6 +1694,14 @@ CREATE FUNCTION c_overpaid (EMP, integer) RETURNS boolean AS '
 
   <title>Porting from Oracle PL/SQL</title>
 
+  <indexterm>
+   <primary>Oracle</primary>
+  </indexterm>
+
+  <indexterm>
+   <primary>PL/SQL</primary>
+  </indexterm>
+
   <note>
    <title>Author</title>
    <para>
diff --git a/doc/src/sgml/pltcl.sgml b/doc/src/sgml/pltcl.sgml
index 7d7ceb33792ffefd9e7d0b0c2a7afb98a49174b3..4f57beb25f371e9b59368afde85e96f831c2fc1d 100644
--- a/doc/src/sgml/pltcl.sgml
+++ b/doc/src/sgml/pltcl.sgml
@@ -1,10 +1,18 @@
 <!--
-$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
@@ -161,6 +169,11 @@ CREATE FUNCTION overpaid_2 (EMP) RETURNS bool AS '
    <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
@@ -328,6 +341,9 @@ CREATE TRIGGER trig_mytab_modcount BEFORE INSERT OR UPDATE ON mytab
     <variablelist>
 
      <varlistentry>
+      <indexterm>
+       <primary>elog</primary>
+      </indexterm>
       <term>elog <replaceable>level</replaceable> <replaceable>msg</replaceable></term>
       <listitem>
        <para>
diff --git a/doc/src/sgml/postgres.sgml b/doc/src/sgml/postgres.sgml
index 22d8bec6de3ead35fbeebf8f7242fd013827d187..a37f3e9dc819dfb50b11f3770f80f79eda2ad928 100644
--- a/doc/src/sgml/postgres.sgml
+++ b/doc/src/sgml/postgres.sgml
@@ -1,5 +1,5 @@
 <!--
-$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" [
@@ -35,6 +35,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/postgres.sgml,v 1.45 2001/02/03 19:03:27 pe
  &programmer;
  &reference;
  &developer; 
+ &setindex;
 
 </set>
 
diff --git a/doc/src/sgml/programmer.sgml b/doc/src/sgml/programmer.sgml
index f4013a52132e4d90badc533ce75155eecb064862..52456c058389dd77cff51de74b5e017794753253 100644
--- a/doc/src/sgml/programmer.sgml
+++ b/doc/src/sgml/programmer.sgml
@@ -1,5 +1,5 @@
 <!--
-$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.
 -->
@@ -63,18 +63,8 @@ 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">
@@ -89,6 +79,7 @@ Disable it until we put in some info.
 
 <![%single-book;[
  &biblio;
+ &bookindex;
 ]]>
 
 </book>
diff --git a/doc/src/sgml/queries.sgml b/doc/src/sgml/queries.sgml
index 28aeccf96f9e2040596cd5f61fa19a2cb89f8c1a..7f16eb7af9d54de008b6d2251da6c1cae529129b 100644
--- a/doc/src/sgml/queries.sgml
+++ b/doc/src/sgml/queries.sgml
@@ -1,4 +1,4 @@
-<!-- $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>
@@ -102,6 +102,10 @@ FROM <replaceable>table_reference</replaceable> <optional>, <replaceable>table_r
    <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
@@ -115,6 +119,10 @@ FROM <replaceable>table_reference</replaceable> <optional>, <replaceable>table_r
       <term>CROSS JOIN</term>
 
       <listitem>
+       <indexterm>
+        <primary>joins</primary>
+	<secondary>cross</secondary>
+       </indexterm>
 <synopsis>
 <replaceable>T1</replaceable> CROSS JOIN <replaceable>T2</replaceable>
 </synopsis>
@@ -145,6 +153,11 @@ FROM <replaceable>table_reference</replaceable> <optional>, <replaceable>table_r
       <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> )
@@ -187,6 +200,10 @@ FROM <replaceable>table_reference</replaceable> <optional>, <replaceable>table_r
        </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
@@ -213,6 +230,11 @@ FROM <replaceable>table_reference</replaceable> <optional>, <replaceable>table_r
          <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
@@ -268,6 +290,10 @@ FROM <replaceable>table_reference</replaceable> <optional>, <replaceable>table_r
    <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
@@ -289,6 +315,16 @@ FROM (SELECT * FROM table1) AS alias_name
    <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
@@ -400,6 +436,10 @@ FROM (SELECT * FROM T1) DT1, T2, T3
   <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>
@@ -482,6 +522,10 @@ FROM FDT WHERE
   <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
@@ -578,6 +622,11 @@ SELECT pid    AS "Products",
  <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
@@ -620,6 +669,11 @@ SELECT tbl1.a, tbl2.b, tbl1.c FROM ...
   <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
@@ -652,6 +706,10 @@ SELECT a AS value, b + c AS sum FROM ...
   <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
@@ -700,6 +758,16 @@ SELECT DISTINCT ON (<replaceable>expression</replaceable> <optional>, <replaceab
  <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
@@ -756,6 +824,11 @@ SELECT DISTINCT ON (<replaceable>expression</replaceable> <optional>, <replaceab
 
  <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
@@ -817,6 +890,15 @@ SELECT a AS b FROM table1 ORDER BY a;
  <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>
diff --git a/doc/src/sgml/rules.sgml b/doc/src/sgml/rules.sgml
index 87802323c257362441de2f0847f40486bbfb0aca..6f3ac48573472bd39c59bb7a3aa92e1e24f022ae 100644
--- a/doc/src/sgml/rules.sgml
+++ b/doc/src/sgml/rules.sgml
@@ -1,6 +1,10 @@
 <Chapter Id="rules">
 <Title>The <ProductName>Postgres</ProductName> Rule System</Title>
 
+ <indexterm zone="rules">
+  <primary>rules</primary>
+ </indexterm>
+
    <note>
     <title>Author</title>
     <para>
diff --git a/doc/src/sgml/runtime.sgml b/doc/src/sgml/runtime.sgml
index e0f23001108aec9ca2e6b082573c47be1c07fc54..bc7a86dba1def93d415e554cd6aaea0c437a5878 100644
--- a/doc/src/sgml/runtime.sgml
+++ b/doc/src/sgml/runtime.sgml
@@ -1,5 +1,5 @@
 <!--
-$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">
@@ -13,6 +13,10 @@ $Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.65 2001/05/08 21:09:47 mom
  <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
@@ -36,6 +40,15 @@ $Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.65 2001/05/08 21:09:47 mom
  <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
@@ -70,6 +83,9 @@ $Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.65 2001/05/08 21:09:47 mom
 
   <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>
@@ -129,6 +145,9 @@ NOTICE:  Initializing database with en_US collation order.
   <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>.
@@ -157,6 +176,9 @@ NOTICE:  Initializing database with en_US collation order.
   </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
@@ -165,6 +187,9 @@ NOTICE:  Initializing database with en_US collation order.
   </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.,
@@ -410,6 +435,11 @@ connectDBstart() -- connect() failed: No such file or directory
   <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
@@ -445,6 +475,9 @@ syslog = 2
    </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.
@@ -549,6 +582,10 @@ env PGOPTIONS='-c geqo=off' psql
      </varlistentry>
 
      <varlistentry>
+      <indexterm>
+       <primary>index scan</primary>
+      </indexterm>
+
       <term>ENABLE_INDEXSCAN (<type>boolean</type>)</term>
       <listitem>
        <para>
@@ -585,6 +622,10 @@ env PGOPTIONS='-c geqo=off' psql
      </varlistentry>
 
      <varlistentry>
+      <indexterm>
+       <primary>sequential scan</primary>
+      </indexterm>
+
       <term>ENABLE_SEQSCAN (<type>boolean</type>)</term>
       <listitem>
        <para>
@@ -623,6 +664,14 @@ env PGOPTIONS='-c geqo=off' psql
      </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>
@@ -919,6 +968,11 @@ env PGOPTIONS='-c geqo=off' psql
    <para>
     <variablelist>
      <varlistentry>
+      <indexterm>
+       <primary>deadlock</primary>
+       <secondary>timeout</secondary>
+      </indexterm>
+
       <term>DEADLOCK_TIMEOUT (<type>integer</type>)</term>
       <listitem>
        <para>
@@ -943,6 +997,10 @@ env PGOPTIONS='-c geqo=off' psql
      </varlistentry>
 
      <varlistentry>
+      <indexterm>
+       <primary>fsync</primary>
+      </indexterm>
+
       <term>FSYNC (<type>boolean</type>)</term>
       <listitem>
        <para>
@@ -1101,6 +1159,10 @@ env PGOPTIONS='-c geqo=off' psql
      </varlistentry>
 
      <varlistentry>
+      <indexterm>
+       <primary>SSL</primary>
+      </indexterm>
+
       <term>SSL (<type>boolean</type>)</term>
       <listitem>
        <para>
@@ -1431,6 +1493,14 @@ env PGOPTIONS='-c geqo=off' psql
   <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
@@ -1544,6 +1614,7 @@ env PGOPTIONS='-c geqo=off' psql
 
 
    <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
@@ -2015,6 +2086,10 @@ default:\
  <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
@@ -2078,6 +2153,10 @@ cp cert.cert <replaceable>$PGDATA</replaceable>/server.crt
  <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>
diff --git a/doc/src/sgml/stylesheet.dsl b/doc/src/sgml/stylesheet.dsl
index 7574b57e2fbfa9c0e3afde51a90b7a3dfc9cf2bb..ead1cac25a03a09ebc7369b25bd1e12586bba262 100644
--- a/doc/src/sgml/stylesheet.dsl
+++ b/doc/src/sgml/stylesheet.dsl
@@ -1,4 +1,4 @@
-<!-- $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 -->
@@ -58,6 +58,8 @@
 (define %html-header-tags% 
   (list (list "META" '("NAME" "creation") (list "CONTENT" (time->string (time) #t)))))
 
+(define html-index #t)
+
 ]]> <!-- %output-html -->
 
 <![ %output-print; [
diff --git a/doc/src/sgml/syntax.sgml b/doc/src/sgml/syntax.sgml
index 1e95caa637c17570ea95a99f183ccb6bf7d88612..9234e3c26d4e586c1f2d4cd2e8259b331cfaaa27 100644
--- a/doc/src/sgml/syntax.sgml
+++ b/doc/src/sgml/syntax.sgml
@@ -1,10 +1,15 @@
 <!--
-$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.
@@ -70,6 +75,15 @@ INSERT INTO MY_TABLE VALUES (3, 'hi there');
   <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
@@ -107,6 +121,10 @@ INSERT INTO MY_TABLE VALUES (3, 'hi there');
    </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;
@@ -123,6 +141,10 @@ 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
@@ -173,6 +195,10 @@ UPDATE "my_table" SET "a" = 5;
   <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>:
@@ -186,7 +212,16 @@ UPDATE "my_table" SET "a" = 5;
    <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
@@ -237,6 +272,11 @@ SELECT 'foo'      'bar';
    <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
@@ -264,6 +304,11 @@ SELECT 'foo'      'bar';
    <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>
@@ -309,6 +354,11 @@ REAL '1.23'  -- string style
    <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:
@@ -351,6 +401,11 @@ CAST ( '<replaceable>string</replaceable>' AS <replaceable>type</replaceable> )
    <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>
@@ -390,6 +445,11 @@ CAST ( '<replaceable>string</replaceable>' AS <replaceable>type</replaceable> )
   <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:
@@ -524,6 +584,11 @@ CAST ( '<replaceable>string</replaceable>' AS <replaceable>type</replaceable> )
   <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.:
@@ -562,11 +627,19 @@ CAST ( '<replaceable>string</replaceable>' AS <replaceable>type</replaceable> )
      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.
@@ -841,6 +914,10 @@ sqrt(2)
   <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
@@ -896,6 +973,11 @@ sqrt(2)
   <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
diff --git a/doc/src/sgml/user.sgml b/doc/src/sgml/user.sgml
index 7a4f8a3caa1bb8816a8c65aef59249a50cd78792..f8da13ded6ff18dc921df6eb464b33926678e8e3 100644
--- a/doc/src/sgml/user.sgml
+++ b/doc/src/sgml/user.sgml
@@ -1,5 +1,5 @@
 <!--
-$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">
@@ -34,6 +34,10 @@ $Header: /cvsroot/pgsql/doc/src/sgml/Attic/user.sgml,v 1.28 2001/02/04 15:28:18
 
  &biblio;
 
+ <![%single-book;[
+ &bookindex;
+ ]]>
+
 </book>
 
 <!-- Keep this comment at the end of the file
diff --git a/doc/src/sgml/xaggr.sgml b/doc/src/sgml/xaggr.sgml
index cd9cea2fc5453db6cbb421a2ebbe83fff4b4b17b..9451d536b4c2d981f454694a0069332835aeb3f2 100644
--- a/doc/src/sgml/xaggr.sgml
+++ b/doc/src/sgml/xaggr.sgml
@@ -1,10 +1,15 @@
 <!--
-$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>
diff --git a/doc/src/sgml/xtypes.sgml b/doc/src/sgml/xtypes.sgml
index 943b14f82eb3d051f3741c0e79309139f4615774..65407e50a9db5e40dcdbb3bb404c806bfdd0f6c6 100644
--- a/doc/src/sgml/xtypes.sgml
+++ b/doc/src/sgml/xtypes.sgml
@@ -1,5 +1,11 @@
  <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)