of Norm's Modular Style Sheets and jade/docbook.
From Vince Vielhaber <vev@michvhf.com>.
<Para>
<ProductName>PostgreSQL</ProductName> is available without cost. This manual
describes version 6.4 of <ProductName>PostgreSQL</ProductName>.
-
+</Para>
<Para>
We will use <ProductName>Postgres</ProductName>
to mean the version distributed as <ProductName>PostgreSQL</ProductName>.
-
+</Para>
<Para>
Check the Administrator's Guide for a list of currently supported machines.
In general,
<ProductName>Postgres</ProductName> is portable to any Unix/Posix-compatible system
with full libc library support.
-
+</Para>
</Sect1>
|Mariposa | 1953 |
+----------+----------+
</ProgramListing>
+</Para>
<Para>
On the other hand, to find the names of all cities,
sub-values that can be accessed from the query
language. For example, you can create attributes that
are arrays of base types.
+</Para>
<Sect2>
<Title>Arrays</Title>
+-------------------+
</ProgramListing>
</Para>
-
+</sect2>
</Sect1>
<Sect1>
|Mariposa | 1320 |
+---------+------------+
</ProgramListing>
+</Para>
<Para>
The default beginning of a time range is the earliest
the current time; thus, the above time range can be
abbreviated as ``[,].''
</Para>
+</sect1>
<Sect1>
<Title>More Advanced Features</Title>
<ProductName>Postgres</ProductName> has many features not touched upon in this
tutorial introduction, which has been oriented toward newer users of <Acronym>SQL</Acronym>.
These are discussed in more detail in both the User's and Programmer's Guides.
+</Para>
+</sect1>
</Chapter>
</Para>
</ListItem>
</ItemizedList>
+</Para>
<Para>
A single <Application>postmaster</Application> manages a given collection of
case, all files relating to a database should belong to
this <ProductName>Postgres</ProductName> superuser.
</Para>
-
+</sect1>
</Chapter>
</Para>
</ListItem>
</ItemizedList>
-
+</para>
<Para>
A single <Application>postmaster</Application> manages a given collection of
databases on a single host. Such a collection of
case, all files relating to a database should belong to
this <ProductName>Postgres</ProductName> superuser.
</Para>
-
+</sect1>
</Chapter>
In database jargon, <ProductName>Postgres</ProductName> uses a simple "process
per-user" client/server model. A <ProductName>Postgres</ProductName> session
consists of the following cooperating UNIX processes (programs):
+</Para>
<ItemizedList>
<ListItem>
<Application>postmaster</Application>. Hence, the <Application>postmaster</Application> is always running, waiting
for requests, whereas frontend and backend processes
come and go.
+</Para>
<Para>
The <FileName>libpq</FileName> library allows a single
machine may not be accessible (or may only be accessed
using a different filename) on the database server
machine.
+</Para>
<Para>
You should also be aware that the <Application>postmaster</Application> and
case, all files relating to a database should belong to
this <ProductName>Postgres</ProductName> superuser.
</Para>
-
+</sect1>
</Chapter>
<!--
-$Header: /cvsroot/pgsql/doc/src/sgml/bki.sgml,v 1.1 1998/08/15 06:49:33 thomas Exp $
+$Header: /cvsroot/pgsql/doc/src/sgml/bki.sgml,v 1.2 1998/12/29 02:24:13 thomas Exp $
Transcribed from the original bki.man.5 documentation
- Thomas Lockhart 1998-08-03
<application>genbki</application>
input that builds tables and C header files that describe those
tables.
+</para>
<para>
Related information may be found in documentation for
<application>initdb</application>,
<application>createdb</application>,
and the <acronym>SQL</acronym> command <command>CREATE DATABASE</command>.
+</para>
<sect1>
<title><acronym>BKI</acronym> File Format</title>
at hand as an example. (As explained above, this .source file isn't quite
a <acronym>BKI</acronym> file, but you'll be able to guess what the resulting <acronym>BKI</acronym> file would be
anyway).
+</para>
<para>
Commands are composed of a command name followed by space separated
interpreted as the name of a macro causing the argument to be replaced
with the macro's value. It is an error for this macro to be
undefined.
+</para>
<para>
Macros are defined using
undefine macro macro_name
</programlisting>
and redefined using the same syntax as define.
+</para>
<para>
Lists of general commands and macro commands
follow.
+</para>
+</sect1>
<sect1>
<title>General Commands</title>
Open the class called
<replaceable class="parameter">classname</replaceable>
for further manipulation.
+</para>
+</listitem>
+</varlistentry>
<varlistentry>
<term>
is not already opened. If no
<replaceable class="parameter">classname</replaceable>
is given, then the currently open class is closed.
+</para>
+</listitem>
+</varlistentry>
<varlistentry>
<term>
<listitem>
<para>
Print the currently open class.
+</para>
+</listitem>
+</varlistentry>
<varlistentry>
<term>
<replaceable class="parameter">oid_value</replaceable>
is not <quote>0</quote>, then this value will be used as the instance's
object identifier. Otherwise, it is an error.
+</para>
+</listitem>
+</varlistentry>
<varlistentry>
<term>
<listitem>
<para>
As above, but the system generates a unique object identifier.
+</para>
+</listitem>
+</varlistentry>
<varlistentry>
<term>
Create a class named
<replaceable class="parameter">classname</replaceable>
with the attributes given in parentheses.
+</para>
+</listitem>
+</varlistentry>
<varlistentry>
<term>
<replaceable class="parameter">classname</replaceable>
for writing but do not record its existence in the system catalogs.
(This is primarily to aid in bootstrapping.)
+</para>
+</listitem>
+</varlistentry>
<varlistentry>
<term>
<para>
Destroy the class named
<replaceable class="parameter">classname</replaceable>.
+</para>
+</listitem>
+</varlistentry>
<varlistentry>
<term>
<replaceable class="parameter">collection_1</replaceable>,
<replaceable class="parameter">collection_2</replaceable>
etc., respectively.
-
+</para>
+</listitem>
</varlistentry>
+
</variablelist>
<note>
<para>
This last sentence doesn't reference anything in the example. Should be changed to make sense. - Thomas 1998-08-04
+</para>
</note>
+</sect1>
<sect1>
<title>Macro Commands</title>
with the arguments
<replaceable class="parameter">args</replaceable>
declared in a C-like manner.
+</para>
+</listitem>
+</varlistentry>
<varlistentry>
<term>
which has its value
read from the file called
<replaceable class="parameter">filename</replaceable>.
-
+</para>
+</listitem>
</varlistentry>
+
</variablelist>
+</para>
+</sect1>
<sect1>
<title>Debugging Commands</title>
<note>
<para>
This section on debugging commands was commented-out in the original documentation. Thomas 1998-08-05
+</para>
</note>
<variablelist>
<listitem>
<para>
Randomly print the open class.
+</para>
+</listitem>
+</varlistentry>
<varlistentry>
<term>
<listitem>
<para>
Toggle display of time information.
+</para>
+</listitem>
+</varlistentry>
<varlistentry>
<term>
<listitem>
<para>
Set retrievals to now.
+</para>
+</listitem>
+</varlistentry>
<varlistentry>
<term>
<listitem>
<para>
Set retrievals to snapshots of the specfied time.
+</para>
+</listitem>
+</varlistentry>
<varlistentry>
<term>
Set retrievals to ranges of the specified times.
Either time may be replaced with space
if an unbounded time range is desired.
+</para>
+</listitem>
+</varlistentry>
<varlistentry>
<term>
<replaceable class="parameter">type2</replaceable>,
etc. to the class
<replaceable class="parameter">classname</replaceable>.
+</para>
+</listitem>
+</varlistentry>
<varlistentry>
<term>
<replaceable class="parameter">oldclassname</replaceable>
class to
<replaceable class="parameter">newclassname</replaceable>.
+</para>
+</listitem>
+</varlistentry>
<varlistentry>
<term>
<replaceable class="parameter">classname</replaceable>
to
<replaceable class="parameter">newattname</replaceable>.
-
+</para>
+</listitem>
</varlistentry>
</variablelist>
+</para>
+</sect1>
<sect1>
<title>Example</title>
print
close pg_opclass
</programlisting>
-
+</para>
+</sect1>
</chapter>
Contributed by <ULink url="mailto:geek+@cmu.edu">Brian Gallew</ULink>
</Para>
</Note>
+</para>
<Para>
Configuring gcc to use certain flags by default is a simple matter of
"*<Replaceable>section_name</Replaceable>:" (e.g. "*asm:").
The second line is a list of flags,
and the third line is blank.
+</para>
<Para>
The easiest change to make is to append
</ProgramListing>
This will always omit frame pointers, any will build 486-optimized
code unless -m386 is specified on the command line.
+</para>
<Para>
You can actually do quite a lot of customization with the specs file.
Always remember, however, that these changes are global, and affect
all users of the system.
+</para>
</Chapter>
<chapter id="config">
<title id="install-config">Configuration Options</title>
-<sect1>
-<title>Parameters for Configuration (<application>configure</application>)</title>
-
-<para>
-The full set of parameters available in <application>configure</application>
-can be obtained by typing
-
-<programlisting>
-$ ./configure --help
-</programlisting>
-
-<para>
-The following parameters may be of interest to installers:
-
-<programlisting>
+ <sect1>
+ <title>Parameters for Configuration (<application>configure</application>)</title>
+
+ <para>
+ The full set of parameters available in <application>configure</application>
+ can be obtained by typing
+
+ <programlisting>
+ $ ./configure --help
+ </programlisting>
+ </para>
+ <para>
+ The following parameters may be of interest to installers:
+
+ <programlisting>
Directory and file names:
--prefix=PREFIX install architecture-independent files in PREFIX
[/usr/local/pgsql]
--enable-cassert enable assertion checks (debugging)
--with-CC=<replaceable>compiler</replaceable> use specific C compiler
--with-CXX=<replaceable>compiler</replaceable> use specific C++ compiler
-</programlisting>
-
-<para>
-Some systems may have trouble building a specific feature of
-<productname>Postgres</productname>. For example, systems with a damaged
-C++ compiler may need to specify <option>--without-CXX</option> to encourage
-the build procedure to ignore the <filename>libpq++</filename> construction.
-
-<sect1>
-<title>Parameters for Building (<application>make</application>)</title>
-
-<para>
-Many installation-related parameters can be set in the building
-stage of <productname>Postgres</productname> installation.
-
-<para>
-In most cases, these parameters should be place in a file,
-<filename>Makefile.custom</filename>, intended just for that purpose.
-The default distribution does not contain this optional file, so you
-will create it using a text editor of your choice. When upgrading installations,
-you can simply copy your old Makefile.custom to the new installation before
-doing the build.
-
-<synopsis>
-make [ <replaceable>variable</replaceable>=<replaceable class="parameter">value</replaceable> [,...] ]
-</synopsis>
-
-<para>
-A few of the many variables which can be specified are:
-
-<variablelist>
-<varlistentry>
-<term>
-<envar>POSTGRESDIR</envar>
-
-<listitem>
-<para>
-Top of the installation tree.
-
-<varlistentry>
-<term>
-<envar>BINDIR</envar>
-
-<listitem>
-<para>
-Location of applications and utilities.
-
-<varlistentry>
-<term>
-<envar>LIBDIR</envar>
-
-<listitem>
-<para>
-Location of object libraries, including shared libraries.
-
-<varlistentry>
-<term>
-<envar>HEADERDIR</envar>
-
-<listitem>
-<para>
-Location of include files.
-
-<varlistentry>
-<term>
-<envar>ODBCINST</envar>
-
-<listitem>
-<para>
-Location of installation-wide <application>psqlODBC</application>
-(<acronym>ODBC</acronym>) configuration file.
-
-</variablelist>
-
-<para>
-There are other optional parameters which are not as commonly used.
-Many of those listed below are appropriate when doing
-<application>Postgres</application> server code development.
-
-<variablelist>
-<varlistentry>
-<term>
-<envar>CFLAGS</envar>
-
-<listitem>
-<para>
-Set flags for the C compiler.
-Should be assigned with "+=" to retain relevant default parameters.
-
-<varlistentry>
-<term>
-YFLAGS
-
-<listitem>
-<para>
-Set flags for the yacc/bison parser. <option>-v</option> might be
-used to help diagnose problems building a new parser.
-Should be assigned with "+=" to retain relevant default parameters.
-
-<varlistentry>
-<term>
-<envar>USE_TCL</envar>
-
-<listitem>
-<para>
-Enable Tcl interface building.
-
-<varlistentry>
-<term>
-<envar>HSTYLE</envar>
-
-<listitem>
-<para>
-DocBook <acronym>HTML</acronym> style sheets for building the
-documentation from scratch.
-Not used unless you are developing new documentation from the
-DocBook-compatible <acronym>SGML</acronym> source documents in
-<filename>doc/src/sgml/</filename>.
-
-<varlistentry>
-<term>
-<envar>PSTYLE</envar>
-
-<listitem>
-<para>
-DocBook style sheets for building printed documentation from scratch.
-Not used unless you are developing new documentation from the
-DocBook-compatible <acronym>SGML</acronym> source documents in
-<filename>doc/src/sgml/</filename>.
-
-</variablelist>
-
-<para>
-Here is an example <filename>Makefile.custom</filename> for a
-PentiumPro Linux system:
-
-<programlisting>
+ </programlisting>
+ </para>
+ <para>
+ Some systems may have trouble building a specific feature of
+ <productname>Postgres</productname>. For example, systems with a damaged
+ C++ compiler may need to specify <option>--without-CXX</option> to encourage
+ the build procedure to ignore the <filename>libpq++</filename> construction.
+ </para>
+ </sect1>
+ <sect1>
+ <title>Parameters for Building (<application>make</application>)</title>
+
+ <para>
+ Many installation-related parameters can be set in the building
+ stage of <productname>Postgres</productname> installation.
+ </para>
+ <para>
+ In most cases, these parameters should be place in a file,
+ <filename>Makefile.custom</filename>, intended just for that purpose.
+ The default distribution does not contain this optional file, so you
+ will create it using a text editor of your choice. When upgrading installations,
+ you can simply copy your old Makefile.custom to the new installation before
+ doing the build.
+
+ <synopsis>
+ make [ <replaceable>variable</replaceable>=<replaceable class="parameter">value</replaceable> [,...] ]
+ </synopsis>
+ </para>
+ <para>
+ A few of the many variables which can be specified are:
+
+ <variablelist>
+ <varlistentry>
+ <term>
+ <envar>POSTGRESDIR</envar>
+ </term>
+ <listitem>
+ <para>
+ Top of the installation tree.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>
+ <envar>BINDIR</envar>
+ </term>
+ <listitem>
+ <para>
+ Location of applications and utilities.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>
+ <envar>LIBDIR</envar>
+ </term>
+ <listitem>
+ <para>
+ Location of object libraries, including shared libraries.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>
+ <envar>HEADERDIR</envar>
+ </term>
+ <listitem>
+ <para>
+ Location of include files.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>
+ <envar>ODBCINST</envar>
+ </term>
+ <listitem>
+ <para>
+ Location of installation-wide <application>psqlODBC</application>
+ (<acronym>ODBC</acronym>) configuration file.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+ </para>
+ <para>
+ There are other optional parameters which are not as commonly used.
+ Many of those listed below are appropriate when doing
+ <application>Postgres</application> server code development.
+
+ <variablelist>
+ <varlistentry>
+ <term>
+ <envar>CFLAGS</envar>
+ </term>
+ <listitem>
+ <para>
+ Set flags for the C compiler.
+ Should be assigned with "+=" to retain relevant default parameters.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>
+ YFLAGS
+ </term>
+ <listitem>
+ <para>
+ Set flags for the yacc/bison parser. <option>-v</option> might be
+ used to help diagnose problems building a new parser.
+ Should be assigned with "+=" to retain relevant default parameters.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>
+ <envar>USE_TCL</envar>
+ </term>
+ <listitem>
+ <para>
+ Enable Tcl interface building.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>
+ <envar>HSTYLE</envar>
+ </term>
+ <listitem>
+ <para>
+ DocBook <acronym>HTML</acronym> style sheets for building the
+ documentation from scratch.
+ Not used unless you are developing new documentation from the
+ DocBook-compatible <acronym>SGML</acronym> source documents in
+ <filename>doc/src/sgml/</filename>.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>
+ <envar>PSTYLE</envar>
+ </term>
+ <listitem>
+ <para>
+ DocBook style sheets for building printed documentation from scratch.
+ Not used unless you are developing new documentation from the
+ DocBook-compatible <acronym>SGML</acronym> source documents in
+ <filename>doc/src/sgml/</filename>.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+ </para>
+ <para>
+ Here is an example <filename>Makefile.custom</filename> for a
+ PentiumPro Linux system:
+
+ <programlisting>
# Makefile.custom
# Thomas Lockhart 1998-03-01
HSTYLE= /home/tgl/SGML/db118.d/docbook/html
PSTYLE= /home/tgl/SGML/db118.d/docbook/print
-</programlisting>
-
-<Sect1>
-<Title>Locale Support</Title>
-
-<Para>
-<Note>
-<Para>
-Written by Oleg Bartunov.
-See <ULink url="http://www.sai.msu.su/~megera/postgres/">Oleg's web page</ULink>
- for additional information on locale and Russian language support.
-
-</Para>
-</Note>
-While doing a project for a company in Moscow, Russia,
-I encountered the problem that postgresql had no
-support of national alphabets. After looking for possible workarounds
-I decided to develop support of locale myself.
-I'm not a C-programer but already had some experience with locale programming
-when I work with perl
-(debugging) and glimpse. After several days of digging through
- the <ProductName>Postgres</ProductName> source tree I made very minor corections to
-src/backend/utils/adt/varlena.c and src/backend/main/main.c and got what I needed!
-I did support only for
-<envar>LC_CTYPE</envar> and <envar>LC_COLLATE</envar>,
-but later <envar>LC_MONETARY</envar> was added by others. I got many
-messages from people about this patch so I decided to send it to developers
-and (to my surprise) it was
-incorporated into the <productname>Postgres</productname> distribution.
-
-<Para>
- People often complain that locale doesn't work for them.
-There are several common mistakes:
-
-<ItemizedList>
-<ListItem>
-<Para>
- Didn't properly configure postgresql before compilation.
- You must run configure with --enable-locale option to enable locale support.
- Didn't setup environment correctly when starting postmaster.
- You must define environment variables
-<envar>LC_CTYPE</envar> and <envar>LC_COLLATE</envar>
-before running postmaster
- because backend gets information about locale from environment.
-I use following shell script
- (runpostgres):
-
-<ProgramListing>
- #!/bin/sh
-
- export LC_CTYPE=koi8-r
- export LC_COLLATE=koi8-r
- postmaster -B 1024 -S -D/usr/local/pgsql/data/ -o '-Fe'
-</ProgramListing>
-
- and run it from rc.local as
-
-<ProgramListing>
- /bin/su - postgres -c "/home/postgres/runpostgres"
-</ProgramListing>
-
-</Para>
-</ListItem>
-<ListItem>
-<Para>
- Broken locale support in OS (for example, locale support in libc
-under Linux several times has changed
- and this caused a lot of problems). Latest perl has also support of
-locale and if locale is broken <command>perl -v</command> will
- complain something like:
-
-<programlisting>
- 8:17[mira]:~/WWW/postgres>setenv LC_CTYPE not_exist
- 8:18[mira]:~/WWW/postgres>perl -v
- perl: warning: Setting locale failed.
- perl: warning: Please check that your locale settings:
- LC_ALL = (unset),
- LC_CTYPE = "not_exist",
- LANG = (unset)
- are supported and installed on your system.
- perl: warning: Falling back to the standard locale ("C").
-</programlisting>
-
-</Para>
-</ListItem>
-<ListItem>
-<Para>
- Wrong location of locale files!
-
- Possible locations include:
-<filename>/usr/lib/locale</filename>
-(Linux, Solaris), <filename>/usr/share/locale</filename> (Linux),
-<filename>/usr/lib/nls/loc</filename> (DUX 4.0).
-
- Check <command>man locale</command> to find the correct location.
-Under Linux I did a symbolic link between <filename>/usr/lib/locale</filename> and
- <filename>/usr/share/locale</filename> to be sure that
-the next libc will not break my locale.
-</Para>
-</ListItem>
-</ItemizedList>
-
-<Sect2>
-<Title>What are the Benefits?</Title>
-
-<Para>
-You can use ~* and order by operators for strings contain characters
-from national alphabets. Non-english users
-definitely need that. If you won't use locale stuff just undefine
-the USE_LOCALE variable.
-
-<Sect2>
-<Title>What are the Drawbacks?</Title>
-
-<Para>
-There is one evident drawback of using locale - it's speed!
-So, use locale only if you really need it.
-
-
-<Sect1>
-<Title>Kerberos Authentication</Title>
-
-<Para>
-<productname>Kerberos</productname> is an industry-standard secure authentication
-system suitable for distributed computing over a public network.
-
-<sect2>
-<title>Availability</title>
-
-<para>
-The
-<productname>Kerberos</productname>
-authentication system is not distributed with <Productname>Postgres</Productname>. Versions of
-<productname>Kerberos</productname>
-are typically available as optional software from operating system
-vendors. In addition, a source code distribution may be obtained through
-<ulink url="ftp://athena-dist.mit.edu">MIT Project Athena</ulink>.
-
-<note>
-<para>
-You may wish to obtain the MIT version even if your
-vendor provides a version, since some vendor ports have been
-deliberately crippled or rendered non-interoperable with the MIT
-version.
-</note>
-Users located outside the United States of America and
-Canada are warned that distribution of the actual encryption code in
-<productname>Kerberos</productname>
-is restricted by U. S. Government export regulations.
-
-<para>
-Inquiries regarding your <productname>Kerberos</productname>
-should be directed to your vendor or
-<ulink url="info-kerberos@athena.mit.edu">MIT Project Athena</ulink>.
-Note that <acronym>FAQL</acronym>s
-(Frequently-Asked Questions Lists) are periodically posted to the
-<ulink url="mailto:kerberos@ATHENA.MIT.EDU"><productname>Kerberos</productname> mailing list</ulink>
-(send
-<ulink url="mailto:kerberos-request@ATHENA.MIT.EDU">mail to subscribe</ulink>),
-and
-<ulink url="news:comp.protocols.kerberos">USENET news group</ulink>.
-
-<sect2>
-<title>Installation</title>
-
-<para>
-Installation of
-<productname>Kerberos</productname>
-itself is covered in detail in the
-<citetitle>Kerberos Installation Notes</citetitle> .
-Make sure that the server key file (the <filename>srvtab</filename>
-or <filename>keytab</filename>)
-is somehow readable by the <productname>Postgres</productname> account.
-
-<para>
-<Productname>Postgres</Productname> and its clients can be compiled to use
-either Version 4 or Version 5 of the MIT
-<productname>Kerberos</productname>
-protocols by setting the
-<envar>KRBVERS</envar>
-variable in the file <filename>src/Makefile.global</filename> to the
-appropriate value. You can also change the location where
- <Productname>Postgres</Productname>
-expects to find the associated libraries, header files and its own
-server key file.
-
-<para>
-After compilation is complete, <Productname>Postgres</Productname>
- must be registered as a <productname>Kerberos</productname>
-service. See the
-<citetitle>Kerberos Operations Notes</citetitle>
-and related manual pages for more details on registering services.
-
-<sect2>
-<title>Operation</title>
-
-<para>
-After initial installation, <Productname>Postgres</Productname>
-should operate in all ways as a normal
-<productname>Kerberos</productname>
-service. For details on the use of authentication, see the
-<citetitle>PostgreSQL User's Guide</citetitle> reference sections
-for <application>postmaster</application>
-and <application>psql</application>.
-
-<para>
-In the
-<productname>Kerberos</productname>
-Version 5 hooks, the following assumptions are made about user
-and service naming:
-
-<itemizedlist>
-<listitem>
-<para>
-User principal names (anames) are assumed to
-contain the actual Unix/<Productname>Postgres</Productname> user name
- in the first component.
-
-<listitem>
-<para>
-The <Productname>Postgres</Productname> service is assumed to be have two components,
- the service name and a hostname, canonicalized as in Version 4 (i.e., with all domain
-suffixes removed).
-
-</itemizedlist>
-
-<para>
-<table tocentry="1">
-<title>Kerberos Parameter Examples</title>
-<titleabbrev>Kerberos</titleabbrev>
-
-<tgroup cols="2">
-<thead>
-<row>
-<entry>
-Parameter
-</entry>
-<entry>
-Example
-</entry>
-
-<tbody>
-<row>
-<entry>
-user
-</entry>
-<entry>
-frew@S2K.ORG
-</entry>
-
-<row>
-<entry>
-user
-</entry>
-<entry>
-aoki/HOST=miyu.S2K.Berkeley.EDU@S2K.ORG
-</entry>
-
-<row>
-<entry>
-host
-</entry>
-<entry>
-postgres_dbms/ucbvax@S2K.ORG
-</entry>
-</tbody>
-</tgroup>
-</table>
-
-<para>
-Support for Version 4 will disappear sometime after the production
-release of Version 5 by MIT.
+ </programlisting>
+ </para>
+ </sect1>
+ <Sect1>
+ <Title>Locale Support</Title>
+
+ <Para>
+ <Note>
+ <Para>
+ Written by Oleg Bartunov.
+ See <ULink url="http://www.sai.msu.su/~megera/postgres/">Oleg's web page</ULink>
+ for additional information on locale and Russian language support.
+
+ </Para>
+ </Note>
+ While doing a project for a company in Moscow, Russia,
+ I encountered the problem that postgresql had no
+ support of national alphabets. After looking for possible workarounds
+ I decided to develop support of locale myself.
+ I'm not a C-programer but already had some experience with locale programming
+ when I work with perl
+ (debugging) and glimpse. After several days of digging through
+ the <ProductName>Postgres</ProductName> source tree I made very minor corections to
+ src/backend/utils/adt/varlena.c and src/backend/main/main.c and got what I needed!
+ I did support only for
+ <envar>LC_CTYPE</envar> and <envar>LC_COLLATE</envar>,
+ but later <envar>LC_MONETARY</envar> was added by others. I got many
+ messages from people about this patch so I decided to send it to developers
+ and (to my surprise) it was
+ incorporated into the <productname>Postgres</productname> distribution.
+ </para>
+ <Para>
+ People often complain that locale doesn't work for them.
+ There are several common mistakes:
+
+ <ItemizedList>
+ <ListItem>
+ <Para>
+ Didn't properly configure postgresql before compilation.
+ You must run configure with --enable-locale option to enable locale support.
+ Didn't setup environment correctly when starting postmaster.
+ You must define environment variables
+ <envar>LC_CTYPE</envar> and <envar>LC_COLLATE</envar>
+ before running postmaster
+ because backend gets information about locale from environment.
+ I use following shell script
+ (runpostgres):
+
+ <ProgramListing>
+ #!/bin/sh
+
+ export LC_CTYPE=koi8-r
+ export LC_COLLATE=koi8-r
+ postmaster -B 1024 -S -D/usr/local/pgsql/data/ -o '-Fe'
+ </ProgramListing>
+
+ and run it from rc.local as
+
+ <ProgramListing>
+ /bin/su - postgres -c "/home/postgres/runpostgres"
+ </ProgramListing>
+
+ </Para>
+ </ListItem>
+ <ListItem>
+ <Para>
+ Broken locale support in OS (for example, locale support in libc
+ under Linux several times has changed
+ and this caused a lot of problems). Latest perl has also support of
+ locale and if locale is broken <command>perl -v</command> will
+ complain something like:
+
+ <programlisting>
+ 8:17[mira]:~/WWW/postgres>setenv LC_CTYPE not_exist
+ 8:18[mira]:~/WWW/postgres>perl -v
+ perl: warning: Setting locale failed.
+ perl: warning: Please check that your locale settings:
+ LC_ALL = (unset),
+ LC_CTYPE = "not_exist",
+ LANG = (unset)
+ are supported and installed on your system.
+ perl: warning: Falling back to the standard locale ("C").
+ </programlisting>
+
+ </Para>
+ </ListItem>
+ <ListItem>
+ <Para>
+ Wrong location of locale files!
+
+ Possible locations include:
+ <filename>/usr/lib/locale</filename>
+ (Linux, Solaris), <filename>/usr/share/locale</filename> (Linux),
+ <filename>/usr/lib/nls/loc</filename> (DUX 4.0).
+
+ Check <command>man locale</command> to find the correct location.
+ Under Linux I did a symbolic link between <filename>/usr/lib/locale</filename> and
+ <filename>/usr/share/locale</filename> to be sure that
+ the next libc will not break my locale.
+ </Para>
+ </ListItem>
+ </ItemizedList>
+ </para>
+
+ <Sect2>
+ <Title>What are the Benefits?</Title>
+
+ <Para>
+ You can use ~* and order by operators for strings contain characters
+ from national alphabets. Non-english users
+ definitely need that. If you won't use locale stuff just undefine
+ the USE_LOCALE variable.
+ </para>
+ </sect2>
+
+ <Sect2>
+ <Title>What are the Drawbacks?</Title>
+
+ <Para>
+ There is one evident drawback of using locale - it's speed!
+ So, use locale only if you really need it.
+ </para>
+ </sect2>
+ </sect1>
+
+ <Sect1>
+ <Title>Kerberos Authentication</Title>
+
+ <Para>
+ <productname>Kerberos</productname> is an industry-standard secure authentication
+ system suitable for distributed computing over a public network.
+ </para>
+
+ <sect2>
+ <title>Availability</title>
+
+ <para>
+ The
+ <productname>Kerberos</productname>
+ authentication system is not distributed with <Productname>Postgres</Productname>. Versions of
+ <productname>Kerberos</productname>
+ are typically available as optional software from operating system
+ vendors. In addition, a source code distribution may be obtained through
+ <ulink url="ftp://athena-dist.mit.edu">MIT Project Athena</ulink>.
+ </para>
+ <note>
+ <para>
+ You may wish to obtain the MIT version even if your
+ vendor provides a version, since some vendor ports have been
+ deliberately crippled or rendered non-interoperable with the MIT
+ version.
+ </para>
+ </note>
+ <para>
+ Users located outside the United States of America and
+ Canada are warned that distribution of the actual encryption code in
+ <productname>Kerberos</productname>
+ is restricted by U. S. Government export regulations.
+ </para>
+ <para>
+ Inquiries regarding your <productname>Kerberos</productname>
+ should be directed to your vendor or
+ <ulink url="info-kerberos@athena.mit.edu">MIT Project Athena</ulink>.
+ Note that <acronym>FAQL</acronym>s
+ (Frequently-Asked Questions Lists) are periodically posted to the
+ <ulink url="mailto:kerberos@ATHENA.MIT.EDU"><productname>Kerberos</productname> mailing list</ulink>
+ (send
+ <ulink url="mailto:kerberos-request@ATHENA.MIT.EDU">mail to subscribe</ulink>),
+ and
+ <ulink url="news:comp.protocols.kerberos">USENET news group</ulink>.
+ </para>
+ </sect2>
+
+ <sect2>
+ <title>Installation</title>
+
+ <para>
+ Installation of
+ <productname>Kerberos</productname>
+ itself is covered in detail in the
+ <citetitle>Kerberos Installation Notes</citetitle> .
+ Make sure that the server key file (the <filename>srvtab</filename>
+ or <filename>keytab</filename>)
+ is somehow readable by the <productname>Postgres</productname> account.
+ </para>
+ <para>
+ <Productname>Postgres</Productname> and its clients can be compiled to use
+ either Version 4 or Version 5 of the MIT
+ <productname>Kerberos</productname>
+ protocols by setting the
+ <envar>KRBVERS</envar>
+ variable in the file <filename>src/Makefile.global</filename> to the
+ appropriate value. You can also change the location where
+ <Productname>Postgres</Productname>
+ expects to find the associated libraries, header files and its own
+ server key file.
+ </para>
+ <para>
+ After compilation is complete, <Productname>Postgres</Productname>
+ must be registered as a <productname>Kerberos</productname>
+ service. See the
+ <citetitle>Kerberos Operations Notes</citetitle>
+ and related manual pages for more details on registering services.
+ </para>
+ </sect2>
+
+ <sect2>
+ <title>Operation</title>
+
+ <para>
+ After initial installation, <Productname>Postgres</Productname>
+ should operate in all ways as a normal
+ <productname>Kerberos</productname>
+ service. For details on the use of authentication, see the
+ <citetitle>PostgreSQL User's Guide</citetitle> reference sections
+ for <application>postmaster</application>
+ and <application>psql</application>.
+ </para>
+ <para>
+ In the
+ <productname>Kerberos</productname>
+ Version 5 hooks, the following assumptions are made about user
+ and service naming:
+
+ <itemizedlist>
+ <listitem>
+ <para>
+ User principal names (anames) are assumed to
+ contain the actual Unix/<Productname>Postgres</Productname> user name
+ in the first component.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ The <Productname>Postgres</Productname> service is assumed to be have two components,
+ the service name and a hostname, canonicalized as in Version 4 (i.e., with all domain
+ suffixes removed).
+ </para>
+ </listitem>
+
+ </itemizedlist>
+ </para>
+ <para>
+ <table tocentry="1">
+ <title>Kerberos Parameter Examples</title>
+ <titleabbrev>Kerberos</titleabbrev>
+
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>
+ Parameter
+ </entry>
+ <entry>
+ Example
+ </entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>
+ user
+ </entry>
+ <entry>
+ frew@S2K.ORG
+ </entry>
+ </row>
+ <row>
+ <entry>
+ user
+ </entry>
+ <entry>
+ aoki/HOST=miyu.S2K.Berkeley.EDU@S2K.ORG
+ </entry>
+ </row>
+ <row>
+ <entry>
+ host
+ </entry>
+ <entry>
+ postgres_dbms/ucbvax@S2K.ORG
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </para>
+ <para>
+ Support for Version 4 will disappear sometime after the production
+ release of Version 5 by MIT.
+ </para>
+ </sect2>
+ </sect1>
+</chapter>
Views and rules are now functional thanks to extensive new code in the
rewrite rules system from Jan Wieck. He also wrote a chapter on it
for the <citetitle>Programmer's Guide</citetitle>.
-
+</para>
+</listitem>
<listitem>
<para>
Jan also contributed a second procedural language, PL/pgSQL, to go with the
original PL/pgTCL procedural language he contributed last release.
+</para>
+</listitem>
<listitem>
<para>
We have optional multiple-byte character set support from Tatsuo Iishi
to complement our existing locale support.
+</para>
+</listitem>
<listitem>
<para>
Client/server communications has been cleaned up, with better support for
asynchronous messages and interrupts thanks to Tom Lane.
+</para>
+</listitem>
<listitem>
<para>
the type extensibility features of <productname>Postgres</productname>.
There is a new chapter in the <citetitle>User's Guide</citetitle>
which covers this topic.
+</para>
+</listitem>
<listitem>
<para>
in the <citetitle>User's Guide</citetitle> for details.
A fourth type, <type>serial</type>, is now supported by the parser as an
amalgam of the <type>int4</type> type, a sequence, and a unique index.
+</para>
+</listitem>
<listitem>
<para>
Several more <acronym>SQL92</acronym>-compatible syntax features have been
added, including <command>INSERT DEFAULT VALUES</command>
+</para>
+</listitem>
<listitem>
<para>
The automatic configuration and installation system has received some
attention, and should be more robust for more platforms than it has ever
been.
+</para>
+</listitem>
</itemizedlist>
-
+</para>
<sect2>
<title>Migration to v6.4</title>
or <application>pg_dumpall</application>
is required for those wishing to migrate data from any
previous release of <productname>Postgres</productname>.
-
-
+</para>
+</sect2>
<sect2>
<title>Detailed Change List</title>
new Makefile.shlib for shared library configuration(Tom)
</programlisting>
</Para>
-
+</sect2>
</Sect1>
postprocessed a bit before it can be loaded into <ProductName>Postgres</ProductName>. We
hope that the large increase in speed and reliability will
make up for the slight decrease in convenience.
-<Para>
+</para>
</Tip>
- You should expect to read (and reread, and re-reread) the
+</para>
+<para>
+ You should expect to read (and reread, and re-reread) the
manual pages for the C compiler, cc(1), and the link
editor, ld(1), if you have specific questions. In
addition, the regression test suites in the directory
</Para>
</ListItem>
</ItemizedList>
+</para>
<Sect1>
<Title><Acronym>ULTRIX</Acronym></Title>
<!--
-$Header: /cvsroot/pgsql/doc/src/sgml/docguide.sgml,v 1.12 1998/12/18 16:17:29 thomas Exp $
+$Header: /cvsroot/pgsql/doc/src/sgml/docguide.sgml,v 1.13 1998/12/29 02:24:14 thomas Exp $
Documentation Guide
Thomas Lockhart
$Log: docguide.sgml,v $
+Revision 1.13 1998/12/29 02:24:14 thomas
+Clean up to ensure tag completion as required by the newest versions
+ of Norm's Modular Style Sheets and jade/docbook.
+From Vince Vielhaber <vev@michvhf.com>.
+
Revision 1.12 1998/12/18 16:17:29 thomas
Include more details on editing with Emacs.
Remove mention of the old "migration" flat files.
It should be able to answer
common questions and to allow a user to find those answers on his own
without resorting to mailing list support.
+</para>
<sect1>
<title>Documentation Roadmap</title>
<acronym>man pages</acronym>, for quick reference.
</para></listitem>
</itemizedlist>
+</para>
<para>
<table tocentry="1">
</tbody>
</tgroup>
</table>
+</para>
<para>
There are man pages available for installation, as well as a large number
of plain-text README-type files throughout the <productname>Postgres</productname>
source tree.
+</para>
+</sect1>
<sect1>
<title>The Documentation Project</title>
<productname>Postgres</productname> installation. We discuss here
working with the documentation sources and generating documentation
packages.
+</para>
<para>
The purpose of <productname>DocBook</productname> <acronym>SGML</acronym>
final form (e.g. using Norm Walsh's
<productname>Modular Style Sheets</productname>).</para>
+
<para>
See <ulink url="http://nis-www.lanl.gov/~rosalia/mydocs/docbook-intro.html">
Introduction to DocBook</ulink> for a nice "quickstart" summary of
<ulink url="http://www.ora.com/homepages/dtdparse/docbook/3.0/"> DocBook Elements</ulink>
provides a powerful cross-reference for features of
<productname>DocBook</productname>.
+</para>
<para>
This documentation set is constructed using several tools, including
<ulink url="http://www.jclark.com/jade/"> <productname>jade</productname></ulink>
and Norm Walsh's
<ulink url="http://www.berkshire.net/~norm/docbook/dsssl">Modular DocBook Stylesheets</ulink>.
+</para>
<para>
Currently, hardcopy is produced by importing <firstterm>Rich Text
<productname>ApplixWare</productname> for minor formatting fixups then
exporting as a Postscript file.</para>
+
<para>
<ulink url="http://sunsite.unc.edu/pub/packages/TeX/systems/unix/">
<productname>TeX</productname></ulink> is a supported format for
support in the <productname>TeX</productname>
stylesheets.</para>
+</sect1>
+
<sect1>
<title>Documentation Sources</title>
<ulink url="http://www.ora.com/davenport/"> <productname>DocBook</productname></ulink>
<firstterm>Document Type Definition</firstterm> (<acronym>DTD</acronym>).
Much of the existing documentation has been or will be converted to <acronym>SGML</acronym>.
+</para>
<para>
The purpose of <acronym>SGML</acronym> is to allow an author to
<productname>DocBook</productname> <acronym>DTD</acronym>), and to
have the document style define how that content is rendered into a
final form (e.g. using Norm Walsh's stylesheets).
+</para>
<para>
Documentation has accumulated from several sources. As we integrate
distribution. However, this will not happen immediately, and will not
happen to all documents at the same time. To ease the transition, and
to help guide developers and writers, we have defined a transition roadmap.
+</para>
<para>
Here is the documentation plan for v6.5:
<listitem>
<para>
Start compiling index information for the User's and Administrator's Guides.
+</para>
+</listitem>
<listitem>
<para>
Write more sections for the User's Guide covering areas outside the reference pages.
This would include introductory information and suggestions for approaches to typical
design problems.
+</para>
+</listitem>
<listitem>
<para>
Merge information in the existing man pages into the reference pages and User's Guide.
Condense the man pages down to reminder information, with references into the
primary doc set.
+</para>
+</listitem>
<listitem>
<para>
Convert the new sgml reference pages to new man pages, replacing the existing man pages.
+</para>
+</listitem>
<listitem>
<para>
Convert all source graphics to CGM format files for portability. Currently we mostly have
Applix Graphics sources from which we can generate .gif output. One graphic is only
available in .gif and .ps, and should be redrawn or removed.
+</para>
+</listitem>
</itemizedlist>
+</para>
<sect2>
<title>Document Structure</title>
</listitem>
</varlistentry>
</variablelist>
+</para>
<!--
Disable for the hardcopy production release.
Too much tabular info and not very helpful in hardcopy.
- thomas 1998-10-27
-->
+</sect2>
<sect2>
<title>Documentation Files</title>
</tbody>
</tgroup>
</table>
+</para>
+</sect2>
<sect2>
<title>Document Conversion</title>
</tbody>
</tgroup>
</table>
-
+</para>
+</sect2>
<sect2>
<title>Styles and Conventions</title>
</table>
</para>
-->
+</sect2>
<sect2>
<title>SGML Authoring Tools</title>
The current <acronym>Postgres</acronym> documentation set was written using
a plain text editor (or emacs/psgml; see below) with the content marked up using
<acronym>SGML</acronym> DocBook tags.
+</para>
<para>
<acronym>SGML</acronym> and <productname>DocBook</productname> do not suffer
from an oversupply of open-source authoring tools. The most common toolset is
the emacs/xemacs editing package with the psgml feature extension.
On some systems (e.g. RedHat Linux) these tools are provided in a typical full installation.
+</para>
<sect3>
<title>emacs/psgml</title>
an <acronym>SGML</acronym> <firstterm>major mode</firstterm>. When properly configured,
this will allow you to use <application>emacs</application> to insert tags and
check markup consistancy.
+</para>
<para>
Put the following in your <filename>~/.emacs</filename> environment file:
sgml-local-catalogs:"/usr/lib/sgml/catalog"
sgml-local-ecat-files:nil
End:
---<sgmltag>
+--</sgmltag>
</programlisting>
+</para>
<para>
The <productname>Postgres</productname> distribution includes a
parsed DTD definitions file <filename>reference.ced</filename>.
You may find that
+</para>
<para>
When using <application>emacs</application>/psgml, a comfortable way of working with
This means that anything and everything that reads <acronym>SGML</acronym> will get it
right, and I can verify the document with "nsgmls -s docguide.sgml".
+</para>
</sect3>
</sect2>
<filename>/usr/share/lib/sgml/</filename>,
or
<filename>/usr/local/lib/sgml/</filename>.
+</para>
<para>
<acronym>HTML</acronym> documentation packages can be generated from the <acronym>SGML</acronym> source by
importing into <productname>ApplixWare-4.4.1</productname>.
After a little cleanup (see the following
section) the output is "printed" to a postscript file.
+</para>
<para>
Some figures were redrawn to avoid having bitmap
these tools. <productname>FreeBSD</productname> seems to have them
available. Please report package status to the docs mailing list and
we will include that information here.
+</para>
<sect2>
<title><acronym>RPM</acronym> installation on
installing the software you'll need to edit DocBook source with Emacs
and process it with Norman Walsh's DSSSL style sheets to create <acronym>HTML</acronym>
and <acronym>RTF</acronym>.
+</para>
<para>
These instructions do not cover new <application>jade</application>/DocBook
<ulink url="http://www.sgmltools.org/"><productname>sgml-tools</productname></ulink>
package. The authors have not tried this package since it adopted DocBook,
but it is almost certainly a good candidate for use.
+</para>
<sect3><title>Prerequisites</title>
<listitem><para><ulink url="http://www.sil.org/sgml/publicSW.html">
Robin Cover's database of <acronym>SGML</acronym> software</ulink></para></listitem>
</itemizedlist>
+</para>
</sect3>
<sect3>
<title>Installing Jade</title>
-<para>
<procedure>
<title>Installing Jade</title>
<para>
Read the installation instructions at the above listed
URL.
+</para>
+</step>
<step performance="required">
<para>
unzip -aU jade1_1.zip
</programlisting>
</para>
+</step>
<step performance="required">
<para><productname>Jade</productname> is not built using
<command>ranlib</command> command, leave them as they are in the
<filename>Makefile</filename>.
</para>
+</step>
<step performance="required">
<para>Type <command>make</command> to build Jade and the various
<productname>SP</productname> tools.</para>
+</step>
<step performance="required">
<para>Once the software is built, <command>make install</command> will
do the obvious.</para>
-
+</step>
</procedure>
+</sect3>
<sect3>
<title>Installing the <productname>DocBook</productname> <acronym>DTD</acronym> Kit</title>
-<para>
<procedure>
<title>Installing the <productname>DocBook</productname> <acronym>DTD</acronym> Kit</title>
<programlisting>
CATALOG /usr/local/share/sgml/CATALOG
</programlisting>
+</para>
+</step>
<step performance="required">
<para>
PUBLIC "-//Davenport//ELEMENTS DocBook Document Hierarchy V3.0//EN" dbhier.mod
PUBLIC "-//Davenport//ENTITIES DocBook Additional General Entities V3.0//EN" dbgenent.mod
</programlisting>
+</para>
+</step>
<step performance="required">
<para>
named <filename>ISO</filename>. Again, proper catalog entries should
accompany the entity kit you fetch.
</para>
+</step>
</procedure>
+</sect3>
<sect3>
<title>Installing Norman Walsh's <acronym>DSSSL</acronym> Style Sheets</title>
-<para>
<procedure>
<title>Installing Norman Walsh's <acronym>DSSSL</acronym> Style Sheets</title>
<step performance="required">
<para>Read the installation instructions at the above listed
URL.</para>
+</step>
<step performance="required">
<para>To install Norman's style sheets, simply unzip the distribution
unzip -aU db119.zip
</programlisting>
</para>
+</step>
<step performance="required">
<para>One way to test the installation is to build the
<acronym>HTML</acronym> and <acronym>RTF</acronym> forms of the
<citetitle><productname>PostgreSQL</productname> User's Guide</citetitle>.
+</para>
<substeps>
<programlisting>
jade -t sgml -d /usr/local/share/docbook/html/docbook.dsl -D ../graphics postgres.sgml
</programlisting>
+</para>
<para>
<filename>book1.htm</filename> is the top level node of the output..
+</para>
+</step>
<step performance="required">
<para>
<programlisting>
jade -t rtf -d /usr/local/share/docbook/print/docbook.dsl -D ../graphics postgres.sgml
</programlisting>
+</para>
+</step>
</substeps>
+</step>
</procedure>
+</sect3>
<sect3>
<title>Installing <productname>PSGML</productname></title>
-<para>
<procedure>
<title>Installing <productname>PSGML</productname></title>
<step performance="required">
<para>Read the installation instructions at the above listed
URL.</para>
+</step>
<step performance="required">
<para>Unpack the distribution file, run configure, make and make
install to put the byte-compiled files and info library in place.
+</para>
+</step>
<step performance="required" id="psgml-setup">
<para>
(cons "/usr/local/share/emacs/site-lisp/psgml" load-path))
(autoload 'sgml-mode "psgml" "Major mode to edit SGML files." t)
</programlisting>
+</para>
+</step>
<step performance="optional">
<para>
(cons '("\\.s?html?\\'" . sgml-mode) auto-mode-alist))
</programlisting>
</para>
-
+</step>
<step performance="optional">
<para>There is one important thing to note with
<filename>/usr/local/lib/sgml</filename>. If, as in the examples in
this chapter, you use <filename>/usr/local/share/sgml</filename>, you
have to compensate for this.
+</para>
<substeps>
<step performance="optional">
<para>
You can set the
<filename>SGML_CATALOG_FILES</filename> environment variable.
+</para>
+</step>
<step performance="optional">
<para>
You can
customize your <productname>PSGML</productname> installation (its
manual tells you how).
+</para>
+</step>
<step performance="optional">
<para>
<filename>psgml.el</filename> before compiling and installing
<productname>PSGML</productname>, changing the hard-coded paths to
match your own default.</para>
+</step>
</substeps>
+</step>
</procedure>
+</sect3>
<sect3><title>Installing <productname>JadeTeX</productname></title>
and <productname>DocBook</productname>. It may be the preferred toolset
for working with <acronym>SGML</acronym> but we have not had a chance to
evaluate the new package.
+</para>
<!--
</para></sect2></sect1>
-->
-
+</sect1>
</appendix>
<!-- Keep this comment at the end of the file
to copy and use the rest of the <ProductName>PostgreSQL</ProductName>.
</Para>
</Note>
-
+</para>
<Sect1>
<Title>Why Embedded <Acronym>SQL</Acronym>?</Title>
from variables in your <Acronym>C</Acronym> program.
Many <Acronym>RDBMS</Acronym> packages
support this embedded language.
+</Para>
<Para> There is an ANSI-standard describing how the embedded language should
work. <Application>ecpg</Application> was designed to meet this standard
other <Acronym>RDBMS</Acronym> packages to
<ProductName>Postgres</ProductName> and thus promoting the spirit of free
software.
-
+</Para>
+</sect1>
<Sect1>
<Title>The Concept</Title>
<Acronym>SQL</Acronym> statements you need to
put them in a special declare section.
You use a special syntax for the <Acronym>SQL</Acronym> queries.
+</Para>
<Para>
Before compiling you run the file through
as input to the <Acronym>SQL</Acronym> statements and variables that will
contain the
result are passed.
+</Para>
<Para>
Then you compile and at link time you link with a special library that
the <Acronym>SQL</Acronym> query using the ordinary interface
(<FileName>libpq</FileName>) and puts back
the result in the arguments dedicated for output.
+</Para>
<Para>
Then you run your program and when the control arrives to
statement the <Acronym>SQL</Acronym> statement is performed against
the database and you
can continue with the result.
-
+</Para>
+</sect1>
<Sect1>
<Title>How To Use <Application>egpc</Application></Title>
<Para>
This section describes how to use the <Application>egpc</Application> tool.
+</Para>
<Sect2>
-<Title>Preprocessor
+<Title>Preprocessor</title>
<Para>
The preprocessor is called <Application>ecpg</Application>.
After installation it resides in
the <ProductName>Postgres</ProductName> <FileName>bin/</FileName> directory.
-
+</Para>
+</sect2>
<Sect2>
-<Title>Library
+<Title>Library</title>
<Para>
The <Application>ecpg</Application> library is called
uses the <FileName>libpq</FileName> library for communication to the
<ProductName>Postgres</ProductName> server so you will
have to link your program with <Parameter>-lecpg -lpq</Parameter>.
+</Para>
<Para>
The library has some methods that are "hidden" but that could prove very
turns on debug logging if called with the first argument non-zero.
Debug logging is done on <replaceable class="parameter">stream</replaceable>.
Most <Acronym>SQL</Acronym> statement logs its arguments and result.
+</Para>
<Para>
The most important one (<Function>ECPGdo</Function>)
</Para>
</ListItem>
</itemizedlist>
+</Para>
+</sect2>
<Sect2>
-<Title>Error handling
+<Title>Error handling</title>
<Para>
To be able to detect errors from the <ProductName>Postgres</ProductName>
} sqlerrm;
} sqlca;
</ProgramListing>
+</Para>
<Para>
If an error occured in the last <Acronym>SQL</Acronym> statement
some kind of serious error, like the database definition does not match
the query given. If it is bigger than 0 then this is a normal error like
the table did not contain the requested row.
+</Para>
<Para>
sqlca.sqlerrm.sqlerrmc will contain a string that describes the error.
The string ends with <Quote>line 23.</Quote> where the line is the line number
in the source file (actually the file generated by the preprocessor but
I hope I can fix this to be the line number in the input file.)
+</Para>
<Para>
List of errors that can occur:
</ListItem>
</VarListEntry>
</VariableList>
-
+</Para>
</Sect2>
+</sect1>
<Sect1>
<Title>Limitations</Title>
client process per application process both the database part and the
application part is run in the same process. In later versions of oracle
this is no longer supported.
+</Para>
<Para>
This would require a total redesign of the <ProductName>Postgres</ProductName> access model and
</ListItem>
</VarListEntry>
</VariableList>
+</Para>
+</sect1>
<Sect1>
<Title>Porting From Other <Acronym>RDBMS</Acronym> Packages</Title>
To be written by someone who knows the different
<Acronym>RDBMS</Acronym> packages and who
actually does port something...
+</Para>
+</sect1>
<Sect1>
<Title>Installation</Title>
together with <ProductName>Postgres</ProductName>. So you
should get your precompiler, libraries and header files compiled and
installed by default as a part of your installation.
+</Para>
+</sect1>
<Sect1>
<Title>For the Developer</Title>
So, read this before looking at the internals of the
<Application>ecpg</Application>. If
you are not interested in how it really works, skip this section.
+</Para>
<Sect2>
<Title>ToDo List</Title>
<ListItem>
<Para>
Records or structures have to be defined in the declare section.
-
+</Para>
</ListItem>
</VarListEntry>
<Term> exec sql type</Term>
<ListItem>
<Para>
+</Para>
+</listitem>
</VarListEntry>
<VarListEntry>
<Term> exec sql prepare</Term>
<ListItem>
<Para>
+</Para>
+</listitem>
</VarListEntry>
<VarListEntry>
<Term> exec sql allocate</Term>
<ListItem>
<Para>
+</Para>
+</listitem>
</VarListEntry>
<VarListEntry>
<Term> exec sql free</Term>
<ListItem>
<Para>
+</Para>
+</listitem>
</VarListEntry>
<VarListEntry>
<Term> exec sql whenever sqlwarning</Term>
<ListItem>
<Para>
+</Para>
+</listitem>
</VarListEntry>
<VarListEntry>
<Term> SQLSTATE</Term>
<ListItem>
<Para>
+</Para>
+</listitem>
</VarListEntry>
</VariableList>
</Para>
other configuration parameters. If you have these scripts for an old
database you would like to just apply them to get a
<ProductName>Postgres</ProductName> database that works in the same way.
+</Para>
<Para>
To set up a database you need a few scripts with table definitions and
</ListItem>
</VarListEntry>
</VariableList>
+</Para>
+</sect2>
<Sect2>
<Title>The Preprocessor</Title>
<Para>
First four lines are written to the output. Two comments and two include
lines necessary for the interface to the library.
+</Para>
<Para>
Then the preprocessor works in one pass only reading the input file and
writing to the output as it goes along. Normally it just echoes
everything to the output without looking at it further.
+</Para>
<Para>
When it comes to an <Command>EXEC SQL</Command> statements it interviens and
In the section only variable declarations are allowed. Every variable
declare within this section is also entered in a list of variables
indexed on their name together with the corresponding type.
+</Para>
<Para>
The declaration is echoed to the file to make the variable a normal
C-variable also.
+</Para>
<Para>
The special types VARCHAR and VARCHAR2 are converted into a named struct
<Command>exec sql</Command> and ends with <Command>;</Command>.
Everything inbetween is treated
as an <Acronym>SQL</Acronym> statement and parsed for variable substitution.
+</Para>
<Para>
Variable substitution occur when a symbol starts with a colon
a variable for input or
output the pointers to the variables are written to the output to allow
for access by the function.
+</Para>
<Para>
For every variable that is part of the <Acronym>SQL</Acronym> request
<Member>Number of elements in the array (for array fetches)</Member>
<Member>The offset to the next element in the array (for array fetches)</Member>
</SimpleList>
+</Para>
<Para>
Since the array fetches are not implemented yet the two last arguments
</ListItem>
</VarListEntry>
</VariableList>
-
+</Para>
</Sect2>
<Sect2>
</ProgramListing>
(the indentation in this manual is added for readability and not
something that the preprocessor can do.)
+</Para>
+</sect2>
<Sect2>
<Title>The Library</Title>
into machines with limits on the amount of variables that can be
accepted by a varchar function. This could easily add up to 50 or so
arguments.
+</Para>
<Para>
The arguments are:
</ListItem>
</VarListEntry>
</VariableList>
+</Para>
<Para>
All the <Acronym>SQL</Acronym> statements are performed in one transaction
unless you issue
a commit transaction. This works so that the first transaction or the
first after a commit or rollback always begins a transaction.
+</Para>
<Para>
To be completed: entries describing the other entries.
-
+</Para>
+</sect2>
+</sect1>
</Chapter>
and will be described in depth (in the section
on interfacing types and operators to indices)
after we have discussed basic extensions.
+</para>
</ListItem>
</ItemizedList>
</Para>
+</sect1>
</Chapter>
</TGROUP>
</TABLE>
</Para>
+</sect1>
<sect1>
<title>String Functions</title>
<para>
Most functions explicitly defined for text will work for char() and varchar() arguments.
</para>
+</sect1>
<sect1>
<title>Date/Time Functions</title>
to return day of week and `epoch' to return seconds since 1970 (for <Type>datetime</Type>)
or 'epoch' to return total elapsed seconds (for <Type>timespan</Type>).
</Para>
+</sect1>
<sect1>
<title>Geometric Functions</title>
</TGROUP>
</TABLE>
</Para>
+</sect1>
<sect1>
<title id="cidr-funcs">IP V4 Functions</title>
<!--
-$Header: /cvsroot/pgsql/doc/src/sgml/geqo.sgml,v 1.4 1998/08/15 06:55:05 thomas Exp $
+$Header: /cvsroot/pgsql/doc/src/sgml/geqo.sgml,v 1.5 1998/12/29 02:24:15 thomas Exp $
Genetic Optimizer
$Log: geqo.sgml,v $
+Revision 1.5 1998/12/29 02:24:15 thomas
+Clean up to ensure tag completion as required by the newest versions
+ of Norm's Modular Style Sheets and jade/docbook.
+From Vince Vielhaber <vev@michvhf.com>.
+
Revision 1.4 1998/08/15 06:55:05 thomas
Change Id field in chapter tag to change html output file name.
for the Institute of Automatic Control at the University of Mining and Technology in Freiberg, Germany.
</Para>
</Note>
+</para>
<Sect1>
<Title>Query Handling as a Complex Optimization Problem</Title>
(e.g., nested loop, index scan, merge join in <ProductName>Postgres</ProductName>) to
process individual <Command>join</Command>s and a diversity of <FirstTerm>indices</FirstTerm> (e.g., r-tree,
b-tree, hash in <ProductName>Postgres</ProductName>) as access paths for relations.
+</para>
<Para>
The current <ProductName>Postgres</ProductName> optimizer implementation performs a <FirstTerm>near-
optimization technique is inadequate to support database application
domains that involve the need for extensive queries, such as artificial
intelligence.
+</para>
<Para>
The Institute of Automatic Control at the University of Mining and
support knowledge based system for the maintenance of an electrical
power grid. The DBMS needed to handle large <Command>join</Command> queries for the
inference machine of the knowledge based system.
+</para>
<Para>
Performance difficulties within exploring the space of possible query
plans arose the demand for a new optimization technique being developed.
+</para>
<Para>
In the following we propose the implementation of a <FirstTerm>Genetic Algorithm</FirstTerm>
as an option for the database query optimization problem.
-
+</para>
+</sect1>
<Sect1>
<Title>Genetic Algorithms (<Acronym>GA</Acronym>)</Title>
optimization problem is considered as a <FirstTerm>population</FirstTerm> of <FirstTerm>individuals</FirstTerm>.
The degree of adaption of an individual to its environment is specified
by its <FirstTerm>fitness</FirstTerm>.
+</para>
<Para>
The coordinates of an individual in the search space are represented
subsection of a chromosome which encodes the value of a single parameter
being optimized. Typical encodings for a gene could be <FirstTerm>binary</FirstTerm> or
<FirstTerm>integer</FirstTerm>.
+</para>
<Para>
Through simulation of the evolutionary operations <FirstTerm>recombination</FirstTerm>,
<FirstTerm>mutation</FirstTerm>, and <FirstTerm>selection</FirstTerm> new generations of search points are found
that show a higher average fitness than their ancestors.
+</para>
<Para>
According to the "comp.ai.genetic" <Acronym>FAQ</Acronym> it cannot be stressed too
| | t := t + 1 |
+===+=====================================+
</ProgramListing>
+</para>
+</sect1>
<Sect1>
<Title>Genetic Query Optimization (<Acronym>GEQO</Acronym>) in Postgres</Title>
is encoded by the integer string '4-1-3-2',
which means, first join relation '4' and '1', then '3', and
then '2', where 1, 2, 3, 4 are relids in <ProductName>Postgres</ProductName>.
+</para>
<Para>
Parts of the <Acronym>GEQO</Acronym> module are adapted from D. Whitley's Genitor
algorithm.
+</para>
<Para>
Specific characteristics of the <Acronym>GEQO</Acronym> implementation in <ProductName>Postgres</ProductName>
</Para>
</ListItem>
</ItemizedList>
+</para>
<Para>
The <Acronym>GEQO</Acronym> module gives the following benefits to the <ProductName>Postgres</ProductName> DBMS
</Para>
</ListItem>
</ItemizedList>
+</para>
</Sect1>
<Function>OrderedElemPop</Function>, file <FileName>backend/utils/mmgr/oset.c</FileName>.
The same problems arise with long queries when using the normal
<ProductName>Postgres</ProductName> query optimization algorithm.
+</para>
+</sect3>
<Sect3>
<Title>Improve genetic algorithm parameter settings</Title>
</Para>
</ListItem>
</ItemizedList>
+</para>
+</sect3>
<Sect3>
<Title>Find better solution for integer overflow</Title>
value of <StructField>rel->size</StructField> to its logarithm.
Modifications of <StructName>Rel</StructName> in <FileName>backend/nodes/relation.h</FileName> will
surely have severe impacts on the whole <ProductName>Postgres</ProductName> implementation.
+</para>
+</sect3>
<Sect3>
<Title>Find solution for exhausted memory</Title>
Of course the <StructName>rel</StructName> data structure of the <Command>join</Command> keeps growing and
growing the more relations are packed into it.
Suggestions are welcome :-(
-
+</para>
+</sect3>
+</sect2>
<Sect2>
<Title>Further Improvements</Title>
<Para>
Enable bushy query tree processing within <ProductName>Postgres</ProductName>;
that may improve the quality of query plans.
+</para>
<BIBLIOGRAPHY Id="geqo-biblio">
<TITLE>
</BIBLIOENTRY>
</BIBLIOGRAPHY>
+</sect2>
+</sect1>
</Chapter>
And there is more interesting reading at the Berkely database site at
<ULink url="http://epoch.cs.berkeley.edu:8000/">http://epoch.cs.berkeley.edu:8000/</ULink>.
-
+</para>
<Para>
<Note>
- thomas 1998-03-01
</Para>
</Note>
-
+</para>
<Para>
Well, I can't say I quite understand what's going on, but at least
I (almost) succeeded in porting GiST examples to linux. The GiST access
method is already in the postgres tree (<FileName>src/backend/access/gist</FileName>).
-
+</para>
<Para>
<ULink url="ftp://s2k-ftp.cs.berkeley.edu/pub/gist/pggist/pggist.tgz">Examples at Berkeley</ULink>
come with an overview of the methods and demonstrate spatial index
(PostgreSQL 6.3 Sun Feb 1 14:57:30 EST 1998)
</ProgramListing>
-
+</para>
<Para>
I could not get sense of this error message; it appears to be something
we'd rather ask the developers about (see also Note 4 below). What I
original sources quoted above and apply my patch (see attachment) and
tell us what you feel about it. Looks cool to me, but I would not like
to hold it up while there are so many competent people around.
-
+</para>
<Para>
A few notes on the sources:
-
+</para>
<Para>
1. I failed to make use of the original (HPUX) Makefile and rearranged
the Makefile from the ancient postgres95 tutorial to do the job. I tried
to keep it generic, but I am a very poor makefile writer -- just did
some monkey work. Sorry about that, but I guess it is now a little
more portable that the original makefile.
-
+</para>
<Para>
2. I built the example sources right under pgsql/src (just extracted the
tar file there). The aforementioned Makefile assumes it is one level
below pgsql/src (in our case, in pgsql/src/pggist).
-
+</para>
<Para>
3. The changes I made to the *.c files were all about #include's,
function prototypes and typecasting. Other than that, I just threw
away a bunch of unused vars and added a couple parentheses to please
gcc. I hope I did not screw up too much :)
-
+</para>
<Para>
4. There is a comment in polyproc.sql:
<ProductName>Postgres</ProductName> versions
back and tried the query. My system went nuts and I had to shoot down
the postmaster in about ten minutes.
-
+</para>
<Para>
I will continue to look into GiST for a while, but I would also
appreciate
more examples of R-tree usage.
-
+</para>
</Chapter>
was reset to start at 6.0,
putting the numbers back into the sequence originally begun by
the <ProductName>Postgres</ProductName> Project.
+</Para>
<Para>
The emphasis on development for the v1.0.x releases of
identifying and understanding existing problems in the backend
to augmenting features and capabilities, although
work continues in all areas.
+</Para>
<Para>
Major enhancements include:
+</Para>
<ItemizedList>
<ListItem>
Built-in types have been improved, including new wide-range date/time types
and additional geometric type support.
</Para>
+
</ListItem>
<ListItem>
<Para>
</Para>
</ListItem>
</ItemizedList>
-</Para>
</Sect2>
-</sect1>
\ No newline at end of file
+</sect1>
<Para>
This manual set is organized into several parts:
+</Para>
<VariableList>
<VarListEntry>
<Para>
In addition to this manual set, there are other resources to help you with
<ProductName>Postgres</ProductName> installation and use:
+</Para>
<VariableList>
<VarListEntry>
|Mariposa | 1953 |
+----------+----------+
</ProgramListing>
+</para>
<Para>
On the other hand, to find the names of all cities,
</Para>
</ListItem>
</ItemizedList>
-
+</para>
<Para>
Commands were tested on RedHat Linux version 4.2 using the tcsh shell.
Except where noted, they will probably work on most systems. Commands
In general, most Unix-compatible
platforms with modern libraries should be able to run <ProductName>Postgres</ProductName>.
-
+</para>
<para>
Although the minimum required memory for running <ProductName>Postgres</ProductName>
is as little as 8MB, there are noticable improvements in runtimes for the regression
tests when expanding memory up to 96MB on a relatively fast dual-processor system
running X-Windows.
The rule is you can never have too much memory.
-
+</para>
<Para>
Check that you have sufficient disk space. You will need about
30 Mbytes for <filename>/usr/src/pgsql</filename>,
<programlisting>
$ df -k
</programlisting>
-
+</para>
</Sect1>
<Sect1>
<Title>Installation Procedure</Title>
-<Para>
<Procedure>
<Title><ProductName>Postgres</ProductName> Installation</Title>
<Para>
Create the <ProductName>Postgres</ProductName> superuser account
(<literal>postgres</literal> is commonly used) if it does not already exist.
-
+</para>
<para>
The owner of the Postgres files can be any unprivileged user account.
It <emphasis>must not</emphasis> be <literal>root</literal>, <literal>bin</literal>,
or any other account with special access rights, as that would create a security risk.
-
+</para>
</Step>
<Step Performance="required">
<Para>
Log in to the <ProductName>Postgres</ProductName> superuser account. Most of the
remaining steps in the installation will happen in this account.
-
+</para>
+</step>
<Step Performance="required">
<Para>
Ftp file
in the HACKERS mailing list. Full releases always require a dump/reload
from previous releases. It is therefore a bad idea to skip this
step.
-
+</para>
<tip>
<para>
Do not use the <application>pg_dumpall</application>
script from v6.0 or everything
will be owned by the <ProductName>Postgres</ProductName> super user.
+</para>
</tip>
<para>
<programlisting>
$ pg_dumpall -z > db.out
</programlisting>
-
+</para>
<para>
To use the latest <application>pg_dumpall</application> script on your
existing older database before upgrading <productname>Postgres</productname>,
$ /etc/rc.d/init.d/postgres.init stop
</programlisting>
to halt <productname>Postgres</productname>.
+</para>
</tip>
</Para>
</Step>
<Para>
Make new source and install directories. The actual paths can be
different for your installation but you must be consistant throughout this procedure.
+</para>
<note>
<para>
There are two places in this installation procedure where you will have an opportunity
to specify installation locations for programs, libraries, documentation, and other files.
Usually it is sufficient to specify these at the <command>make install</command> stage
of installation.
+</para>
</note>
<para>
send email to
<ulink url="mailto:scrappy@hub.org">scrappy@hub.org</ulink> with the output of the program
<application>./config.guess</application>. Indicate what the template file should be.
+</para>
</note>
</Para>
-
+</step>
<Step Performance="optional">
<Para>
Choose configuration options. Check <xref linkend="config" endterm="install-config">
present.)
</ProgramListing>
</Para>
-
+</step>
<Step Performance="required">
<Para>
Here is the configure script used on a Sparc Solaris 2.5 system
<para>
Of course, you may type these three lines all
on the same line.
+</para>
</tip>
</Para>
</Step>
</substeps>
-
+</step>
<Step Performance="required">
<Para>
Install the <application>man</application> and
$ cd /usr/src/pgsql/doc
$ gmake install
</ProgramListing>
-
+</para>
<para>
The documentation is also available in Postscript format. Look for files
ending with <filename>.ps.gz</filename> in the same directory.
-
+</para>
+</step>
<Step Performance="required">
<Para>
Compile the program. Type
You will probably find a number of warning
messages in make.log. Unless you have problems later on, these
messages may be safely ignored.
+</para>
</note>
-
+</para>
<Para>
If the compiler fails with a message stating that
the <application>flex</application> command
<Para>
If necessary, tell your system how to find the new shared libraries. You can
do <emphasis>one</emphasis> of the following, preferably the first:
-
+</para>
<SubSteps>
<Step Performance="optional">
<Para>
<ProgramListing>
setenv LD_LIBRARY_PATH /usr/local/pgsql/lib
</ProgramListing>
+</para>
</Step>
</SubSteps>
</Para>
</Step>
-<Step Performance="optional">
-<Para>
-If you used the <option>--with-perl</option> option to configure, check
-the install log to see whether the Perl module was actually installed.
-If you've followed our advice to make the Postgres files be owned by
-an unprivileged userid, then the Perl module won't have been installed,
-for lack of write privileges on the Perl library directories. You can
-complete its installation, either now or later, by becoming the user that
-does own the Perl library (often root) (via <command>su</command>) and doing
-<ProgramListing>
-$ cd /usr/src/pgsql/src/interfaces/perl5
-$ gmake install
-</ProgramListing>
-</Para>
-</Step>
-
-<Step Performance="required">
-<Para>
- If it has not already been done, then prepare account <literal>postgres</literal>
+ <Step Performance="optional">
+ <Para>
+ If you used the <option>--with-perl</option> option to configure, check
+ the install log to see whether the Perl module was actually installed.
+ If you've followed our advice to make the Postgres files be owned by
+ an unprivileged userid, then the Perl module won't have been installed,
+ for lack of write privileges on the Perl library directories. You can
+ complete its installation, either now or later, by becoming the user that
+ does own the Perl library (often root) (via <command>su</command>) and doing
+ <ProgramListing>
+ $ cd /usr/src/pgsql/src/interfaces/perl5
+ $ gmake install
+ </ProgramListing>
+ </Para>
+ </Step>
+
+ <Step Performance="required">
+ <Para>
+ If it has not already been done, then prepare account <literal>postgres</literal>
for using <ProductName>Postgres</ProductName>.
-Any account that will use <ProductName>Postgres</ProductName> must
+ Any account that will use <ProductName>Postgres</ProductName> must
be similarly prepared.
-
-<para>
-There are several ways to influence the runtime environment of the
- <ProductName>Postgres</ProductName>
-server. Refer to the <citetitle>Administrator's Guide</citetitle>
- for more information.
-
-<note>
-<para>
-The following instructions are for a
- bash/sh shell. Adapt accordingly for other shells.
-</note>
-
-</Para>
-
-<substeps>
-
-<Step Performance="required">
-<Para>
- Add the following lines to your login environment:
-
- shell, <filename>~/.bash_profile</filename>:
-<ProgramListing>
-PATH=$PATH:/usr/local/pgsql/bin
-MANPATH=$MANPATH:/usr/local/pgsql/man
-PGLIB=/usr/local/pgsql/lib
-PGDATA=/usr/local/pgsql/data
-export PATH MANPATH PGLIB PGDATA
-</ProgramListing>
-</Para>
-
-<Step Performance="required">
-<para>
-Several regression tests could failed if the user's locale collation
-scheme is different from that of standard C locale.
-
-<para>
-If you configure and compile <ProductName>Postgres</ProductName>
- with the <option>--enable-locale</option> option then
- set locale environment to C (or unset all LC_* variables)
-by putting these additional lines to your login environment
- before starting postmaster:
-<ProgramListing>
-LC_COLLATE=C
-LC_CTYPE=C
-LC_COLLATE=C
-export LC_COLLATE LC_CTYPE LC_COLLATE
-</ProgramListing>
-
-<ProgramListing>
-
-</ProgramListing>
-
-
-<Step Performance="required">
-<Para>
- Make sure that you have defined these variables before continuing
- with the remaining steps. The easiest way to do this is to type:
-<ProgramListing>
-$ source ~/.bash_profile
-</ProgramListing>
-</Para>
-</Step>
-
-</substeps>
+ </para>
+ <para>
+ There are several ways to influence the runtime environment of the
+ <ProductName>Postgres</ProductName>
+ server. Refer to the <citetitle>Administrator's Guide</citetitle>
+ for more information.
+ <note>
+ <para>
+ The following instructions are for a
+ bash/sh shell. Adapt accordingly for other shells.
+ </para>
+ </note>
+ </Para>
+
+ <substeps>
+
+ <Step Performance="required">
+ <Para>
+ Add the following lines to your login environment:
+
+ shell, <filename>~/.bash_profile</filename>:
+ <ProgramListing>
+ PATH=$PATH:/usr/local/pgsql/bin
+ MANPATH=$MANPATH:/usr/local/pgsql/man
+ PGLIB=/usr/local/pgsql/lib
+ PGDATA=/usr/local/pgsql/data
+ export PATH MANPATH PGLIB PGDATA
+ </ProgramListing>
+ </Para>
+ </step>
+ <Step Performance="required">
+ <para>
+ Several regression tests could failed if the user's locale collation
+ scheme is different from that of standard C locale.
+ </para>
+ <para>
+ If you configure and compile <ProductName>Postgres</ProductName>
+ with the <option>--enable-locale</option> option then
+ set locale environment to C (or unset all LC_* variables)
+ by putting these additional lines to your login environment
+ before starting postmaster:
+ <ProgramListing>
+ LC_COLLATE=C
+ LC_CTYPE=C
+ LC_COLLATE=C
+ export LC_COLLATE LC_CTYPE LC_COLLATE
+ </ProgramListing>
+
+ <ProgramListing>
+
+ </ProgramListing>
+ </para>
+ </step>
+
+ <Step Performance="required">
+ <Para>
+ Make sure that you have defined these variables before continuing
+ with the remaining steps. The easiest way to do this is to type:
+ <ProgramListing>
+ $ source ~/.bash_profile
+ </ProgramListing>
+ </Para>
+ </Step>
+
+ </substeps>
+ </step>
<Step Performance="required">
<Para>
<para>
Briefly test that the backend will start and run by running it from
the command line.
-
+</para>
<substeps>
<Step Performance="required">
<ProgramListing>
$ createdb
</ProgramListing>
-
+</para>
+</step>
<Step Performance="required">
<para>
Connect to the new database:
<ProgramListing>
$ psql
</ProgramListing>
-
+</para>
+</step>
<Step Performance="required">
<para>
And run a sample query:
<ProgramListing>
postgres=> SELECT datetime 'now';
</ProgramListing>
-
+</para>
+</step>
<Step Performance="required">
<para>
Exit <application>psql</application>:
<ProgramListing>
postgres=> \q
</ProgramListing>
-
+</para>
+</step>
<Step Performance="required">
<para>
Remove the test database (unless you will want to use it later for other tests):
<ProgramListing>
$ destroydb
</ProgramListing>
-
+</para>
+</step>
</substeps>
-
+</step>
<Step Performance="required">
<Para>
Run postmaster in the background from your <ProductName>Postgres</ProductName>
superuser account (typically account <literal>postgres</literal>).
<emphasis>Do not run <application>postmaster</application>
from the root account!</emphasis>
-
+</para>
<Para>
Usually, you will want to modify
your computer so that it will automatically start postmaster whenever
it boots. It is not required; the <ProductName>Postgres</ProductName>
server can
be run successfully from non-privileged accounts without root intervention.
-
+</para>
<para>
Here are some suggestions on how to do this, contributed by various
users.
-
+</para>
<para>
Whatever you do, postmaster must be run by
the <ProductName>Postgres</ProductName> superuser (<literal>postgres</literal>?)
$ cd
$ nohup postmaster > regress.log 2>&1 &
</ProgramListing>
-
+</para>
+</listitem>
<listitem>
<para>
Edit file rc.local on NetBSD or file rc2.d on SPARC Solaris
<programlisting>
su postgres -c "/usr/local/pgsql/bin/postmaster -S -D /usr/local/pgsql/data"
</programlisting>
+</para>
+</listitem>
<listitem>
<para>
enough to keep parsing beyond end-of-line if there is an
expression unfinished. The exec saves one layer of shell under
the postmaster process so the parent is init.
+</para>
+</listitem>
<listitem>
<para>
which is based on the example in <filename>contrib/linux/</filename>.
Then make a softlink to this file from
<filename>/etc/rc.d/rc5.d/S98postgres.init</filename>.
+</para>
+</listitem>
<listitem>
<para>
(The author of this example says this example will revive the
postmaster if it dies, but he doesn't know if there are other side
effects.)
+</para>
+</listitem>
</itemizedlist>
For a i686/Linux-ELF platform, no tests failed since this is the
v6.4 regression testing reference platform.
</Para>
+</listitem>
<listitem>
<Para>
floating point numbers. select_views produces massively different output,
but the differences are due to minor floating point differences.
</Para>
-</itemizedlist>
+</listitem>
+</itemizedlist>
+</para>
<Para>
Even if a test result clearly indicates a real failure, it may be a
localized problem that will not affect you. An example is that the
</Step>
</substeps>
-
+</step>
<Step Performance="required">
<Para>
If you haven't already done so, this would be a good time to modify
your computer to do regular maintainence. The following should be
done at regular intervals:
-
+</para>
<procedure>
<title>Minimal Backup Procedure</title>
<para>
Run the <acronym>SQL</acronym> command <command>VACUUM</command>.
This will clean up your database.
-
+</para>
+</step>
<step performance="required">
<para>
Back up your system. (You should probably keep the last few
backups on hand.) Preferably, no one else should be using the
system at the time.
-
+</para>
+</step>
</procedure>
<para>
$ cd /usr/local/pgsql/doc
$ gunzip user.ps.tz | lpr
</programlisting>
-
+</para>
<para>
Here is how
you might do it if you have Ghostscript on your system and are
$ gzip user.ps
$ lpr -l -s -r manpage.hp
</programlisting>
-
+</para>
</Step>
<Step Performance="required">
<listitem>
<para>
The version of <ProductName>Postgres</ProductName> (v6.4, 6.3.2, beta 981014, etc.).
+</para>
+</listitem>
<listitem>
<para>
Your operating system (i.e. RedHat v5.1 Linux v2.0.34).
+</para>
+</listitem>
<listitem>
<para>
Your hardware (SPARC, i486, etc.).
+</para>
+</listitem>
<listitem>
<para>
applied, changes you made, etc.), what tests failed, etc.
It is normal to get many warning when you compile. You do
not need to report these.
+</para>
+</listitem>
</itemizedlist>
</Para>
</Step>
</Procedure>
+</sect1>
<Sect1>
<Title>Playing with <ProductName>Postgres</ProductName></Title>
</Para>
</Note>
-<Sect2>
-<Title>Ultrix4.x</Title>
-
-<para>
-<note>
-<para>
-There have been no recent reports of Ultrix usage with <productname>Postgres</productname>.
-</note>
-
-<para>
- You need to install the libdl-1.1 package since Ultrix 4.x doesn't
- have a dynamic loader. It's available in
- s2k-ftp.CS.Berkeley.EDU:pub/personal/andrew/libdl-1.1.tar.Z
-</Para>
-</Sect2>
-
-<Sect2>
-<Title>Linux</Title>
-
-<Sect3>
-<Sect3Info>
-<Author>
-<FirstName>Thomas G.</FirstName>
-<SurName>Lockhart</SurName>
-</Author>
-<Date>1998-02-19</Date>
-</Sect3Info>
-<Title>Linux ELF</Title>
-
-<Para>
-The regression test reference machine is
-a linux-2.0.30/libc-5.3.12/RedHat-4.2 installation running on a dual processor i686.
-The linux-elf port installs cleanly. See the Linux FAQ for more details.
-</Para>
-</Sect3>
+ <Sect2>
+ <Title>Ultrix4.x</Title>
+
+ <para>
+ <note>
+ <para>
+ There have been no recent reports of Ultrix usage with <productname>Postgres</productname>.
+ </para>
+ </note>
+ </para>
+ <para>
+ You need to install the libdl-1.1 package since Ultrix 4.x doesn't
+ have a dynamic loader. It's available in
+ s2k-ftp.CS.Berkeley.EDU:pub/personal/andrew/libdl-1.1.tar.Z
+ </Para>
+ </Sect2>
+
+ <Sect2>
+ <Title>Linux</Title>
+
+ <Sect3>
+ <Sect3Info>
+ <Author>
+ <FirstName>Thomas G.</FirstName>
+ <SurName>Lockhart</SurName>
+ </Author>
+ <Date>1998-02-19</Date>
+ </Sect3Info>
+ <Title>Linux ELF</Title>
+
+ <Para>
+ The regression test reference machine is
+ a linux-2.0.30/libc-5.3.12/RedHat-4.2 installation running on a dual processor i686.
+ The linux-elf port installs cleanly. See the Linux FAQ for more details.
+ </Para>
+ </Sect3>
<Sect3>
<Sect3Info>
a product so contact him for information. He has also indicated that
binary releases of <ProductName>Postgres</ProductName> for NEXTSTEP will be made available to
the general public. Contact Info@RnA.nl for information.
-
+</para>
<Para>
We have no recent reports of successful NeXT installations (as of v6.2.1).
However, the client-side libraries should work even
So, although <ProductName>Postgres</ProductName> has some object-oriented features,
it is firmly in the relational database world. In fact, some commercial databases
have recently incorporated features pioneered by <ProductName>Postgres</ProductName>.
+</Para>
</Sect1>
<para>
Written by <ulink url="peter@retep.org.uk">Peter T. Mount</ulink>, the
author of the <acronym>JDBC</acronym> driver.
+</para>
</note>
+</para>
<para>
<acronym>JDBC</acronym> is a core <acronym>API</acronym> of Java 1.1 and later.
It provides a standard set of
interfaces to <acronym>SQL</acronym>-compliant databases.
+</para>
<para>
<application>Postgres</application> provides
a type 4 <acronym>JDBC</acronym> Driver. Type 4 indicates that the driver
is written in Pure Java, and communicates in the database's own network
protocol. Because of this, the driver is platform independent. Once compiled,
the driver can be used on any platform.
+</para>
<sect1>
<title>Building the <acronym>JDBC</acronym> Interface</title>
-<para>
-
<sect2>
<title>Compiling the Driver</title>
<programlisting>
% make
</programlisting>
+</para>
<para>
Upon completion, you will find the archive <filename>postgresql.jar</filename>
loading techniques for performance reasons,
and <application>javac</application> cannot cope.
The <filename>Makefile</filename> will generate the jar archive.
+</para>
</note>
+</para>
+</sect2>
<sect2>
<title>Installing the Driver</title>
<para>
To use the driver, the jar archive postgresql.jar needs to be included in
the CLASSPATH.
+</para>
<para>
Example:
+</para>
<para>
I have an application that uses the <acronym>JDBC</acronym> driver to access a large database
containing astronomical objects. I have the application and the jdbc driver
installed in the /usr/local/lib directory, and the java jdk installed in /usr/local/jdk1.1.6.
+</para>
<para>
To run the application, I would use:
+</para>
<para>
export CLASSPATH = \
/usr/local/lib/finder.jar:/usr/local/lib/postgresql.jar:.
java uk.org.retep.finder.Main
+</para>
<para>
Loading the driver is covered later on in this chapter.
-<para>
+</para>
+</sect2>
+</sect1>
<sect1>
<title>Preparing the Database for <acronym>JDBC</acronym></title>
<para>
Because Java can only use TCP/IP connections, the <application>Postgres</application> postmaster
must be running with the -i flag.
+</para>
<para>
Also, the <filename>pg_hba.conf</filename> file must be configured. It's located in the PGDATA
directory. In a default installation, this file permits access only by UNIX
domain sockets. For the <acronym>JDBC</acronym> driver to connect to the same localhost, you need
to add something like:
+</para>
<para>
host all 127.0.0.1 255.255.255.255 password
+</para>
<para>
Here access to all databases are possible from the local machine
with <acronym>JDBC</acronym>.
+</para>
<para>
The <acronym>JDBC</acronym> Driver supports trust, ident,
password and crypt authentication methods.
-
-<para>
+</para>
+</sect1>
<sect1>
<title>Using the Driver</title>
<acronym>JDBC</acronym> programming, but
should help to get you started. For more information refer to the standard
<acronym>JDBC</acronym> <acronym>API</acronym> documentation.
+</para>
<para>
Also, take a look at the examples included with the source. The basic
example is used here.
-<para>
+</para>
+</sect1>
<sect1>
<title>Importing <acronym>JDBC</acronym></title>
<para>
Do not import the postgresql package. If you do, your source will not
compile, as javac will get confused.
+</para>
</important>
+</para>
+</sect1>
<sect1>
<title>Loading the Driver</title>
<para>
Before you can connect to a database, you need to load the driver. There
are two methods available, and it depends on your code to the best one to use.
+</para>
<para>
In the first method, your code implicitly loads the driver using the
This will load the driver, and while loading, the driver will automatically
register itself with <acronym>JDBC</acronym>.
+</para>
<para>
Note: The <function>forName()</function> method
can throw a ClassNotFoundException, so you will
need to catch it if the driver is not available.
+</para>
<para>
This is the most common method to use, but restricts your code to use just
<application>Postgres</application>.
If your code may access another database in the future, and you
don't use our extensions, then the second method is advisable.
+</para>
<para>
The second method passes the driver as a parameter to the JVM as it starts,
using the -D argument.
+</para>
<para>
Example:
<programlisting>
% java -Djdbc.drivers=postgresql.Driver example.ImageViewer
</programlisting>
+</para>
<para>
In this example, the JVM will attempt to load the driver as part of it's
initialisation. Once done, the ImageViewer is started.
+</para>
<para>
Now, this method is the better one to use because it allows your code to
be used with other databases, without recompiling the code. The only thing
that would also change is the URL, which is covered next.
+</para>
<para>
One last thing. When your code then tries to open a Connection, and you get
this is probably
caused by the driver not being in the classpath, or the value in the parameter
not being correct.
+</para>
+</sect1>
<sect1>
<title>Connecting to the Database</title>
<listitem>
<para>
jdbc:postgresql:<replaceable class="parameter">database</replaceable>
+</para>
+</listitem>
<listitem>
<para>
jdbc:postgresql://<replaceable class="parameter">host</replaceable>/<replaceable class="parameter">database</replaceable>
+</para>
+</listitem>
<listitem>
<para>
jdbc:postgresql://<replaceable class="parameter">host</replaceable>:<replaceable class="parameter">port</replaceable>/<replaceable class="parameter">database</replaceable>
+</para>
+</listitem>
+
</itemizedlist>
where:
<varlistentry>
<term>
<replaceable class="parameter">host</replaceable>
-
+</term>
<listitem>
<para>
The hostname of the server. Defaults to "localhost".
+</para>
+</listitem>
+</varlistentry>
<varlistentry>
<term>
<replaceable class="parameter">port</replaceable>
-
+</term>
<listitem>
<para>
The port number the server is listening on. Defaults to the Postgres
standard port number (5432).
+</para>
+</listitem>
+</varlistentry>
<varlistentry>
<term>
<replaceable class="parameter">database</replaceable>
-
+</term>
<listitem>
<para>
The database name.
+</para>
+</listitem>
+</varlistentry>
</variablelist>
+</para>
<para>
To connect, you need to get a Connection instance from
<acronym>JDBC</acronym>. To do this,
you would use the DriverManager.getConnection() method:
+</para>
<para>
Connection db = DriverManager.getConnection(url,user,pwd);
-<para>
+</para>
+</sect1>
<sect1>
<title>Issuing a Query and Processing the Result</title>
Statement instance. Once you have a Statement, you can use the executeQuery()
method to issue a query. This will return a ResultSet instance, which contains
the entire result.
-<para>
+</para>
<sect2>
<title>Using the Statement Interface</title>
You can use a Statement instance as many times as you want. You could
create one as soon as you open the connection, and use it for the connections
lifetime. You have to remember that only one ResultSet can exist per Statement.
+</para>
+</listitem>
<listitem>
<para>
If you need to perform a query while processing a ResultSet, you can
simply create and use another Statement.
+</para>
+</listitem>
<listitem>
<para>
If you are using Threads, and several are using the database, you must
use a separate Statement for each thread. Refer to the sections covering
Threads and Servlets later in this document if you are thinking of using them,
as it covers some important points.
+</para>
+</listitem>
</itemizedlist>
-
+</para>
+</sect2>
<sect2>
<title>Using the ResultSet Interface</title>
<para>
Before reading any values, you must call <function>next()</function>. This returns true if
there is a result, but more importantly, it prepares the row for processing.
+</para>
+</listitem>
<listitem>
<para>
Under the <acronym>JDBC</acronym> spec, you should access a field only once. It's safest
to stick to this rule, although at the current time, the <application>Postgres</application> driver
will allow you to access a field as many times as you want.
+</para>
+</listitem>
<listitem>
<para>
You must close a ResultSet by calling <function>close()</function> once you have finished with it.
+</para>
+</listitem>
<listitem>
<para>
Once you request another query with the Statement used to create a
ResultSet, the currently open instance is closed.
+</para>
+</listitem>
</itemizedlist>
+</para>
<para>
An example is as follows:
rs.close();
st.close();
</programlisting>
-
+</para>
+</sect2>
+</sect1>
<sect1>
<title>Performing Updates</title>
<programlisting>
st.executeUpdate(<literal>create table basic (a int2, b int2)</literal>);
</programlisting>
-
+</para>
+</sect1>
<sect1>
<title>Closing the Connection</title>
<programlisting>
db.close();
</programlisting>
+</para>
+</sect1>
<sect1>
<title>Using Large Objects</title>
large objects (also known as <firstterm>blobs</firstterm>) are used to hold data in
the database that cannot be stored in a normal SQL table. They are stored as a
Table/Index pair, and are refered to from your own tables, by an OID value.
+</para>
<para>
Now, there are you methods of using Large Objects. The first is the
to the api, which presents the libpq large object <acronym>API</acronym> to Java, providing even
better access to large objects than the standard. Internally, the driver uses
the extension to provide large object support.
+</para>
<para>
In <acronym>JDBC</acronym>, the standard way to access them is using the getBinaryStream()
method in ResultSet, and setBinaryStream() method in PreparedStatement. These
methods make the large object appear as a Java stream, allowing you to use the
java.io package, and others, to manipulate the object.
+</para>
<para>
For example, suppose
<programlisting>
create table images (imgname name,imgoid oid);
</programlisting>
+</para>
<para>
To insert an image, you would use:
ps.close();
fis.close();
</programlisting>
+</para>
<para>
Now in this example, setBinaryStream transfers a set number of bytes from a
stream into a large object, and stores the OID into the field holding a
reference to it.
+</para>
<para>
Retrieving an image is even easier (I'm using PreparedStatement here, but
}
ps.close();
</programlisting>
+</para>
<para>
Now here you can see where the Large Object is retrieved as an InputStream.
You'll also notice that we close the stream before processing the next row in
the result. This is part of the <acronym>JDBC</acronym> Specification, which states that any
InputStream returned is closed when ResultSet.next() or ResultSet.close() is called.
-
+</para>
+</sect1>
<sect1>
<title><application>Postgres</application> Extensions to the <acronym>JDBC</acronym> <acronym>API</acronym></title>
You can add your own functions
to the backend, which can then be called from queries, or even add your own
data types.
+</para>
<para>
Now, as these are facilities unique to us, we support them from Java, with
a set of extension <acronym>API</acronym>'s. Some features within
It's up to you, and your applications requirements.
</programlisting>
+</para>
+</sect1>
<sect1>
<title>Further Reading</title>
and the <acronym>JDBC</acronym> Specification.
Both are available on
<ulink url="http://www.javasoft.com">JavaSoft's web site</ulink>.
+</para>
<para>
<ulink url="http://www.retep.org.uk">My own web site</ulink>
contains updated information not included in this
document, and also includes precompiled drivers for v6.4, and earlier.
-
-</chapter>
\ No newline at end of file
+</para>
+</sect1>
+</chapter>
<!--
-$Header: /cvsroot/pgsql/doc/src/sgml/Attic/keys.sgml,v 1.2 1998/08/17 16:18:13 thomas Exp $
+$Header: /cvsroot/pgsql/doc/src/sgml/Attic/keys.sgml,v 1.3 1998/12/29 02:24:16 thomas Exp $
Indices and Keys
$Log: keys.sgml,v $
+Revision 1.3 1998/12/29 02:24:16 thomas
+Clean up to ensure tag completion as required by the newest versions
+ of Norm's Modular Style Sheets and jade/docbook.
+From Vince Vielhaber <vev@michvhf.com>.
+
Revision 1.2 1998/08/17 16:18:13 thomas
Small sentence cleanups. Add tags for acronyms and products.
</Para>
</ListItem>
</itemizedlist>
+</para>
+</listitem>
<ListItem>
<Para>
</Para>
</ListItem>
</itemizedlist>
+</para>
+</listitem>
</itemizedlist>
+</para>
<Para>
As for why no non-unique keys are defined explicitly in standard <acronym>SQL</acronym> syntax?
<ProductName>PostgreSQL</ProductName> is copyright (C) 1996-8
by the PostgreSQL Global Development Group,
and is distributed under the terms of the Berkeley license.
+</Para>
<Para>
<ProductName>Postgres95</ProductName> is copyright (C) 1994-5
Hewlett-Packard Co. OSF/1 is a trademark of the Open
Software Foundation.
</Para>
+</Sect1>
+
</TITLE>
<PARA><FUNCTION>pg_connect</FUNCTION> opens a connection to the
<ProductName>Postgres</ProductName> backend.
+</Para>
<para>
Two syntaxes are available. In the older one, each possible option
The result is a list describing the possible connection options and their
current default values.
Each entry in the list is a sublist of the format:
+</Para>
<para>
{optname label dispchar dispsize value}
+</Para>
<Para>
where the optname is usable as an option in
<FUNCTION>pg_connect -conninfo</FUNCTION>.
Query result handles start with the connection handle and add a period
and a result number.
+</Para>
<PARA>
Note that lack of a Tcl error is not proof that the query succeeded!
in pg_exec.
</PARA>
</REFSECT1>
+</refentry>
<REFENTRY ID="PGTCL-PGRESULT">
<REFMETA>
<PARA>
<FUNCTION>pg_result</FUNCTION> returns information about a query result
created by a prior <FUNCTION>pg_exec</FUNCTION>.
+</Para>
<para>
You can keep a query result around for as long as you need it, but when
idle state of an application written with Tk. In non-Tk Tcl shells, you can
execute <FUNCTION>update</FUNCTION> or <FUNCTION>vwait</FUNCTION> to cause
the idle loop to be entered.
+</Para>
<para>
You should not invoke the SQL statements LISTEN or UNLISTEN directly when
../src/test/examples
../src/bin/psql
</ProgramListing>
+</Para>
<Para>
Frontend programs which use <FileName>libpq</FileName> must include the
<synopsis>
ConnStatusType *PQstatus(PGconn *conn)
</synopsis>
+</Para>
<Para>
A failed connection attempt is signaled by status CONNECTION_BAD.
communications failure might result in the status changing to
CONNECTION_BAD prematurely. In that case the application could
try to recover by calling PQreset.
+</Para>
</ListItem>
<ListItem>
<synopsis>
char *PQerrorMessage(PGconn* conn);
</synopsis>
+</Para>
<Para>
Nearly all libpq functions will set PQerrorMessage if they fail.
Note that by libpq convention, a non-empty PQerrorMessage will
include a trailing newline.
+</Para>
</ListItem>
<ListItem>
int PQfnumber(PGresult *res,
char* field_name);
</synopsis>
+</Para>
<Para>
-1 is returned if the given name does not match any field.
+</Para>
</ListItem>
<ListItem>
The PQexec function is adequate for submitting queries in simple synchronous
applications. It has a couple of major deficiencies however:
-<Para>
<ItemizedList>
<ListItem>
<Para>
underlying functions that PQexec is built from: PQsendQuery and
PQgetResult.
-<Para>
<ItemizedList>
<ListItem>
<Para>
next SQL command. This can be avoided by proper use of three more
functions:
-<Para>
<ItemizedList>
<ListItem>
<Para>
if PQisBusy returns FALSE. It can also call PQnotifies to detect NOTIFY
messages (see "Asynchronous Notification", below). An example is given
in the sample programs section.
+</Para>
<Para>
A frontend that uses PQsendQuery/PQgetResult can also attempt to cancel
a query that is still being processed by the backend.
+</Para>
<Para>
<ItemizedList>
<Para>
Note that if the current query is part of a transaction, cancellation
will abort the whole transaction.
+</Para>
<Para>
PQrequestCancel can safely be invoked from a signal handler. So, it is
cancellation of queries that it issues through PQexec. Note that
PQrequestCancel will have no effect if the connection is not currently open
or the backend is not currently processing a query.
+</Para>
</Sect1>
function calls to the backend. This is a trapdoor into system internals and
can be a potential security hole. Most users will not need this feature.
-<Para>
<ItemizedList>
<ListItem>
<Para>
that needs to be communicated is transferred through a database relation.
Commonly the condition name is the same as the associated relation, but it is
not necessary for there to be any associated relation.
+</Para>
<Para>
<FileName>libpq</FileName> applications submit LISTEN and UNLISTEN
commands as ordinary SQL queries. Subsequently, arrival of NOTIFY
messages can be detected by calling PQnotifies().
-<Para>
<ItemizedList>
<ListItem>
<Para>
<Para>
The second sample program gives an example of the use
of asynchronous notification.
+</Para>
<Para>
PQnotifies() does not actually read backend data; it just returns messages
<synopsis>
int PQendcopy(PGconn *conn);
</synopsis>
+</Para>
<Para>
As an example:
fprintf(stderr, "%s", message);
}
</ProgramListing>
+</Para>
<Para>
To use a special notice processor, call <function>PQsetNoticeProcessor</function> just after
creation of a new PGconn object.
+</Para>
</Sect1>
}
</ProgramListing>
-<Para>
+</Para>
</Sect2>
</Sect1>
lo_open. On success, <Acronym>lo_close</Acronym> returns zero. On error,
the return value is negative.
</Para>
+</sect2>
</Sect1>
<Sect1>
location for the installation. Remember that all database access actually
occurs through the database backend, so that any location specified must
be accessible by the backend.
+</Para>
<Para>
Alternate database locations are created and referenced by an environment variable
although using variable names with a prefix of <quote>PGDATA</quote> is recommended
to avoid confusion
and conflict with other variables.
+</Para>
<Note>
<Para>
For security and integrity reasons,
any path or environment variable specified has some
additional path fields appended.
+</Para>
<Para>
Alternate database locations must be prepared by running
<Application>initlocation</Application>.
+</Para>
<Para>
To create a data storage area using the environment variable
Creating Postgres database system directory /alt/postgres/data
Creating Postgres database system directory /alt/postgres/data/base
</ProgramListing>
+</Para>
<Para>
-To create a database in the alternate storage area <envar>PGDATA2<envar>
+To create a database in the alternate storage area <envar>PGDATA2</envar>
from the command line, use the following command:
<ProgramListing>
% createdb -D PGDATA2 mydb
ERROR: Unable to create database directory /alt/postgres/data/base/mydb
createdb: database creation failed on mydb.
</ProgramListing>
+</Para>
</Sect1>
<Title>Database Privileges</Title>
<Para>
+</para>
</Sect2>
<Sect2>
databases on a single host, this term more precisely denotes any
particular set of installed
<Productname>Postgres</Productname> binaries and databases.
+</para>
<para>
The
the same as the Unix superuser (which will be referred to as <firstterm>root</firstterm>).
The superuser should have a non-zero user identifier (<firstterm>UID</firstterm>)
for security reasons.
+</para>
<para>
The
the method described below
and maintain a set of template databases for use by
<application>createdb</application>.
+</para>
<para>
The <application>postmaster</application>
can take several command-line arguments to tune its behavior.
However, supplying arguments is necessary only if you intend to run multiple
sites or a non-default site.
+</para>
<para>
The <Productname>Postgres</Productname> backend
doing this bypasses the shared buffer pool and lock table associated
with a postmaster/site, therefore this is not recommended in a multiuser
site.
+</para>
+</sect1>
<sect1>
<title>Notation</title>
<quote>...</quote> or <filename>/usr/local/pgsql/</filename>
at the front of a file name is used to represent the
path to the <Productname>Postgres</Productname> superuser's home directory.
+</para>
<para>
In a command synopsis, brackets
Anything in braces
(<quote>{</quote> and <quote>}</quote>) and containing vertical bars (<quote>|</quote>)
indicates that you must choose one.
+</para>
<para>
In examples, parentheses (<quote>(</quote> and <quote>)</quote>) are used to group boolean
expressions. <quote>|</quote> is the boolean operator OR.
+</para>
<para>
Examples will show commands executed from various accounts and programs.
<quote>$</quote>.
<acronym>SQL</acronym> commands will be preceeded with <quote>=></quote>
or will have no leading prompt, depending on the context.
+</para>
<note>
<para>
flagging commands is not universally consistant throughout the documentation set.
Please report problems to
<ulink url="mailto:docs@postgresql.org">the Documentation Mailing List</ulink>.
+</para>
</note>
</sect1>
<Title>ODBC Interface</Title>
-<Para>
<Note>
<Para>
Background information originally by
between frontend applications and database servers,
allowing a user or developer to write applications which are
transportable between servers from different manufacturers..
+</Para>
<Sect1>
<Title>Background</Title>
on the backend to an <acronym>ODBC</acronym>-compatible data source.
This could be anything from a text file to an Oracle or
<productname>Postgres</productname> <acronym>RDBMS</acronym>.
+</Para>
<Para>
The backend access come from <acronym>ODBC</acronym> drivers,
allow data access. <productname>psqlODBC</productname> is such a driver,
along with others that are
available, such as the OpenLink <acronym>ODBC</acronym> drivers.
+</Para>
<Para>
Once you write an <acronym>ODBC</acronym> application,
you <emphasis>should</emphasis> be able to connect to <emphasis>any</emphasis>
back end database, regardless of the vendor, as long as the database schema
is the same.
+</Para>
<Para>
For example. you could have <productname>MS SQL Server</productname>
your Windows application would make exactly the
same calls and the back end data source would look the same (to the Windows
app).
+</Para>
<para>
<ulink url="http://www.insightdist.com/">Insight Distributors</ulink>
<ulink url="http://www.insightdist.com/psqlodbc/"><acronym>FAQ</acronym></ulink>,
ongoing development on the code base, and actively participate on the
<ulink url="mailto:interfaces@postgresql.org">interfaces mailing list</ulink>.
+</Para>
+</sect1>
<sect1>
<title><productname>Windows</productname> Applications</title>
<ListItem>
<Para>
Access, Delphi, and Visual Basic all support <acronym>ODBC</acronym> directly.
-
+</Para>
+</listitem>
<ListItem>
<Para>
Under C++, such as Visual C++,
you can use the C++ <acronym>ODBC</acronym> <acronym>API</acronym>.
+</Para>
+</listitem>
<ListItem>
<Para>
<acronym>ODBC</acronym> <acronym>API</acronym>
set within an MFC 4.2 class. This is the easiest route if you are doing
Windows C++ development under Windows NT.
+</Para>
+</listitem>
</ItemizedList>
+</Para>
<sect2>
<title>Writing Applications</title>
to the <productname>Postgres</productname> server,
or is that only when another database program
like MS SQL Server or Access needs to access the data?</quote>
-
+</para>
<Para>
The <acronym>ODBC</acronym> <acronym>API</acronym>
is the way to go.
For <productname>Visual C++</productname> coding you can find out more at
Microsoft's web site or in your <productname>VC++</productname> docs.
+</Para>
<Para>
Visual Basic and the other RAD tools have Recordset objects
directly to access data. Using the data-aware controls, you can quickly
link to the <acronym>ODBC</acronym> back end database
(<Emphasis>very</Emphasis> quickly).
+</Para>
<Para>
Playing around with MS Access will help you sort this out. Try using
<literal>File->Get External Data</literal>.
+</Para>
<Tip>
<Para>
</Para>
</Tip>
-->
+</sect2>
+</sect1>
<sect1>
<title>Unix Installation</title>
demonstrated under Linux with <productname>Postgres</productname> v6.4
using the <productname>psqlODBC</productname>
driver contained in the <productname>Postgres</productname> distribution.
+</Para>
<sect2>
<title>Building the Driver</title>
document, but there is a <filename>README</filename>
that can be found inside the <productname>iodbc</productname> compressed
.shar file that should explain how to get it up and running.
+</Para>
<para>
Having said that, any driver manager that you can find for your platform
should support the <productname>psqlODBC</productname> driver
or any <acronym>ODBC</acronym> driver.
+</Para>
<para>
The Unix configuration files for <productname>psqlODBC</productname>
these include Linux and FreeBSD but we are hoping other users will
contribute the necessary information to quickly expand the number of
platforms for which the driver can be built.
+</Para>
<para>
There are actually two separate methods to build the driver depending on
client applications on multiple, heterogeneous platforms. The integrated
installation is convenient when the target client is the same as the
server, or when the client and server have similar runtime configurations.
+</Para>
<para>
Specifically if you have received the <productname>psqlODBC</productname>
If you received the driver as a standalone package than you will run
configure and make from the directory in which you unpacked the
driver source.
+</Para>
<procedure>
<title>Integrated Installation</title>
<para>
This installation procedure is appropriate for an integrated installation.
+</Para>
<step performance="required">
<para>
% ./configure --with-odbc
% make
</programlisting>
-
+</Para>
+</step>
<step performance="required">
<para>
Rebuild the <productname>Postgres</productname> distribution:
<programlisting>
% make install
</programlisting>
-
+</Para>
+</step>
</procedure>
<para>
<programlisting>
% make ODBCINST=<replaceable>filename</replaceable> install
</programlisting>
+</Para>
<procedure>
<title>Pre-v6.4 Integrated Installation</title>
v6.4, you have the original source tree available,
and you want to use the newest version of the <acronym>ODBC</acronym>
driver, then you may want to try this form of installation.
+</Para>
<step performance="required">
<para>
Copy the output tar file to your target system and unpack it into a
clean directory.
-
+</Para>
+</step>
<step performance="required">
<para>
From the directory containing the
% make
% make POSTGRESDIR=<replaceable class="parameter">PostgresTopDir</replaceable> install
</programlisting>
+</Para>
+</step>
<step performance="optional">
<para>
<programlisting>
% make BINDIR=bindir LIBDIR=libdir HEADERDIR=headerdir ODBCINST=instfile install
</programlisting>
-
+</Para>
+</step>
</procedure>
<procedure>
for building the <acronym>ODBC</acronym> driver for multiple, heterogeneous
clients who do not have a locally-installed <productname>Postgres</productname>
source tree.
+</Para>
<para>
The default location for libraries and headers
as <filename>/share/odbcinst.ini</filename> (if <filename>/share</filename>
exists) or as <filename>/etc/odbcinst.ini</filename>
(if <filename>/share</filename> does not exist).
+</Para>
<note>
<para>