Commit d2a907c6 authored by Thomas G. Lockhart's avatar Thomas G. Lockhart

Markup and editing adjustments...

parent 5a68fd56
...@@ -18,9 +18,9 @@ Modifies table properties ...@@ -18,9 +18,9 @@ Modifies table properties
</REFSYNOPSISDIVINFO> </REFSYNOPSISDIVINFO>
<SYNOPSIS> <SYNOPSIS>
ALTER TABLE <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE> ALTER TABLE <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE>
[*] ADD [COLUMN] <REPLACEABLE CLASS="PARAMETER">column</REPLACEABLE> <REPLACEABLE CLASS="PARAMETER">type</REPLACEABLE> [ * ] ADD [ COLUMN ] <REPLACEABLE CLASS="PARAMETER">column</REPLACEABLE> <REPLACEABLE CLASS="PARAMETER">type</REPLACEABLE>
ALTER TABLE <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE> ALTER TABLE <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE>
[*] RENAME [COLUMN] <REPLACEABLE CLASS="PARAMETER">column</REPLACEABLE> TO <REPLACEABLE CLASS="PARAMETER">newcolumn</REPLACEABLE> [ * ] RENAME [ COLUMN ] <REPLACEABLE CLASS="PARAMETER">column</REPLACEABLE> TO <REPLACEABLE CLASS="PARAMETER">newcolumn</REPLACEABLE>
ALTER TABLE <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE> ALTER TABLE <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE>
RENAME TO <REPLACEABLE CLASS="PARAMETER">newtable</REPLACEABLE> RENAME TO <REPLACEABLE CLASS="PARAMETER">newtable</REPLACEABLE>
</SYNOPSIS> </SYNOPSIS>
...@@ -103,14 +103,14 @@ Outputs ...@@ -103,14 +103,14 @@ Outputs
<VARIABLELIST> <VARIABLELIST>
<VARLISTENTRY> <VARLISTENTRY>
<TERM> <TERM>
<ReturnValue>status</ReturnValue> <replaceable>status</replaceable>
</TERM> </TERM>
<LISTITEM> <LISTITEM>
<PARA> <PARA>
<VARIABLELIST> <VARIABLELIST>
<VARLISTENTRY> <VARLISTENTRY>
<TERM> <TERM>
<ReturnValue>ALTER</ReturnValue> <returnvalue>ALTER</returnvalue>
</TERM> </TERM>
<LISTITEM> <LISTITEM>
<PARA> <PARA>
...@@ -121,7 +121,7 @@ Outputs ...@@ -121,7 +121,7 @@ Outputs
<VARLISTENTRY> <VARLISTENTRY>
<TERM> <TERM>
<ReturnValue>NEW</ReturnValue> <returnvalue>NEW</returnvalue>
</TERM> </TERM>
<LISTITEM> <LISTITEM>
<PARA> <PARA>
...@@ -156,9 +156,9 @@ Outputs ...@@ -156,9 +156,9 @@ Outputs
Description Description
</TITLE> </TITLE>
<PARA> <PARA>
ALTER TABLE changes the definition of an existing table. <command>ALTER TABLE</command> changes the definition of an existing table.
The new columns and their types are specified in the same style The new columns and their types are specified in the same style
and with the the same restrictions as in CREATE TABLE. and with the the same restrictions as in <command>CREATE TABLE</command>.
The RENAME clause causes the name of a table or column The RENAME clause causes the name of a table or column
to change without changing any of the data contained in to change without changing any of the data contained in
the affected table. Thus, the table or column will the affected table. Thus, the table or column will
...@@ -178,18 +178,15 @@ Notes ...@@ -178,18 +178,15 @@ Notes
<PARA> <PARA>
The keyword COLUMN is noise and can be omitted. The keyword COLUMN is noise and can be omitted.
<PARA>
ALTER TABLE/RENAME is a PostgreSQL language extension.
<PARA> <PARA>
<Quote>[*]</Quote> following a name of a table indicates that statement <Quote>[*]</Quote> following a name of a table indicates that statement
should be run over that table and all tables below it in the should be run over that table and all tables below it in the
inheritance hierarchy. inheritance hierarchy.
Refer to PostgreSQL User's Guide for further The PostgreSQL User's Guide has further
information on inheritance. information on inheritance.
<PARA> <PARA>
Refer to the CREATE TABLE reference for further description Refer to CREATE TABLE for a further description
of valid arguments. of valid arguments.
</REFSECT2> </REFSECT2>
...@@ -232,23 +229,30 @@ Compatibility ...@@ -232,23 +229,30 @@ Compatibility
SQL92 SQL92
</TITLE> </TITLE>
<PARA> <PARA>
SQL92 specifies some additional capabilities for ALTER TABLE <command>ALTER TABLE/RENAME</command>
statement which are not yet directly supported by <ProductName>Postgres</ProductName>: is a <productname>Postgres</productname> language extension.
<PARA>
SQL92 specifies some additional capabilities for <command>ALTER TABLE</command>
statement which are not yet directly supported by
<ProductName>Postgres</ProductName>:
<VARIABLELIST> <VARIABLELIST>
<VARLISTENTRY> <VARLISTENTRY>
<TERM> <TERM>
<Synopsis> <Synopsis>
ALTER TABLE <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE> ALTER [COLUMN] <REPLACEABLE CLASS="PARAMETER">column</REPLACEABLE> ALTER TABLE <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE> ALTER [ COLUMN ] <REPLACEABLE CLASS="PARAMETER">column</REPLACEABLE>
SET DEFAULT <REPLACEABLE CLASS="PARAMETER">default</REPLACEABLE> SET DEFAULT <REPLACEABLE CLASS="PARAMETER">default</REPLACEABLE>
ALTER TABLE <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE> ALTER [COLUMN] <REPLACEABLE CLASS="PARAMETER">column</REPLACEABLE>
ADD [CONSTRAINT <REPLACEABLE CLASS="PARAMETER">constraint</REPLACEABLE>] <REPLACEABLE CLASS="PARAMETER">table-constraint</REPLACEABLE> ALTER TABLE <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE> ALTER [ COLUMN ] <REPLACEABLE CLASS="PARAMETER">column</REPLACEABLE>
ADD [ CONSTRAINT <REPLACEABLE CLASS="PARAMETER">constraint</REPLACEABLE> ] <REPLACEABLE CLASS="PARAMETER">table-constraint</REPLACEABLE>
</Synopsis> </Synopsis>
</TERM> </TERM>
<LISTITEM> <LISTITEM>
<PARA> <PARA>
Puts the default value or constraint specified into the Puts the default value or constraint specified into the
definition of column in the table. See CREATE TABLE for the definition of column in the table.
See <command>CREATE TABLE</command> for the
syntax of the default and table-constraint clauses. syntax of the default and table-constraint clauses.
If a default clause already exists, it will be replaced by If a default clause already exists, it will be replaced by
the new definition. If any constraints on this column already the new definition. If any constraints on this column already
...@@ -307,7 +311,7 @@ DROP TABLE temp; ...@@ -307,7 +311,7 @@ DROP TABLE temp;
<TERM> <TERM>
<Synopsis> <Synopsis>
ALTER TABLE <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE> ALTER TABLE <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE>
DROP [COLUMN] <REPLACEABLE CLASS="PARAMETER">column</REPLACEABLE> { RESTRICT | CASCADE } DROP [ COLUMN ] <REPLACEABLE CLASS="PARAMETER">column</REPLACEABLE> { RESTRICT | CASCADE }
</Synopsis> </Synopsis>
</TERM> </TERM>
<LISTITEM> <LISTITEM>
...@@ -335,23 +339,3 @@ DROP TABLE temp; ...@@ -335,23 +339,3 @@ DROP TABLE temp;
</PARA> </PARA>
</VARIABLELIST> </VARIABLELIST>
</REFENTRY> </REFENTRY>
<!--
<REPLACEABLE CLASS="PARAMETER">
</REPLACEABLE>
<ReturnValue></ReturnValue>
<PARA>
</PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>&bull;
</TERM>
<LISTITEM>
<PARA>
</PARA>
</LISTITEM>
</VARLISTENTRY>
</VARIABLELIST>
<PARA>
</PARA>
-->
...@@ -14,26 +14,26 @@ ...@@ -14,26 +14,26 @@
</REFPURPOSE> </REFPURPOSE>
<REFSYNOPSISDIV> <REFSYNOPSISDIV>
<REFSYNOPSISDIVINFO> <REFSYNOPSISDIVINFO>
<DATE>1998-04-15</DATE> <DATE>1998-09-08</DATE>
</REFSYNOPSISDIVINFO> </REFSYNOPSISDIVINFO>
<synopsis> <synopsis>
ALTER USER <replaceable class="PARAMETER">username</replaceable> ALTER USER <replaceable class="PARAMETER">username</replaceable>
[WITH PASSWORD <replaceable class="PARAMETER">password</replaceable>] [ WITH PASSWORD <replaceable class="PARAMETER">password</replaceable> ]
[CREATEDB | NOCREATEDB] [ CREATEDB | NOCREATEDB ]
[CREATEUSER | NOCREATEUSER] [ CREATEUSER | NOCREATEUSER ]
[IN GROUP <replaceable class="PARAMETER">groupname</replaceable> [, ...] ] [ IN GROUP <replaceable class="PARAMETER">groupname</replaceable> [, ...] ]
[VALID UNTIL '<replaceable class="PARAMETER">abstime</replaceable>'] [ VALID UNTIL '<replaceable class="PARAMETER">abstime</replaceable>' ]
</synopsis> </synopsis>
<REFSECT2 ID="R2-SQL-ALTERUSER-1"> <REFSECT2 ID="R2-SQL-ALTERUSER-1">
<REFSECT2INFO> <REFSECT2INFO>
<DATE>1998-04-15</DATE> <DATE>1998-09-08</DATE>
</REFSECT2INFO> </REFSECT2INFO>
<TITLE> <TITLE>
Inputs Inputs
</TITLE> </TITLE>
<PARA> <PARA>
Refer to CREATE USER statement for a detailed description of each Refer to <command>CREATE USER</command> for a detailed description of each
clause. clause.
</para> </para>
<VARIABLELIST> <VARIABLELIST>
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
</PARA> </PARA>
</LISTITEM> </LISTITEM>
</VARLISTENTRY> </VARLISTENTRY>
<VARLISTENTRY> <VARLISTENTRY>
<TERM> <TERM>
<REPLACEABLE CLASS="PARAMETER"> password </REPLACEABLE> <REPLACEABLE CLASS="PARAMETER"> password </REPLACEABLE>
...@@ -57,6 +58,7 @@ ...@@ -57,6 +58,7 @@
</PARA> </PARA>
</LISTITEM> </LISTITEM>
</VARLISTENTRY> </VARLISTENTRY>
<VARLISTENTRY> <VARLISTENTRY>
<TERM> <TERM>
<REPLACEABLE CLASS="PARAMETER"> groupname </REPLACEABLE> <REPLACEABLE CLASS="PARAMETER"> groupname </REPLACEABLE>
...@@ -67,13 +69,15 @@ ...@@ -67,13 +69,15 @@
</PARA> </PARA>
</LISTITEM> </LISTITEM>
</VARLISTENTRY> </VARLISTENTRY>
<VARLISTENTRY> <VARLISTENTRY>
<TERM> <TERM>
<REPLACEABLE CLASS="PARAMETER"> abstime </REPLACEABLE> <REPLACEABLE CLASS="PARAMETER"> abstime </REPLACEABLE>
</TERM> </TERM>
<LISTITEM> <LISTITEM>
<PARA> <PARA>
The date (and, optionally, the time) at which this user's access is to be terminated. The date (and, optionally, the time)
at which this user's access is to be terminated.
</PARA> </PARA>
</LISTITEM> </LISTITEM>
</VARLISTENTRY> </VARLISTENTRY>
...@@ -82,7 +86,7 @@ ...@@ -82,7 +86,7 @@
<REFSECT2 ID="R2-SQL-ALTERUSER-2"> <REFSECT2 ID="R2-SQL-ALTERUSER-2">
<REFSECT2INFO> <REFSECT2INFO>
<DATE>1998-04-15</DATE> <DATE>1998-09-08</DATE>
</REFSECT2INFO> </REFSECT2INFO>
<TITLE> <TITLE>
Outputs Outputs
...@@ -92,14 +96,14 @@ ...@@ -92,14 +96,14 @@
<VARIABLELIST> <VARIABLELIST>
<VARLISTENTRY> <VARLISTENTRY>
<TERM> <TERM>
<ReturnValue>status</ReturnValue> <replaceable>status</replaceable>
</TERM> </TERM>
<LISTITEM> <LISTITEM>
<PARA> <PARA>
<VARIABLELIST> <VARIABLELIST>
<VARLISTENTRY> <VARLISTENTRY>
<TERM> <TERM>
<ReturnValue>ALTER USER</ReturnValue> <returnvalue>ALTER USER</returnvalue>
</TERM> </TERM>
<LISTITEM> <LISTITEM>
<PARA> <PARA>
...@@ -110,7 +114,7 @@ ...@@ -110,7 +114,7 @@
<VARLISTENTRY> <VARLISTENTRY>
<TERM> <TERM>
<ReturnValue>ERROR: alterUser: user "username" does not exist</ReturnValue> <returnvalue>ERROR: alterUser: user "username" does not exist</returnvalue>
</TERM> </TERM>
<LISTITEM> <LISTITEM>
<PARA> <PARA>
...@@ -129,16 +133,18 @@ ...@@ -129,16 +133,18 @@
<REFSECT1 ID="R1-SQL-ALTERUSER-1"> <REFSECT1 ID="R1-SQL-ALTERUSER-1">
<REFSECT1INFO> <REFSECT1INFO>
<DATE>1998-04-15</DATE> <DATE>1998-09-08</DATE>
</REFSECT1INFO> </REFSECT1INFO>
<TITLE> <TITLE>
Description Description
</TITLE> </TITLE>
<PARA> <PARA>
ALTER USER is used to change the attributes of a user's <command>ALTER USER</command> is used to change the attributes of a user's
PostgreSQL account. Please note that it is not possible <productname>Postgres</productname> account.
Please note that it is not possible
to alter a user's "usesysid" via the alter user to alter a user's "usesysid" via the alter user
statement. Also, it is only possible for the PostgreSQL statement. Also, it is only possible for the
<productname>Postgres</productname>
user or any user with read and modify permissions on user or any user with read and modify permissions on
"pg_shadow" to alter user passwords. "pg_shadow" to alter user passwords.
</PARA> </PARA>
...@@ -150,21 +156,24 @@ ...@@ -150,21 +156,24 @@
<REFSECT2 ID="R2-SQL-ALTERUSER-3"> <REFSECT2 ID="R2-SQL-ALTERUSER-3">
<REFSECT2INFO> <REFSECT2INFO>
<DATE>1998-04-15</DATE> <DATE>1998-09-08</DATE>
</REFSECT2INFO> </REFSECT2INFO>
<TITLE> <TITLE>
Notes Notes
</TITLE> </TITLE>
<PARA> <PARA>
ALTER USER statement is a PostgreSQL language extension. <command>ALTER USER</command> statement
is a <productname>Postgres</productname>
language extension.
</para> </para>
<para> <para>
Refer to CREATE/DROP USER statements to create/remove an user Refer to <command>CREATE/DROP USER</command>
to create or remove a user
account. account.
</para> </para>
<para> <para>
At the current release (6.3.2), the IN GROUP clause is parsed In the current release (v6.4), the IN GROUP clause is parsed
but has no effect. When it is fully implemented, it is but has no affect. When it is fully implemented, it is
intended to modify the pg_group relation. intended to modify the pg_group relation.
</para> </para>
</REFSECT2> </REFSECT2>
...@@ -178,13 +187,13 @@ ...@@ -178,13 +187,13 @@
Change a user password Change a user password
</PARA> </PARA>
<ProgramListing> <ProgramListing>
ALTER USER davide WITH PASSWORD hu8jmn3; ALTER USER davide WITH PASSWORD hu8jmn3;
</ProgramListing> </ProgramListing>
<para> <para>
Change a user's valid until date Change a user's valid until date
</para> </para>
<ProgramListing> <ProgramListing>
ALTER USER manuel VALID UNTIL 'Jan 31 2030'; ALTER USER manuel VALID UNTIL 'Jan 31 2030';
</ProgramListing> </ProgramListing>
<para> <para>
Change a user's valid until date, specifying that his Change a user's valid until date, specifying that his
...@@ -192,19 +201,19 @@ authorisation should expire at midday on 4th May 1998 using ...@@ -192,19 +201,19 @@ authorisation should expire at midday on 4th May 1998 using
the time zone which is one hour ahead of UTC the time zone which is one hour ahead of UTC
</para> </para>
<ProgramListing> <ProgramListing>
ALTER USER chris VALID UNTIL 'May 4 12:00:00 1998 +1'; ALTER USER chris VALID UNTIL 'May 4 12:00:00 1998 +1';
</ProgramListing> </ProgramListing>
<para> <para>
Give a user the ability to create other users and new databases. Give a user the ability to create other users and new databases.
</para> </para>
<programlisting> <programlisting>
ALTER USER miriam CREATEUSER CREATEDB; ALTER USER miriam CREATEUSER CREATEDB;
</programlisting> </programlisting>
<para> <para>
Place a user in two groups Place a user in two groups
</para> </para>
<programlisting> <programlisting>
ALTER USER miriam IN GROUP sales, payroll; ALTER USER miriam IN GROUP sales, payroll;
</programlisting> </programlisting>
</REFSECT1> </REFSECT1>
...@@ -217,13 +226,15 @@ the time zone which is one hour ahead of UTC ...@@ -217,13 +226,15 @@ the time zone which is one hour ahead of UTC
<REFSECT2 ID="R2-SQL-ALTERUSER-4"> <REFSECT2 ID="R2-SQL-ALTERUSER-4">
<REFSECT2INFO> <REFSECT2INFO>
<DATE>1998-04-15</DATE> <DATE>1998-09-08</DATE>
</REFSECT2INFO> </REFSECT2INFO>
<TITLE> <TITLE>
SQL92 SQL92
</TITLE> </TITLE>
<PARA> <PARA>
There is no ALTER USER statement in SQL92. The standard leaves There is no <command>ALTER USER</command> statement in
<acronym>SQL92</acronym>.
The standard leaves
the definition of users to the implementation. the definition of users to the implementation.
</PARA> </PARA>
</refsect1> </refsect1>
......
...@@ -16,38 +16,26 @@ ...@@ -16,38 +16,26 @@
<REFSYNOPSISDIV> <REFSYNOPSISDIV>
<REFSYNOPSISDIVINFO> <REFSYNOPSISDIVINFO>
<DATE>1998-04-15</DATE> <DATE>1998-09-08</DATE>
</REFSYNOPSISDIVINFO> </REFSYNOPSISDIVINFO>
<SYNOPSIS> <SYNOPSIS>
BEGIN { WORK | TRANSACTION } BEGIN [ WORK | TRANSACTION ]
</SYNOPSIS> </SYNOPSIS>
<REFSECT2 ID="R2-SQL-BEGINWORK-1"> <REFSECT2 ID="R2-SQL-BEGINWORK-1">
<REFSECT2INFO> <REFSECT2INFO>
<DATE>1998-04-15</DATE> <DATE>1998-09-08</DATE>
</REFSECT2INFO> </REFSECT2INFO>
<TITLE> <TITLE>
Inputs Inputs
</TITLE> </TITLE>
<PARA> <PARA>
</PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
<ReturnValue>
None None
</ReturnValue>
</TERM>
<LISTITEM>
<para></para>
</LISTITEM>
</varlistentry>
</VARIABLELIST>
</REFSECT2> </REFSECT2>
<REFSECT2 ID="R2-SQL-BEGINWORK-2"> <REFSECT2 ID="R2-SQL-BEGINWORK-2">
<REFSECT2INFO> <REFSECT2INFO>
<DATE>1998-04-15</DATE> <DATE>1998-09-08</DATE>
</REFSECT2INFO> </REFSECT2INFO>
<TITLE> <TITLE>
Outputs Outputs
...@@ -57,14 +45,14 @@ ...@@ -57,14 +45,14 @@
<VARIABLELIST> <VARIABLELIST>
<VARLISTENTRY> <VARLISTENTRY>
<TERM> <TERM>
status <replaceable>status</replaceable>
</TERM> </TERM>
<LISTITEM> <LISTITEM>
<PARA> <PARA>
<VARIABLELIST> <VARIABLELIST>
<VARLISTENTRY> <VARLISTENTRY>
<TERM> <TERM>
<ReturnValue>BEGIN</ReturnValue> <returnvalue>BEGIN</returnvalue>
</TERM> </TERM>
<LISTITEM> <LISTITEM>
<PARA> <PARA>
...@@ -74,18 +62,12 @@ ...@@ -74,18 +62,12 @@
</VARLISTENTRY> </VARLISTENTRY>
<VARLISTENTRY> <VARLISTENTRY>
<TERM> <TERM>
<ReturnValue> <returnvalue>NOTICE: BeginTransactionBlock and not in default state</returnvalue>
NOTICE: BeginTransactionBlock and not in default state
</ReturnValue>
</TERM> </TERM>
<LISTITEM> <LISTITEM>
<PARA> <PARA>
This indicates that a transaction was already in progress. This indicates that a transaction was already in progress.
<comment> The current transaction is not affected.
What happens to command queries already run
in the transaction? Does this have no effect, or does
it restart the transaction?
</comment>
</PARA> </PARA>
</LISTITEM> </LISTITEM>
</VARLISTENTRY> </VARLISTENTRY>
...@@ -99,17 +81,20 @@ ...@@ -99,17 +81,20 @@
<REFSECT1 ID="R1-SQL-BEGINWORK-1"> <REFSECT1 ID="R1-SQL-BEGINWORK-1">
<REFSECT1INFO> <REFSECT1INFO>
<DATE>1998-04-15</DATE> <DATE>1998-09-08</DATE>
</REFSECT1INFO> </REFSECT1INFO>
<TITLE> <TITLE>
Description Description
</TITLE> </TITLE>
<para> <para>
BEGIN begins a user transaction which PostgreSQL will <command>BEGIN</command> initiates a user transaction
guarantee is serialisable with respect to all concurrently which <productname>Postgres</productname> will
executing transactions. PostgreSQL uses two-phase locking guarantee is serializable with respect to all concurrently
executing transactions. <productname>Postgres</productname> uses two-phase
locking
to perform this task. If the transaction is committed, to perform this task. If the transaction is committed,
PostgreSQL will ensure either that all updates are done orelse <productname>Postgres</productname> will ensure either that all updates are
done or else
that none of that none of
them are done. Transactions have the standard ACID them are done. Transactions have the standard ACID
(atomic, consistent, isolatable, and durable) property. (atomic, consistent, isolatable, and durable) property.
...@@ -117,7 +102,7 @@ ...@@ -117,7 +102,7 @@
<REFSECT2 ID="R2-SQL-BEGINWORK-3"> <REFSECT2 ID="R2-SQL-BEGINWORK-3">
<REFSECT2INFO> <REFSECT2INFO>
<DATE>1998-04-15</DATE> <DATE>1998-09-08</DATE>
</REFSECT2INFO> </REFSECT2INFO>
<TITLE> <TITLE>
Notes Notes
...@@ -126,18 +111,15 @@ ...@@ -126,18 +111,15 @@
The keyword TRANSACTION is just a cosmetic alternative to WORK. The keyword TRANSACTION is just a cosmetic alternative to WORK.
Neither keyword need be specified. Neither keyword need be specified.
</PARA> </PARA>
<PARA>
BEGIN statement is a PostgreSQL language extension.
</PARA>
<PARA> <PARA>
Refer to the LOCK statement for further information about locking Refer to the <command>LOCK</command> statement for further information
tables inside a transaction. about locking tables inside a transaction.
</PARA> </PARA>
<PARA> <PARA>
Use COMMIT or ROLLBACK to terminate a transaction. Use <command>COMMIT</command> or <command>ROLLBACK</command>
to terminate a transaction.
</PARA> </PARA>
</REFSECT2> </REFSECT2>
...@@ -146,9 +128,9 @@ ...@@ -146,9 +128,9 @@
Usage Usage
</TITLE> </TITLE>
<PARA>To begin a user transaction: <PARA>To begin a user transaction:
</PARA>
<ProgramListing> <ProgramListing>
BEGIN WORK; BEGIN WORK;
</ProgramListing> </ProgramListing>
</REFSECT1> </REFSECT1>
...@@ -157,17 +139,19 @@ ...@@ -157,17 +139,19 @@
Compatibility Compatibility
</TITLE> </TITLE>
<PARA> <PARA>
</PARA> <command>BEGIN</command>
is a <productname>Postgres</productname> language extension.
<REFSECT2 ID="R2-SQL-BEGINWORK-4"> <REFSECT2 ID="R2-SQL-BEGINWORK-4">
<REFSECT2INFO> <REFSECT2INFO>
<DATE>1998-04-15</DATE> <DATE>1998-09-08</DATE>
</REFSECT2INFO> </REFSECT2INFO>
<TITLE> <TITLE>
SQL92 SQL92
</TITLE> </TITLE>
<PARA> <PARA>
There is no explicit "BEGIN WORK" in SQL92; transaction initiation There is no explicit BEGIN WORK command in <acronym>SQL92</acronym>;
transaction initiation
is always implicit and it terminates either with a COMMIT or with is always implicit and it terminates either with a COMMIT or with
a ROLLBACK statement. a ROLLBACK statement.
</PARA> </PARA>
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<REFSYNOPSISDIV> <REFSYNOPSISDIV>
<REFSYNOPSISDIVINFO> <REFSYNOPSISDIVINFO>
<DATE>1998-04-15</DATE> <DATE>1998-09-08</DATE>
</REFSYNOPSISDIVINFO> </REFSYNOPSISDIVINFO>
<SYNOPSIS> <SYNOPSIS>
CLOSE <REPLACEABLE CLASS="PARAMETER">cursor</REPLACEABLE> CLOSE <REPLACEABLE CLASS="PARAMETER">cursor</REPLACEABLE>
...@@ -23,25 +23,16 @@ CLOSE <REPLACEABLE CLASS="PARAMETER">cursor</REPLACEABLE> ...@@ -23,25 +23,16 @@ CLOSE <REPLACEABLE CLASS="PARAMETER">cursor</REPLACEABLE>
<REFSECT2 ID="R2-SQL-CLOSE-1"> <REFSECT2 ID="R2-SQL-CLOSE-1">
<REFSECT2INFO> <REFSECT2INFO>
<DATE>1998-04-15</DATE> <DATE>1998-09-08</DATE>
</REFSECT2INFO> </REFSECT2INFO>
<TITLE> <TITLE>
Inputs Inputs
</TITLE> </TITLE>
<PARA> <PARA>
</PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
</TERM>
<LISTITEM>
<PARA>
<VARIABLELIST> <VARIABLELIST>
<VARLISTENTRY> <VARLISTENTRY>
<TERM> <TERM>
<ReturnValue>
<REPLACEABLE CLASS="PARAMETER">cursor</REPLACEABLE> <REPLACEABLE CLASS="PARAMETER">cursor</REPLACEABLE>
</ReturnValue>
</TERM> </TERM>
<LISTITEM> <LISTITEM>
<PARA> <PARA>
...@@ -50,14 +41,11 @@ CLOSE <REPLACEABLE CLASS="PARAMETER">cursor</REPLACEABLE> ...@@ -50,14 +41,11 @@ CLOSE <REPLACEABLE CLASS="PARAMETER">cursor</REPLACEABLE>
</LISTITEM> </LISTITEM>
</VARLISTENTRY> </VARLISTENTRY>
</variablelist> </variablelist>
</LISTITEM>
</VARLISTENTRY>
</VARIABLELIST>
</REFSECT2> </REFSECT2>
<REFSECT2 ID="R2-SQL-CLOSE-2"> <REFSECT2 ID="R2-SQL-CLOSE-2">
<REFSECT2INFO> <REFSECT2INFO>
<DATE>1998-04-15</DATE> <DATE>1998-09-08</DATE>
</REFSECT2INFO> </REFSECT2INFO>
<TITLE> <TITLE>
Outputs Outputs
...@@ -67,15 +55,16 @@ CLOSE <REPLACEABLE CLASS="PARAMETER">cursor</REPLACEABLE> ...@@ -67,15 +55,16 @@ CLOSE <REPLACEABLE CLASS="PARAMETER">cursor</REPLACEABLE>
<VARIABLELIST> <VARIABLELIST>
<VARLISTENTRY> <VARLISTENTRY>
<TERM> <TERM>
<replaceable>
status
</replaceable>
</TERM> </TERM>
<LISTITEM> <LISTITEM>
<PARA> <PARA>
<VARIABLELIST> <VARIABLELIST>
<VARLISTENTRY> <VARLISTENTRY>
<TERM> <TERM>
<ReturnValue> <ReturnValue>CLOSE</ReturnValue>
CLOSE
</ReturnValue>
</TERM> </TERM>
<LISTITEM> <LISTITEM>
<PARA> <PARA>
...@@ -85,9 +74,7 @@ CLOSE <REPLACEABLE CLASS="PARAMETER">cursor</REPLACEABLE> ...@@ -85,9 +74,7 @@ CLOSE <REPLACEABLE CLASS="PARAMETER">cursor</REPLACEABLE>
</VARLISTENTRY> </VARLISTENTRY>
<VARLISTENTRY> <VARLISTENTRY>
<TERM> <TERM>
<ReturnValue> <ReturnValue>NOTICE PerformPortalClose: portal "<REPLACEABLE CLASS="PARAMETER">cursor</REPLACEABLE>" not found</ReturnValue>
NOTICE PerformPortalClose: portal "<REPLACEABLE CLASS="PARAMETER">cursor</REPLACEABLE>" not found
</ReturnValue>
</TERM> </TERM>
<LISTITEM> <LISTITEM>
<PARA> <PARA>
...@@ -107,33 +94,35 @@ CLOSE <REPLACEABLE CLASS="PARAMETER">cursor</REPLACEABLE> ...@@ -107,33 +94,35 @@ CLOSE <REPLACEABLE CLASS="PARAMETER">cursor</REPLACEABLE>
<REFSECT1 ID="R1-SQL-CLOSE-1"> <REFSECT1 ID="R1-SQL-CLOSE-1">
<REFSECT1INFO> <REFSECT1INFO>
<DATE>1998-04-15</DATE> <DATE>1998-09-08</DATE>
</REFSECT1INFO> </REFSECT1INFO>
<TITLE> <TITLE>
Description Description
</TITLE> </TITLE>
<PARA> <PARA>
CLOSE frees the resources associated with an open cursor. <command>CLOSE</command> frees the resources associated with an open cursor.
After the cursor is closed, no subsequent operations After the cursor is closed, no subsequent operations
are allowed on it. A cursor should be closed when it is are allowed on it. A cursor should be closed when it is
no longer needed. no longer needed.
</PARA> </PARA>
<PARA> <PARA>
An implicit close is executed for every open cursor when a An implicit close is executed for every open cursor when a
transaction is terminated by COMMIT or ROLLBACK. transaction is terminated by <command>COMMIT</command>
or <command>ROLLBACK</command>.
</PARA> </PARA>
<REFSECT2 ID="R2-SQL-CLOSE-3"> <REFSECT2 ID="R2-SQL-CLOSE-3">
<REFSECT2INFO> <REFSECT2INFO>
<DATE>1998-04-15</DATE> <DATE>1998-09-08</DATE>
</REFSECT2INFO> </REFSECT2INFO>
<TITLE> <TITLE>
Notes Notes
</TITLE> </TITLE>
<PARA> <PARA>
PostgreSQL does not have an explicit OPEN cursor statement; <productname>Postgres</productname> does not have
a cursor is considered open when it is DECLAREd. an explicit <command>OPEN</command> cursor statement;
Use DECLARE to declare a cursor. a cursor is considered open when it is declared.
Use the <command>DECLARE</command> statement to declare a cursor.
</PARA> </PARA>
</REFSECT2> </REFSECT2>
</refsect1> </refsect1>
...@@ -146,7 +135,7 @@ CLOSE <REPLACEABLE CLASS="PARAMETER">cursor</REPLACEABLE> ...@@ -146,7 +135,7 @@ CLOSE <REPLACEABLE CLASS="PARAMETER">cursor</REPLACEABLE>
Close the cursor liahona: Close the cursor liahona:
</PARA> </PARA>
<ProgramListing> <ProgramListing>
CLOSE liahona; CLOSE liahona;
</ProgramListing> </ProgramListing>
</REFSECT1> </REFSECT1>
...@@ -159,13 +148,13 @@ CLOSE <REPLACEABLE CLASS="PARAMETER">cursor</REPLACEABLE> ...@@ -159,13 +148,13 @@ CLOSE <REPLACEABLE CLASS="PARAMETER">cursor</REPLACEABLE>
<REFSECT2 ID="R2-SQL-CLOSE-4"> <REFSECT2 ID="R2-SQL-CLOSE-4">
<REFSECT2INFO> <REFSECT2INFO>
<DATE>1998-04-15</DATE> <DATE>1998-09-08</DATE>
</REFSECT2INFO> </REFSECT2INFO>
<TITLE> <TITLE>
SQL92 SQL92
</TITLE> </TITLE>
<PARA> <PARA>
CLOSE is fully compatibile with SQL92. <command>CLOSE</command> is fully compatible with SQL92.
</PARA> </PARA>
</refsect2> </refsect2>
</refsect1> </refsect1>
......
...@@ -15,15 +15,15 @@ ...@@ -15,15 +15,15 @@
<REFSYNOPSISDIV> <REFSYNOPSISDIV>
<REFSYNOPSISDIVINFO> <REFSYNOPSISDIVINFO>
<DATE>1998-04-15</DATE> <DATE>1998-09-08</DATE>
</REFSYNOPSISDIVINFO> </REFSYNOPSISDIVINFO>
<SYNOPSIS> <SYNOPSIS>
CLUSTER <REPLACEABLE CLASS="PARAMETER">indexname</REPLACEABLE> ON <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE> CLUSTER <REPLACEABLE CLASS="PARAMETER">indexname</REPLACEABLE> ON <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE>
</SYNOPSIS> </SYNOPSIS>
<REFSECT2 ID="R2-SQL-CLUSTER-1"> <REFSECT2 ID="R2-SQL-CLUSTER-1">
<REFSECT2INFO> <REFSECT2INFO>
<DATE>1998-04-15</DATE> <DATE>1998-09-08</DATE>
</REFSECT2INFO> </REFSECT2INFO>
<TITLE> <TITLE>
Inputs Inputs
...@@ -33,9 +33,7 @@ ...@@ -33,9 +33,7 @@
<VARIABLELIST> <VARIABLELIST>
<VARLISTENTRY> <VARLISTENTRY>
<TERM> <TERM>
<ReturnValue>
<REPLACEABLE CLASS="PARAMETER">indexname</REPLACEABLE> <REPLACEABLE CLASS="PARAMETER">indexname</REPLACEABLE>
</ReturnValue>
</TERM> </TERM>
<LISTITEM> <LISTITEM>
<PARA> <PARA>
...@@ -45,9 +43,7 @@ ...@@ -45,9 +43,7 @@
</VARLISTENTRY> </VARLISTENTRY>
<VARLISTENTRY> <VARLISTENTRY>
<TERM> <TERM>
<ReturnValue>
<REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE> <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE>
</ReturnValue>
</TERM> </TERM>
<LISTITEM> <LISTITEM>
<PARA> <PARA>
...@@ -60,7 +56,7 @@ ...@@ -60,7 +56,7 @@
<REFSECT2 ID="R2-SQL-CLUSTER-2"> <REFSECT2 ID="R2-SQL-CLUSTER-2">
<REFSECT2INFO> <REFSECT2INFO>
<DATE>1998-04-15</DATE> <DATE>1998-09-08</DATE>
</REFSECT2INFO> </REFSECT2INFO>
<TITLE> <TITLE>
Outputs Outputs
...@@ -70,13 +66,14 @@ ...@@ -70,13 +66,14 @@
<VARIABLELIST> <VARIABLELIST>
<VARLISTENTRY> <VARLISTENTRY>
<TERM> <TERM>
<replaceable>status</replaceable>
</TERM> </TERM>
<LISTITEM> <LISTITEM>
<PARA> <PARA>
<VARIABLELIST> <VARIABLELIST>
<VARLISTENTRY> <VARLISTENTRY>
<TERM> <TERM>
<ReturnValue>CLUSTER</ReturnValue> <returnvalue>CLUSTER</returnvalue>
</TERM> </TERM>
<LISTITEM> <LISTITEM>
<PARA> <PARA>
...@@ -86,11 +83,11 @@ ...@@ -86,11 +83,11 @@
</VARLISTENTRY> </VARLISTENTRY>
<VARLISTENTRY> <VARLISTENTRY>
<TERM> <TERM>
<ReturnValue>ERROR: relation &lt;<REPLACEABLE CLASS="PARAMETER">tablerelation_number</REPLACEABLE>&gt; inherits "invoice"</ReturnValue> <returnvalue>ERROR: relation &lt;<REPLACEABLE CLASS="PARAMETER">tablerelation_number</REPLACEABLE>&gt; inherits "invoice"</returnvalue>
</TERM> </TERM>
<LISTITEM> <LISTITEM>
<PARA> <PARA>
???
<comment> <comment>
This is not documented anywhere. It seems not to be possible to This is not documented anywhere. It seems not to be possible to
cluster a table that is inherited. cluster a table that is inherited.
...@@ -100,11 +97,11 @@ ...@@ -100,11 +97,11 @@
</VARLISTENTRY> </VARLISTENTRY>
<VARLISTENTRY> <VARLISTENTRY>
<TERM> <TERM>
<ReturnValue>ERROR: Relation x does not exist!</ReturnValue> <returnvalue>ERROR: Relation x does not exist!</returnvalue>
</TERM> </TERM>
<LISTITEM> <LISTITEM>
<PARA> <PARA>
???
<comment> <comment>
The relation complained of was not shown in the error message, The relation complained of was not shown in the error message,
which contained a random string instead of the relation name. which contained a random string instead of the relation name.
...@@ -122,27 +119,37 @@ ...@@ -122,27 +119,37 @@
<REFSECT1 ID="R1-SQL-CLUSTER-1"> <REFSECT1 ID="R1-SQL-CLUSTER-1">
<REFSECT1INFO> <REFSECT1INFO>
<DATE>1998-04-15</DATE> <DATE>1998-09-08</DATE>
</REFSECT1INFO> </REFSECT1INFO>
<TITLE> <TITLE>
Description Description
</TITLE> </TITLE>
<PARA> <PARA>
This command instructs PostgreSQL to cluster the class specified <command>CLUSTER</command> instructs <productname>Postgres</productname>
to cluster the class specified
by <replaceable class="parameter">classname</replaceable> approximately by <replaceable class="parameter">classname</replaceable> approximately
based on the index specified by based on the index specified by
<replaceable class="parameter">indexname</replaceable>. The index must <replaceable class="parameter">indexname</replaceable>. The index must
already have been defined on <replaceable class="parameter">classname</replaceable>. already have been defined on
<replaceable class="parameter">classname</replaceable>.
</PARA> </PARA>
<para> <para>
When a class is clustered, it is physically reordered When a class is clustered, it is physically reordered
based on the index information. The clustering is static. based on the index information. The clustering is static.
In other words, as the class is updated, the changes are In other words, as the class is updated, the changes are
not clustered. No attempt is made to keep new instances or not clustered. No attempt is made to keep new instances or
updated tuples clustered. If he wishes, the user can updated tuples clustered. If one wishes, one can
recluster manually by issuing the command again. recluster manually by issuing the command again.
</para> </para>
<REFSECT2 ID="R2-SQL-CLUSTER-3">
<REFSECT2INFO>
<DATE>1998-09-08</DATE>
</REFSECT2INFO>
<TITLE>
Notes
</TITLE>
<PARA>
<para> <para>
The table is actually copied to a temporary table in index The table is actually copied to a temporary table in index
order, then renamed back to the original name. For this order, then renamed back to the original name. For this
...@@ -155,16 +162,15 @@ ...@@ -155,16 +162,15 @@
within a table, the actual order of the data in the heap within a table, the actual order of the data in the heap
table is unimportant. However, if you tend to access some table is unimportant. However, if you tend to access some
data more than others, and there is an index that groups data more than others, and there is an index that groups
them together, you will benefit from using the CLUSTER them together, you will benefit from using <command>CLUSTER</command>.
command.
</para> </para>
<para> <para>
Another place CLUSTER is good is in cases where you use an Another place <command>CLUSTER</command> is helpful is in cases where you use an
index to pull out several rows from a table. If you are index to pull out several rows from a table. If you are
requesting a range of indexed values from a table, or a requesting a range of indexed values from a table, or a
single indexed value that has multiple rows that match, single indexed value that has multiple rows that match,
CLUSTER will help because once the index identifies the <command>CLUSTER</command> will help because once the index identifies the
heap page for the first row that matches, all other rows heap page for the first row that matches, all other rows
that match are probably already on the same heap page, that match are probably already on the same heap page,
saving disk accesses and speeding up the query. saving disk accesses and speeding up the query.
...@@ -172,25 +178,27 @@ ...@@ -172,25 +178,27 @@
<para> <para>
There are two ways to cluster data. The first is with the There are two ways to cluster data. The first is with the
CLUSTER command, which reorders the original table with <command>CLUSTER</command> command, which reorders the original table with
the ordering of the index you specify. This can be slow the ordering of the index you specify. This can be slow
on large tables because the rows are fetched from the heap on large tables because the rows are fetched from the heap
in index order, and if the heap table is unordered, the in index order, and if the heap table is unordered, the
entries are on random pages, so there is one disk page entries are on random pages, so there is one disk page
retrieved for every row moved. PostgreSQL has a cache, retrieved for every row moved. <productname>Postgres</productname> has a cache,
but the majority of a big table will not fit in the cache. but the majority of a big table will not fit in the cache.
</para> </para>
<para> <para>
Another way is to use Another way to cluster data is to use
<programlisting>SELECT ... INTO TABLE temp FROM ... ORDER BY ...</programlisting> <programlisting>
This uses the PostgreSQL sorting code in SELECT ... INTO TABLE <replaceable class="parameter">temp</replaceable> FROM ... ORDER BY ...
</programlisting>
This uses the <productname>Postgres</productname> sorting code in
ORDER BY to match the index, and is much faster for ORDER BY to match the index, and is much faster for
unordered data. You then drop the old table, use unordered data. You then drop the old table, use
<programlisting>ALTER TABLE RENAME</programlisting> <command>ALTER TABLE/RENAME</command>
to rename 'temp' to the old name, and to rename <replaceable class="parameter">temp</replaceable> to the old name, and
recreate the b bindexes. The only problem is that oids recreate any indexes. The only problem is that <acronym>OID</acronym>s
will not be preserved. From then on, CLUSTER should be will not be preserved. From then on, <command>CLUSTER</command> should be
fast because most of the heap data has already been fast because most of the heap data has already been
ordered, and the existing index is used. ordered, and the existing index is used.
</para> </para>
...@@ -204,7 +212,7 @@ ...@@ -204,7 +212,7 @@
Cluster the employees relation on the basis of its salary attribute Cluster the employees relation on the basis of its salary attribute
</PARA> </PARA>
<ProgramListing> <ProgramListing>
CLUSTER emp_ind ON emp CLUSTER emp_ind ON emp
</ProgramListing> </ProgramListing>
</REFSECT1> </REFSECT1>
...@@ -217,13 +225,13 @@ ...@@ -217,13 +225,13 @@
<REFSECT2 ID="R2-SQL-CLUSTER-4"> <REFSECT2 ID="R2-SQL-CLUSTER-4">
<REFSECT2INFO> <REFSECT2INFO>
<DATE>1998-04-15</DATE> <DATE>1998-09-08</DATE>
</REFSECT2INFO> </REFSECT2INFO>
<TITLE> <TITLE>
SQL92 SQL92
</TITLE> </TITLE>
<PARA> <PARA>
There is no CLUSTER statement in SQL92. There is no <command>CLUSTER</command> statement in SQL92.
</PARA> </PARA>
</refsect2> </refsect2>
</refsect1> </refsect1>
......
...@@ -16,63 +16,43 @@ ...@@ -16,63 +16,43 @@
<REFSYNOPSISDIV> <REFSYNOPSISDIV>
<REFSYNOPSISDIVINFO> <REFSYNOPSISDIVINFO>
<DATE>1998-04-15</DATE> <DATE>1998-09-08</DATE>
</REFSYNOPSISDIVINFO> </REFSYNOPSISDIVINFO>
<SYNOPSIS> <SYNOPSIS>
COMMIT [ WORK ] COMMIT [ WORK | TRANSACTION ]
</SYNOPSIS> </SYNOPSIS>
<REFSECT2 ID="R2-SQL-COMMIT-1"> <REFSECT2 ID="R2-SQL-COMMIT-1">
<REFSECT2INFO> <REFSECT2INFO>
<DATE>1998-04-15</DATE> <DATE>1998-09-08</DATE>
</REFSECT2INFO> </REFSECT2INFO>
<TITLE> <TITLE>
Inputs Inputs
</TITLE> </TITLE>
<PARA> <PARA>
</PARA> None
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
</TERM>
<LISTITEM>
<PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
<ReturnValue>None</ReturnValue>
</TERM>
<LISTITEM>
<PARA>
</PARA>
</LISTITEM>
</VARLISTENTRY>
</variablelist>
</LISTITEM>
</VARLISTENTRY>
</VARIABLELIST>
</REFSECT2> </REFSECT2>
<REFSECT2 ID="R2-SQL-COMMIT-2"> <REFSECT2 ID="R2-SQL-COMMIT-2">
<REFSECT2INFO> <REFSECT2INFO>
<DATE>1998-04-15</DATE> <DATE>1998-09-08</DATE>
</REFSECT2INFO> </REFSECT2INFO>
<TITLE> <TITLE>
Outputs Outputs
</TITLE> </TITLE>
<PARA> <PARA>
</PARA>
<VARIABLELIST> <VARIABLELIST>
<VARLISTENTRY> <VARLISTENTRY>
<TERM> <TERM>
<replaceable>status</replaceable>
</TERM> </TERM>
<LISTITEM> <LISTITEM>
<PARA> <PARA>
<VARIABLELIST> <VARIABLELIST>
<VARLISTENTRY> <VARLISTENTRY>
<TERM> <TERM>
<ReturnValue>END</ReturnValue> <returnvalue>END</returnvalue>
</TERM> </TERM>
<LISTITEM> <LISTITEM>
<PARA> <PARA>
...@@ -82,8 +62,7 @@ Message returned if the transaction is successfully committed. ...@@ -82,8 +62,7 @@ Message returned if the transaction is successfully committed.
</VARLISTENTRY> </VARLISTENTRY>
<VARLISTENTRY> <VARLISTENTRY>
<TERM> <TERM>
<ReturnValue>NOTICE EndTransactionBlock and not inprogress/abort state <returnvalue>NOTICE EndTransactionBlock and not inprogress/abort state</returnvalue>
</ReturnValue>
</TERM> </TERM>
<LISTITEM> <LISTITEM>
<PARA> <PARA>
...@@ -100,29 +79,29 @@ If there is no transaction in progress. ...@@ -100,29 +79,29 @@ If there is no transaction in progress.
<REFSECT1 ID="R1-SQL-COMMIT-1"> <REFSECT1 ID="R1-SQL-COMMIT-1">
<REFSECT1INFO> <REFSECT1INFO>
<DATE>1998-04-15</DATE> <DATE>1998-09-08</DATE>
</REFSECT1INFO> </REFSECT1INFO>
<TITLE> <TITLE>
Description Description
</TITLE> </TITLE>
<PARA> <PARA>
COMMIT commits the current transaction. All <command>COMMIT</command> commits the current transaction. All
changes made by the transaction become visible to others changes made by the transaction become visible to others
and are guaranteed to be durable if a crash occurs. and are guaranteed to be durable if a crash occurs.
</PARA> </PARA>
<REFSECT2 ID="R2-SQL-COMMIT-3"> <REFSECT2 ID="R2-SQL-COMMIT-3">
<REFSECT2INFO> <REFSECT2INFO>
<DATE>1998-04-15</DATE> <DATE>1998-09-08</DATE>
</REFSECT2INFO> </REFSECT2INFO>
<TITLE> <TITLE>
Notes Notes
</TITLE> </TITLE>
<PARA> <PARA>
The keyword WORK is noise and can be omitted. The keywords WORK and TRANSACTION are noise and can be omitted.
</PARA> </PARA>
<para> <para>
Refer to ROLLBACK statements to abort a transaction. Use the <command>ROLLBACK</command> statement to abort a transaction.
</para> </para>
</REFSECT2> </REFSECT2>
</refsect1> </refsect1>
...@@ -135,7 +114,7 @@ If there is no transaction in progress. ...@@ -135,7 +114,7 @@ If there is no transaction in progress.
To make all changes permanent: To make all changes permanent:
</PARA> </PARA>
<ProgramListing> <ProgramListing>
COMMIT WORK; COMMIT WORK;
</ProgramListing> </ProgramListing>
</REFSECT1> </REFSECT1>
...@@ -148,7 +127,7 @@ To make all changes permanent: ...@@ -148,7 +127,7 @@ To make all changes permanent:
<REFSECT2 ID="R2-SQL-COMMIT-4"> <REFSECT2 ID="R2-SQL-COMMIT-4">
<REFSECT2INFO> <REFSECT2INFO>
<DATE>1998-04-15</DATE> <DATE>1998-09-08</DATE>
</REFSECT2INFO> </REFSECT2INFO>
<TITLE> <TITLE>
SQL92 SQL92
......
This diff is collapsed.
This diff is collapsed.
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
<DATE>1998-04-15</DATE> <DATE>1998-04-15</DATE>
</REFSYNOPSISDIVINFO> </REFSYNOPSISDIVINFO>
<SYNOPSIS> <SYNOPSIS>
CREATE DATABASE <REPLACEABLE CLASS="PARAMETER">name</REPLACEABLE> [WITH LOCATION = '<replaceable class="parameter">dbpath</replaceable>'] CREATE DATABASE <REPLACEABLE CLASS="PARAMETER">name</REPLACEABLE> [ WITH LOCATION = '<replaceable class="parameter">dbpath</replaceable>' ]
</SYNOPSIS> </SYNOPSIS>
<REFSECT2 ID="R2-SQL-CREATEDATABASE-1"> <REFSECT2 ID="R2-SQL-CREATEDATABASE-1">
...@@ -28,13 +28,6 @@ ...@@ -28,13 +28,6 @@
Inputs Inputs
</TITLE> </TITLE>
<PARA> <PARA>
</PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
</TERM>
<LISTITEM>
<PARA>
<VARIABLELIST> <VARIABLELIST>
<VARLISTENTRY> <VARLISTENTRY>
<TERM> <TERM>
...@@ -62,9 +55,6 @@ ...@@ -62,9 +55,6 @@
</LISTITEM> </LISTITEM>
</VARLISTENTRY> </VARLISTENTRY>
</VARIABLELIST> </VARIABLELIST>
</LISTITEM>
</VARLISTENTRY>
</VARIABLELIST>
</REFSECT2> </REFSECT2>
<REFSECT2 ID="R2-SQL-CREATEDATABASE-2"> <REFSECT2 ID="R2-SQL-CREATEDATABASE-2">
...@@ -79,6 +69,7 @@ ...@@ -79,6 +69,7 @@
<VARIABLELIST> <VARIABLELIST>
<VARLISTENTRY> <VARLISTENTRY>
<TERM> <TERM>
<replaceable>status</replaceable>
</TERM> </TERM>
<LISTITEM> <LISTITEM>
<PARA> <PARA>
...@@ -142,10 +133,11 @@ There was a problem with creating the required directory; this operation will ...@@ -142,10 +133,11 @@ There was a problem with creating the required directory; this operation will
Notes Notes
</TITLE> </TITLE>
<PARA> <PARA>
<command>CREATE DATABASE</command> statement is a Postgres language extension. <command>CREATE DATABASE</command> is a <productname>Postgres</productname>
language extension.
</PARA> </PARA>
<para> <para>
Refer to <command>DROP DATABASE</command> statement to remove a database. Use <command>DROP DATABASE</command> to remove a database.
</para> </para>
</REFSECT2> </REFSECT2>
...@@ -157,26 +149,26 @@ There was a problem with creating the required directory; this operation will ...@@ -157,26 +149,26 @@ There was a problem with creating the required directory; this operation will
To create a new database: To create a new database:
</PARA> </PARA>
<ProgramListing> <ProgramListing>
<prompt>olly=></prompt> <userinput>create database lusiadas;</userinput> <prompt>olly=></prompt> <userinput>create database lusiadas;</userinput>
</ProgramListing> </ProgramListing>
<PARA> <PARA>
To create a new database in an alternate area <filename>~/private_db</filename>: To create a new database in an alternate area <filename>~/private_db</filename>:
</PARA> </PARA>
<ProgramListing> <ProgramListing>
<prompt>$</prompt> <userinput>mkdir private_db</userinput> <prompt>$</prompt> <userinput>mkdir private_db</userinput>
<prompt>$</prompt> <userinput>initlocation ~/private_db</userinput> <prompt>$</prompt> <userinput>initlocation ~/private_db</userinput>
<computeroutput>Creating Postgres database system directory /home/olly/private_db/base</computeroutput> <computeroutput>Creating Postgres database system directory /home/olly/private_db/base</computeroutput>
<prompt>$</prompt> <userinput>psql olly</userinput> <prompt>$</prompt> <userinput>psql olly</userinput>
<computeroutput>Welcome to the POSTGRESQL interactive sql monitor: <computeroutput>Welcome to the POSTGRESQL interactive sql monitor:
Please read the file COPYRIGHT for copyright terms of POSTGRESQL Please read the file COPYRIGHT for copyright terms of POSTGRESQL
type \? for help on slash commands type \? for help on slash commands
type \q to quit type \q to quit
type \g or terminate with semicolon to execute query type \g or terminate with semicolon to execute query
You are currently connected to the database: template1 You are currently connected to the database: template1
<prompt>olly=></prompt></computeroutput> <userinput>create database elsewhere with location = '/home/olly/private_db';</userinput> <prompt>olly=></prompt></computeroutput> <userinput>create database elsewhere with location = '/home/olly/private_db';</userinput>
<computeroutput>CREATEDB</computeroutput> <computeroutput>CREATEDB</computeroutput>
</ProgramListing> </ProgramListing>
</REFSECT1> </REFSECT1>
...@@ -186,8 +178,12 @@ There was a problem with creating the required directory; this operation will ...@@ -186,8 +178,12 @@ There was a problem with creating the required directory; this operation will
Bugs Bugs
</TITLE> </TITLE>
<PARA> <PARA>
There are security and data integrity issues involved with using alternate database locations There are security and data integrity issues
specified with absolute path names. See the Administrator's Guide for more information. involved with using alternate database locations
specified with absolute path names, and by default
only an environment variable known to the backend may be
specified for an alternate location.
See the Administrator's Guide for more information.
</PARA> </PARA>
</refsect1> </refsect1>
...@@ -207,7 +203,6 @@ Not sure if the dump/reload would guarantee that the alternate data area gets re ...@@ -207,7 +203,6 @@ Not sure if the dump/reload would guarantee that the alternate data area gets re
Compatibility Compatibility
</TITLE> </TITLE>
<PARA> <PARA>
</PARA>
<REFSECT2 ID="R2-SQL-CREATEDATABASE-4"> <REFSECT2 ID="R2-SQL-CREATEDATABASE-4">
<REFSECT2INFO> <REFSECT2INFO>
...@@ -217,7 +212,7 @@ Not sure if the dump/reload would guarantee that the alternate data area gets re ...@@ -217,7 +212,7 @@ Not sure if the dump/reload would guarantee that the alternate data area gets re
SQL92 SQL92
</TITLE> </TITLE>
<PARA> <PARA>
There is no <command>CREATE DATABASE</command> statement on SQL92. There is no <command>CREATE DATABASE</command> statement in SQL92.
</PARA> </PARA>
<para> <para>
The equivalent command in standard SQL is <command>CREATE SCHEMA</command>. The equivalent command in standard SQL is <command>CREATE SCHEMA</command>.
......
...@@ -15,30 +15,23 @@ ...@@ -15,30 +15,23 @@
<REFSYNOPSISDIV> <REFSYNOPSISDIV>
<REFSYNOPSISDIVINFO> <REFSYNOPSISDIVINFO>
<DATE>1998-04-15</DATE> <DATE>1998-09-09</DATE>
</REFSYNOPSISDIVINFO> </REFSYNOPSISDIVINFO>
<SYNOPSIS> <SYNOPSIS>
CREATE FUNCTION <replaceable class="parameter">name</replaceable> ([<replaceable class="parameter">ftype</replaceable> [, ...]]) CREATE FUNCTION <replaceable class="parameter">name</replaceable> ( [ <replaceable class="parameter">ftype</replaceable> [, ...] ] )
RETURNS <replaceable class="parameter">rtype</replaceable> RETURNS <replaceable class="parameter">rtype</replaceable>
AS <replaceable class="parameter">path</replaceable> AS <replaceable class="parameter">path</replaceable>
LANGUAGE '<replaceable class="parameter">langname</replaceable>' LANGUAGE '<replaceable class="parameter">langname</replaceable>'
</SYNOPSIS> </SYNOPSIS>
<REFSECT2 ID="R2-SQL-CREATEFUNCTION-1"> <REFSECT2 ID="R2-SQL-CREATEFUNCTION-1">
<REFSECT2INFO> <REFSECT2INFO>
<DATE>1998-04-15</DATE> <DATE>1998-09-09</DATE>
</REFSECT2INFO> </REFSECT2INFO>
<TITLE> <TITLE>
Inputs Inputs
</TITLE> </TITLE>
<PARA> <PARA>
</PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
</TERM>
<LISTITEM>
<PARA>
<VARIABLELIST> <VARIABLELIST>
<VARLISTENTRY> <VARLISTENTRY>
<TERM> <TERM>
...@@ -87,21 +80,21 @@ ...@@ -87,21 +80,21 @@
</TERM> </TERM>
<LISTITEM> <LISTITEM>
<PARA> <PARA>
may be '<literal>c</literal>', '<literal>sql</literal>', '<literal>internal</literal>' or '<replaceable class="parameter">plname</replaceable>'. may be '<literal>C</literal>', '<literal>sql</literal>',
(where '<replaceable class="parameter">plname</replaceable>' is the language name of a created procedural '<literal>internal</literal>'
language. See <command>CREATE LANGUAGE</command> for details). or '<replaceable class="parameter">plname</replaceable>',
where '<replaceable class="parameter">plname</replaceable>'
is the name of a created procedural
language. See <command>CREATE LANGUAGE</command> for details.
</PARA> </PARA>
</LISTITEM> </LISTITEM>
</VARLISTENTRY> </VARLISTENTRY>
</variablelist> </variablelist>
</LISTITEM>
</VARLISTENTRY>
</VARIABLELIST>
</REFSECT2> </REFSECT2>
<REFSECT2 ID="R2-SQL-CREATEFUNCTION-2"> <REFSECT2 ID="R2-SQL-CREATEFUNCTION-2">
<REFSECT2INFO> <REFSECT2INFO>
<DATE>1998-04-15</DATE> <DATE>1998-09-09</DATE>
</REFSECT2INFO> </REFSECT2INFO>
<TITLE> <TITLE>
Outputs Outputs
...@@ -111,6 +104,7 @@ ...@@ -111,6 +104,7 @@
<VARIABLELIST> <VARIABLELIST>
<VARLISTENTRY> <VARLISTENTRY>
<TERM> <TERM>
<replaceable>status</replaceable>
</TERM> </TERM>
<LISTITEM> <LISTITEM>
<PARA> <PARA>
...@@ -134,32 +128,34 @@ ...@@ -134,32 +128,34 @@
<REFSECT1 ID="R1-SQL-CREATEFUNCTION-1"> <REFSECT1 ID="R1-SQL-CREATEFUNCTION-1">
<REFSECT1INFO> <REFSECT1INFO>
<DATE>1998-04-15</DATE> <DATE>1998-09-09</DATE>
</REFSECT1INFO> </REFSECT1INFO>
<TITLE> <TITLE>
Description Description
</TITLE> </TITLE>
<PARA> <PARA>
With this command, a PostgreSQL user can register a function <command>CREATE FUNCTION</command> allows a
with PostgreSQL. Subsequently, this user is treated as the <productname>Postgres</productname> user
to register a function
with a database. Subsequently, this user is treated as the
owner of the function. owner of the function.
</PARA> </PARA>
<REFSECT2 ID="R2-SQL-CREATEFUNCTION-3"> <REFSECT2 ID="R2-SQL-CREATEFUNCTION-3">
<REFSECT2INFO> <REFSECT2INFO>
<DATE>1998-04-15</DATE> <DATE>1998-09-09</DATE>
</REFSECT2INFO> </REFSECT2INFO>
<TITLE> <TITLE>
Notes Notes
</TITLE> </TITLE>
<PARA> <PARA>
Refer to <citetitle>PostgreSQL User's Guide</citetitle> chapter 6 for further information. Refer to the chapter on functions
<comment>This reference needs to be corrected.</comment> in the <citetitle>PostgreSQL Programmer's Guide</citetitle>
for further information.
</PARA> </PARA>
<PARA> <PARA>
Refer to the <citerefentry> Use <command>DROP FUNCTION</command>
<refentrytitle>DROP FUNCTION</refentrytitle> to drop user-defined functions.
</citerefentry> statement to drop functions.
</PARA> </PARA>
</REFSECT2> </REFSECT2>
...@@ -171,15 +167,17 @@ ...@@ -171,15 +167,17 @@
To create a simple SQL function: To create a simple SQL function:
</PARA> </PARA>
<ProgramListing> <ProgramListing>
CREATE FUNCTION one() RETURNS int4 CREATE FUNCTION one() RETURNS int4
AS 'SELECT 1 AS RESULT' AS 'SELECT 1 AS RESULT'
LANGUAGE 'sql'; LANGUAGE 'sql';
SELECT one() AS answer; SELECT one() AS answer;
<computeroutput>answer <computeroutput>
------ answer
1 </computeroutput> ------
1
</computeroutput>
</ProgramListing> </ProgramListing>
<para> <para>
To create a C function, calling a routine from a user-created To create a C function, calling a routine from a user-created
...@@ -188,17 +186,18 @@ ...@@ -188,17 +186,18 @@
is correct. It is intended for use in a CHECK contraint. is correct. It is intended for use in a CHECK contraint.
</para> </para>
<programlisting> <programlisting>
<userinput>CREATE FUNCTION ean_checkdigit(bpchar, bpchar) RETURNS bool <userinput>
AS '/usr1/proj/bray/sql/funcs.so' LANGUAGE 'c'; CREATE FUNCTION ean_checkdigit(bpchar, bpchar) RETURNS bool
AS '/usr1/proj/bray/sql/funcs.so' LANGUAGE 'c';
CREATE TABLE product CREATE TABLE product
( (
id char(8) PRIMARY KEY, id char(8) PRIMARY KEY,
eanprefix char(8) CHECK (eanprefix ~ '[0-9]{2}-[0-9]{5}') eanprefix char(8) CHECK (eanprefix ~ '[0-9]{2}-[0-9]{5}')
REFERENCES brandname(ean_prefix), REFERENCES brandname(ean_prefix),
eancode char(6) CHECK (eancode ~ '[0-9]{6}'), eancode char(6) CHECK (eancode ~ '[0-9]{6}'),
CONSTRAINT ean CHECK (ean_checkdigit(eanprefix, eancode)) CONSTRAINT ean CHECK (ean_checkdigit(eanprefix, eancode))
);</userinput> );</userinput>
</programlisting> </programlisting>
</REFSECT1> </REFSECT1>
...@@ -216,39 +215,44 @@ ...@@ -216,39 +215,44 @@
Compatibility Compatibility
</TITLE> </TITLE>
<PARA> <PARA>
The CREATE FUNCTION statement is a PostgreSQL language extension. <command>CREATE FUNCTION</command> is
a <productname>Postgres</productname> language extension.
</PARA> </PARA>
<REFSECT2 ID="R2-SQL-CREATEFUNCTION-4"> <REFSECT2 ID="R2-SQL-CREATEFUNCTION-4">
<REFSECT2INFO> <REFSECT2INFO>
<DATE>1998-04-15</DATE> <DATE>1998-09-09</DATE>
</REFSECT2INFO> </REFSECT2INFO>
<TITLE> <TITLE>
SQL/PSM<footnote> SQL/PSM
</TITLE>
<para>
<note>
<para> <para>
PSM stands for Persistent Stored Modules, it is a procedural PSM stands for Persistent Stored Modules. It is a procedural
language and it was originally hoped that PSM would be ratified language and it was originally hoped that PSM would be ratified
as an official standard by late 1996. However PSM will as an official standard by late 1996. As of mid-1998, this
has not yet happened, but it is hoped that PSM will
eventually become a standard. eventually become a standard.
</para> </para>
</footnote> </note>
</TITLE>
<para> SQL/PSM <command>CREATE FUNCTION</command> has the following syntax:
The SQL/PSM CREATE FUNCTION statement has the following syntax: <synopsis>
<programlisting> CREATE FUNCTION <replaceable class="parameter">name</replaceable>
CREATE FUNCTION <replaceable class="parameter">name</replaceable> ( [ [ IN | OUT | INOUT ] <replaceable class="parameter">parm</replaceable> <replaceable class="parameter">type</replaceable> [, ...] ] )
( [ [IN|OUT|INOUT] <replaceable class="parameter">parm</replaceable> <replaceable class="parameter">type</replaceable> [, ...] ]) RETURNS <replaceable class="parameter">rtype</replaceable>
RETURNS <replaceable class="parameter">rtype</replaceable> LANGUAGE '<replaceable class="parameter">langname</replaceable>'
LANGUAGE '<replaceable class="parameter">langname</replaceable>' ESPECIFIC <replaceable class="parameter">routine</replaceable>
ESPECIFIC <replaceable class="parameter">routine</replaceable> <replaceable class="parameter">SQL-statement</replaceable>
<replaceable class="parameter">SQL-statement</replaceable> </synopsis>
</programlisting>
</para> </para>
</refsect2> </refsect2>
</refsect1> </refsect1>
</REFENTRY> </REFENTRY>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file
Local variables: Local variables:
mode: sgml mode: sgml
......
...@@ -14,41 +14,33 @@ ...@@ -14,41 +14,33 @@
</REFPURPOSE> </REFPURPOSE>
<REFSYNOPSISDIV> <REFSYNOPSISDIV>
<REFSYNOPSISDIVINFO> <REFSYNOPSISDIVINFO>
<DATE>1998-04-15</DATE> <DATE>1998-09-09</DATE>
</REFSYNOPSISDIVINFO> </REFSYNOPSISDIVINFO>
<SYNOPSIS> <SYNOPSIS>
CREATE [UNIQUE] INDEX <replaceable class="parameter">index_name</replaceable> CREATE [ UNIQUE ] INDEX <replaceable class="parameter">index_name</replaceable>
ON <replaceable class="parameter">table</replaceable> [USING <replaceable class="parameter">acc_name</replaceable> ] ON <replaceable class="parameter">table</replaceable> [ USING <replaceable class="parameter">acc_name</replaceable> ]
( <replaceable class="parameter">column</replaceable> [<replaceable class="parameter">ops_name</replaceable>] [, ...] ) ( <replaceable class="parameter">column</replaceable> [ <replaceable class="parameter">ops_name</replaceable>] [, ...] )
CREATE [ UNIQUE ] INDEX <replaceable class="parameter">index_name</replaceable>
CREATE [UNIQUE] INDEX <replaceable class="parameter">index_name</replaceable> ON <replaceable class="parameter">table</replaceable> [ USING <replaceable class="parameter">acc_name</replaceable> ]
ON <replaceable class="parameter">table</replaceable> [USING <replaceable class="parameter">acc_name</replaceable> ] ( <replaceable class="parameter">func_name</replaceable>( <replaceable class="parameter">column</replaceable> [, ... ]) <replaceable class="parameter">ops_name</replaceable> )
( <replaceable class="parameter">func_name</replaceable>( <replaceable class="parameter">column</replaceable> [, ... ]) <replaceable class="parameter">ops_name</replaceable> )
</SYNOPSIS> </SYNOPSIS>
<REFSECT2 ID="R2-SQL-CREATEINDEX-1"> <REFSECT2 ID="R2-SQL-CREATEINDEX-1">
<REFSECT2INFO> <REFSECT2INFO>
<DATE>1998-04-15</DATE> <DATE>1998-09-09</DATE>
</REFSECT2INFO> </REFSECT2INFO>
<TITLE> <TITLE>
Inputs Inputs
</TITLE> </TITLE>
<PARA> <PARA>
</PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
</TERM>
<LISTITEM>
<PARA>
<VARIABLELIST> <VARIABLELIST>
<VARLISTENTRY> <VARLISTENTRY>
<TERM> <TERM>
<function>UNIQUE</function> UNIQUE
</TERM> </TERM>
<LISTITEM> <LISTITEM>
<PARA> <PARA>
<function>UNIQUE</function> causes the system to check for Causes the system to check for
duplicate values when the index is created (if data duplicate values when the index is created (if data
already exist) and each time data is added. Attempts to already exist) and each time data is added. Attempts to
insert or update non-duplicate data will generate an insert or update non-duplicate data will generate an
...@@ -134,17 +126,18 @@ ...@@ -134,17 +126,18 @@
An associated operator class. An associated operator class.
The following select list returns all ops_names: The following select list returns all ops_names:
<programlisting> <programlisting>
SELECT am.amname AS acc_name, SELECT am.amname AS acc_name,
opc.opcname AS ops_name, opc.opcname AS ops_name,
opr.oprname AS ops_comp opr.oprname AS ops_comp
FROM pg_am am, pg_amop amop, FROM pg_am am, pg_amop amop,
pg_opclass opc, pg_operator opr pg_opclass opc, pg_operator opr
WHERE amop.amopid = am.oid AND WHERE amop.amopid = am.oid AND
amop.amopclaid = opc.oid AND amop.amopclaid = opc.oid AND
amop.amopopr = opr.oid amop.amopopr = opr.oid
ORDER BY acc_name, ops_name, ops_comp ORDER BY acc_name, ops_name, ops_comp
</programlisting> </programlisting>
</PARA> </PARA>
</LISTITEM> </LISTITEM>
</VARLISTENTRY> </VARLISTENTRY>
...@@ -160,14 +153,12 @@ ...@@ -160,14 +153,12 @@
</LISTITEM> </LISTITEM>
</VARLISTENTRY> </VARLISTENTRY>
</variablelist> </variablelist>
</LISTITEM>
</VARLISTENTRY>
</VARIABLELIST>
</REFSECT2> </REFSECT2>
<REFSECT2 ID="R2-SQL-CREATEINDEX-2"> <REFSECT2 ID="R2-SQL-CREATEINDEX-2">
<REFSECT2INFO> <REFSECT2INFO>
<DATE>1998-04-15</DATE> <DATE>1998-09-09</DATE>
</REFSECT2INFO> </REFSECT2INFO>
<TITLE> <TITLE>
Outputs Outputs
...@@ -177,6 +168,7 @@ ...@@ -177,6 +168,7 @@
<VARIABLELIST> <VARIABLELIST>
<VARLISTENTRY> <VARLISTENTRY>
<TERM> <TERM>
<replaceable>status</replaceable>
</TERM> </TERM>
<LISTITEM> <LISTITEM>
<PARA> <PARA>
...@@ -210,14 +202,23 @@ ...@@ -210,14 +202,23 @@
<REFSECT1 ID="R1-SQL-CREATEINDEX-1"> <REFSECT1 ID="R1-SQL-CREATEINDEX-1">
<REFSECT1INFO> <REFSECT1INFO>
<DATE>1998-04-15</DATE> <DATE>1998-09-09</DATE>
</REFSECT1INFO> </REFSECT1INFO>
<TITLE> <TITLE>
Description Description
</TITLE> </TITLE>
<PARA> <PARA>
This command constructs an index called <replaceable class="parameter">index_name</replaceable>. This command constructs an index
</PARA> <replaceable class="parameter">index_name</replaceable>.
on the specified
<replaceable class="parameter">table</replaceable>.
<tip>
<para>
Indices are primarily used to enhance database performance.
But inappropriate use will result in slower performance.
</tip>
<para> <para>
In the first syntax shown above, the key fields for the In the first syntax shown above, the key fields for the
index are specified as column names; a column may also have index are specified as column names; a column may also have
...@@ -242,7 +243,7 @@ ...@@ -242,7 +243,7 @@
<REFSECT2 ID="R2-SQL-CREATEINDEX-3"> <REFSECT2 ID="R2-SQL-CREATEINDEX-3">
<REFSECT2INFO> <REFSECT2INFO>
<DATE>1998-04-15</DATE> <DATE>1998-09-09</DATE>
</REFSECT2INFO> </REFSECT2INFO>
<TITLE> <TITLE>
Notes Notes
...@@ -252,10 +253,8 @@ ...@@ -252,10 +253,8 @@
indices. Up to 7 keys may be specified. indices. Up to 7 keys may be specified.
</PARA> </PARA>
<para> <para>
Use the <citerefentry> Use <command>DROP INDEX</command>
<refentrytitle>DROP INDEX</refentrytitle> to remove an index.
</citerefentry>
statement to remove indexes.
</para> </para>
</REFSECT2> </REFSECT2>
...@@ -267,24 +266,27 @@ ...@@ -267,24 +266,27 @@
in the table <literal>films</literal>: in the table <literal>films</literal>:
</PARA> </PARA>
<ProgramListing> <ProgramListing>
CREATE UNIQUE INDEX title_idx CREATE UNIQUE INDEX title_idx
ON films (title); ON films (title);
</ProgramListing> </ProgramListing>
<!--
<comment>
Is this example correct?
</comment>
<para> <para>
To create a rtree index on a point attribute so that we To create a rtree index on a point attribute so that we
can efficiently use box operators on the result of the can efficiently use box operators on the result of the
conversion function: conversion function:
</para> </para>
<programlisting> <programlisting>
CREATE INDEX pointloc CREATE INDEX pointloc
ON points USING RTREE (point2box(location) box_ops); ON points USING RTREE (point2box(location) box_ops);
SELECT * FROM points
SELECT * FROM points WHERE point2box(points.pointloc) = boxes.box;
WHERE point2box(points.pointloc) = boxes.box;
<comment>
Is this example correct?
</comment>
</programlisting> </programlisting>
-->
</REFSECT1> </REFSECT1>
<REFSECT1 ID="R1-SQL-CREATEINDEX-3"> <REFSECT1 ID="R1-SQL-CREATEINDEX-3">
...@@ -296,16 +298,16 @@ Is this example correct? ...@@ -296,16 +298,16 @@ Is this example correct?
<REFSECT2 ID="R2-SQL-CREATEINDEX-4"> <REFSECT2 ID="R2-SQL-CREATEINDEX-4">
<REFSECT2INFO> <REFSECT2INFO>
<DATE>1998-04-15</DATE> <DATE>1998-09-09</DATE>
</REFSECT2INFO> </REFSECT2INFO>
<TITLE> <TITLE>
SQL92 SQL92
</TITLE> </TITLE>
<PARA> <PARA>
CREATE INDEX is a PostgreSQL language extension. CREATE INDEX is a <productname>Postgres</productname> language extension.
</PARA> </PARA>
<para> <para>
There is no CREATE INDEX command in SQL92. There is no <command>CREATE INDEX</command> command in SQL92.
</para> </para>
</refsect2> </refsect2>
</refsect1> </refsect1>
......
...@@ -15,29 +15,22 @@ ...@@ -15,29 +15,22 @@
<REFSYNOPSISDIV> <REFSYNOPSISDIV>
<REFSYNOPSISDIVINFO> <REFSYNOPSISDIVINFO>
<DATE>1998-04-15</DATE> <DATE>1998-09-09</DATE>
</REFSYNOPSISDIVINFO> </REFSYNOPSISDIVINFO>
<SYNOPSIS> <SYNOPSIS>
CREATE [TRUSTED] PROCEDURAL LANGUAGE '<replaceable class="parameter">langname</replaceable>' CREATE [ TRUSTED ] PROCEDURAL LANGUAGE '<replaceable class="parameter">langname</replaceable>'
HANDLER <replaceable class="parameter">call_handler</replaceable> HANDLER <replaceable class="parameter">call_handler</replaceable>
LANCOMPILER '<replaceable class="parameter">comment</replaceable>' LANCOMPILER '<replaceable class="parameter">comment</replaceable>'
</SYNOPSIS> </SYNOPSIS>
<REFSECT2 ID="R2-SQL-CREATELANGUAGE-1"> <REFSECT2 ID="R2-SQL-CREATELANGUAGE-1">
<REFSECT2INFO> <REFSECT2INFO>
<DATE>1998-04-15</DATE> <DATE>1998-09-09</DATE>
</REFSECT2INFO> </REFSECT2INFO>
<TITLE> <TITLE>
Inputs Inputs
</TITLE> </TITLE>
<PARA> <PARA>
</PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
</TERM>
<LISTITEM>
<PARA>
<VARIABLELIST> <VARIABLELIST>
<VARLISTENTRY> <VARLISTENTRY>
<TERM> <TERM>
...@@ -99,14 +92,12 @@ ...@@ -99,14 +92,12 @@
</LISTITEM> </LISTITEM>
</VARLISTENTRY> </VARLISTENTRY>
</variablelist> </variablelist>
</LISTITEM>
</VARLISTENTRY>
</VARIABLELIST>
</REFSECT2> </REFSECT2>
<REFSECT2 ID="R2-SQL-CREATELANGUAGE-2"> <REFSECT2 ID="R2-SQL-CREATELANGUAGE-2">
<REFSECT2INFO> <REFSECT2INFO>
<DATE>1998-04-15</DATE> <DATE>1998-09-09</DATE>
</REFSECT2INFO> </REFSECT2INFO>
<TITLE> <TITLE>
Outputs Outputs
...@@ -116,6 +107,7 @@ ...@@ -116,6 +107,7 @@
<VARIABLELIST> <VARIABLELIST>
<VARLISTENTRY> <VARLISTENTRY>
<TERM> <TERM>
<replaceable>status</replaceable>
</TERM> </TERM>
<LISTITEM> <LISTITEM>
<PARA> <PARA>
...@@ -152,22 +144,25 @@ ...@@ -152,22 +144,25 @@
<REFSECT1 ID="R1-SQL-CREATELANGUAGE-1"> <REFSECT1 ID="R1-SQL-CREATELANGUAGE-1">
<REFSECT1INFO> <REFSECT1INFO>
<DATE>1998-04-15</DATE> <DATE>1998-09-09</DATE>
</REFSECT1INFO> </REFSECT1INFO>
<TITLE> <TITLE>
Description Description
</TITLE> </TITLE>
<PARA> <PARA>
Using <command>CREATE LANGUAGE</command>, a PostgreSQL user can register Using <command>CREATE LANGUAGE</command>, a
a new language with PostgreSQL. Subsequently, functions and <productname>Postgres</productname> user can register
a new language with <productname>Postgres</productname>.
Subsequently, functions and
trigger procedures can be defined in this new language. trigger procedures can be defined in this new language.
The user must have the PostgreSQL superuser privilege to The user must have the <productname>Postgres</productname>
superuser privilege to
register a new language. register a new language.
</PARA> </PARA>
<REFSECT2 ID="R2-SQL-CREATELANGUAGE-3"> <REFSECT2 ID="R2-SQL-CREATELANGUAGE-3">
<REFSECT2INFO> <REFSECT2INFO>
<DATE>1998-04-15</DATE> <DATE>1998-09-09</DATE>
</REFSECT2INFO> </REFSECT2INFO>
<TITLE> <TITLE>
Writing PL handlers Writing PL handlers
...@@ -175,9 +170,9 @@ ...@@ -175,9 +170,9 @@
<PARA> <PARA>
The call handler for a procedural language must be written The call handler for a procedural language must be written
in a compiler language such as 'C' and registered with in a compiler language such as 'C' and registered with
PostgreSQL as a function taking no arguments and returning <productname>Postgres</productname> as a function taking
opaque type. no arguments and returning the
<comment>What does `opaque type' mean?</comment> <type>opaque</type> type, a placeholder for unspecified or undefined types..
This prevents the call handler from being This prevents the call handler from being
called directly as a function from queries. called directly as a function from queries.
</para> </para>
...@@ -214,11 +209,11 @@ ...@@ -214,11 +209,11 @@
It's up to the call handler to fetch the It's up to the call handler to fetch the
<filename>pg_proc</filename> entry and <filename>pg_proc</filename> entry and
to analyze the argument and return types of the called to analyze the argument and return types of the called
procedure. The <function>AS</function> clause from the procedure. The AS clause from the
<command>CREATE FUNCTION</command> of <command>CREATE FUNCTION</command> of
the procedure will be found in the <literal>prosrc</literal> the procedure will be found in the <literal>prosrc</literal>
attribute of the attribute of the
<filename>pg_proc</filename> entry. This may be the <filename>pg_proc</filename> table entry. This may be the
source text in the procedural source text in the procedural
language itself (like for PL/Tcl), a pathname to a language itself (like for PL/Tcl), a pathname to a
file or anything else that tells the call handler what to file or anything else that tells the call handler what to
...@@ -227,43 +222,40 @@ ...@@ -227,43 +222,40 @@
<REFSECT2 ID="R2-SQL-CREATELANGUAGE-4"> <REFSECT2 ID="R2-SQL-CREATELANGUAGE-4">
<REFSECT2INFO> <REFSECT2INFO>
<DATE>1998-04-15</DATE> <DATE>1998-09-09</DATE>
</REFSECT2INFO> </REFSECT2INFO>
<TITLE> <TITLE>
Notes Notes
</TITLE> </TITLE>
<PARA> <PARA>
Use <citerefentry> Use <command>CREATE FUNCTION</command>
<refentrytitle>CREATE FUNCTION</refentrytitle>
</citerefentry>
to create a function. to create a function.
</para> </para>
<para> <para>
Use <citerefentry> Use <command>DROP LANGUAGE</command> to drop procedural languages.
<refentrytitle>DROP LANGUAGE</refentrytitle>
</citerefentry> to drop procedural languages.
</para> </para>
<para> <para>
Refer to the table <filename>pg_language</filename> Refer to the table <filename>pg_language</filename>
for further information: for further information:
<programlisting> <programlisting>
<computeroutput> <computeroutput>
Table = pg_language Table = pg_language
+--------------------------+--------------------------+-------+ +--------------------------+--------------------------+-------+
| Field | Type | Length| | Field | Type | Length|
+--------------------------+--------------------------+-------+ +--------------------------+--------------------------+-------+
| lanname | name | 32 | | lanname | name | 32 |
| lancompiler | text | var | | lancompiler | text | var |
+--------------------------+--------------------------+-------+ +--------------------------+--------------------------+-------+
lanname |lancompiler
--------+--------------
internal|n/a
lisp |/usr/ucb/liszt
C |/bin/cc
sql |postgres
</computeroutput>
</programlisting>
lanname |lancompiler
--------+--------------
internal|n/a
lisp |/usr/ucb/liszt
C |/bin/cc
sql |postgres
</computeroutput>
</programlisting>
</para> </para>
</refsect2> </refsect2>
</refsect1> </refsect1>
...@@ -274,11 +266,9 @@ ...@@ -274,11 +266,9 @@
</TITLE> </TITLE>
<PARA> <PARA>
Since the call handler for a procedural language must be Since the call handler for a procedural language must be
registered with PostgreSQL in the 'C' language, it inherits registered with <productname>Postgres</productname> in the 'C' language,
all the restrictions of 'C' functions. it inherits
<comment> all the capabilities and restrictions of 'C' functions.
What are these restrictions?
</comment>
</para> </para>
</refsect1> </refsect1>
<REFSECT1 ID="R1-SQL-CREATELANGUAGE-5"> <REFSECT1 ID="R1-SQL-CREATELANGUAGE-5">
...@@ -340,22 +330,21 @@ ...@@ -340,22 +330,21 @@
</ProgramListing> </ProgramListing>
<para> <para>
Only a few thousand lines of code have to be added instead Only a few thousand lines of code have to be added instead
of the dots to complete the PL call handler. See <citerefentry> of the dots to complete the PL call handler.
<refentrytitle>CREATE FUNCTION</refentrytitle> See <command>CREATE FUNCTION</command> for information on how to compile
</citerefentry> for information on how to compile
it into a loadable module it into a loadable module
.</para> .</para>
<para> <para>
The following commands then register the sample procedural The following commands then register the sample procedural
language.</para> language:
<programlisting> <programlisting>
CREATE FUNCTION plsample_call_handler () RETURNS opaque CREATE FUNCTION plsample_call_handler () RETURNS opaque
AS '/usr/local/pgsql/lib/plsample.so' AS '/usr/local/pgsql/lib/plsample.so'
LANGUAGE 'C'; LANGUAGE 'C';
CREATE PROCEDURAL LANGUAGE 'plsample' CREATE PROCEDURAL LANGUAGE 'plsample'
HANDLER plsample_call_handler HANDLER plsample_call_handler
LANCOMPILER 'PL/Sample'; LANCOMPILER 'PL/Sample';
</programlisting> </programlisting>
</REFSECT1> </REFSECT1>
...@@ -364,18 +353,18 @@ ...@@ -364,18 +353,18 @@
Compatibility Compatibility
</TITLE> </TITLE>
<PARA> <PARA>
CREATE LANGUAGE is a PostgreSQL extension. CREATE LANGUAGE is a <productname>Postgres</productname> extension.
</PARA> </PARA>
<REFSECT2 ID="R2-SQL-CREATELANGUAGE-5"> <REFSECT2 ID="R2-SQL-CREATELANGUAGE-5">
<REFSECT2INFO> <REFSECT2INFO>
<DATE>1998-04-15</DATE> <DATE>1998-09-09</DATE>
</REFSECT2INFO> </REFSECT2INFO>
<TITLE> <TITLE>
SQL92 SQL92
</TITLE> </TITLE>
<PARA> <PARA>
There is no CREATE LANGUAGE statement in SQL92. There is no <command>CREATE LANGUAGE</command> statement in SQL92.
</PARA> </PARA>
</refsect2> </refsect2>
</refsect1> </refsect1>
......
This diff is collapsed.
This diff is collapsed.
...@@ -18,34 +18,28 @@ ...@@ -18,34 +18,28 @@
<DATE>1998-04-15</DATE> <DATE>1998-04-15</DATE>
</REFSYNOPSISDIVINFO> </REFSYNOPSISDIVINFO>
<SYNOPSIS> <SYNOPSIS>
CREATE SEQUENCE <replaceable class="parameter">seqname</replaceable> CREATE SEQUENCE <replaceable class="parameter">seqname</replaceable>
[INCREMENT <replaceable class="parameter">increment</replaceable>] [ INCREMENT <replaceable class="parameter">increment</replaceable> ]
[MINVALUE <replaceable class="parameter">minvalue</replaceable>] [ MINVALUE <replaceable class="parameter">minvalue</replaceable> ]
[MAXVALUE <replaceable class="parameter">maxvalue</replaceable>] [ MAXVALUE <replaceable class="parameter">maxvalue</replaceable> ]
[START <replaceable class="parameter">start</replaceable>] [ START <replaceable class="parameter">start</replaceable> ]
[CACHE <replaceable class="parameter">cache</replaceable>] [ CACHE <replaceable class="parameter">cache</replaceable> ]
[CYCLE] [ CYCLE ]
</SYNOPSIS> </SYNOPSIS>
<REFSECT2 ID="R2-SQL-CREATESEQUENCE-1"> <REFSECT2 ID="R2-SQL-CREATESEQUENCE-1">
<REFSECT2INFO> <REFSECT2INFO>
<DATE>1998-04-15</DATE> <DATE>1998-09-11</DATE>
</REFSECT2INFO> </REFSECT2INFO>
<TITLE> <TITLE>
Inputs Inputs
</TITLE> </TITLE>
<PARA> <PARA>
</PARA> </PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
</TERM>
<LISTITEM>
<PARA>
<VARIABLELIST> <VARIABLELIST>
<VARLISTENTRY> <VARLISTENTRY>
<TERM> <TERM>
<ReturnValue><replaceable class="parameter">seqname</replaceable></ReturnValue> <replaceable class="parameter">seqname</replaceable>
</TERM> </TERM>
<LISTITEM> <LISTITEM>
<PARA> <PARA>
...@@ -55,19 +49,19 @@ ...@@ -55,19 +49,19 @@
</VARLISTENTRY> </VARLISTENTRY>
<VARLISTENTRY> <VARLISTENTRY>
<TERM> <TERM>
<ReturnValue><replaceable class="parameter">increment</replaceable></ReturnValue> <replaceable class="parameter">increment</replaceable>
</TERM> </TERM>
<LISTITEM> <LISTITEM>
<PARA> <PARA>
The <option>INCREMENT <replaceable class="parameter">increment</replaceable></option> clause is optional. A positive value will make an The <option>INCREMENT <replaceable class="parameter">increment</replaceable></option> clause is optional. A positive value will make an
ascending sequence, a negative one a descending sequence. The default value ascending sequence, a negative one a descending sequence.
is 1. The default value is one (1).
</PARA> </PARA>
</LISTITEM> </LISTITEM>
</VARLISTENTRY> </VARLISTENTRY>
<VARLISTENTRY> <VARLISTENTRY>
<TERM> <TERM>
<ReturnValue><replaceable class="parameter">minvalue</replaceable></ReturnValue> <replaceable class="parameter">minvalue</replaceable>
</TERM> </TERM>
<LISTITEM> <LISTITEM>
<PARA> <PARA>
...@@ -81,7 +75,7 @@ ...@@ -81,7 +75,7 @@
</VARLISTENTRY> </VARLISTENTRY>
<VARLISTENTRY> <VARLISTENTRY>
<TERM> <TERM>
<ReturnValue><replaceable class="parameter">maxvalue</replaceable></ReturnValue> <replaceable class="parameter">maxvalue</replaceable>
</TERM> </TERM>
<LISTITEM> <LISTITEM>
<PARA> <PARA>
...@@ -95,7 +89,7 @@ ...@@ -95,7 +89,7 @@
</VARLISTENTRY> </VARLISTENTRY>
<VARLISTENTRY> <VARLISTENTRY>
<TERM> <TERM>
<ReturnValue><replaceable class="parameter">start</replaceable></ReturnValue> <replaceable class="parameter">start</replaceable>
</TERM> </TERM>
<LISTITEM> <LISTITEM>
<PARA> <PARA>
...@@ -107,15 +101,12 @@ ...@@ -107,15 +101,12 @@
for ascending sequences and for ascending sequences and
<replaceable class="parameter">maxvalue</replaceable> <replaceable class="parameter">maxvalue</replaceable>
for descending ones. for descending ones.
<comment>
What happens if the user specifies start outside the range?
</comment>
</PARA> </PARA>
</LISTITEM> </LISTITEM>
</VARLISTENTRY> </VARLISTENTRY>
<VARLISTENTRY> <VARLISTENTRY>
<TERM> <TERM>
<ReturnValue><replaceable class="parameter">cache</replaceable></ReturnValue> <replaceable class="parameter">cache</replaceable>
</TERM> </TERM>
<LISTITEM> <LISTITEM>
<PARA> <PARA>
...@@ -128,7 +119,7 @@ ...@@ -128,7 +119,7 @@
</VARLISTENTRY> </VARLISTENTRY>
<VARLISTENTRY> <VARLISTENTRY>
<TERM> <TERM>
<ReturnValue>CYCLE</ReturnValue> CYCLE
</TERM> </TERM>
<LISTITEM> <LISTITEM>
<PARA> <PARA>
...@@ -146,14 +137,11 @@ ...@@ -146,14 +137,11 @@
</LISTITEM> </LISTITEM>
</VARLISTENTRY> </VARLISTENTRY>
</variablelist> </variablelist>
</LISTITEM>
</VARLISTENTRY>
</variablelist>
</REFSECT2> </REFSECT2>
<REFSECT2 ID="R2-SQL-CREATESEQUENCE-2"> <REFSECT2 ID="R2-SQL-CREATESEQUENCE-2">
<REFSECT2INFO> <REFSECT2INFO>
<DATE>1998-04-15</DATE> <DATE>1998-09-11</DATE>
</REFSECT2INFO> </REFSECT2INFO>
<TITLE> <TITLE>
Outputs Outputs
...@@ -163,6 +151,7 @@ ...@@ -163,6 +151,7 @@
<VARIABLELIST> <VARIABLELIST>
<VARLISTENTRY> <VARLISTENTRY>
<TERM> <TERM>
<replaceable>status</replaceable>
</TERM> </TERM>
<LISTITEM> <LISTITEM>
<PARA> <PARA>
...@@ -179,7 +168,7 @@ ...@@ -179,7 +168,7 @@
</VARLISTENTRY> </VARLISTENTRY>
<VARLISTENTRY> <VARLISTENTRY>
<TERM> <TERM>
<ReturnValue>ERROR: amcreate: '<replaceable class="parameter"> seqname</replaceable>' relation already exists</ReturnValue> <ReturnValue>ERROR: amcreate: '<replaceable class="parameter">seqname</replaceable>' relation already exists</ReturnValue>
</TERM> </TERM>
<LISTITEM> <LISTITEM>
<PARA> <PARA>
...@@ -187,6 +176,36 @@ ...@@ -187,6 +176,36 @@
</PARA> </PARA>
</LISTITEM> </LISTITEM>
</VARLISTENTRY> </VARLISTENTRY>
<VARLISTENTRY>
<TERM>
<ReturnValue>ERROR: DefineSequence: START value (<replaceable class="parameter">start</replaceable>) can't be > MAXVALUE (<replaceable class="parameter">maxvalue</replaceable>)</ReturnValue>
</TERM>
<LISTITEM>
<PARA>
If the specified starting value is out of range.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
<ReturnValue>ERROR: DefineSequence: START value (<replaceable class="parameter">start</replaceable>) can't be < MINVALUE (<replaceable class="parameter">minvalue</replaceable>)</ReturnValue>
</TERM>
<LISTITEM>
<PARA>
If the specified starting value is out of range.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
<ReturnValue>ERROR: DefineSequence: MINVALUE (<replaceable class="parameter">minvalue</replaceable>) can't be >= MAXVALUE (<replaceable class="parameter">maxvalue</replaceable>)</ReturnValue>
</TERM>
<LISTITEM>
<PARA>
If the minimum and maximum values are inconsistant.
</PARA>
</LISTITEM>
</VARLISTENTRY>
</variablelist> </variablelist>
</LISTITEM> </LISTITEM>
</VARLISTENTRY> </VARLISTENTRY>
...@@ -196,7 +215,7 @@ ...@@ -196,7 +215,7 @@
<REFSECT1 ID="R1-SQL-CREATESEQUENCE-1"> <REFSECT1 ID="R1-SQL-CREATESEQUENCE-1">
<REFSECT1INFO> <REFSECT1INFO>
<DATE>1998-04-15</DATE> <DATE>1998-09-11</DATE>
</REFSECT1INFO> </REFSECT1INFO>
<TITLE> <TITLE>
Description Description
...@@ -210,18 +229,20 @@ ...@@ -210,18 +229,20 @@
</PARA> </PARA>
<para> <para>
After the sequence is created, you may use the function After the sequence is created, you may use the function
<function>nextval()</function> with the <function>nextval(<replaceable class="parameter">seqname</replaceable>)</function>
sequence name as the argument to get a new number from the sequence. to get a new number from the sequence.
The function <function>currval('<replaceable class="parameter">sequence_name</replaceable>')</function> may be used The function
<function>currval('<replaceable class="parameter">seqname</replaceable>')</function>
may be used
to determine the number returned by the last call to to determine the number returned by the last call to
<function>nextval()</function> for the <function>nextval(<replaceable class="parameter">seqname</replaceable>)</function>
specified sequence in the current session. for the specified sequence in the current session.
</para> </para>
<para> <para>
Use a query like Use a query like
<programlisting> <programlisting>
SELECT * FROM sequence_name; SELECT * FROM sequence_name;
</programlisting> </programlisting>
to get the parameters of a sequence. to get the parameters of a sequence.
</para> </para>
...@@ -232,7 +253,7 @@ ...@@ -232,7 +253,7 @@
<REFSECT2 ID="R2-SQL-CREATESEQUENCE-3"> <REFSECT2 ID="R2-SQL-CREATESEQUENCE-3">
<REFSECT2INFO> <REFSECT2INFO>
<DATE>1998-04-15</DATE> <DATE>1998-09-11</DATE>
</REFSECT2INFO> </REFSECT2INFO>
<TITLE> <TITLE>
Notes Notes
...@@ -243,7 +264,7 @@ ...@@ -243,7 +264,7 @@
<para> <para>
Each backend uses its own cache to store allocated numbers. Each backend uses its own cache to store allocated numbers.
Numbers that are cached but not used in the current session will be Numbers that are cached but not used in the current session will be
lost. lost, resulting in "holes" in the sequence.
</para> </para>
</REFSECT2> </REFSECT2>
</refsect1> </refsect1>
...@@ -253,25 +274,25 @@ ...@@ -253,25 +274,25 @@
Usage Usage
</TITLE> </TITLE>
<PARA> <PARA>
Create an ascending sequence called serial, starting at 101: Create an ascending sequence called <literal>serial</literal>, starting at 101:
</PARA> </PARA>
<ProgramListing> <ProgramListing>
CREATE SEQUENCE serial START 101; CREATE SEQUENCE serial START 101;
</ProgramListing> </ProgramListing>
<para> <para>
Select the next number from this sequence Select the next number from this sequence
<programlisting> <programlisting>
SELECT NEXTVAL ('serial'); SELECT NEXTVAL ('serial');
nextval nextval
------- -------
114 114
</programlisting> </programlisting>
</para> </para>
<para> <para>
Use this sequence in an INSERT: Use this sequence in an INSERT:
<programlisting> <programlisting>
INSERT INTO distributors VALUES (NEXTVAL ('serial'),'nothing'); INSERT INTO distributors VALUES (NEXTVAL('serial'),'nothing');
</programlisting> </programlisting>
</para> </para>
</REFSECT1> </REFSECT1>
...@@ -281,18 +302,20 @@ ...@@ -281,18 +302,20 @@
Compatibility Compatibility
</TITLE> </TITLE>
<PARA> <PARA>
CREATE SEQUENCE statement is a PostgreSQL language extension. <command>CREATE SEQUENCE</command> is a <productname>Postgres</productname>
language extension.
</PARA> </PARA>
<REFSECT2 ID="R2-SQL-CREATESEQUENCE-4"> <REFSECT2 ID="R2-SQL-CREATESEQUENCE-4">
<REFSECT2INFO> <REFSECT2INFO>
<DATE>1998-04-15</DATE> <DATE>1998-09-11</DATE>
</REFSECT2INFO> </REFSECT2INFO>
<TITLE> <TITLE>
SQL92 SQL92
</TITLE> </TITLE>
<PARA> <PARA>
There is no CREATE SEQUENCE statement on SQL92. There is no <command>CREATE SEQUENCE</command> statement
in <acronym>SQL92</acronym>.
</PARA> </PARA>
</refsect2> </refsect2>
</refsect1> </refsect1>
......
...@@ -84,8 +84,8 @@ ...@@ -84,8 +84,8 @@
</TERM> </TERM>
<LISTITEM> <LISTITEM>
<PARA> <PARA>
This message occurs if it is impossible to drop the index This message occurs if "<REPLACEABLE CLASS="PARAMETER">index_name</REPLACEABLE>"
because it does not exist. is not an index in the database.
</PARA> </PARA>
</LISTITEM> </LISTITEM>
</VARLISTENTRY> </VARLISTENTRY>
...@@ -121,7 +121,7 @@ ...@@ -121,7 +121,7 @@
</PARA> </PARA>
<PARA> <PARA>
Refer to the <command>CREATE INDEX</command> statement for Refer to the <command>CREATE INDEX</command> statement for
inforamtion on how to create indexes. information on how to create indices.
</PARA> </PARA>
</REFSECT2> </REFSECT2>
...@@ -152,7 +152,9 @@ ...@@ -152,7 +152,9 @@
SQL92 SQL92
</TITLE> </TITLE>
<PARA> <PARA>
There is no <command>DROP INDEX</command> statement on SQL92. SQL92 defines commands by which to access a generic relational database.
Indices are an implementation-dependent feature and hence
there is no <command>DROP INDEX</command> statement in SQL92.
</PARA> </PARA>
</refsect2> </refsect2>
</refsect1> </refsect1>
......
...@@ -172,7 +172,7 @@ ...@@ -172,7 +172,7 @@
SQL92 SQL92
</TITLE> </TITLE>
<PARA> <PARA>
There is no DROP PROCEDURAL LANGUAGE statement on SQL92. There is no DROP PROCEDURAL LANGUAGE statement in SQL92.
</PARA> </PARA>
</refsect2> </refsect2>
</refsect1> </refsect1>
......
...@@ -158,7 +158,7 @@ ...@@ -158,7 +158,7 @@
SQL92 SQL92
</TITLE> </TITLE>
<PARA> <PARA>
There is no <command>DROP USER</command> statement on SQL92. There is no <command>DROP USER</command> statement in SQL92.
</PARA> </PARA>
</refsect2> </refsect2>
</refsect1> </refsect1>
......
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