Commit 1b342df0 authored by Peter Eisentraut's avatar Peter Eisentraut

Merge documentation updates from 7.3 branch.

parent b3279066
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/advanced.sgml,v 1.30 2002/10/24 17:48:54 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/advanced.sgml,v 1.31 2002/11/11 20:14:02 petere Exp $
--> -->
<chapter id="tutorial-advanced"> <chapter id="tutorial-advanced">
...@@ -46,14 +46,14 @@ $Header: /cvsroot/pgsql/doc/src/sgml/advanced.sgml,v 1.30 2002/10/24 17:48:54 pe ...@@ -46,14 +46,14 @@ $Header: /cvsroot/pgsql/doc/src/sgml/advanced.sgml,v 1.30 2002/10/24 17:48:54 pe
<firstterm>view</firstterm> over the query, which gives a name to <firstterm>view</firstterm> over the query, which gives a name to
the query that you can refer to like an ordinary table. the query that you can refer to like an ordinary table.
<programlisting> <programlisting>
CREATE VIEW myview AS CREATE VIEW myview AS
SELECT city, temp_lo, temp_hi, prcp, date, location SELECT city, temp_lo, temp_hi, prcp, date, location
FROM weather, cities FROM weather, cities
WHERE city = name; WHERE city = name;
SELECT * FROM myview; SELECT * FROM myview;
</programlisting> </programlisting>
</para> </para>
<para> <para>
...@@ -101,7 +101,7 @@ SELECT * FROM myview; ...@@ -101,7 +101,7 @@ SELECT * FROM myview;
<para> <para>
The new declaration of the tables would look like this: The new declaration of the tables would look like this:
<programlisting> <programlisting>
CREATE TABLE cities ( CREATE TABLE cities (
city varchar(80) primary key, city varchar(80) primary key,
location point location point
...@@ -114,23 +114,23 @@ CREATE TABLE weather ( ...@@ -114,23 +114,23 @@ CREATE TABLE weather (
prcp real, prcp real,
date date date date
); );
</programlisting> </programlisting>
Now try inserting an invalid record: Now try inserting an invalid record:
<programlisting> <programlisting>
INSERT INTO weather VALUES ('Berkeley', 45, 53, 0.0, '1994-11-28'); INSERT INTO weather VALUES ('Berkeley', 45, 53, 0.0, '1994-11-28');
</programlisting> </programlisting>
<screen> <screen>
ERROR: &lt;unnamed&gt; referential integrity violation - key referenced from weather not found in cities ERROR: &lt;unnamed&gt; referential integrity violation - key referenced from weather not found in cities
</screen> </screen>
</para> </para>
<para> <para>
The behavior of foreign keys can be finely tuned to your The behavior of foreign keys can be finely tuned to your
application. We will not go beyond this simple example in this application. We will not go beyond this simple example in this
tutorial, but just refer you to the &cite-reference; tutorial, but just refer you to the &cite-user;
for more information. Making correct use of for more information. Making correct use of
foreign keys will definitely improve the quality of your database foreign keys will definitely improve the quality of your database
applications, so you are strongly encouraged to learn about them. applications, so you are strongly encouraged to learn about them.
...@@ -161,7 +161,7 @@ ERROR: &lt;unnamed&gt; referential integrity violation - key referenced from we ...@@ -161,7 +161,7 @@ ERROR: &lt;unnamed&gt; referential integrity violation - key referenced from we
to Bob's account. Simplifying outrageously, the SQL commands for this to Bob's account. Simplifying outrageously, the SQL commands for this
might look like might look like
<programlisting> <programlisting>
UPDATE accounts SET balance = balance - 100.00 UPDATE accounts SET balance = balance - 100.00
WHERE name = 'Alice'; WHERE name = 'Alice';
UPDATE branches SET balance = balance - 100.00 UPDATE branches SET balance = balance - 100.00
...@@ -170,7 +170,7 @@ UPDATE accounts SET balance = balance + 100.00 ...@@ -170,7 +170,7 @@ UPDATE accounts SET balance = balance + 100.00
WHERE name = 'Bob'; WHERE name = 'Bob';
UPDATE branches SET balance = balance + 100.00 UPDATE branches SET balance = balance + 100.00
WHERE name = (SELECT branch_name FROM accounts WHERE name = 'Bob'); WHERE name = (SELECT branch_name FROM accounts WHERE name = 'Bob');
</programlisting> </programlisting>
</para> </para>
<para> <para>
...@@ -222,13 +222,13 @@ UPDATE branches SET balance = balance + 100.00 ...@@ -222,13 +222,13 @@ UPDATE branches SET balance = balance + 100.00
<command>BEGIN</> and <command>COMMIT</> commands. So our banking <command>BEGIN</> and <command>COMMIT</> commands. So our banking
transaction would actually look like transaction would actually look like
<programlisting> <programlisting>
BEGIN; BEGIN;
UPDATE accounts SET balance = balance - 100.00 UPDATE accounts SET balance = balance - 100.00
WHERE name = 'Alice'; WHERE name = 'Alice';
-- etc etc -- etc etc
COMMIT; COMMIT;
</programlisting> </programlisting>
</para> </para>
<para> <para>
...@@ -278,7 +278,7 @@ COMMIT; ...@@ -278,7 +278,7 @@ COMMIT;
implicitly when you list all cities. If you're really clever you implicitly when you list all cities. If you're really clever you
might invent some scheme like this: might invent some scheme like this:
<programlisting> <programlisting>
CREATE TABLE capitals ( CREATE TABLE capitals (
name text, name text,
population real, population real,
...@@ -296,7 +296,7 @@ CREATE VIEW cities AS ...@@ -296,7 +296,7 @@ CREATE VIEW cities AS
SELECT name, population, altitude FROM capitals SELECT name, population, altitude FROM capitals
UNION UNION
SELECT name, population, altitude FROM non_capitals; SELECT name, population, altitude FROM non_capitals;
</programlisting> </programlisting>
This works OK as far as querying goes, but it gets ugly when you This works OK as far as querying goes, but it gets ugly when you
need to update several rows, to name one thing. need to update several rows, to name one thing.
...@@ -305,7 +305,7 @@ CREATE VIEW cities AS ...@@ -305,7 +305,7 @@ CREATE VIEW cities AS
<para> <para>
A better solution is this: A better solution is this:
<programlisting> <programlisting>
CREATE TABLE cities ( CREATE TABLE cities (
name text, name text,
population real, population real,
...@@ -315,7 +315,7 @@ CREATE TABLE cities ( ...@@ -315,7 +315,7 @@ CREATE TABLE cities (
CREATE TABLE capitals ( CREATE TABLE capitals (
state char(2) state char(2)
) INHERITS (cities); ) INHERITS (cities);
</programlisting> </programlisting>
</para> </para>
<para> <para>
...@@ -336,11 +336,11 @@ CREATE TABLE capitals ( ...@@ -336,11 +336,11 @@ CREATE TABLE capitals (
including state capitals, that are located at an altitude including state capitals, that are located at an altitude
over 500 ft.: over 500 ft.:
<programlisting> <programlisting>
SELECT name, altitude SELECT name, altitude
FROM cities FROM cities
WHERE altitude &gt; 500; WHERE altitude &gt; 500;
</programlisting> </programlisting>
which returns: which returns:
...@@ -359,11 +359,11 @@ SELECT name, altitude ...@@ -359,11 +359,11 @@ SELECT name, altitude
all the cities that are not state capitals and all the cities that are not state capitals and
are situated at an altitude of 500 ft. or higher: are situated at an altitude of 500 ft. or higher:
<programlisting> <programlisting>
SELECT name, altitude SELECT name, altitude
FROM ONLY cities FROM ONLY cities
WHERE altitude &gt; 500; WHERE altitude &gt; 500;
</programlisting> </programlisting>
<screen> <screen>
name | altitude name | altitude
...@@ -380,7 +380,7 @@ SELECT name, altitude ...@@ -380,7 +380,7 @@ SELECT name, altitude
<classname>cities</classname> table, and not tables below <classname>cities</classname> table, and not tables below
<classname>cities</classname> in the inheritance hierarchy. Many <classname>cities</classname> in the inheritance hierarchy. Many
of the commands that we have already discussed -- of the commands that we have already discussed --
<command>SELECT</command>, <command>UPDATE</command> and <command>SELECT</command>, <command>UPDATE</command>, and
<command>DELETE</command> -- support this <literal>ONLY</literal> <command>DELETE</command> -- support this <literal>ONLY</literal>
notation. notation.
</para> </para>
......
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/array.sgml,v 1.23 2002/11/10 00:32:16 momjian Exp $ --> <!-- $Header: /cvsroot/pgsql/doc/src/sgml/array.sgml,v 1.24 2002/11/11 20:14:02 petere Exp $ -->
<sect1 id="arrays"> <sect1 id="arrays">
<title>Arrays</title> <title>Arrays</title>
...@@ -21,7 +21,7 @@ CREATE TABLE sal_emp ( ...@@ -21,7 +21,7 @@ CREATE TABLE sal_emp (
</programlisting> </programlisting>
As shown, an array data type is named by appending square brackets As shown, an array data type is named by appending square brackets
(<literal>[]</>) to the data type name of the array elements. (<literal>[]</>) to the data type name of the array elements.
The above query will create a table named The above command will create a table named
<structname>sal_emp</structname> with columns including <structname>sal_emp</structname> with columns including
a <type>text</type> string (<structfield>name</structfield>), a <type>text</type> string (<structfield>name</structfield>),
a one-dimensional array of type a one-dimensional array of type
...@@ -68,7 +68,7 @@ SELECT name FROM sal_emp WHERE pay_by_quarter[1] &lt;&gt; pay_by_quarter[2]; ...@@ -68,7 +68,7 @@ SELECT name FROM sal_emp WHERE pay_by_quarter[1] &lt;&gt; pay_by_quarter[2];
The array subscript numbers are written within square brackets. The array subscript numbers are written within square brackets.
By default <productname>PostgreSQL</productname> uses the By default <productname>PostgreSQL</productname> uses the
<quote>one-based</quote> numbering convention for arrays, that is, one-based numbering convention for arrays, that is,
an array of <replaceable>n</> elements starts with <literal>array[1]</literal> and an array of <replaceable>n</> elements starts with <literal>array[1]</literal> and
ends with <literal>array[<replaceable>n</>]</literal>. ends with <literal>array[<replaceable>n</>]</literal>.
</para> </para>
...@@ -90,10 +90,9 @@ SELECT pay_by_quarter[3] FROM sal_emp; ...@@ -90,10 +90,9 @@ SELECT pay_by_quarter[3] FROM sal_emp;
<para> <para>
We can also access arbitrary rectangular slices of an array, or We can also access arbitrary rectangular slices of an array, or
subarrays. An array slice is denoted by writing subarrays. An array slice is denoted by writing
<literal><replaceable>lower subscript</replaceable> : <literal><replaceable>lower-bound</replaceable>:<replaceable>upper-bound</replaceable></literal>
<replaceable>upper subscript</replaceable></literal> for one or more for one or more array dimensions. This query retrieves the first
array dimensions. This query retrieves the first item on Bill's item on Bill's schedule for the first two days of the week:
schedule for the first two days of the week:
<programlisting> <programlisting>
SELECT schedule[1:2][1:1] FROM sal_emp WHERE name = 'Bill'; SELECT schedule[1:2][1:1] FROM sal_emp WHERE name = 'Bill';
...@@ -112,9 +111,10 @@ SELECT schedule[1:2][1] FROM sal_emp WHERE name = 'Bill'; ...@@ -112,9 +111,10 @@ SELECT schedule[1:2][1] FROM sal_emp WHERE name = 'Bill';
with the same result. An array subscripting operation is taken to with the same result. An array subscripting operation is taken to
represent an array slice if any of the subscripts are written in the represent an array slice if any of the subscripts are written in the
form <replaceable>lower</replaceable> <literal>:</literal> form
<replaceable>upper</replaceable>. A lower bound of 1 is assumed for <literal><replaceable>lower</replaceable>:<replaceable>upper</replaceable></literal>.
any subscript where only one value is specified. A lower bound of 1 is assumed for any subscript where only one value
is specified.
</para> </para>
<para> <para>
...@@ -310,7 +310,7 @@ SELECT * FROM sal_emp WHERE pay_by_quarter **= 10000; ...@@ -310,7 +310,7 @@ SELECT * FROM sal_emp WHERE pay_by_quarter **= 10000;
<tip> <tip>
<para> <para>
Remember that what you write in an SQL query will first be interpreted Remember that what you write in an SQL command will first be interpreted
as a string literal, and then as an array. This doubles the number of as a string literal, and then as an array. This doubles the number of
backslashes you need. For example, to insert a <type>text</> array backslashes you need. For example, to insert a <type>text</> array
value containing a backslash and a double quote, you'd need to write value containing a backslash and a double quote, you'd need to write
...@@ -323,7 +323,7 @@ INSERT ... VALUES ('{"\\\\","\\""}'); ...@@ -323,7 +323,7 @@ INSERT ... VALUES ('{"\\\\","\\""}');
become <literal>\</> and <literal>"</> respectively. (If we were working become <literal>\</> and <literal>"</> respectively. (If we were working
with a data type whose input routine also treated backslashes specially, with a data type whose input routine also treated backslashes specially,
<type>bytea</> for example, we might need as many as eight backslashes <type>bytea</> for example, we might need as many as eight backslashes
in the query to get one backslash into the stored array element.) in the command to get one backslash into the stored array element.)
</para> </para>
</tip> </tip>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/backup.sgml,v 2.23 2002/10/21 02:11:37 tgl Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/backup.sgml,v 2.24 2002/11/11 20:14:02 petere Exp $
--> -->
<chapter id="backup"> <chapter id="backup">
<title>Backup and Restore</title> <title>Backup and Restore</title>
...@@ -64,7 +64,7 @@ pg_dump <replaceable class="parameter">dbname</replaceable> &gt; <replaceable cl ...@@ -64,7 +64,7 @@ pg_dump <replaceable class="parameter">dbname</replaceable> &gt; <replaceable cl
<para> <para>
As any other <productname>PostgreSQL</> client application, As any other <productname>PostgreSQL</> client application,
<application>pg_dump</> will by default connect with the database <application>pg_dump</> will by default connect with the database
user name that is equal to the current Unix user name. To override user name that is equal to the current operating system user name. To override
this, either specify the <option>-U</option> option or set the this, either specify the <option>-U</option> option or set the
environment variable <envar>PGUSER</envar>. Remember that environment variable <envar>PGUSER</envar>. Remember that
<application>pg_dump</> connections are subject to the normal <application>pg_dump</> connections are subject to the normal
...@@ -104,9 +104,9 @@ psql <replaceable class="parameter">dbname</replaceable> &lt; <replaceable class ...@@ -104,9 +104,9 @@ psql <replaceable class="parameter">dbname</replaceable> &lt; <replaceable class
</synopsis> </synopsis>
where <replaceable class="parameter">infile</replaceable> is what where <replaceable class="parameter">infile</replaceable> is what
you used as <replaceable class="parameter">outfile</replaceable> you used as <replaceable class="parameter">outfile</replaceable>
for the pg_dump command. The database <replaceable for the <command>pg_dump</> command. The database <replaceable
class="parameter">dbname</replaceable> will not be created by this class="parameter">dbname</replaceable> will not be created by this
command, you must create it yourself from template0 before executing command, you must create it yourself from <literal>template0</> before executing
<application>psql</> (e.g., with <literal>createdb -T template0 <application>psql</> (e.g., with <literal>createdb -T template0
<replaceable class="parameter">dbname</></literal>). <replaceable class="parameter">dbname</></literal>).
<application>psql</> supports similar options to <application>pg_dump</> <application>psql</> supports similar options to <application>pg_dump</>
...@@ -129,21 +129,20 @@ psql <replaceable class="parameter">dbname</replaceable> &lt; <replaceable class ...@@ -129,21 +129,20 @@ psql <replaceable class="parameter">dbname</replaceable> &lt; <replaceable class
The ability of <application>pg_dump</> and <application>psql</> to The ability of <application>pg_dump</> and <application>psql</> to
write to or read from pipes makes it possible to dump a database write to or read from pipes makes it possible to dump a database
directly from one server to another, for example directly from one server to another, for example
<informalexample>
<programlisting> <programlisting>
pg_dump -h <replaceable>host1</> <replaceable>dbname</> | psql -h <replaceable>host2</> <replaceable>dbname</> pg_dump -h <replaceable>host1</> <replaceable>dbname</> | psql -h <replaceable>host2</> <replaceable>dbname</>
</programlisting> </programlisting>
</informalexample>
</para> </para>
<important> <important>
<para> <para>
The dumps produced by pg_dump are relative to template0. This means The dumps produced by <application>pg_dump</> are relative to
that any languages, procedures, etc. added to template1 will also be <literal>template0</>. This means that any languages, procedures,
dumped by <application>pg_dump</>. As a result, when restoring, if etc. added to <literal>template1</> will also be dumped by
you are using a customized template1, you must create the empty <application>pg_dump</>. As a result, when restoring, if you are
database from template0, as in the example above. using a customized <literal>template1</>, you must create the
empty database from <literal>template0</>, as in the example
above.
</para> </para>
</important> </important>
...@@ -222,20 +221,16 @@ cat <replaceable class="parameter">filename</replaceable>.gz | gunzip | psql <re ...@@ -222,20 +221,16 @@ cat <replaceable class="parameter">filename</replaceable>.gz | gunzip | psql <re
acceptable in size to the underlying file system. For example, to acceptable in size to the underlying file system. For example, to
make chunks of 1 megabyte: make chunks of 1 megabyte:
<informalexample>
<programlisting> <programlisting>
pg_dump <replaceable class="parameter">dbname</replaceable> | split -b 1m - <replaceable class="parameter">filename</replaceable> pg_dump <replaceable class="parameter">dbname</replaceable> | split -b 1m - <replaceable class="parameter">filename</replaceable>
</programlisting> </programlisting>
</informalexample>
Reload with Reload with
<informalexample>
<programlisting> <programlisting>
createdb <replaceable class="parameter">dbname</replaceable> createdb <replaceable class="parameter">dbname</replaceable>
cat <replaceable class="parameter">filename</replaceable>* | psql <replaceable class="parameter">dbname</replaceable> cat <replaceable class="parameter">filename</replaceable>* | psql <replaceable class="parameter">dbname</replaceable>
</programlisting> </programlisting>
</informalexample>
</para> </para>
</formalpara> </formalpara>
...@@ -249,14 +244,11 @@ cat <replaceable class="parameter">filename</replaceable>* | psql <replaceable c ...@@ -249,14 +244,11 @@ cat <replaceable class="parameter">filename</replaceable>* | psql <replaceable c
restored selectively. The following command dumps a database using the restored selectively. The following command dumps a database using the
custom dump format: custom dump format:
<informalexample>
<programlisting> <programlisting>
pg_dump -Fc <replaceable class="parameter">dbname</replaceable> > <replaceable class="parameter">filename</replaceable> pg_dump -Fc <replaceable class="parameter">dbname</replaceable> > <replaceable class="parameter">filename</replaceable>
</programlisting> </programlisting>
</informalexample>
See the <application>pg_dump</> and <application>pg_restore</> reference pages for details. See the <application>pg_dump</> and <application>pg_restore</> reference pages for details.
</para> </para>
</formalpara> </formalpara>
...@@ -284,7 +276,7 @@ pg_dump -Fc <replaceable class="parameter">dbname</replaceable> > <replaceable c ...@@ -284,7 +276,7 @@ pg_dump -Fc <replaceable class="parameter">dbname</replaceable> > <replaceable c
<para> <para>
For reasons of backward compatibility, <application>pg_dump</> does For reasons of backward compatibility, <application>pg_dump</> does
not dump large objects by default. To dump large objects you must use not dump large objects by default. To dump large objects you must use
either the custom or the TAR output format, and use the -b option in either the custom or the TAR output format, and use the <option>-b</> option in
<application>pg_dump</>. See the reference pages for details. <application>pg_dump</>. See the reference pages for details.
The directory <filename>contrib/pg_dumplo</> of the The directory <filename>contrib/pg_dumplo</> of the
<productname>PostgreSQL</> source tree also contains a program that can <productname>PostgreSQL</> source tree also contains a program that can
...@@ -308,11 +300,10 @@ pg_dump -Fc <replaceable class="parameter">dbname</replaceable> > <replaceable c ...@@ -308,11 +300,10 @@ pg_dump -Fc <replaceable class="parameter">dbname</replaceable> > <replaceable c
are located, but you have probably found them already if you are are located, but you have probably found them already if you are
interested in this method. You can use whatever method you prefer interested in this method. You can use whatever method you prefer
for doing usual file system backups, for example for doing usual file system backups, for example
<informalexample>
<programlisting> <programlisting>
tar -cf backup.tar /usr/local/pgsql/data tar -cf backup.tar /usr/local/pgsql/data
</programlisting> </programlisting>
</informalexample>
</para> </para>
<para> <para>
...@@ -390,11 +381,11 @@ tar -cf backup.tar /usr/local/pgsql/data ...@@ -390,11 +381,11 @@ tar -cf backup.tar /usr/local/pgsql/data
The least downtime can be achieved by installing the new server in The least downtime can be achieved by installing the new server in
a different directory and running both the old and the new servers a different directory and running both the old and the new servers
in parallel, on different ports. Then you can use something like in parallel, on different ports. Then you can use something like
<informalexample>
<programlisting> <programlisting>
pg_dumpall -p 5432 | psql -d template1 -p 6543 pg_dumpall -p 5432 | psql -d template1 -p 6543
</programlisting> </programlisting>
</informalexample>
to transfer your data, or use an intermediate file if you want. to transfer your data, or use an intermediate file if you want.
Then you can shut down the old server and start the new server at Then you can shut down the old server and start the new server at
the port the old one was running at. You should make sure that the the port the old one was running at. You should make sure that the
...@@ -410,7 +401,7 @@ pg_dumpall -p 5432 | psql -d template1 -p 6543 ...@@ -410,7 +401,7 @@ pg_dumpall -p 5432 | psql -d template1 -p 6543
do the back up step before installing the new version, bring down do the back up step before installing the new version, bring down
the server, move the old version out of the way, install the new the server, move the old version out of the way, install the new
version, start the new server, restore the data. For example: version, start the new server, restore the data. For example:
<informalexample>
<programlisting> <programlisting>
pg_dumpall > backup pg_dumpall > backup
pg_ctl stop pg_ctl stop
...@@ -421,7 +412,7 @@ initdb -D /usr/local/pgsql/data ...@@ -421,7 +412,7 @@ initdb -D /usr/local/pgsql/data
postmaster -D /usr/local/pgsql/data postmaster -D /usr/local/pgsql/data
psql template1 < backup psql template1 < backup
</programlisting> </programlisting>
</informalexample>
See <xref linkend="runtime"> about ways to start and stop the See <xref linkend="runtime"> about ways to start and stop the
server and other details. The installation instructions will advise server and other details. The installation instructions will advise
you of strategic places to perform these steps. you of strategic places to perform these steps.
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/client-auth.sgml,v 1.39 2002/09/21 18:32:52 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/client-auth.sgml,v 1.40 2002/11/11 20:14:02 petere Exp $
--> -->
<chapter id="client-authentication"> <chapter id="client-authentication">
...@@ -62,7 +62,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/client-auth.sgml,v 1.39 2002/09/21 18:32:52 ...@@ -62,7 +62,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/client-auth.sgml,v 1.39 2002/09/21 18:32:52
</para> </para>
<para> <para>
The general format of the <filename>pg_hba.conf</filename> file is of The general format of the <filename>pg_hba.conf</filename> file is
a set of records, one per line. Blank lines are ignored, as is any a set of records, one per line. Blank lines are ignored, as is any
text after the <quote>#</quote> comment character. A record is made text after the <quote>#</quote> comment character. A record is made
up of a number of fields which are separated by spaces and/or tabs. up of a number of fields which are separated by spaces and/or tabs.
...@@ -305,8 +305,9 @@ hostssl <replaceable>database</replaceable> <replaceable>user</replaceable> < ...@@ -305,8 +305,9 @@ hostssl <replaceable>database</replaceable> <replaceable>user</replaceable> <
<para> <para>
If you use the map <literal>sameuser</literal>, the user If you use the map <literal>sameuser</literal>, the user
names are assumed to be identical. If not, the map name is names are assumed to be identical. If not, the map name is
looked up in the <literal>$PGDATA/pg_ident.conf</literal> looked up in the file <filename>pg_ident.conf</filename>
file. The connection is accepted if that file contains an in the same directory as <filename>pg_hba.conf</filename>.
The connection is accepted if that file contains an
entry for this map name with the ident-supplied user name entry for this map name with the ident-supplied user name
and the requested <productname>PostgreSQL</productname> user and the requested <productname>PostgreSQL</productname> user
name. name.
...@@ -473,7 +474,7 @@ local db1,db2,@demodbs all md5 ...@@ -473,7 +474,7 @@ local db1,db2,@demodbs all md5
<para> <para>
When <literal>trust</> authentication is specified, When <literal>trust</> authentication is specified,
<productname>PostgreSQL</productname> assumes that anyone who can <productname>PostgreSQL</productname> assumes that anyone who can
connect to the postmaster is authorized to access the database as connect to the server is authorized to access the database as
whatever database user he specifies (including the database superuser). whatever database user he specifies (including the database superuser).
This method should only be used when there is adequate system-level This method should only be used when there is adequate system-level
protection on connections to the postmaster port. protection on connections to the postmaster port.
...@@ -504,7 +505,7 @@ local db1,db2,@demodbs all md5 ...@@ -504,7 +505,7 @@ local db1,db2,@demodbs all md5
<para> <para>
<literal>trust</> authentication is only suitable for TCP connections <literal>trust</> authentication is only suitable for TCP connections
if you trust every user on every machine that is allowed to connect if you trust every user on every machine that is allowed to connect
to the postmaster by the <filename>pg_hba.conf</> lines that specify to the server by the <filename>pg_hba.conf</> lines that specify
<literal>trust</>. It is seldom reasonable to use <literal>trust</> <literal>trust</>. It is seldom reasonable to use <literal>trust</>
for any TCP connections other than those from <systemitem>localhost</> (127.0.0.1). for any TCP connections other than those from <systemitem>localhost</> (127.0.0.1).
</para> </para>
...@@ -538,14 +539,14 @@ local db1,db2,@demodbs all md5 ...@@ -538,14 +539,14 @@ local db1,db2,@demodbs all md5
<para> <para>
<productname>PostgreSQL</productname> database passwords are <productname>PostgreSQL</productname> database passwords are
separate from operating system user passwords. Ordinarily, the separate from operating system user passwords. The password for
password for each database user is stored in the pg_shadow system each database user is stored in the <literal>pg_shadow</> system
catalog table. Passwords can be managed with the query language catalog table. Passwords can be managed with the query language
commands <command>CREATE USER</command> and <command>ALTER commands <command>CREATE USER</command> and <command>ALTER
USER</command>, e.g., <userinput>CREATE USER foo WITH PASSWORD USER</command>, e.g., <userinput>CREATE USER foo WITH PASSWORD
'secret';</userinput>. By default, that is, if no password has been 'secret';</userinput>. By default, that is, if no password has
set up, the stored password is <literal>NULL</literal> and password been set up, the stored password is null and
authentication will always fail for that user. password authentication will always fail for that user.
</para> </para>
<para> <para>
...@@ -554,8 +555,8 @@ local db1,db2,@demodbs all md5 ...@@ -554,8 +555,8 @@ local db1,db2,@demodbs all md5
file. The file should contain user names separated by commas or one file. The file should contain user names separated by commas or one
user name per line, and be in the same directory as user name per line, and be in the same directory as
<filename>pg_hba.conf</>. Mention the (base) name of the file <filename>pg_hba.conf</>. Mention the (base) name of the file
preceded with <literal>@</>in the <literal>USER</> column. The preceded with <literal>@</> in the user column. The
<literal>DATABASE</> column can similarly accept a list of values or database column can similarly accept a list of values or
a file name. You can also specify group names by preceding the group a file name. You can also specify group names by preceding the group
name with <literal>+</>. name with <literal>+</>.
</para> </para>
...@@ -715,7 +716,7 @@ local db1,db2,@demodbs all md5 ...@@ -715,7 +716,7 @@ local db1,db2,@demodbs all md5
Unix-domain sockets (currently <systemitem Unix-domain sockets (currently <systemitem
class="osname">Linux</>, <systemitem class="osname">FreeBSD</>, class="osname">Linux</>, <systemitem class="osname">FreeBSD</>,
<systemitem class="osname">NetBSD</>, and <systemitem <systemitem class="osname">NetBSD</>, and <systemitem
class="osname">BSD/OS</>, ident authentication can also be applied class="osname">BSD/OS</>), ident authentication can also be applied
to local connections. In this case, no security risk is added by to local connections. In this case, no security risk is added by
using ident authentication; indeed it is a preferable choice for using ident authentication; indeed it is a preferable choice for
local connections on such systems. local connections on such systems.
......
This diff is collapsed.
This diff is collapsed.
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/ddl.sgml,v 1.8 2002/10/24 21:10:58 tgl Exp $ --> <!-- $Header: /cvsroot/pgsql/doc/src/sgml/ddl.sgml,v 1.9 2002/11/11 20:14:02 petere Exp $ -->
<chapter id="ddl"> <chapter id="ddl">
<title>Data Definition</title> <title>Data Definition</title>
...@@ -222,7 +222,7 @@ DROP TABLE products; ...@@ -222,7 +222,7 @@ DROP TABLE products;
<para> <para>
The identity (transaction ID) of the deleting transaction, or The identity (transaction ID) of the deleting transaction, or
zero for an undeleted tuple. It is possible for this field to zero for an undeleted tuple. It is possible for this field to
be nonzero in a visible tuple: that usually indicates that the be nonzero in a visible tuple: That usually indicates that the
deleting transaction hasn't committed yet, or that an attempted deleting transaction hasn't committed yet, or that an attempted
deletion was rolled back. deletion was rolled back.
</para> </para>
...@@ -353,7 +353,7 @@ CREATE TABLE products ( ...@@ -353,7 +353,7 @@ CREATE TABLE products (
price numeric <emphasis>CONSTRAINT positive_price</emphasis> CHECK (price > 0) price numeric <emphasis>CONSTRAINT positive_price</emphasis> CHECK (price > 0)
); );
</programlisting> </programlisting>
To specify a named constraint, use the key word So, to specify a named constraint, use the key word
<literal>CONSTRAINT</literal> followed by an identifier followed <literal>CONSTRAINT</literal> followed by an identifier followed
by the constraint definition. by the constraint definition.
</para> </para>
...@@ -382,7 +382,7 @@ CREATE TABLE products ( ...@@ -382,7 +382,7 @@ CREATE TABLE products (
</para> </para>
<para> <para>
We say that the first two are column constraints, whereas the We say that the first two constraints are column constraints, whereas the
third one is a table constraint because it is written separately third one is a table constraint because it is written separately
from the column definitions. Column constraints can also be from the column definitions. Column constraints can also be
written as table constraints, while the reverse is not necessarily written as table constraints, while the reverse is not necessarily
...@@ -931,7 +931,7 @@ WHERE c.altitude &gt; 500 and c.tableoid = p.oid; ...@@ -931,7 +931,7 @@ WHERE c.altitude &gt; 500 and c.tableoid = p.oid;
<para> <para>
In previous versions of <productname>PostgreSQL</productname>, the In previous versions of <productname>PostgreSQL</productname>, the
default was not to get access to child tables. This was found to default was not to get access to child tables. This was found to
be error prone and is also in violation of SQL99. Under the old be error prone and is also in violation of the SQL standard. Under the old
syntax, to get the sub-tables you append <literal>*</literal> to the table name. syntax, to get the sub-tables you append <literal>*</literal> to the table name.
For example For example
<programlisting> <programlisting>
...@@ -1609,7 +1609,7 @@ REVOKE CREATE ON public FROM PUBLIC; ...@@ -1609,7 +1609,7 @@ REVOKE CREATE ON public FROM PUBLIC;
standard. Therefore, many users consider qualified names to standard. Therefore, many users consider qualified names to
really consist of really consist of
<literal><replaceable>username</>.<replaceable>tablename</></literal>. <literal><replaceable>username</>.<replaceable>tablename</></literal>.
This is also supported by PostgreSQL if you create a per-user This is how PostgreSQL will effectively behave if you create a per-user
schema for every user. schema for every user.
</para> </para>
...@@ -1693,8 +1693,8 @@ DROP TABLE products CASCADE; ...@@ -1693,8 +1693,8 @@ DROP TABLE products CASCADE;
</screen> </screen>
and all the dependent objects will be removed. In this case, it and all the dependent objects will be removed. In this case, it
doesn't remove the orders table, it only removes the foreign key doesn't remove the orders table, it only removes the foreign key
constraint. (If you want to check what DROP ... CASCADE will do, constraint. (If you want to check what <literal>DROP ... CASCADE</> will do,
run DROP without CASCADE and read the NOTICEs.) run <command>DROP</> without <literal>CASCADE</> and read the <literal>NOTICE</> messages.)
</para> </para>
<para> <para>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/diskusage.sgml,v 1.6 2002/10/16 22:06:33 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/diskusage.sgml,v 1.7 2002/11/11 20:14:02 petere Exp $
--> -->
<chapter id="diskusage"> <chapter id="diskusage">
...@@ -32,7 +32,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/diskusage.sgml,v 1.6 2002/10/16 22:06:33 pe ...@@ -32,7 +32,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/diskusage.sgml,v 1.6 2002/10/16 22:06:33 pe
<para> <para>
You can monitor disk space from three places: from You can monitor disk space from three places: from
<application>psql</> using <command>VACUUM</> information, from <application>psql</> using <command>VACUUM</> information, from
<application>psql</> using <application>contrib/dbsize</>, and from <application>psql</> using <filename>contrib/dbsize</>, and from
the command line using <application>contrib/oid2name</>. Using the command line using <application>contrib/oid2name</>. Using
<application>psql</> on a recently vacuumed (or analyzed) database, <application>psql</> on a recently vacuumed (or analyzed) database,
you can issue queries to see the disk usage of any table: you can issue queries to see the disk usage of any table:
...@@ -94,13 +94,14 @@ play-# ORDER BY relpages DESC; ...@@ -94,13 +94,14 @@ play-# ORDER BY relpages DESC;
</para> </para>
<para> <para>
<application>dbsize</> loads functions into your database that allow <filename>contrib/dbsize</> loads functions into your database that allow
you to find the size of a table or database from inside you to find the size of a table or database from inside
<application>psql</> without the need for <command>VACUUM/ANALYZE.</> <application>psql</> without the need for <command>VACUUM/ANALYZE.</>
</para> </para>
<para> <para>
You can also use <application>oid2name</> to show disk usage. See You can also use <filename>contrib/oid2name</> to show disk usage. See
<filename>README.oid2name</> for examples. It includes a script <filename>README.oid2name</> for examples. It includes a script that
shows disk usage for each database. shows disk usage for each database.
</para> </para>
</sect1> </sect1>
......
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/dml.sgml,v 1.2 2002/10/20 05:05:46 tgl Exp $ --> <!-- $Header: /cvsroot/pgsql/doc/src/sgml/dml.sgml,v 1.3 2002/11/11 20:14:02 petere Exp $ -->
<chapter id="dml"> <chapter id="dml">
<title>Data Manipulation</title> <title>Data Manipulation</title>
...@@ -23,10 +23,10 @@ ...@@ -23,10 +23,10 @@
<para> <para>
When a table is created, it contains no data. The first thing to When a table is created, it contains no data. The first thing to
do before a database can be of much use is to insert data. Data is do before a database can be of much use is to insert data. Data is
inserted one row at a time. This does not mean that there are no conceptually inserted one row at a time. Of course you can also
means to <quote>bulk load</quote> many rows efficiently. But there insert more than one row, but there is no way to insert less than
is no way to insert less than one row at a time. Even if you know one row at a time. Even if you know only some column values, a
only some column values, a complete row must be created. complete row must be created.
</para> </para>
<para> <para>
...@@ -84,6 +84,15 @@ INSERT INTO products (product_no, name, price) VALUES (1, 'Cheese', DEFAULT); ...@@ -84,6 +84,15 @@ INSERT INTO products (product_no, name, price) VALUES (1, 'Cheese', DEFAULT);
INSERT INTO products DEFAULT VALUES; INSERT INTO products DEFAULT VALUES;
</programlisting> </programlisting>
</para> </para>
<tip>
<para>
To do <quote>bulk loads</quote>, that is, inserting a lot of data,
take a look at the <command>COPY</command> command (see
&cite-reference;). It is not as flexible as the
<command>INSERT</command> command, but more efficient.
</para>
</tip>
</sect1> </sect1>
<sect1 id="dml-update"> <sect1 id="dml-update">
......
This diff is collapsed.
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/indices.sgml,v 1.37 2002/09/21 18:32:53 petere Exp $ --> <!-- $Header: /cvsroot/pgsql/doc/src/sgml/indices.sgml,v 1.38 2002/11/11 20:14:03 petere Exp $ -->
<chapter id="indexes"> <chapter id="indexes">
<title id="indexes-title">Indexes</title> <title id="indexes-title">Indexes</title>
...@@ -432,172 +432,6 @@ SELECT am.amname AS acc_method, ...@@ -432,172 +432,6 @@ SELECT am.amname AS acc_method,
</sect1> </sect1>
<sect1 id="keys">
<title id="keys-title">Keys</title>
<para>
<note>
<title>Author</title>
<para>
Written by Herouth Maoz (<email>herouth@oumail.openu.ac.il</email>).
This originally appeared on the User's Mailing List on 1998-03-02
in response to the question:
"What is the difference between PRIMARY KEY and UNIQUE constraints?".
</para>
</note>
</para>
<para>
<literallayout>
Subject: Re: [QUESTIONS] PRIMARY KEY | UNIQUE
What's the difference between:
PRIMARY KEY(fields,...) and
UNIQUE (fields,...)
- Is this an alias?
- If PRIMARY KEY is already unique, then why
is there another kind of key named UNIQUE?
</literallayout>
</para>
<para>
A primary key is the field(s) used to identify a specific row. For example,
Social Security numbers identifying a person.
</para>
<para>
A simply UNIQUE combination of fields has nothing to do with identifying
the row. It's simply an integrity constraint. For example, I have
collections of links. Each collection is identified by a unique number,
which is the primary key. This key is used in relations.
</para>
<para>
However, my application requires that each collection will also have a
unique name. Why? So that a human being who wants to modify a collection
will be able to identify it. It's much harder to know, if you have two
collections named <quote>Life Science</quote>, the one tagged 24433 is the one you
need, and the one tagged 29882 is not.
</para>
<para>
So, the user selects the collection by its name. We therefore make sure,
within the database, that names are unique. However, no other table in the
database relates to the collections table by the collection Name. That
would be very inefficient.
</para>
<para>
Moreover, despite being unique, the collection name does not actually
define the collection! For example, if somebody decided to change the name
of the collection from <quote>Life Science</quote> to <quote>Biology</quote>, it will still be the
same collection, only with a different name. As long as the name is unique,
that's OK.
</para>
<para>
So:
<itemizedlist>
<listitem>
<para>
Primary key:
<itemizedlist spacing="compact" mark="bullet">
<listitem>
<para>
Is used for identifying the row and relating to it.
</para>
</listitem>
<listitem>
<para>
Is impossible (or hard) to update.
</para>
</listitem>
<listitem>
<para>
Should not allow null values.
</para>
</listitem>
</itemizedlist>
</para>
</listitem>
<listitem>
<para>
Unique field(s):
<itemizedlist spacing="compact" mark="bullet">
<listitem>
<para>
Are used as an alternative access to the row.
</para>
</listitem>
<listitem>
<para>
Are updatable, so long as they are kept unique.
</para>
</listitem>
<listitem>
<para>
Null values are acceptable.
</para>
</listitem>
</itemizedlist>
</para>
</listitem>
</itemizedlist>
</para>
<para>
As for why no non-unique keys are defined explicitly in standard
<acronym>SQL</acronym> syntax? Well, you
must understand that indexes are implementation-dependent.
<acronym>SQL</acronym> does not
define the implementation, merely the relations between data in the
database. <productname>PostgreSQL</productname> does allow
non-unique indexes, but indexes
used to enforce <acronym>SQL</acronym> keys are always unique.
</para>
<para>
Thus, you may query a table by any combination of its columns, despite the
fact that you don't have an index on these columns. The indexes are merely
an implementation aid that each <acronym>RDBMS</acronym> offers
you, in order to cause
commonly used queries to be done more efficiently.
Some <acronym>RDBMS</acronym> may give you
additional measures, such as keeping a key stored in main memory. They will
have a special command, for example
<synopsis>
CREATE MEMSTORE ON <replaceable>table</replaceable> COLUMNS <replaceable>cols</replaceable>
</synopsis>
(This is not an existing command, just an example.)
</para>
<para>
In fact, when you create a primary key or a unique combination of fields,
nowhere in the <acronym>SQL</acronym> specification does it say
that an index is created, nor that
the retrieval of data by the key is going to be more efficient than a
sequential scan!
</para>
<para>
So, if you want to use a combination of fields that is not unique as a
secondary key, you really don't have to specify anything - just start
retrieving by that combination! However, if you want to make the retrieval
efficient, you'll have to resort to the means your
<acronym>RDBMS</acronym> provider gives you
- be it an index, my imaginary <literal>MEMSTORE</literal> command, or an intelligent
<acronym>RDBMS</acronym>
that creates indexes without your knowledge based on the fact that you have
sent it many queries based on a specific combination of keys... (It learns
from experience).
</para>
</sect1>
<sect1 id="indexes-partial"> <sect1 id="indexes-partial">
<title>Partial Indexes</title> <title>Partial Indexes</title>
...@@ -876,8 +710,8 @@ CREATE UNIQUE INDEX tests_success_constraint ON tests (subject, target) ...@@ -876,8 +710,8 @@ CREATE UNIQUE INDEX tests_success_constraint ON tests (subject, target)
<para> <para>
When indexes are not used, it can be useful for testing to force When indexes are not used, it can be useful for testing to force
their use. There are run-time parameters that can turn off their use. There are run-time parameters that can turn off
various plan types (described in the <citetitle>Administrator's various plan types (described in the &cite-admin;).
Guide</citetitle>). For instance, turning off sequential scans For instance, turning off sequential scans
(<varname>enable_seqscan</>) and nested-loop joins (<varname>enable_seqscan</>) and nested-loop joins
(<varname>enable_nestloop</>), which are the most basic plans, (<varname>enable_nestloop</>), which are the most basic plans,
will force the system to use a different plan. If the system will force the system to use a different plan. If the system
...@@ -906,8 +740,8 @@ CREATE UNIQUE INDEX tests_success_constraint ON tests (subject, target) ...@@ -906,8 +740,8 @@ CREATE UNIQUE INDEX tests_success_constraint ON tests (subject, target)
again, two possibilities. The total cost is computed from the again, two possibilities. The total cost is computed from the
per-row costs of each plan node times the selectivity estimate of per-row costs of each plan node times the selectivity estimate of
the plan node. The costs of the plan nodes can be tuned with the plan node. The costs of the plan nodes can be tuned with
run-time parameters (described in the <citetitle>Administrator's run-time parameters (described in the &cite-admin;).
Guide</citetitle>). An inaccurate selectivity estimate is due to An inaccurate selectivity estimate is due to
insufficient statistics. It may be possible to help this by insufficient statistics. It may be possible to help this by
tuning the statistics-gathering parameters (see <command>ALTER tuning the statistics-gathering parameters (see <command>ALTER
TABLE</command> reference). TABLE</command> reference).
......
...@@ -6,14 +6,6 @@ ...@@ -6,14 +6,6 @@
<secondary>on Windows</secondary> <secondary>on Windows</secondary>
</indexterm> </indexterm>
<abstract>
<para>
Build, installation, and use instructions for
<productname>PostgreSQL</productname> client libraries on
<productname>Windows</productname>
</para>
</abstract>
<para> <para>
Although <productname>PostgreSQL</productname> is written for Although <productname>PostgreSQL</productname> is written for
Unix-like operating systems, the C client library Unix-like operating systems, the C client library
......
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/installation.sgml,v 1.110 2002/11/05 19:01:07 momjian Exp $ --> <!-- $Header: /cvsroot/pgsql/doc/src/sgml/installation.sgml,v 1.111 2002/11/11 20:14:03 petere Exp $ -->
<chapter id="installation"> <chapter id="installation">
<title><![%standalone-include[<productname>PostgreSQL</>]]> <title><![%standalone-include[<productname>PostgreSQL</>]]>
...@@ -8,6 +8,13 @@ ...@@ -8,6 +8,13 @@
<primary>installation</primary> <primary>installation</primary>
</indexterm> </indexterm>
<para>
This <![%standalone-include;[document.]]>
<![%standalone-ignore;[chapter.]]> describes the installation of
<productname>PostgreSQL</productname> from the source code
distribution.
</para>
<sect1 id="install-short"> <sect1 id="install-short">
<title>Short Version</title> <title>Short Version</title>
...@@ -131,27 +138,30 @@ su - postgres ...@@ -131,27 +138,30 @@ su - postgres
<para> <para>
To build the server programming language PL/Perl you need a full To build the server programming language PL/Perl you need a full
Perl installation, including the <filename>libperl</filename> Perl installation, including the <filename>libperl</filename>
library and the header files. Since PL/Perl is a shared library and the header files. Since PL/Perl will be a shared
library, the <indexterm><primary>libperl</primary></indexterm> library, the <indexterm><primary>libperl</primary></indexterm>
<filename>libperl</filename> library must be a shared library <filename>libperl</filename> library must be a shared library
also on most platforms. At the time of this writing, this is also on most platforms. This appears to be the default in
almost never the case in prebuilt Perl packages. recent Perl versions, but it was not in earlier versions, and in
general it is the choice of whomever installed Perl at your
site.
</para> </para>
<para> <para>
If this difficulty arises in your situation, a message like this If you don't have the shared library but you need one, a message
will appear during the build to point out this fact: like this will appear during the build to point out this fact:
<screen> <screen>
*** Cannot build PL/Perl because libperl is not a shared library. *** Cannot build PL/Perl because libperl is not a shared library.
*** You might have to rebuild your Perl installation. Refer to *** You might have to rebuild your Perl installation. Refer to
*** the documentation for details. *** the documentation for details.
</screen> </screen>
(If you don't follow the on-screen output you will merely notice (If you don't follow the on-screen output you will merely notice
the the PL/Perl library object will not be installed.) If you that the PL/Perl library object, <filename>plperl.so</filename>
see this, you will have to re-build and install or similar, will not be installed.) If you see this, you will
<productname>Perl</productname> manually to be able to build have to rebuild and install <productname>Perl</productname>
PL/Perl. During the configuration process for manually to be able to build PL/Perl. During the configuration
<productname>Perl</productname>, request a shared library. process for <productname>Perl</productname>, request a shared
library.
</para> </para>
</listitem> </listitem>
...@@ -160,17 +170,18 @@ su - postgres ...@@ -160,17 +170,18 @@ su - postgres
To build the Python interface module or the PL/Python server To build the Python interface module or the PL/Python server
programming language, you need a Python installation, including programming language, you need a Python installation, including
the header files. the header files.
</para> Since PL/Python will be a shared library, the
<para>
Since PL/Python is a shared library, the
<indexterm><primary>libpython</primary></indexterm> <indexterm><primary>libpython</primary></indexterm>
<filename>libpython</filename> library must be a shared library <filename>libpython</filename> library must be a shared library
also on most platforms. This is not the case in a default also on most platforms. This is not the case in a default
Python installation. If after building and installing you have Python installation.
a file called <filename>plpython.so</filename> (possibly a </para>
different extension), then everything went well. Otherwise you
should have seen a notice like this flying by: <para>
If after building and installing you have a file called
<filename>plpython.so</filename> (possibly a different
extension), then everything went well. Otherwise you should
have seen a notice like this flying by:
<screen> <screen>
*** Cannot build PL/Python because libpython is not a shared library. *** Cannot build PL/Python because libpython is not a shared library.
*** You might have to rebuild your Python installation. Refer to *** You might have to rebuild your Python installation. Refer to
...@@ -282,7 +293,7 @@ JAVACMD=$JAVA_HOME/bin/java ...@@ -282,7 +293,7 @@ JAVACMD=$JAVA_HOME/bin/java
<primary>yacc</primary> <primary>yacc</primary>
</indexterm> </indexterm>
<acronym>GNU</> <application>Flex</> and <application>Bison</> <application>Flex</> and <application>Bison</>
are needed to build a CVS checkout or if you changed the actual are needed to build a CVS checkout or if you changed the actual
scanner and parser definition files. If you need them, be sure scanner and parser definition files. If you need them, be sure
to get <application>Flex</> 2.5.4 or later and to get <application>Flex</> 2.5.4 or later and
...@@ -373,7 +384,7 @@ JAVACMD=$JAVA_HOME/bin/java ...@@ -373,7 +384,7 @@ JAVACMD=$JAVA_HOME/bin/java
<primary>pg_dumpall</primary> <primary>pg_dumpall</primary>
</indexterm> </indexterm>
To dump your database installation, type: To back up your database installation, type:
<screen> <screen>
<userinput>pg_dumpall &gt; <replaceable>outputfile</></userinput> <userinput>pg_dumpall &gt; <replaceable>outputfile</></userinput>
</screen> </screen>
...@@ -391,9 +402,16 @@ JAVACMD=$JAVA_HOME/bin/java ...@@ -391,9 +402,16 @@ JAVACMD=$JAVA_HOME/bin/java
</para> </para>
<para> <para>
Make sure that you use the <command>pg_dumpall</> command To make the backup, you can use the <command>pg_dumpall</command>
from the version you are currently running. &version;'s command from the version you are currently running. For best
<command>pg_dumpall</> should not be used on older databases. results, however, try to use the <command>pg_dumpall</command>
command from PostgreSQL &version;, since this version contains
bug fixes and improvements over older versions. While this
advice might seem idiosyncratic since you haven't installed the
new version yet, it is advisable to follow it if you plan to
install the new version in parallel with the old version. In
that case you can complete the installation normally and transfer
the data later. This will also decrease the downtime.
</para> </para>
</step> </step>
...@@ -453,12 +471,10 @@ JAVACMD=$JAVA_HOME/bin/java ...@@ -453,12 +471,10 @@ JAVACMD=$JAVA_HOME/bin/java
</para> </para>
<para> <para>
You can also install the new version in parallel with the old one These topics are discussed at length in <![%standalone-include[the
to decrease the downtime. These topics are discussed at length in <citetitle>Administrator's Guide</>,]]> <![%standalone-ignore[<xref
<![%standalone-include[the <citetitle>Administrator's Guide</>,]]> linkend="migration">,]]> which you are encouraged to read in any
<![%standalone-ignore[<xref linkend="migration">,]]> case.
which you are encouraged
to read in any case.
</para> </para>
</sect1> </sect1>
...@@ -751,10 +767,6 @@ JAVACMD=$JAVA_HOME/bin/java ...@@ -751,10 +767,6 @@ JAVACMD=$JAVA_HOME/bin/java
server-side language. You need to have root access to be able server-side language. You need to have root access to be able
to install the Python module at its default place to install the Python module at its default place
(<filename>/usr/lib/python<replaceable>x</>.<replaceable>y</></>). (<filename>/usr/lib/python<replaceable>x</>.<replaceable>y</></>).
To be able to use this option, you must have Python installed
and your system needs to support shared libraries. If you
instead want to build a new complete interpreter binary, you
will have to do it manually.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -763,7 +775,7 @@ JAVACMD=$JAVA_HOME/bin/java ...@@ -763,7 +775,7 @@ JAVACMD=$JAVA_HOME/bin/java
<term><option>--with-tcl</option></term> <term><option>--with-tcl</option></term>
<listitem> <listitem>
<para> <para>
Builds components that require Tcl/Tk, which are Build components that require Tcl/Tk, which are
<application>libpgtcl</>, <application>pgtclsh</>, <application>libpgtcl</>, <application>pgtclsh</>,
<application>pgtksh</application>, <application>pgtksh</application>,
and <application>PL/Tcl</>. But see below about and <application>PL/Tcl</>. But see below about
...@@ -1106,7 +1118,7 @@ All of PostgreSQL is successfully made. Ready to install. ...@@ -1106,7 +1118,7 @@ All of PostgreSQL is successfully made. Ready to install.
</procedure> </procedure>
<formalpara> <formalpara>
<title>Uninstall:</title> <title>Uninstallation:</title>
<para> <para>
To undo the installation use the command <command>gmake To undo the installation use the command <command>gmake
uninstall</>. However, this will not remove any created directories. uninstall</>. However, this will not remove any created directories.
...@@ -1192,7 +1204,7 @@ setenv LD_LIBRARY_PATH /usr/local/pgsql/lib ...@@ -1192,7 +1204,7 @@ setenv LD_LIBRARY_PATH /usr/local/pgsql/lib
<para> <para>
On <systemitem class="osname">Cygwin</systemitem>, put the library On <systemitem class="osname">Cygwin</systemitem>, put the library
directory on the <envar>PATH</envar> or move the directory in the <envar>PATH</envar> or move the
<filename>.dll</filename> files into the <filename>bin/</filename> <filename>.dll</filename> files into the <filename>bin/</filename>
directory. directory.
</para> </para>
...@@ -1735,7 +1747,7 @@ gunzip -c user.ps.gz \ ...@@ -1735,7 +1747,7 @@ gunzip -c user.ps.gz \
<entry>7.3</entry> <entry>7.3</entry>
<entry>2002-11-01, <entry>2002-11-01,
7.1.3 Larry Rosenman (<email>ler@lerctr.org</email>), 7.1.3 Larry Rosenman (<email>ler@lerctr.org</email>),
7.1.1 and 7.1.2(8.0.0) Olivier Prenant (<email>ohp@pyrenet.fr</email>) 7.1.1 and 7.1.2(8.0.0) Olivier Prenant (<email>ohp@pyrenet.fr</email>)</entry>
<entry>see also <filename>doc/FAQ_SCO</filename></entry> <entry>see also <filename>doc/FAQ_SCO</filename></entry>
</row> </row>
<row> <row>
......
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/keywords.sgml,v 2.7 2002/11/02 18:41:21 tgl Exp $ --> <!-- $Header: /cvsroot/pgsql/doc/src/sgml/keywords.sgml,v 2.8 2002/11/11 20:14:03 petere Exp $ -->
<appendix id="sql-keywords-appendix"> <appendix id="sql-keywords-appendix">
<title><acronym>SQL</acronym> Key Words</title> <title><acronym>SQL</acronym> Key Words</title>
...@@ -232,13 +232,13 @@ ...@@ -232,13 +232,13 @@
</row> </row>
<row> <row>
<entry><token>ASSERTION</token></entry> <entry><token>ASSERTION</token></entry>
<entry></entry> <entry>non-reserved</entry>
<entry>reserved</entry> <entry>reserved</entry>
<entry>reserved</entry> <entry>reserved</entry>
</row> </row>
<row> <row>
<entry><token>ASSIGNMENT</token></entry> <entry><token>ASSIGNMENT</token></entry>
<entry></entry> <entry>non-reserved</entry>
<entry>non-reserved</entry> <entry>non-reserved</entry>
<entry></entry> <entry></entry>
</row> </row>
...@@ -262,7 +262,7 @@ ...@@ -262,7 +262,7 @@
</row> </row>
<row> <row>
<entry><token>AUTHORIZATION</token></entry> <entry><token>AUTHORIZATION</token></entry>
<entry>non-reserved</entry> <entry>reserved (can be function)</entry>
<entry>reserved</entry> <entry>reserved</entry>
<entry>reserved</entry> <entry>reserved</entry>
</row> </row>
...@@ -296,6 +296,12 @@ ...@@ -296,6 +296,12 @@
<entry>non-reserved</entry> <entry>non-reserved</entry>
<entry>reserved</entry> <entry>reserved</entry>
</row> </row>
<row>
<entry><token>BIGINT</token></entry>
<entry>non-reserved (cannot be function or type)</entry>
<entry></entry>
<entry></entry>
</row>
<row> <row>
<entry><token>BINARY</token></entry> <entry><token>BINARY</token></entry>
<entry>reserved (can be function)</entry> <entry>reserved (can be function)</entry>
...@@ -328,7 +334,7 @@ ...@@ -328,7 +334,7 @@
</row> </row>
<row> <row>
<entry><token>BOOLEAN</token></entry> <entry><token>BOOLEAN</token></entry>
<entry></entry> <entry>non-reserved (cannot be function or type)</entry>
<entry>reserved</entry> <entry>reserved</entry>
<entry></entry> <entry></entry>
</row> </row>
...@@ -370,7 +376,7 @@ ...@@ -370,7 +376,7 @@
</row> </row>
<row> <row>
<entry><token>CALLED</token></entry> <entry><token>CALLED</token></entry>
<entry></entry> <entry>non-reserved</entry>
<entry>non-reserved</entry> <entry>non-reserved</entry>
<entry></entry> <entry></entry>
</row> </row>
...@@ -490,7 +496,7 @@ ...@@ -490,7 +496,7 @@
</row> </row>
<row> <row>
<entry><token>CLASS</token></entry> <entry><token>CLASS</token></entry>
<entry></entry> <entry>non-reserved</entry>
<entry>reserved</entry> <entry>reserved</entry>
<entry></entry> <entry></entry>
</row> </row>
...@@ -680,6 +686,12 @@ ...@@ -680,6 +686,12 @@
<entry>reserved</entry> <entry>reserved</entry>
<entry>reserved</entry> <entry>reserved</entry>
</row> </row>
<row>
<entry><token>CONVERSION</token></entry>
<entry>non-reserved</entry>
<entry></entry>
<entry></entry>
</row>
<row> <row>
<entry><token>CONVERT</token></entry> <entry><token>CONVERT</token></entry>
<entry>non-reserved (cannot be function or type)</entry> <entry>non-reserved (cannot be function or type)</entry>
...@@ -706,7 +718,7 @@ ...@@ -706,7 +718,7 @@
</row> </row>
<row> <row>
<entry><token>CREATE</token></entry> <entry><token>CREATE</token></entry>
<entry>non-reserved</entry> <entry>reserved</entry>
<entry>reserved</entry> <entry>reserved</entry>
<entry>reserved</entry> <entry>reserved</entry>
</row> </row>
...@@ -832,7 +844,7 @@ ...@@ -832,7 +844,7 @@
</row> </row>
<row> <row>
<entry><token>DEALLOCATE</token></entry> <entry><token>DEALLOCATE</token></entry>
<entry></entry> <entry>non-reserved</entry>
<entry>reserved</entry> <entry>reserved</entry>
<entry>reserved</entry> <entry>reserved</entry>
</row> </row>
...@@ -880,7 +892,7 @@ ...@@ -880,7 +892,7 @@
</row> </row>
<row> <row>
<entry><token>DEFINER</token></entry> <entry><token>DEFINER</token></entry>
<entry></entry> <entry>non-reserved</entry>
<entry>non-reserved</entry> <entry>non-reserved</entry>
<entry></entry> <entry></entry>
</row> </row>
...@@ -988,7 +1000,7 @@ ...@@ -988,7 +1000,7 @@
</row> </row>
<row> <row>
<entry><token>DOMAIN</token></entry> <entry><token>DOMAIN</token></entry>
<entry></entry> <entry>non-reserved</entry>
<entry>reserved</entry> <entry>reserved</entry>
<entry>reserved</entry> <entry>reserved</entry>
</row> </row>
...@@ -1126,7 +1138,7 @@ ...@@ -1126,7 +1138,7 @@
</row> </row>
<row> <row>
<entry><token>EXTERNAL</token></entry> <entry><token>EXTERNAL</token></entry>
<entry></entry> <entry>non-reserved</entry>
<entry>reserved</entry> <entry>reserved</entry>
<entry>reserved</entry> <entry>reserved</entry>
</row> </row>
...@@ -1252,7 +1264,7 @@ ...@@ -1252,7 +1264,7 @@
</row> </row>
<row> <row>
<entry><token>GET</token></entry> <entry><token>GET</token></entry>
<entry></entry> <entry>non-reserved</entry>
<entry>reserved</entry> <entry>reserved</entry>
<entry>reserved</entry> <entry>reserved</entry>
</row> </row>
...@@ -1276,7 +1288,7 @@ ...@@ -1276,7 +1288,7 @@
</row> </row>
<row> <row>
<entry><token>GRANT</token></entry> <entry><token>GRANT</token></entry>
<entry>non-reserved</entry> <entry>reserved</entry>
<entry>reserved</entry> <entry>reserved</entry>
<entry>reserved</entry> <entry>reserved</entry>
</row> </row>
...@@ -1358,12 +1370,24 @@ ...@@ -1358,12 +1370,24 @@
<entry>reserved</entry> <entry>reserved</entry>
<entry>reserved</entry> <entry>reserved</entry>
</row> </row>
<row>
<entry><token>IMMUTABLE</token></entry>
<entry>non-reserved</entry>
<entry></entry>
<entry></entry>
</row>
<row> <row>
<entry><token>IMPLEMENTATION</token></entry> <entry><token>IMPLEMENTATION</token></entry>
<entry></entry> <entry></entry>
<entry>non-reserved</entry> <entry>non-reserved</entry>
<entry></entry> <entry></entry>
</row> </row>
<row>
<entry><token>IMPLICIT</token></entry>
<entry>non-reserved</entry>
<entry></entry>
<entry></entry>
</row>
<row> <row>
<entry><token>IN</token></entry> <entry><token>IN</token></entry>
<entry>reserved (can be function)</entry> <entry>reserved (can be function)</entry>
...@@ -1426,7 +1450,7 @@ ...@@ -1426,7 +1450,7 @@
</row> </row>
<row> <row>
<entry><token>INPUT</token></entry> <entry><token>INPUT</token></entry>
<entry></entry> <entry>non-reserved</entry>
<entry>reserved</entry> <entry>reserved</entry>
<entry>reserved</entry> <entry>reserved</entry>
</row> </row>
...@@ -1462,13 +1486,13 @@ ...@@ -1462,13 +1486,13 @@
</row> </row>
<row> <row>
<entry><token>INT</token></entry> <entry><token>INT</token></entry>
<entry></entry> <entry>non-reserved (cannot be function or type)</entry>
<entry>reserved</entry> <entry>reserved</entry>
<entry>reserved</entry> <entry>reserved</entry>
</row> </row>
<row> <row>
<entry><token>INTEGER</token></entry> <entry><token>INTEGER</token></entry>
<entry></entry> <entry>non-reserved (cannot be function or type)</entry>
<entry>reserved</entry> <entry>reserved</entry>
<entry>reserved</entry> <entry>reserved</entry>
</row> </row>
...@@ -1492,7 +1516,7 @@ ...@@ -1492,7 +1516,7 @@
</row> </row>
<row> <row>
<entry><token>INVOKER</token></entry> <entry><token>INVOKER</token></entry>
<entry></entry> <entry>non-reserved</entry>
<entry>non-reserved</entry> <entry>non-reserved</entry>
<entry></entry> <entry></entry>
</row> </row>
...@@ -1642,13 +1666,13 @@ ...@@ -1642,13 +1666,13 @@
</row> </row>
<row> <row>
<entry><token>LOCALTIME</token></entry> <entry><token>LOCALTIME</token></entry>
<entry></entry> <entry>reserved</entry>
<entry>reserved</entry> <entry>reserved</entry>
<entry></entry> <entry></entry>
</row> </row>
<row> <row>
<entry><token>LOCALTIMESTAMP</token></entry> <entry><token>LOCALTIMESTAMP</token></entry>
<entry></entry> <entry>reserved</entry>
<entry>reserved</entry> <entry>reserved</entry>
<entry></entry> <entry></entry>
</row> </row>
...@@ -2056,7 +2080,7 @@ ...@@ -2056,7 +2080,7 @@
</row> </row>
<row> <row>
<entry><token>OVERLAY</token></entry> <entry><token>OVERLAY</token></entry>
<entry></entry> <entry>non-reserved (cannot be function or type)</entry>
<entry>non-reserved</entry> <entry>non-reserved</entry>
<entry></entry> <entry></entry>
</row> </row>
...@@ -2156,6 +2180,12 @@ ...@@ -2156,6 +2180,12 @@
<entry></entry> <entry></entry>
<entry></entry> <entry></entry>
</row> </row>
<row>
<entry><token>PLACING</token></entry>
<entry>reserved</entry>
<entry></entry>
<entry></entry>
</row>
<row> <row>
<entry><token>PLI</token></entry> <entry><token>PLI</token></entry>
<entry></entry> <entry></entry>
...@@ -2194,7 +2224,7 @@ ...@@ -2194,7 +2224,7 @@
</row> </row>
<row> <row>
<entry><token>PREPARE</token></entry> <entry><token>PREPARE</token></entry>
<entry></entry> <entry>non-reserved</entry>
<entry>reserved</entry> <entry>reserved</entry>
<entry>reserved</entry> <entry>reserved</entry>
</row> </row>
...@@ -2236,7 +2266,7 @@ ...@@ -2236,7 +2266,7 @@
</row> </row>
<row> <row>
<entry><token>PUBLIC</token></entry> <entry><token>PUBLIC</token></entry>
<entry>reserved (can be function)</entry> <entry></entry>
<entry>reserved</entry> <entry>reserved</entry>
<entry>reserved</entry> <entry>reserved</entry>
</row> </row>
...@@ -2254,10 +2284,16 @@ ...@@ -2254,10 +2284,16 @@
</row> </row>
<row> <row>
<entry><token>REAL</token></entry> <entry><token>REAL</token></entry>
<entry></entry> <entry>non-reserved (cannot be function or type)</entry>
<entry>reserved</entry> <entry>reserved</entry>
<entry>reserved</entry> <entry>reserved</entry>
</row> </row>
<row>
<entry><token>RECHECK</token></entry>
<entry>non-reserved</entry>
<entry></entry>
<entry></entry>
</row>
<row> <row>
<entry><token>RECURSIVE</token></entry> <entry><token>RECURSIVE</token></entry>
<entry></entry> <entry></entry>
...@@ -2416,7 +2452,7 @@ ...@@ -2416,7 +2452,7 @@
</row> </row>
<row> <row>
<entry><token>ROW</token></entry> <entry><token>ROW</token></entry>
<entry>non-reserved</entry> <entry>non-reserved (cannot be function or type)</entry>
<entry>reserved</entry> <entry>reserved</entry>
<entry></entry> <entry></entry>
</row> </row>
...@@ -2494,7 +2530,7 @@ ...@@ -2494,7 +2530,7 @@
</row> </row>
<row> <row>
<entry><token>SECURITY</token></entry> <entry><token>SECURITY</token></entry>
<entry></entry> <entry>non-reserved</entry>
<entry>non-reserved</entry> <entry>non-reserved</entry>
<entry></entry> <entry></entry>
</row> </row>
...@@ -2578,13 +2614,13 @@ ...@@ -2578,13 +2614,13 @@
</row> </row>
<row> <row>
<entry><token>SIMILAR</token></entry> <entry><token>SIMILAR</token></entry>
<entry></entry> <entry>reserved (can be function)</entry>
<entry>non-reserved</entry> <entry>non-reserved</entry>
<entry></entry> <entry></entry>
</row> </row>
<row> <row>
<entry><token>SIMPLE</token></entry> <entry><token>SIMPLE</token></entry>
<entry></entry> <entry>non-reserved</entry>
<entry>non-reserved</entry> <entry>non-reserved</entry>
<entry></entry> <entry></entry>
</row> </row>
...@@ -2596,7 +2632,7 @@ ...@@ -2596,7 +2632,7 @@
</row> </row>
<row> <row>
<entry><token>SMALLINT</token></entry> <entry><token>SMALLINT</token></entry>
<entry></entry> <entry>non-reserved (cannot be function or type)</entry>
<entry>reserved</entry> <entry>reserved</entry>
<entry>reserved</entry> <entry>reserved</entry>
</row> </row>
...@@ -2672,6 +2708,12 @@ ...@@ -2672,6 +2708,12 @@
<entry>reserved</entry> <entry>reserved</entry>
<entry></entry> <entry></entry>
</row> </row>
<row>
<entry><token>STABLE</token></entry>
<entry>non-reserved</entry>
<entry></entry>
<entry></entry>
</row>
<row> <row>
<entry><token>START</token></entry> <entry><token>START</token></entry>
<entry>non-reserved</entry> <entry>non-reserved</entry>
...@@ -2714,6 +2756,18 @@ ...@@ -2714,6 +2756,18 @@
<entry></entry> <entry></entry>
<entry></entry> <entry></entry>
</row> </row>
<row>
<entry><token>STORAGE</token></entry>
<entry>non-reserved</entry>
<entry></entry>
<entry></entry>
</row>
<row>
<entry><token>STRICT</token></entry>
<entry>non-reserved</entry>
<entry></entry>
<entry></entry>
</row>
<row> <row>
<entry><token>STRUCTURE</token></entry> <entry><token>STRUCTURE</token></entry>
<entry></entry> <entry></entry>
...@@ -2914,7 +2968,7 @@ ...@@ -2914,7 +2968,7 @@
</row> </row>
<row> <row>
<entry><token>TREAT</token></entry> <entry><token>TREAT</token></entry>
<entry></entry> <entry>non-reserved (cannot be function or type)</entry>
<entry>reserved</entry> <entry>reserved</entry>
<entry></entry> <entry></entry>
</row> </row>
...@@ -3046,7 +3100,7 @@ ...@@ -3046,7 +3100,7 @@
</row> </row>
<row> <row>
<entry><token>USAGE</token></entry> <entry><token>USAGE</token></entry>
<entry></entry> <entry>non-reserved</entry>
<entry>reserved</entry> <entry>reserved</entry>
<entry>reserved</entry> <entry>reserved</entry>
</row> </row>
...@@ -3092,6 +3146,12 @@ ...@@ -3092,6 +3146,12 @@
<entry></entry> <entry></entry>
<entry></entry> <entry></entry>
</row> </row>
<row>
<entry><token>VALIDATOR</token></entry>
<entry>non-reserved</entry>
<entry></entry>
<entry></entry>
</row>
<row> <row>
<entry><token>VALUE</token></entry> <entry><token>VALUE</token></entry>
<entry></entry> <entry></entry>
...@@ -3140,6 +3200,12 @@ ...@@ -3140,6 +3200,12 @@
<entry>reserved</entry> <entry>reserved</entry>
<entry>reserved</entry> <entry>reserved</entry>
</row> </row>
<row>
<entry><token>VOLATILE</token></entry>
<entry>non-reserved</entry>
<entry></entry>
<entry></entry>
</row>
<row> <row>
<entry><token>WHEN</token></entry> <entry><token>WHEN</token></entry>
<entry>reserved</entry> <entry>reserved</entry>
...@@ -3178,7 +3244,7 @@ ...@@ -3178,7 +3244,7 @@
</row> </row>
<row> <row>
<entry><token>WRITE</token></entry> <entry><token>WRITE</token></entry>
<entry></entry> <entry>non-reserved</entry>
<entry>reserved</entry> <entry>reserved</entry>
<entry>reserved</entry> <entry>reserved</entry>
</row> </row>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/libpq.sgml,v 1.100 2002/11/10 00:14:22 momjian Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/libpq.sgml,v 1.101 2002/11/11 20:14:03 petere Exp $
--> -->
<chapter id="libpq"> <chapter id="libpq">
...@@ -2139,22 +2139,23 @@ for information on correct values for these environment variables. ...@@ -2139,22 +2139,23 @@ for information on correct values for these environment variables.
<primary>password</primary> <primary>password</primary>
<secondary>.pgpass</secondary> <secondary>.pgpass</secondary>
</indexterm> </indexterm>
<filename>$HOME/.pgpass</filename> is a file that can contain passwords The file <filename>.pgpass</filename> in the home directory is a file
to be used if the connection requires a password. This file should have the that can contain passwords to be used if the connection requires a
format: password. This file should have the format:
<screen> <synopsis>
<replaceable>hostname</replaceable>:<replaceable>port</replaceable>:<replaceable>database</replaceable>:<replaceable>username</replaceable>:<replaceable>password</replaceable> <replaceable>hostname</replaceable>:<replaceable>port</replaceable>:<replaceable>database</replaceable>:<replaceable>username</replaceable>:<replaceable>password</replaceable>
</screen> </synopsis>
Any of these may be a literal name, or <literal>*</literal>, which matches Any of these may be a literal name, or <literal>*</literal>, which matches
anything. The first match will be used so put more specific entries first. anything. The first match will be used so put more specific entries first.
Entries with <literal>:</literal> or <literal>\</literal> should be escaped Entries with <literal>:</literal> or <literal>\</literal> should be escaped
with <literal>\</literal>. with <literal>\</literal>.
</para> </para>
<para> <para>
The permissions on <filename>$HOME/.pgpass</filename> must disallow any The permissions on <filename>.pgpass</filename> must disallow any
access to world or group; achieve this by the command access to world or group; achieve this by the command
<command>chmod 0600 $HOME/.pgaccess</command>. <command>chmod 0600 .pgaccess</command>.
If the permissions are less strict than this, the file will be ignored. If the permissions are less strict than this, the file will be ignored.
</para>
</sect1> </sect1>
<sect1 id="libpq-threading"> <sect1 id="libpq-threading">
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/maintenance.sgml,v 1.19 2002/09/21 18:32:53 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/maintenance.sgml,v 1.20 2002/11/11 20:14:03 petere Exp $
--> -->
<chapter id="maintenance"> <chapter id="maintenance">
...@@ -13,7 +13,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/maintenance.sgml,v 1.19 2002/09/21 18:32:53 ...@@ -13,7 +13,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/maintenance.sgml,v 1.19 2002/09/21 18:32:53
a regular basis to keep a <productname>PostgreSQL</productname> a regular basis to keep a <productname>PostgreSQL</productname>
installation running smoothly. The tasks discussed here are repetitive installation running smoothly. The tasks discussed here are repetitive
in nature and can easily be automated using standard Unix tools such in nature and can easily be automated using standard Unix tools such
as <filename>cron</filename> scripts. But it is the database as <application>cron</application> scripts. But it is the database
administrator's responsibility to set up appropriate scripts, and to administrator's responsibility to set up appropriate scripts, and to
check that they execute successfully. check that they execute successfully.
</para> </para>
...@@ -104,7 +104,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/maintenance.sgml,v 1.19 2002/09/21 18:32:53 ...@@ -104,7 +104,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/maintenance.sgml,v 1.19 2002/09/21 18:32:53
<command>UPDATE</> or <command>DELETE</> of a row does not <command>UPDATE</> or <command>DELETE</> of a row does not
immediately remove the old <firstterm>tuple</> (version of the row). immediately remove the old <firstterm>tuple</> (version of the row).
This approach is necessary to gain the benefits of multiversion This approach is necessary to gain the benefits of multiversion
concurrency control (see the <citetitle>User's Guide</>): the tuple concurrency control (see the &cite-user;): the tuple
must not be deleted while it is still potentially visible to other must not be deleted while it is still potentially visible to other
transactions. But eventually, an outdated or deleted tuple is no transactions. But eventually, an outdated or deleted tuple is no
longer of interest to any transaction. The space it occupies must be longer of interest to any transaction. The space it occupies must be
...@@ -206,7 +206,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/maintenance.sgml,v 1.19 2002/09/21 18:32:53 ...@@ -206,7 +206,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/maintenance.sgml,v 1.19 2002/09/21 18:32:53
Although per-column tweaking of <command>ANALYZE</> frequency may not be Although per-column tweaking of <command>ANALYZE</> frequency may not be
very productive, you may well find it worthwhile to do per-column very productive, you may well find it worthwhile to do per-column
adjustment of the level of detail of the statistics collected by adjustment of the level of detail of the statistics collected by
<command>ANALYZE</>. Columns that are heavily used in WHERE clauses <command>ANALYZE</>. Columns that are heavily used in <literal>WHERE</> clauses
and have highly irregular data distributions may require a finer-grain and have highly irregular data distributions may require a finer-grain
data histogram than other columns. See <command>ALTER TABLE SET data histogram than other columns. See <command>ALTER TABLE SET
STATISTICS</>. STATISTICS</>.
...@@ -299,7 +299,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/maintenance.sgml,v 1.19 2002/09/21 18:32:53 ...@@ -299,7 +299,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/maintenance.sgml,v 1.19 2002/09/21 18:32:53
is exactly one billion transactions: if you wait longer, it's possible is exactly one billion transactions: if you wait longer, it's possible
that a tuple that was not quite old enough to be reassigned last time that a tuple that was not quite old enough to be reassigned last time
is now more than two billion transactions old and has wrapped around is now more than two billion transactions old and has wrapped around
into the future --- ie, is lost to you. (Of course, it'll reappear into the future --- i.e., is lost to you. (Of course, it'll reappear
after another two billion transactions, but that's no help.) after another two billion transactions, but that's no help.)
</para> </para>
...@@ -311,17 +311,17 @@ $Header: /cvsroot/pgsql/doc/src/sgml/maintenance.sgml,v 1.19 2002/09/21 18:32:53 ...@@ -311,17 +311,17 @@ $Header: /cvsroot/pgsql/doc/src/sgml/maintenance.sgml,v 1.19 2002/09/21 18:32:53
statistics in the system table <filename>pg_database</>. In particular, statistics in the system table <filename>pg_database</>. In particular,
the <filename>datfrozenxid</> field of a database's the <filename>datfrozenxid</> field of a database's
<filename>pg_database</> row is updated at the completion of any <filename>pg_database</> row is updated at the completion of any
database-wide vacuum operation (ie, <command>VACUUM</> that does not database-wide vacuum operation (i.e., <command>VACUUM</> that does not
name a specific table). The value stored in this field is the freeze name a specific table). The value stored in this field is the freeze
cutoff XID that was used by that <command>VACUUM</> command. All normal cutoff XID that was used by that <command>VACUUM</> command. All normal
XIDs older than this cutoff XID are guaranteed to have been replaced by XIDs older than this cutoff XID are guaranteed to have been replaced by
<literal>FrozenXID</> within that database. A convenient way to <literal>FrozenXID</> within that database. A convenient way to
examine this information is to execute the query examine this information is to execute the query
<informalexample>
<programlisting> <programlisting>
SELECT datname, age(datfrozenxid) FROM pg_database; SELECT datname, age(datfrozenxid) FROM pg_database;
</programlisting> </programlisting>
</informalexample>
The <literal>age</> column measures the number of transactions from the The <literal>age</> column measures the number of transactions from the
cutoff XID to the current transaction's XID. cutoff XID to the current transaction's XID.
</para> </para>
...@@ -336,7 +336,7 @@ SELECT datname, age(datfrozenxid) FROM pg_database; ...@@ -336,7 +336,7 @@ SELECT datname, age(datfrozenxid) FROM pg_database;
each database-wide <command>VACUUM</> automatically delivers a warning each database-wide <command>VACUUM</> automatically delivers a warning
if there are any <filename>pg_database</> entries showing an if there are any <filename>pg_database</> entries showing an
<literal>age</> of more than 1.5 billion transactions, for example: <literal>age</> of more than 1.5 billion transactions, for example:
<informalexample>
<programlisting> <programlisting>
play=# vacuum; play=# vacuum;
WARNING: Some databases have not been vacuumed in 1613770184 transactions. WARNING: Some databases have not been vacuumed in 1613770184 transactions.
...@@ -344,7 +344,6 @@ WARNING: Some databases have not been vacuumed in 1613770184 transactions. ...@@ -344,7 +344,6 @@ WARNING: Some databases have not been vacuumed in 1613770184 transactions.
or you may have a wraparound failure. or you may have a wraparound failure.
VACUUM VACUUM
</programlisting> </programlisting>
</informalexample>
</para> </para>
<para> <para>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/manage-ag.sgml,v 2.22 2002/10/24 17:48:54 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/manage-ag.sgml,v 2.23 2002/11/11 20:14:03 petere Exp $
--> -->
<chapter id="managing-databases"> <chapter id="managing-databases">
...@@ -27,7 +27,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/manage-ag.sgml,v 2.22 2002/10/24 17:48:54 p ...@@ -27,7 +27,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/manage-ag.sgml,v 2.22 2002/10/24 17:48:54 p
database within the installation.) More accurately, a database is database within the installation.) More accurately, a database is
a collection of schemas and the schemas contain the tables, a collection of schemas and the schemas contain the tables,
functions, etc. So the full hierarchy is: functions, etc. So the full hierarchy is:
server-database-schema-table (or something else instead of a server, database, schema, table (or something else instead of a
table). table).
</para> </para>
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/queries.sgml,v 1.18 2002/10/20 05:05:46 tgl Exp $ --> <!-- $Header: /cvsroot/pgsql/doc/src/sgml/queries.sgml,v 1.19 2002/11/11 20:14:03 petere Exp $ -->
<chapter id="queries"> <chapter id="queries">
<title>Queries</title> <title>Queries</title>
...@@ -668,7 +668,7 @@ SELECT <replaceable>select_list</replaceable> ...@@ -668,7 +668,7 @@ SELECT <replaceable>select_list</replaceable>
order in which the columns are listed does not matter. The order in which the columns are listed does not matter. The
purpose is to reduce each group of rows sharing common values into purpose is to reduce each group of rows sharing common values into
one group row that is representative of all rows in the group. one group row that is representative of all rows in the group.
This is done to eliminate redundancy in the output and/or obtain This is done to eliminate redundancy in the output and/or compute
aggregates that apply to these groups. For instance: aggregates that apply to these groups. For instance:
<screen> <screen>
<prompt>=></> <userinput>SELECT * FROM test1;</> <prompt>=></> <userinput>SELECT * FROM test1;</>
...@@ -694,7 +694,12 @@ SELECT <replaceable>select_list</replaceable> ...@@ -694,7 +694,12 @@ SELECT <replaceable>select_list</replaceable>
In the second query, we could not have written <literal>SELECT * In the second query, we could not have written <literal>SELECT *
FROM test1 GROUP BY x</literal>, because there is no single value FROM test1 GROUP BY x</literal>, because there is no single value
for the column <literal>y</> that could be associated with each for the column <literal>y</> that could be associated with each
group. In general, if a table is grouped, columns that are not group. The grouped-by columns can be referenced in the select list since
they have a known constant value per group.
</para>
<para>
In general, if a table is grouped, columns that are not
used in the grouping cannot be referenced except in aggregate used in the grouping cannot be referenced except in aggregate
expressions. An example with aggregate expressions is: expressions. An example with aggregate expressions is:
<screen> <screen>
...@@ -712,11 +717,6 @@ SELECT <replaceable>select_list</replaceable> ...@@ -712,11 +717,6 @@ SELECT <replaceable>select_list</replaceable>
linkend="functions-aggregate">. linkend="functions-aggregate">.
</para> </para>
<para>
The grouped-by columns can be referenced in the select list since
they have a known constant value per group.
</para>
<tip> <tip>
<para> <para>
Grouping without aggregate expressions effectively calculates the Grouping without aggregate expressions effectively calculates the
...@@ -740,7 +740,7 @@ SELECT product_id, p.name, (sum(s.units) * p.price) AS sales ...@@ -740,7 +740,7 @@ SELECT product_id, p.name, (sum(s.units) * p.price) AS sales
in the <literal>GROUP BY</> clause since they are referenced in in the <literal>GROUP BY</> clause since they are referenced in
the query select list. (Depending on how exactly the products the query select list. (Depending on how exactly the products
table is set up, name and price may be fully dependent on the table is set up, name and price may be fully dependent on the
product ID, so the additional groups could theoretically be product ID, so the additional groupings could theoretically be
unnecessary, but this is not implemented yet.) The column unnecessary, but this is not implemented yet.) The column
<literal>s.units</> does not have to be in the <literal>GROUP <literal>s.units</> does not have to be in the <literal>GROUP
BY</> list since it is only used in an aggregate expression BY</> list since it is only used in an aggregate expression
...@@ -828,7 +828,7 @@ SELECT product_id, p.name, (sum(s.units) * (p.price - p.cost)) AS profit ...@@ -828,7 +828,7 @@ SELECT product_id, p.name, (sum(s.units) * (p.price - p.cost)) AS profit
</para> </para>
<sect2 id="queries-select-list-items"> <sect2 id="queries-select-list-items">
<title>Select List Items</title> <title>Select-List Items</title>
<para> <para>
The simplest kind of select list is <literal>*</literal> which The simplest kind of select list is <literal>*</literal> which
......
This diff is collapsed.
This diff is collapsed.
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/start.sgml,v 1.26 2002/10/24 17:48:54 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/start.sgml,v 1.27 2002/11/11 20:14:04 petere Exp $
--> -->
<chapter id="tutorial-start"> <chapter id="tutorial-start">
...@@ -281,10 +281,10 @@ createdb: database creation failed ...@@ -281,10 +281,10 @@ createdb: database creation failed
<listitem> <listitem>
<para> <para>
Using an existing graphical frontend tool like Using an existing graphical frontend tool like
<application>PgAccess</application> or <application>PgAccess</application> or an office suite with
<application>ApplixWare</application> (via <acronym>ODBC</acronym> support to create and manipulate a
<acronym>ODBC</acronym>) to create and manipulate a database. database. These possibilities are not covered in this
These possibilities are not covered in this tutorial. tutorial.
</para> </para>
</listitem> </listitem>
......
This diff is collapsed.
<chapter Id="typeconv"> <chapter Id="typeconv">
<title>Type Conversion</title> <title>Type Conversion</title>
<sect1 id="typeconv-intro">
<title>Introduction</title>
<para> <para>
<acronym>SQL</acronym> queries can, intentionally or not, require <acronym>SQL</acronym> queries can, intentionally or not, require
mixing of different data types in the same expression. mixing of different data types in the same expression.
...@@ -29,10 +26,9 @@ operators. ...@@ -29,10 +26,9 @@ operators.
</para> </para>
<para> <para>
The <citetitle>Programmer's Guide</citetitle> has more details on the exact algorithms used for The &cite-programmer; has more details on the exact algorithms used for
implicit type conversion and coercion. implicit type conversion and coercion.
</para> </para>
</sect1>
<sect1 id="typeconv-overview"> <sect1 id="typeconv-overview">
<title>Overview</title> <title>Overview</title>
...@@ -41,7 +37,7 @@ implicit type conversion and coercion. ...@@ -41,7 +37,7 @@ implicit type conversion and coercion.
<acronym>SQL</acronym> is a strongly typed language. That is, every data item <acronym>SQL</acronym> is a strongly typed language. That is, every data item
has an associated data type which determines its behavior and allowed usage. has an associated data type which determines its behavior and allowed usage.
<productname>PostgreSQL</productname> has an extensible type system that is <productname>PostgreSQL</productname> has an extensible type system that is
much more general and flexible than other <acronym>RDBMS</acronym> implementations. much more general and flexible than other <acronym>SQL</acronym> implementations.
Hence, most type conversion behavior in <productname>PostgreSQL</productname> Hence, most type conversion behavior in <productname>PostgreSQL</productname>
should be governed by general rules rather than by <foreignphrase>ad hoc</> heuristics, to allow should be governed by general rules rather than by <foreignphrase>ad hoc</> heuristics, to allow
mixed-type expressions to be meaningful even with user-defined types. mixed-type expressions to be meaningful even with user-defined types.
...@@ -142,13 +138,13 @@ conventions for the <acronym>SQL</acronym> standard native types such as ...@@ -142,13 +138,13 @@ conventions for the <acronym>SQL</acronym> standard native types such as
</para> </para>
<para> <para>
The <productname>PostgreSQL</productname> parser uses the convention that all The system catalogs store information about which conversions, called
type conversion functions take a single argument of the source type and are <firstterm>casts</firstterm>, between data types are valid, and how to
named with the same name as the target type. Any function meeting these perform those conversions. Additional casts can be added by the user
criteria is considered to be a valid conversion function, and may be used with the <command>CREATE CAST</command> command. (This is usually
by the parser as such. This simple assumption gives the parser the power done in conjunction with defining new data types. The set of casts
to explore type conversion possibilities without hardcoding, allowing between the built-in types has been carefully crafted and should not
extended user-defined types to use these same features transparently. be altered.)
</para> </para>
<para> <para>
...@@ -169,7 +165,7 @@ types. ...@@ -169,7 +165,7 @@ types.
<para> <para>
All type conversion rules are designed with several principles in mind: All type conversion rules are designed with several principles in mind:
<itemizedlist mark="bullet" spacing="compact"> <itemizedlist>
<listitem> <listitem>
<para> <para>
Implicit conversions should never have surprising or unpredictable outcomes. Implicit conversions should never have surprising or unpredictable outcomes.
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment