1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-07 00:36:50 +03:00

Fix markup for docbook2man man page generation.

No big deal; fixed lots of other markup at the same time.
Bigest change: make sure there is no whitespace
 in front of <term> contents.
This will probably help the other output types too.
This commit is contained in:
Thomas G. Lockhart
1999-07-06 17:16:42 +00:00
parent 192a66e3da
commit a4ac2f458e
63 changed files with 10692 additions and 11081 deletions

View File

@ -1,135 +1,152 @@
<REFENTRY ID="SQL-ABORT"> <refentry id="SQL-ABORT">
<REFMETA> <refmeta>
<REFENTRYTITLE> <refentrytitle>
ABORT ABORT
</REFENTRYTITLE> </refentrytitle>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO> <refmiscinfo>SQL - Language Statements</refmiscinfo>
</REFMETA> </refmeta>
<REFNAMEDIV> <refnamediv>
<REFNAME> <refname>
ABORT ABORT
</REFNAME> </refname>
<REFPURPOSE> <refpurpose>
Aborts the current transaction Aborts the current transaction
</REFPURPOSE> </refpurpose>
</REFNAMEDIV> </refnamediv>
<REFSYNOPSISDIV> <refsynopsisdiv>
<REFSYNOPSISDIVINFO> <refsynopsisdivinfo>
<DATE>1998-09-27</DATE> <date>1998-09-27</date>
</REFSYNOPSISDIVINFO> </refsynopsisdivinfo>
<SYNOPSIS> <synopsis>
ABORT ABORT [ TRANSACTION | WORK ]
</SYNOPSIS> </synopsis>
<REFSECT2 ID="R2-SQL-ABORT-1"> <refsect2 id="R2-SQL-ABORT-1">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-27</DATE> <date>1998-09-27</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Inputs Inputs
</TITLE> </title>
<PARA>
<para>
None. None.
</para> </para>
</refsect2>
</REFSECT2> <refsect2 id="R2-SQL-ABORT-2">
<refsect2info>
<REFSECT2 ID="R2-SQL-ABORT-2"> <date>1998-09-27</date>
<REFSECT2INFO> </refsect2info>
<DATE>1998-09-27</DATE> <title>
</REFSECT2INFO>
<TITLE>
Outputs Outputs
</TITLE> </title>
<PARA>
<VARIABLELIST> <para>
<VARLISTENTRY>
<TERM> <variablelist>
<varlistentry>
<term><computeroutput>
ABORT ABORT
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
Message returned if successful. Message returned if successful.
</para> </para>
</listitem> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
NOTICE: UserAbortTransactionBlock and not in in-progress state NOTICE: UserAbortTransactionBlock and not in in-progress state
ABORT ABORT
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
If there is not any transaction currently in progress. If there is not any transaction currently in progress.
</para> </para>
</listitem> </listitem>
</VARLISTENTRY> </varlistentry>
</VARIABLELIST> </variablelist>
</para> </para>
</REFSECT2> </refsect2>
</REFSYNOPSISDIV> </refsynopsisdiv>
<REFSECT1 ID="R1-SQL-ABORT-1"> <refsect1 id="R1-SQL-ABORT-1">
<REFSECT1INFO> <refsect1info>
<DATE>1998-09-27</DATE> <date>1998-09-27</date>
</REFSECT1INFO> </refsect1info>
<TITLE> <title>
Description Description
</TITLE> </title>
<PARA> <para>
<command>ABORT</command> rolls back the current transaction and causes <command>ABORT</command> rolls back the current transaction and causes
all the updates made by the transaction to be discarded. all the updates made by the transaction to be discarded.
This command is identical This command is identical
in behavior to the <acronym>SQL92</acronym> command <command>ROLLBACK</command>, in behavior to the <acronym>SQL92</acronym> command <command>ROLLBACK</command>,
and is present only for historical reasons. and is present only for historical reasons.
</para> </para>
<REFSECT2 ID="R2-SQL-ABORT-3"> <refsect2 id="R2-SQL-ABORT-3">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-27</DATE> <date>1998-09-27</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Notes Notes
</TITLE> </title>
<para> <para>
Use the <command>COMMIT</command> statement to successfully Use <command>COMMIT</command> to successfully
terminate a transaction. terminate a transaction.
</para> </para>
</refsect2> </refsect2>
</REFSECT1> </refsect1>
<REFSECT1 ID="R1-SQL-ABORT-2"> <refsect1 id="R1-SQL-ABORT-2">
<TITLE> <title>
Usage Usage
</TITLE> </title>
<PARA> <para>
<ProgramListing> To abort all changes:
--To abort all changes <programlisting>
--
ABORT WORK; ABORT WORK;
</ProgramListing> </programlisting>
</para> </para>
</REFSECT1> </refsect1>
<REFSECT1 ID="R1-SQL-ABORT-3"> <refsect1 id="R1-SQL-ABORT-3">
<TITLE> <title>
Compatibility Compatibility
</TITLE> </title>
<REFSECT2 ID="R2-SQL-ABORT-4"> <refsect2 id="R2-SQL-ABORT-4">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-27</DATE> <date>1998-09-27</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
SQL92 SQL92
</TITLE> </title>
<para> <para>
This command is a <productname>Postgres</productname> extension present This command is a <productname>Postgres</productname> extension present
for historical reasons. <command>ROLLBACK</command> is the <acronym>SQL92</acronym> for historical reasons. <command>ROLLBACK</command> is the <acronym>SQL92</acronym>
equivalent command. equivalent command.
</PARA> </para>
</refsect2> </refsect2>
</refsect1> </refsect1>
</REFENTRY> </refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:nil
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../reference.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:"/usr/lib/sgml/catalog"
sgml-local-ecat-files:nil
End:
-->

View File

@ -1,153 +1,145 @@
<REFENTRY ID="SQL-ALTERTABLE"> <refentry id="SQL-ALTERTABLE">
<REFMETA> <refmeta>
<REFENTRYTITLE> <refentrytitle>
ALTER TABLE ALTER TABLE
</REFENTRYTITLE> </refentrytitle>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO> <refmiscinfo>SQL - Language Statements</refmiscinfo>
</REFMETA> </refmeta>
<REFNAMEDIV> <refnamediv>
<REFNAME> <refname>
ALTER TABLE ALTER TABLE
</REFNAME> </refname>
<REFPURPOSE> <refpurpose>
Modifies table properties Modifies table properties
</REFPURPOSE> </refpurpose>
</refnamediv> </refnamediv>
<REFSYNOPSISDIV> <refsynopsisdiv>
<REFSYNOPSISDIVINFO> <refsynopsisdivinfo>
<DATE>1998-04-15</DATE> <date>1998-04-15</date>
</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">ER">co</replaceable>BLE> <replaceable
ALTER TABLE <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE> class="PARAMETER">type</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 [ COLUMN ] <replaceable class="PARAMETER">ER">co</replaceable>BLE> TO <replaceable
RENAME TO <REPLACEABLE CLASS="PARAMETER">newtable</REPLACEABLE> class="PARAMETER">newcolumn</replaceable>
</SYNOPSIS> ALTER TABLE <replaceable class="PARAMETER">table</replaceable>
RENAME TO <replaceable class="PARAMETER">newtable</replaceable>
</synopsis>
<REFSECT2 ID="R2-SQL-ALTERTABLE-1"> <refsect2 id="R2-SQL-ALTERTABLE-1">
<REFSECT2INFO> <refsect2info>
<DATE>1998-04-15</DATE> <date>1998-04-15</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Inputs Inputs
</TITLE> </title>
<PARA> <para>
<VARIABLELIST> <variablelist>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="PARAMETER"> table </replaceable></term>
<REPLACEABLE CLASS="PARAMETER"> table </REPLACEABLE> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
The name of an existing table to alter. The name of an existing table to alter.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
<REPLACEABLE CLASS="PARAMETER"> column </REPLACEABLE>
</TERM>
<LISTITEM>
<PARA>
Name of a new or existing column.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
<REPLACEABLE CLASS="PARAMETER"> type </REPLACEABLE>
</TERM>
<LISTITEM>
<PARA>
Type of the new column.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
<REPLACEABLE CLASS="PARAMETER"> newcolumn </REPLACEABLE>
</TERM>
<LISTITEM>
<PARA>
New name for an existing column.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
<REPLACEABLE CLASS="PARAMETER"> newtable </REPLACEABLE>
</TERM>
<LISTITEM>
<PARA>
New name for an existing column.
</PARA>
</LISTITEM>
</VARLISTENTRY>
</VARIABLELIST>
</para> </para>
</REFSECT2> </listitem>
</varlistentry>
<REFSECT2 ID="R2-SQL-ALTERTABLE-2"> <varlistentry>
<REFSECT2INFO> <term><replaceable class="PARAMETER"> column </replaceable></term>
<DATE>1998-04-15</DATE> <listitem>
</REFSECT2INFO> <para>
<TITLE> Name of a new or existing column.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="PARAMETER"> type </replaceable></term>
<listitem>
<para>
Type of the new column.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="PARAMETER"> newcolumn </replaceable></term>
<listitem>
<para>
New name for an existing column.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="PARAMETER"> newtable </replaceable></term>
<listitem>
<para>
New name for an existing column.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
<refsect2 id="R2-SQL-ALTERTABLE-2">
<refsect2info>
<date>1998-04-15</date>
</refsect2info>
<title>
Outputs Outputs
</TITLE> </title>
<PARA> <para>
<VARIABLELIST> <variablelist>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
<returnvalue>ALTER</returnvalue> ALTER
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
Message returned from column or table renaming. Message returned from column or table renaming.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
<returnvalue>NEW</returnvalue> NEW
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
Message returned from column addition. Message returned from column addition.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
<ReturnValue>ERROR</ReturnValue> ERROR
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
Message returned if table or column is not available. Message returned if table or column is not available.
</para> </para>
</listitem> </listitem>
</VARLISTENTRY> </varlistentry>
</VARIABLELIST> </variablelist>
</para> </para>
</REFSECT2> </refsect2>
</REFSYNOPSISDIV> </refsynopsisdiv>
<REFSECT1 ID="R1-SQL-ALTERTABLE-1"> <refsect1 id="R1-SQL-ALTERTABLE-1">
<REFSECT1INFO> <refsect1info>
<DATE>1998-04-15</DATE> <date>1998-04-15</date>
</REFSECT1INFO> </refsect1info>
<TITLE> <title>
Description Description
</TITLE> </title>
<PARA> <para>
<command>ALTER TABLE</command> 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 <command>CREATE TABLE</command>. and with the the same restrictions as in <command>CREATE TABLE</command>.
@ -157,98 +149,101 @@ Description
remain of the same type and size after this command is remain of the same type and size after this command is
executed. executed.
</para> </para>
<PARA>
You must own the table in order to change its schema.
</PARA>
<REFSECT2 ID="R2-SQL-ALTERTABLE-3"> <para>
<REFSECT2INFO> You must own the table in order to change its schema.
<DATE>1998-04-15</DATE>
</REFSECT2INFO>
<TITLE>
Notes
</TITLE>
<PARA>
The keyword COLUMN is noise and can be omitted.
</para> </para>
<PARA>
<Quote>[*]</Quote> following a name of a table indicates that statement <refsect2 id="R2-SQL-ALTERTABLE-3">
<refsect2info>
<date>1998-04-15</date>
</refsect2info>
<title>
Notes
</title>
<para>
The keyword <literal>COLUMN</literal> is noise and can be omitted.
</para>
<para>
<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.
The <citetitle>PostgreSQL User's Guide</citetitle> has further The <citetitle>PostgreSQL User's Guide</citetitle> has further
information on inheritance. information on inheritance.
</para> </para>
<PARA> <para>
Refer to CREATE TABLE for a further description Refer to <command>CREATE TABLE</command> for a further description
of valid arguments. of valid arguments.
</para> </para>
</REFSECT2> </refsect2>
</REFSECT1> </refsect1>
<REFSECT1 ID="R1-SQL-ALTERTABLE-2"> <refsect1 id="R1-SQL-ALTERTABLE-2">
<TITLE> <title>
Usage Usage
</TITLE> </title>
<PARA> <para>
To add a column of type VARCHAR to a table: To add a column of type VARCHAR to a table:
<ProgramListing> <programlisting>
ALTER TABLE distributors ADD COLUMN address VARCHAR(30); ALTER TABLE distributors ADD COLUMN address VARCHAR(30);
</ProgramListing> </programlisting>
</para> </para>
<PARA> <para>
To rename an existing column: To rename an existing column:
<ProgramListing> <programlisting>
ALTER TABLE distributors RENAME COLUMN address TO city; ALTER TABLE distributors RENAME COLUMN address TO city;
</ProgramListing> </programlisting>
</para> </para>
<PARA> <para>
To rename an existing table: To rename an existing table:
<ProgramListing> <programlisting>
ALTER TABLE distributors RENAME TO suppliers; ALTER TABLE distributors RENAME TO suppliers;
</ProgramListing> </programlisting>
</para> </para>
</refsect1>
</REFSECT1> <refsect1 id="R1-SQL-ALTERTABLE-3">
<title>
<REFSECT1 ID="R1-SQL-ALTERTABLE-3">
<TITLE>
Compatibility Compatibility
</TITLE> </title>
<REFSECT2 ID="R2-SQL-ALTERTABLE-4"> <refsect2 id="R2-SQL-ALTERTABLE-4">
<REFSECT2INFO> <refsect2info>
<DATE>1998-04-15</DATE> <date>1998-04-15</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
SQL92 SQL92
</TITLE> </title>
<PARA> <para>
<command>ALTER TABLE/RENAME</command> <command>ALTER TABLE/RENAME</command>
is a <productname>Postgres</productname> language extension. is a <productname>Postgres</productname> language extension.
</para> </para>
<PARA> <para>
SQL92 specifies some additional capabilities for <command>ALTER TABLE</command> SQL92 specifies some additional capabilities for <command>ALTER TABLE</command>
statement which are not yet directly supported by statement which are not yet directly supported by
<ProductName>Postgres</ProductName>: <productname>Postgres</productname>:
</para> </para>
<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 [
SET DEFAULT <REPLACEABLE CLASS="PARAMETER">default</REPLACEABLE> COLUMN ] <replaceable class="PARAMETER">column</replaceable>
SET DEFAULT <replaceable class="PARAMETER">default</replaceable>
ALTER TABLE <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE> ALTER [ COLUMN ] <REPLACEABLE CLASS="PARAMETER">column</REPLACEABLE> ALTER TABLE <replaceable class="PARAMETER">table</replaceable> ALTER [
ADD [ CONSTRAINT <REPLACEABLE CLASS="PARAMETER">constraint</REPLACEABLE> ] <REPLACEABLE CLASS="PARAMETER">table-constraint</REPLACEABLE> COLUMN ] <replaceable class="PARAMETER">column</replaceable>
</Synopsis> ADD [ CONSTRAINT <replaceable class="PARAMETER">>constrain</replaceable>> ] <replaceable
</TERM> class="PARAMETER">table-constraint</replaceable>
<LISTITEM> </synopsis>
<PARA> </term>
<listitem>
<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. definition of column in the table.
See <command>CREATE TABLE</command> for the See <command>CREATE TABLE</command> for the
@ -259,11 +254,11 @@ ALTER TABLE <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE> ALTER [ COLUMN ]
constraint. constraint.
</para> </para>
<PARA> <para>
Currently, to set new default constraints on an existing column Currently, to set new default constraints on an existing column
the table must be recreated and reloaded: the table must be recreated and reloaded:
<ProgramListing> <programlisting>
CREATE TABLE temp AS SELECT * FROM distributors; CREATE TABLE temp AS SELECT * FROM distributors;
DROP TABLE distributors; DROP TABLE distributors;
CREATE TABLE distributors ( CREATE TABLE distributors (
@ -273,22 +268,22 @@ CREATE TABLE distributors (
); );
INSERT INTO distributors SELECT * FROM temp; INSERT INTO distributors SELECT * FROM temp;
DROP TABLE temp; DROP TABLE temp;
</ProgramListing> </programlisting>
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term>
<Synopsis> <synopsis>
ALTER TABLE <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE> ALTER TABLE <replaceable class="PARAMETER">table</replaceable>
DROP DEFAULT <REPLACEABLE CLASS="PARAMETER">default</REPLACEABLE> DROP DEFAULT <replaceable class="PARAMETER">default</replaceable>
ALTER TABLE <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE> ALTER TABLE <replaceable class="PARAMETER">table</replaceable>
DROP CONSTRAINT <REPLACEABLE CLASS="PARAMETER">constraint</REPLACEABLE> { RESTRICT | CASCADE } DROP CONSTRAINT <replaceable class="PARAMETER">constraint</replaceable> { RESTRICT | CASCADE }
</Synopsis> </synopsis>
</TERM> </term>
<LISTITEM> <listitem>
<PARA> <para>
Removes the default value specified by default or the rule Removes the default value specified by default or the rule
specified by constraint from the definition of a table. specified by constraint from the definition of a table.
If RESTRICT is specified only a constraint with no dependent If RESTRICT is specified only a constraint with no dependent
@ -297,29 +292,29 @@ ALTER TABLE <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE>
this constraint are also dropped. this constraint are also dropped.
</para> </para>
<PARA> <para>
Currently, to remove a default value or constraints on an Currently, to remove a default value or constraints on an
existing column the table must be recreated and reloaded: existing column the table must be recreated and reloaded:
<ProgramListing> <programlisting>
CREATE TABLE temp AS SELECT * FROM distributors; CREATE TABLE temp AS SELECT * FROM distributors;
DROP TABLE distributors; DROP TABLE distributors;
CREATE TABLE distributors AS SELECT * FROM temp; CREATE TABLE distributors AS SELECT * FROM temp;
DROP TABLE temp; DROP TABLE temp;
</ProgramListing> </programlisting>
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<VARLISTENTRY> <varlistentry>
<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>
<PARA> <para>
Removes a column from a table. Removes a column from a table.
If RESTRICT is specified only a column with no dependent If RESTRICT is specified only a column with no dependent
objects can be destroyed. objects can be destroyed.
@ -327,11 +322,11 @@ ALTER TABLE <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE>
this column are also dropped. this column are also dropped.
</para> </para>
<PARA> <para>
Currently, to remove an existing column the table must be Currently, to remove an existing column the table must be
recreated and reloaded: recreated and reloaded:
<ProgramListing> <programlisting>
CREATE TABLE temp AS SELECT did, city FROM distributors; CREATE TABLE temp AS SELECT did, city FROM distributors;
DROP TABLE distributors; DROP TABLE distributors;
CREATE TABLE distributors ( CREATE TABLE distributors (
@ -340,11 +335,28 @@ CREATE TABLE distributors (
); );
INSERT INTO distributors SELECT * FROM temp; INSERT INTO distributors SELECT * FROM temp;
DROP TABLE temp; DROP TABLE temp;
</ProgramListing> </programlisting>
</PARA> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</VARIABLELIST> </variablelist>
</refsect2> </refsect2>
</refsect1> </refsect1>
</REFENTRY> </refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:nil
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../reference.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:"/usr/lib/sgml/catalog"
sgml-local-ecat-files:nil
End:
-->

View File

@ -18,10 +18,8 @@
<date>1998-09-08</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 ] [ CREATEUSER | NOCREATEUSER ]
[ CREATEDB | NOCREATEDB ]
[ 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>
@ -33,15 +31,16 @@ ALTER USER <replaceable class="PARAMETER">username</replaceable>
<title> <title>
Inputs Inputs
</title> </title>
<para> <para>
Refer to <command>CREATE USER</command> for a detailed description of each Refer to <command>CREATE USER</command> for a detailed description of each
clause. clause.
</para> </para>
<para>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term><replaceable class="PARAMETER"> username </replaceable></term>
<replaceable class="PARAMETER"> username </replaceable>
</term>
<listitem> <listitem>
<para> <para>
The Postgres account name of the user whose details are to be altered. The Postgres account name of the user whose details are to be altered.
@ -50,9 +49,7 @@ ALTER USER <replaceable class="PARAMETER">username</replaceable>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><replaceable class="PARAMETER"> password </replaceable></term>
<replaceable class="PARAMETER"> password </replaceable>
</term>
<listitem> <listitem>
<para> <para>
The new password to be used for this account. The new password to be used for this account.
@ -61,9 +58,7 @@ ALTER USER <replaceable class="PARAMETER">username</replaceable>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><replaceable class="PARAMETER"> groupname </replaceable></term>
<replaceable class="PARAMETER"> groupname </replaceable>
</term>
<listitem> <listitem>
<para> <para>
The name of an access group into which this account is to be put. The name of an access group into which this account is to be put.
@ -72,9 +67,7 @@ ALTER USER <replaceable class="PARAMETER">username</replaceable>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><replaceable class="PARAMETER"> abstime </replaceable></term>
<replaceable class="PARAMETER"> abstime </replaceable>
</term>
<listitem> <listitem>
<para> <para>
The date (and, optionally, the time) The date (and, optionally, the time)
@ -83,6 +76,7 @@ ALTER USER <replaceable class="PARAMETER">username</replaceable>
</listitem> </listitem>
</varlistentry> </varlistentry>
</variablelist> </variablelist>
</para>
</refsect2> </refsect2>
<refsect2 id="R2-SQL-ALTERUSER-2"> <refsect2 id="R2-SQL-ALTERUSER-2">
@ -95,9 +89,9 @@ ALTER USER <replaceable class="PARAMETER">username</replaceable>
<para> <para>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term><computeroutput>
<returnvalue>ALTER USER</returnvalue> ALTER USER
</term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
Message returned if the alteration was successful. Message returned if the alteration was successful.
@ -106,13 +100,13 @@ ALTER USER <replaceable class="PARAMETER">username</replaceable>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><computeroutput>
<returnvalue>ERROR: alterUser: user "username" does not exist</returnvalue> ERROR: alterUser: user "username" does not exist
</term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
Error message returned if the user specified doesn't Error message returned if the specified user is not known to
exist. the database.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
@ -136,8 +130,9 @@ ALTER USER <replaceable class="PARAMETER">username</replaceable>
statement. Also, it is only possible for the statement. Also, it is only possible for the
<productname>Postgres</productname> <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. <literal>pg_shadow</literal> to alter user passwords.
</para> </para>
<para> <para>
If any of the clauses of the alter user statement are If any of the clauses of the alter user statement are
omitted, the corresponding value in the "pg_shadow" table omitted, the corresponding value in the "pg_shadow" table
@ -152,14 +147,13 @@ ALTER USER <replaceable class="PARAMETER">username</replaceable>
Notes Notes
</title> </title>
<para> <para>
<command>ALTER USER</command> statement <command>ALTER USER</command>
is a <productname>Postgres</productname> is a <productname>Postgres</productname>
language extension. language extension.
</para> </para>
<para> <para>
Refer to <command>CREATE/DROP USER</command> Refer to <command>CREATE/DROP USER</command>
to create or remove a user to create or remove a user account.
account.
</para> </para>
<para> <para>
In the current release (v6.5), the IN GROUP clause is parsed In the current release (v6.5), the IN GROUP clause is parsed
@ -174,37 +168,37 @@ ALTER USER <replaceable class="PARAMETER">username</replaceable>
Usage Usage
</title> </title>
<para> <para>
Change a user password Change a user password:
</para>
<programlisting> <programlisting>
ALTER USER davide WITH PASSWORD hu8jmn3; ALTER USER davide WITH PASSWORD hu8jmn3;
</programlisting> </programlisting>
<para>
Change a user's valid until date Change a user's valid until date
</para>
<programlisting> <programlisting>
ALTER USER manuel VALID UNTIL 'Jan 31 2030'; ALTER USER manuel VALID UNTIL 'Jan 31 2030';
</programlisting> </programlisting>
<para>
Change a user's valid until date, specifying that his Change a user's valid until date, specifying that his
authorisation should expire at midday on 4th May 1998 using 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>
<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>
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>
<programlisting> <programlisting>
ALTER USER miriam CREATEUSER CREATEDB; ALTER USER miriam CREATEUSER CREATEDB;
</programlisting> </programlisting>
<para>
Place a user in two groups Place a user in two groups
</para>
<programlisting> <programlisting>
ALTER USER miriam IN GROUP sales, payroll; ALTER USER miriam IN GROUP sales, payroll;
</programlisting> </programlisting>
</para>
</refsect1> </refsect1>
<refsect1 id="R1-SQL-ALTERUSER-3"> <refsect1 id="R1-SQL-ALTERUSER-3">

View File

@ -30,7 +30,7 @@ BEGIN [ WORK | TRANSACTION ]
Inputs Inputs
</title> </title>
<para> <para>
None None.
</para> </para>
</refsect2> </refsect2>
@ -45,9 +45,9 @@ BEGIN [ WORK | TRANSACTION ]
<para> <para>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term><computeroutput>
<returnvalue>BEGIN</returnvalue> BEGIN
</term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
This signifies that a new transaction has been started. This signifies that a new transaction has been started.
@ -55,9 +55,9 @@ BEGIN [ WORK | TRANSACTION ]
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><computeroutput>
<returnvalue>NOTICE: BeginTransactionBlock and not in default state</returnvalue> NOTICE: BeginTransactionBlock and not in default state
</term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
This indicates that a transaction was already in progress. This indicates that a transaction was already in progress.

View File

@ -1,153 +1,152 @@
<REFENTRY ID="SQL-CLOSE"> <refentry id="SQL-CLOSE">
<REFMETA> <refmeta>
<REFENTRYTITLE> <refentrytitle>
CLOSE CLOSE
</REFENTRYTITLE> </refentrytitle>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO> <refmiscinfo>SQL - Language Statements</refmiscinfo>
</REFMETA> </refmeta>
<REFNAMEDIV> <refnamediv>
<REFNAME> <refname>
CLOSE CLOSE
</REFNAME> </refname>
<REFPURPOSE> <refpurpose>
Close a cursor Close a cursor
</REFPURPOSE> </refpurpose>
</refnamediv> </refnamediv>
<REFSYNOPSISDIV> <refsynopsisdiv>
<REFSYNOPSISDIVINFO> <refsynopsisdivinfo>
<DATE>1998-09-08</DATE> <date>1998-09-08</date>
</REFSYNOPSISDIVINFO> </refsynopsisdivinfo>
<SYNOPSIS> <synopsis>
CLOSE <REPLACEABLE CLASS="PARAMETER">cursor</REPLACEABLE> CLOSE <replaceable class="PARAMETER">cursor</replaceable>
</SYNOPSIS> </synopsis>
<REFSECT2 ID="R2-SQL-CLOSE-1"> <refsect2 id="R2-SQL-CLOSE-1">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-08</DATE> <date>1998-09-08</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Inputs Inputs
</TITLE> </title>
<PARA> <para>
<VARIABLELIST>
<VARLISTENTRY> <variablelist>
<TERM> <varlistentry>
<REPLACEABLE CLASS="PARAMETER">cursor</REPLACEABLE> <term><replaceable class="PARAMETER">cursor</replaceable></term>
</TERM> <listitem>
<LISTITEM> <para>
<PARA>
The name of an open cursor to close. The name of an open cursor to close.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
</variablelist> </variablelist>
</para> </para>
</REFSECT2> </refsect2>
<REFSECT2 ID="R2-SQL-CLOSE-2"> <refsect2 id="R2-SQL-CLOSE-2">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-08</DATE> <date>1998-09-08</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Outputs Outputs
</TITLE> </title>
<PARA> <para>
<VARIABLELIST>
<VARLISTENTRY> <variablelist>
<TERM> <varlistentry>
<ReturnValue>CLOSE</ReturnValue> <term><computeroutput>
</TERM> CLOSE
<LISTITEM> </computeroutput></term>
<PARA> <listitem>
<para>
Message returned if the cursor is successfully closed. Message returned if the cursor is successfully closed.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
<ReturnValue>NOTICE PerformPortalClose: portal "<REPLACEABLE CLASS="PARAMETER">cursor</REPLACEABLE>" not found</ReturnValue> NOTICE PerformPortalClose: portal "<replaceable class="PARAMETER">cursor</replaceable>" not found
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
This warning is given if This warning is given if
<REPLACEABLE CLASS="PARAMETER">cursor</REPLACEABLE> is not <replaceable class="PARAMETER">cursor</replaceable> is not
declared or has already been closed. declared or has already been closed.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</VARIABLELIST> </variablelist>
</para> </para>
</REFSECT2> </refsect2>
</REFSYNOPSISDIV> </refsynopsisdiv>
<REFSECT1 ID="R1-SQL-CLOSE-1"> <refsect1 id="R1-SQL-CLOSE-1">
<REFSECT1INFO> <refsect1info>
<DATE>1998-09-08</DATE> <date>1998-09-08</date>
</REFSECT1INFO> </refsect1info>
<TITLE> <title>
Description Description
</TITLE> </title>
<PARA> <para>
<command>CLOSE</command> 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 <command>COMMIT</command> transaction is terminated by <command>COMMIT</command>
or <command>ROLLBACK</command>. or <command>ROLLBACK</command>.
</PARA> </para>
<REFSECT2 ID="R2-SQL-CLOSE-3"> <refsect2 id="R2-SQL-CLOSE-3">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-08</DATE> <date>1998-09-08</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Notes Notes
</TITLE> </title>
<PARA> <para>
<productname>Postgres</productname> does not have <productname>Postgres</productname> does not have
an explicit <command>OPEN</command> cursor statement; an explicit <command>OPEN</command> cursor statement;
a cursor is considered open when it is declared. a cursor is considered open when it is declared.
Use the <command>DECLARE</command> statement to declare a cursor. Use the <command>DECLARE</command> statement to declare a cursor.
</PARA> </para>
</REFSECT2>
</refsect1>
<REFSECT1 ID="R1-SQL-CLOSE-2">
<TITLE>
Usage
</TITLE>
<PARA>
Close the cursor liahona:
</PARA>
<ProgramListing>
CLOSE liahona;
</ProgramListing>
</REFSECT1>
<REFSECT1 ID="R1-SQL-CLOSE-3">
<TITLE>
Compatibility
</TITLE>
<PARA>
</PARA>
<REFSECT2 ID="R2-SQL-CLOSE-4">
<REFSECT2INFO>
<DATE>1998-09-08</DATE>
</REFSECT2INFO>
<TITLE>
SQL92
</TITLE>
<PARA>
<command>CLOSE</command> is fully compatible with SQL92.
</PARA>
</refsect2> </refsect2>
</refsect1> </refsect1>
</REFENTRY>
<refsect1 id="R1-SQL-CLOSE-2">
<title>
Usage
</title>
<para>
Close the cursor liahona:
</para>
<programlisting>
CLOSE liahona;
</programlisting>
</refsect1>
<refsect1 id="R1-SQL-CLOSE-3">
<title>
Compatibility
</title>
<para>
</para>
<refsect2 id="R2-SQL-CLOSE-4">
<refsect2info>
<date>1998-09-08</date>
</refsect2info>
<title>
SQL92
</title>
<para>
<command>CLOSE</command> is fully compatible with SQL92.
</para>
</refsect2>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file
Local variables: Local variables:

View File

@ -1,120 +1,114 @@
<REFENTRY ID="SQL-CLUSTER"> <refentry id="SQL-CLUSTER">
<REFMETA> <refmeta>
<REFENTRYTITLE> <refentrytitle>
CLUSTER CLUSTER
</REFENTRYTITLE> </refentrytitle>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO> <refmiscinfo>SQL - Language Statements</refmiscinfo>
</REFMETA> </refmeta>
<REFNAMEDIV> <refnamediv>
<REFNAME> <refname>
CLUSTER CLUSTER
</REFNAME> </refname>
<REFPURPOSE> <refpurpose>
Gives storage clustering advice to the backend Gives storage clustering advice to the backend
</REFPURPOSE> </refpurpose>
</refnamediv> </refnamediv>
<REFSYNOPSISDIV> <refsynopsisdiv>
<REFSYNOPSISDIVINFO> <refsynopsisdivinfo>
<DATE>1998-09-08</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-09-08</DATE> <date>1998-09-08</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Inputs Inputs
</TITLE> </title>
<PARA> <para>
</PARA> </para>
<VARIABLELIST> <variablelist>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="PARAMETER">indexname</replaceable></term>
<REPLACEABLE CLASS="PARAMETER">indexname</REPLACEABLE> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
The name of an index. The name of an index.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="PARAMETER">table</replaceable></term>
<REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
The name of a table. The name of a table.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
</VARIABLELIST> </variablelist>
</REFSECT2> </refsect2>
<REFSECT2 ID="R2-SQL-CLUSTER-2"> <refsect2 id="R2-SQL-CLUSTER-2">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-08</DATE> <date>1998-09-08</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Outputs Outputs
</TITLE> </title>
<PARA> <para>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
<returnvalue>CLUSTER</returnvalue>
</TERM>
<LISTITEM>
<PARA>
The clustering was done successfully.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
<returnvalue>ERROR: relation &lt;<REPLACEABLE CLASS="PARAMETER">tablerelation_number</REPLACEABLE>&gt; inherits "invoice"</returnvalue>
</TERM>
<LISTITEM>
<PARA>
<variablelist>
<varlistentry>
<term><computeroutput>
CLUSTER
</computeroutput></term>
<listitem>
<para>
The clustering was done successfully.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><computeroutput>
ERROR: relation &lt;<replaceable class="PARAMETER">tablerelation_number</replaceable>&gt; inherits "invoice"
</computeroutput></term>
<listitem>
<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.
</comment> </comment>
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
<returnvalue>ERROR: Relation x does not exist!</returnvalue> ERROR: Relation x does not exist!
</TERM> </computeroutput></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.
</comment> </comment>
</PARA>
</LISTITEM>
</VARLISTENTRY>
</VARIABLELIST>
</para> </para>
</REFSECT2> </listitem>
</REFSYNOPSISDIV> </varlistentry>
</variablelist>
</para>
</refsect2>
</refsynopsisdiv>
<REFSECT1 ID="R1-SQL-CLUSTER-1"> <refsect1 id="R1-SQL-CLUSTER-1">
<REFSECT1INFO> <refsect1info>
<DATE>1998-09-08</DATE> <date>1998-09-08</date>
</REFSECT1INFO> </refsect1info>
<TITLE> <title>
Description Description
</TITLE> </title>
<PARA> <para>
<command>CLUSTER</command> instructs <productname>Postgres</productname> <command>CLUSTER</command> instructs <productname>Postgres</productname>
to cluster the class specified to cluster the class specified
by <replaceable class="parameter">classname</replaceable> approximately by <replaceable class="parameter">classname</replaceable> approximately
@ -122,7 +116,7 @@ to cluster the class specified
<replaceable class="parameter">indexname</replaceable>. The index must <replaceable class="parameter">indexname</replaceable>. The index must
already have been defined on already have been defined on
<replaceable class="parameter">classname</replaceable>. <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.
@ -132,13 +126,13 @@ to cluster the class specified
recluster manually by issuing the command again. recluster manually by issuing the command again.
</para> </para>
<REFSECT2 ID="R2-SQL-CLUSTER-3"> <refsect2 id="R2-SQL-CLUSTER-3">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-08</DATE> <date>1998-09-08</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Notes Notes
</TITLE> </title>
<para> <para>
The table is actually copied to a temporary table in index The table is actually copied to a temporary table in index
@ -195,44 +189,43 @@ SELECT ... INTO TABLE <replaceable class="parameter">temp</replaceable> FROM ...
</refsect2> </refsect2>
</refsect1> </refsect1>
<REFSECT1 ID="R1-SQL-CLUSTER-2"> <refsect1 id="R1-SQL-CLUSTER-2">
<TITLE> <title>
Usage Usage
</TITLE> </title>
<PARA> <para>
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>
<REFSECT1 ID="R1-SQL-CLUSTER-3"> <refsect1 id="R1-SQL-CLUSTER-3">
<TITLE> <title>
Compatibility Compatibility
</TITLE> </title>
<PARA> <para>
</PARA> </para>
<REFSECT2 ID="R2-SQL-CLUSTER-4"> <refsect2 id="R2-SQL-CLUSTER-4">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-08</DATE> <date>1998-09-08</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
SQL92 SQL92
</TITLE> </title>
<PARA> <para>
There is no <command>CLUSTER</command> statement in SQL92. There is no <command>CLUSTER</command> statement in SQL92.
</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
sgml-omittag:t sgml-omittag:nil
sgml-shorttag:t sgml-shorttag:t
sgml-minimize-attributes:nil sgml-minimize-attributes:nil
sgml-always-quote-attributes:t sgml-always-quote-attributes:t

View File

@ -30,7 +30,7 @@ COMMIT [ WORK | TRANSACTION ]
Inputs Inputs
</title> </title>
<para> <para>
None None.
</para> </para>
</refsect2> </refsect2>
@ -45,9 +45,9 @@ COMMIT [ WORK | TRANSACTION ]
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term><computeroutput>
<returnvalue>END</returnvalue> END
</term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
Message returned if the transaction is successfully committed. Message returned if the transaction is successfully committed.
@ -55,9 +55,9 @@ COMMIT [ WORK | TRANSACTION ]
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><computeroutput>
<returnvalue>NOTICE EndTransactionBlock and not inprogress/abort state</returnvalue> NOTICE EndTransactionBlock and not inprogress/abort state
</term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
If there is no transaction in progress. If there is no transaction in progress.

View File

@ -1,157 +1,146 @@
<REFENTRY ID="SQL-COPY"> <refentry id="SQL-COPY">
<REFMETA> <refmeta>
<REFENTRYTITLE> <refentrytitle>
COPY COPY
</REFENTRYTITLE> </refentrytitle>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO> <refmiscinfo>SQL - Language Statements</refmiscinfo>
</REFMETA> </refmeta>
<REFNAMEDIV> <refnamediv>
<REFNAME> <refname>
COPY COPY
</REFNAME> </refname>
<REFPURPOSE> <refpurpose>
Copies data between files and tables Copies data between files and tables
</REFPURPOSE> </refpurpose>
</refnamediv> </refnamediv>
<REFSYNOPSISDIV> <refsynopsisdiv>
<REFSYNOPSISDIVINFO> <refsynopsisdivinfo>
<DATE>1998-09-08</DATE> <date>1998-09-08</date>
</REFSYNOPSISDIVINFO> </refsynopsisdivinfo>
<SYNOPSIS> <synopsis>
COPY [ BINARY ] <replaceable class="parameter">table</replaceable> [ WITH OIDS ] COPY [ BINARY ] <replaceable class="parameter">table</replaceable> [ WITH OIDS ]
FROM { '<replaceable class="parameter">filename</replaceable>' | <filename>stdin</filename> } FROM { '<replaceable class="parameter">filename</replaceable>' |
<filename>stdin</filename> }
[ USING DELIMITERS '<replaceable class="parameter">delimiter</replaceable>' ] [ USING DELIMITERS '<replaceable class="parameter">delimiter</replaceable>' ]
COPY [ BINARY ] <replaceable class="parameter">table</replaceable> [ WITH OIDS ] COPY [ BINARY ] <replaceable class="parameter">table</replaceable> [ WITH OIDS ]
TO { '<replaceable class="parameter">filename</replaceable>' | <filename>stdout</filename> } TO { '<replaceable class="parameter">filename</replaceable>' |
<filename>stdout</filename> }
[ USING DELIMITERS '<replaceable class="parameter">delimiter</replaceable>' ] [ USING DELIMITERS '<replaceable class="parameter">delimiter</replaceable>' ]
</SYNOPSIS> </synopsis>
<REFSECT2 ID="R2-SQL-COPY-1"> <refsect2 id="R2-SQL-COPY-1">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-08</DATE> <date>1998-09-08</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Inputs Inputs
</TITLE> </title>
<PARA> <para>
<VARIABLELIST>
<VARLISTENTRY> <variablelist>
<TERM> <varlistentry>
BINARY <term>BINARY</term>
</TERM> <listitem>
<LISTITEM> <para>
<PARA>
Changes the behavior of field formatting, forcing all data to be Changes the behavior of field formatting, forcing all data to be
stored or read as binary objects rather than as text. stored or read as binary objects rather than as text.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="parameter">table</replaceable></term>
<replaceable class="parameter">table</replaceable> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
The name of an existing table. The name of an existing table.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term>WITH OIDS</term>
WITH OIDS <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
Copies the internal unique object id (OID) for each row. Copies the internal unique object id (OID) for each row.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="parameter">filename</replaceable></term>
<replaceable class="parameter">filename</replaceable> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
The absolute Unix pathname of the input or output file. The absolute Unix pathname of the input or output file.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><filename>stdin</filename></term>
<filename>stdin</filename> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
Specifies that input comes from a pipe or terminal. Specifies that input comes from a pipe or terminal.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><filename>stdout</filename></term>
<filename>stdout</filename> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
Specifies that output goes to a pipe or terminal. Specifies that output goes to a pipe or terminal.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="parameter">delimiter</replaceable></term>
<replaceable class="parameter">delimiter</replaceable> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
A character that delimits the input or output fields. A character that delimits the input or output fields.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
</variablelist> </variablelist>
</para> </para>
</REFSECT2> </refsect2>
<REFSECT2 ID="R2-SQL-COPY-2"> <refsect2 id="R2-SQL-COPY-2">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-08</DATE> <date>1998-09-08</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Outputs Outputs
</TITLE> </title>
<PARA> <para>
<VARIABLELIST> <variablelist>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
<ReturnValue>COPY</ReturnValue> COPY
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
The copy completed successfully. The copy completed successfully.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
<ReturnValue>ERROR: <replaceable>error message</replaceable></ReturnValue> ERROR: <replaceable>error message</replaceable>
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
The copy failed for the reason stated in the error message. The copy failed for the reason stated in the error message.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</VARIABLELIST> </variablelist>
</para> </para>
</REFSECT2> </refsect2>
</REFSYNOPSISDIV> </refsynopsisdiv>
<REFSECT1 ID="R1-SQL-COPY-1"> <refsect1 id="R1-SQL-COPY-1">
<REFSECT1INFO> <refsect1info>
<DATE>1998-09-08</DATE> <date>1998-09-08</date>
</REFSECT1INFO> </refsect1info>
<TITLE> <title>
Description Description
</TITLE> </title>
<para> <para>
<command>COPY</command> moves data between <command>COPY</command> moves data between
<productname>Postgres</productname> tables and <productname>Postgres</productname> tables and
@ -161,16 +150,17 @@ Specifies that output goes to a pipe or terminal.
the <productname>Postgres</productname> backend the <productname>Postgres</productname> backend
to directly read from or write to a file. The file must be directly visible to to directly read from or write to a file. The file must be directly visible to
the backend and the name must be specified from the viewpoint of the backend. the backend and the name must be specified from the viewpoint of the backend.
If <filename>stdin</filename> or <filename>stdout</filename> are specified, data flows through the client frontend to If <filename>stdin</filename> or <filename>stdout</filename> are
the backend. specified, data flows through the client frontend to the backend.
</para> </para>
<REFSECT2 ID="R2-SQL-COPY-3">
<REFSECT2INFO> <refsect2 id="R2-SQL-COPY-3">
<DATE>1998-09-08</DATE> <refsect2info>
</REFSECT2INFO> <date>1998-09-08</date>
<TITLE> </refsect2info>
<title>
Notes Notes
</TITLE> </title>
<para> <para>
The BINARY keyword will force all data to be The BINARY keyword will force all data to be
stored/read as binary objects rather than as text. It is stored/read as binary objects rather than as text. It is
@ -191,6 +181,7 @@ Specifies that output goes to a pipe or terminal.
The backend also needs appropriate Unix permissions for any file read The backend also needs appropriate Unix permissions for any file read
or written by <command>COPY</command>. or written by <command>COPY</command>.
</para> </para>
<para> <para>
The keyword phrase USING DELIMITERS specifies a single character The keyword phrase USING DELIMITERS specifies a single character
to be used for all delimiters between columns. If multiple characters to be used for all delimiters between columns. If multiple characters
@ -204,10 +195,10 @@ Specifies that output goes to a pipe or terminal.
</para> </para>
</tip> </tip>
</para> </para>
</REFSECT2> </refsect2>
</refsect1> </refsect1>
<refsect1 ID="R1-SQL-COPY-2"> <refsect1 id="R1-SQL-COPY-2">
<refsect1info> <refsect1info>
<date>1998-05-04</date> <date>1998-05-04</date>
</refsect1info> </refsect1info>
@ -280,19 +271,19 @@ Specifies that output goes to a pipe or terminal.
<table frame="all"> <table frame="all">
<title>Contents of a binary copy file</title> <title>Contents of a binary copy file</title>
<tgroup cols="2" colsep="1" rowsep="1" align="center"> <tgroup cols="2" colsep="1" rowsep="1" align="center">
<COLSPEC COLNAME="col1"> <colspec colname="col1">
<COLSPEC COLNAME="col2"> <colspec colname="col2">
<spanspec namest="col1" nameend="col2" spanname="subhead"> <spanspec namest="col1" nameend="col2" spanname="subhead">
<tbody> <tbody>
<row> <row>
<entry align="center" spanname="subhead">At the start of the file</entry> <entry spanname="subhead" align="center">At the start of the file</entry>
</row> </row>
<row> <row>
<entry>uint32</entry> <entry>uint32</entry>
<entry>number of tuples</entry> <entry>number of tuples</entry>
</row> </row>
<row> <row>
<entry align="center" spanname="subhead">For each tuple</entry> <entry spanname="subhead" align="center">For each tuple</entry>
</row> </row>
<row> <row>
<entry>uint32</entry> <entry>uint32</entry>
@ -337,30 +328,30 @@ Specifies that output goes to a pipe or terminal.
</refsect1> </refsect1>
<REFSECT1 ID="R1-SQL-COPY-3"> <refsect1 id="R1-SQL-COPY-3">
<TITLE> <title>
Usage Usage
</TITLE> </title>
<PARA> <para>
The following example copies a table to standard output, The following example copies a table to standard output,
using a vertical bar ("|") as the field using a vertical bar ("|") as the field
delimiter: delimiter:
</PARA> </para>
<ProgramListing> <programlisting>
COPY country TO <filename>stdout</filename> USING DELIMITERS '|'; COPY country TO <filename>stdout</filename> USING DELIMITERS '|';
</ProgramListing> </programlisting>
<PARA> <para>
To copy data from a Unix file into a table "country": To copy data from a Unix file into a table "country":
</PARA> </para>
<ProgramListing> <programlisting>
COPY country FROM '/usr1/proj/bray/sql/country_data'; COPY country FROM '/usr1/proj/bray/sql/country_data';
</ProgramListing> </programlisting>
<PARA> <para>
Here is a sample of data suitable for copying into a table Here is a sample of data suitable for copying into a table
from <filename>stdin</filename> (so it from <filename>stdin</filename> (so it
has the termination sequence on the last line): has the termination sequence on the last line):
</PARA> </para>
<ProgramListing> <programlisting>
AF AFGHANISTAN AF AFGHANISTAN
AL ALBANIA AL ALBANIA
DZ ALGERIA DZ ALGERIA
@ -368,8 +359,8 @@ has the termination sequence on the last line):
ZM ZAMBIA ZM ZAMBIA
ZW ZIMBABWE ZW ZIMBABWE
\. \.
</ProgramListing> </programlisting>
<PARA> <para>
The same data, output in binary format on a Linux/i586 machine. The same data, output in binary format on a Linux/i586 machine.
The data is shown after filtering through The data is shown after filtering through
the Unix utility <command>od -c</command>. The table has the Unix utility <command>od -c</command>. The table has
@ -379,8 +370,8 @@ has the termination sequence on the last line):
Notice how the <classname>char(2)</classname> Notice how the <classname>char(2)</classname>
field is padded with nulls to four bytes and the text field is field is padded with nulls to four bytes and the text field is
preceded by its length: preceded by its length:
</PARA> </para>
<ProgramListing> <programlisting>
355 \0 \0 \0 027 \0 \0 \0 001 \0 \0 \0 002 \0 \0 \0 355 \0 \0 \0 027 \0 \0 \0 001 \0 \0 \0 002 \0 \0 \0
006 \0 \0 \0 A F \0 \0 017 \0 \0 \0 A F G H 006 \0 \0 \0 A F \0 \0 017 \0 \0 \0 A F G H
A N I S T A N 023 \0 \0 \0 001 \0 \0 \0 002 A N I S T A N 023 \0 \0 \0 001 \0 \0 \0 002
@ -391,10 +382,10 @@ has the termination sequence on the last line):
... \n \0 \0 \0 Z A M B I A 024 \0 ... \n \0 \0 \0 Z A M B I A 024 \0
\0 \0 001 \0 \0 \0 002 \0 \0 \0 006 \0 \0 \0 Z W \0 \0 001 \0 \0 \0 002 \0 \0 \0 006 \0 \0 \0 Z W
\0 \0 \f \0 \0 \0 Z I M B A B W E \0 \0 \f \0 \0 \0 Z I M B A B W E
</ProgramListing> </programlisting>
</refsect1> </refsect1>
<refsect1 ID="R1-SQL-COPY-5"> <refsect1 id="R1-SQL-COPY-5">
<title>Bugs and features</title> <title>Bugs and features</title>
<para> <para>
<command>COPY</command> neither invokes rules nor acts on column defaults. <command>COPY</command> neither invokes rules nor acts on column defaults.
@ -435,31 +426,31 @@ must reside on or be
</para> </para>
</refsect1> </refsect1>
<REFSECT1 ID="R1-SQL-COPY-6"> <refsect1 id="R1-SQL-COPY-6">
<TITLE> <title>
Compatibility Compatibility
</TITLE> </title>
<PARA> <para>
</PARA> </para>
<REFSECT2 ID="R2-SQL-COPY-4"> <refsect2 id="R2-SQL-COPY-4">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-08</DATE> <date>1998-09-08</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
SQL92 SQL92
</TITLE> </title>
<PARA> <para>
There is no <command>COPY</command> statement in SQL92. There is no <command>COPY</command> statement in SQL92.
</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
sgml-omittag:t sgml-omittag:nil
sgml-shorttag:t sgml-shorttag:t
sgml-minimize-attributes:nil sgml-minimize-attributes:nil
sgml-always-quote-attributes:t sgml-always-quote-attributes:t

View File

@ -1,60 +1,56 @@
<REFENTRY ID="SQL-CREATEAGGREGATE"> <refentry id="SQL-CREATEAGGREGATE">
<REFMETA> <refmeta>
<REFENTRYTITLE> <refentrytitle>
CREATE AGGREGATE CREATE AGGREGATE
</REFENTRYTITLE> </refentrytitle>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO> <refmiscinfo>SQL - Language Statements</refmiscinfo>
</REFMETA> </refmeta>
<REFNAMEDIV> <refnamediv>
<REFNAME> <refname>
CREATE AGGREGATE CREATE AGGREGATE
</REFNAME> </refname>
<REFPURPOSE> <refpurpose>
Defines a new aggregate function Defines a new aggregate function
</REFPURPOSE> </refpurpose>
</refnamediv> </refnamediv>
<REFSYNOPSISDIV> <refsynopsisdiv>
<REFSYNOPSISDIVINFO> <refsynopsisdivinfo>
<DATE>1998-09-09</DATE> <date>1998-09-09</date>
</REFSYNOPSISDIVINFO> </refsynopsisdivinfo>
<SYNOPSIS> <synopsis>
CREATE AGGREGATE <REPLACEABLE CLASS="PARAMETER">name</REPLACEABLE> [ AS ] CREATE AGGREGATE <replaceable class="PARAMETER">name</replaceable> [ AS ]
( BASETYPE = <REPLACEABLE CLASS="PARAMETER">data_type</REPLACEABLE> ( BASETYPE = <replaceable class="PARAMETER">data_type</replaceable>
[ , SFUNC1 = <REPLACEABLE CLASS="PARAMETER">sfunc1</REPLACEABLE> [ , SFUNC1 = <replaceable class="PARAMETER">sfunc1</replaceable>
, STYPE1 = <REPLACEABLE CLASS="PARAMETER">sfunc1_return_type</REPLACEABLE> ] , STYPE1 = <replaceable class="PARAMETER">sfunc1_return_type</replaceable> ]
[ , SFUNC2 = <REPLACEABLE CLASS="PARAMETER">sfunc2</REPLACEABLE> [ , SFUNC2 = <replaceable class="PARAMETER">sfunc2</replaceable>
, STYPE2 = <REPLACEABLE CLASS="PARAMETER">sfunc2_return_type</REPLACEABLE> ] , STYPE2 = <replaceable class="PARAMETER">sfunc2_return_type</replaceable> ]
[ , FINALFUNC = <REPLACEABLE CLASS="PARAMETER">ffunc</REPLACEABLE> ] [ , FINALFUNC = <replaceable class="PARAMETER">ffunc</replaceable> ]
[ , INITCOND1 = <REPLACEABLE CLASS="PARAMETER">initial_condition1</REPLACEABLE> ] [ , INITCOND1 = <replaceable class="PARAMETER">initial_condition1</replaceable> ]
[ , INITCOND2 = <REPLACEABLE CLASS="PARAMETER">initial_condition2</REPLACEABLE> ] [ , INITCOND2 = <replaceable class="PARAMETER">initial_condition2</replaceable> ]
) )
</SYNOPSIS> </synopsis>
<REFSECT2 ID="R2-SQL-CREATEAGGREGATE-1"> <refsect2 id="R2-SQL-CREATEAGGREGATE-1">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-09</DATE> <date>1998-09-09</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Inputs Inputs
</TITLE> </title>
<PARA> <para>
<VARIABLELIST> <variablelist>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="PARAMETER">name</replaceable></term>
<REPLACEABLE CLASS="PARAMETER">name</REPLACEABLE> <listitem>
</TERM>
<LISTITEM>
<para> <para>
The name of an aggregate function to create. The name of an aggregate function to create.
</para> </para>
</LISTITEM> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><replaceable class="PARAMETER">data_type</replaceable></term>
<REPLACEABLE CLASS="PARAMETER">data_type</REPLACEABLE>
</term>
<listitem> <listitem>
<para> <para>
The fundamental data type on which this aggregate function operates. The fundamental data type on which this aggregate function operates.
@ -63,15 +59,13 @@ The fundamental data type on which this aggregate function operates.
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><replaceable class="PARAMETER">sfunc1</replaceable></term>
<REPLACEABLE CLASS="PARAMETER">sfunc1</REPLACEABLE>
</term>
<listitem> <listitem>
<para> <para>
The state transition function The state transition function
to be called for every non-NULL field from the source column. to be called for every non-NULL field from the source column.
It takes a variable of It takes a variable of
type <REPLACEABLE CLASS="PARAMETER">sfunc1_return_type</REPLACEABLE> as type <replaceable class="PARAMETER">sfunc1_return_type</replaceable> as
the first argument and that field as the the first argument and that field as the
second argument. second argument.
</para> </para>
@ -79,9 +73,7 @@ second argument.
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><replaceable class="PARAMETER">sfunc1_return_type</replaceable></term>
<REPLACEABLE CLASS="PARAMETER">sfunc1_return_type</REPLACEABLE>
</term>
<listitem> <listitem>
<para> <para>
The return type of the first transition function. The return type of the first transition function.
@ -90,24 +82,20 @@ The return type of the first transition function.
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><replaceable class="PARAMETER">sfunc2</replaceable></term>
<REPLACEABLE CLASS="PARAMETER">sfunc2</REPLACEABLE>
</term>
<listitem> <listitem>
<para> <para>
The state transition function The state transition function
to be called for every non-NULL field from the source column. to be called for every non-NULL field from the source column.
It takes a variable It takes a variable
of type <REPLACEABLE CLASS="PARAMETER">sfunc2_return_type</REPLACEABLE> of type <replaceable class="PARAMETER">sfunc2_return_type</replaceable>
as the only argument and returns a variable of the same type. as the only argument and returns a variable of the same type.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><replaceable class="PARAMETER">sfunc2_return_type</replaceable></term>
<REPLACEABLE CLASS="PARAMETER">sfunc2_return_type</REPLACEABLE>
</term>
<listitem> <listitem>
<para> <para>
The return type of the second transition function. The return type of the second transition function.
@ -116,25 +104,21 @@ The return type of the second transition function.
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><replaceable class="PARAMETER">ffunc</replaceable></term>
<REPLACEABLE CLASS="PARAMETER">ffunc</REPLACEABLE>
</term>
<listitem> <listitem>
<para> <para>
The final function The final function
called after traversing all input fields. This function must called after traversing all input fields. This function must
take two arguments of types take two arguments of types
<REPLACEABLE CLASS="PARAMETER">sfunc1_return_type</REPLACEABLE> <replaceable class="PARAMETER">sfunc1_return_type</replaceable>
and and
<REPLACEABLE CLASS="PARAMETER">sfunc2_return_type</REPLACEABLE>. <replaceable class="PARAMETER">sfunc2_return_type</replaceable>.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><replaceable class="PARAMETER">initial_condition1</replaceable></term>
<REPLACEABLE CLASS="PARAMETER">initial_condition1</REPLACEABLE>
</term>
<listitem> <listitem>
<para> <para>
The initial value for the first transition function argument. The initial value for the first transition function argument.
@ -143,9 +127,7 @@ The initial value for the first transition function argument.
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><replaceable class="PARAMETER">initial_condition2</replaceable></term>
<REPLACEABLE CLASS="PARAMETER">initial_condition2</REPLACEABLE>
</term>
<listitem> <listitem>
<para> <para>
The initial value for the second transition function argument. The initial value for the second transition function argument.
@ -154,40 +136,40 @@ The initial value for the second transition function argument.
</varlistentry> </varlistentry>
</variablelist> </variablelist>
</para> </para>
</REFSECT2> </refsect2>
<REFSECT2 ID="R2-SQL-CREATEAGGREGATE-2"> <refsect2 id="R2-SQL-CREATEAGGREGATE-2">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-09</DATE> <date>1998-09-09</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Outputs Outputs
</TITLE> </title>
<PARA> <para>
<VARIABLELIST> <variablelist>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
<ReturnValue>CREATE</ReturnValue> CREATE
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
Message returned if the command completes successfully. Message returned if the command completes successfully.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</VARIABLELIST> </variablelist>
</para> </para>
</REFSECT2> </refsect2>
</REFSYNOPSISDIV> </refsynopsisdiv>
<REFSECT1 ID="R1-SQL-CREATEAGGREGATE-1"> <refsect1 id="R1-SQL-CREATEAGGREGATE-1">
<REFSECT1INFO> <refsect1info>
<DATE>1998-09-09</DATE> <date>1998-09-09</date>
</REFSECT1INFO> </refsect1info>
<TITLE> <title>
Description Description
</TITLE> </title>
<para> <para>
<command>CREATE AGGREGATE</command> <command>CREATE AGGREGATE</command>
allows a user or programmer to extend <productname>Postgres</productname> allows a user or programmer to extend <productname>Postgres</productname>
@ -198,25 +180,24 @@ The initial value for the second transition function argument.
already provided then <command>CREATE AGGREGATE</command> already provided then <command>CREATE AGGREGATE</command>
can be used to provide the desired features. can be used to provide the desired features.
</para> </para>
<PARA> <para>
An aggregate function can require up to three functions, two An aggregate function can require up to three functions, two
state transition functions, state transition functions,
<REPLACEABLE CLASS="PARAMETER">sfunc1</REPLACEABLE> <replaceable class="PARAMETER">sfunc1</replaceable>
and <REPLACEABLE CLASS="PARAMETER">sfunc2</REPLACEABLE>: and <replaceable class="PARAMETER">sfunc2</replaceable>:
<programlisting> <programlisting>
<REPLACEABLE CLASS="PARAMETER">sfunc1</REPLACEABLE>( internal-state1, next-data_item ) ---> next-internal-state1 <replaceable class="PARAMETER">sfunc1</replaceable>( internal-state1, next-data_item ) ---> next-internal-state1 <replaceable class="PARAMETER">sfunc2</replaceable>( internal-state2 ) ---> next-internal-state2
<REPLACEABLE CLASS="PARAMETER">sfunc2</REPLACEABLE>( internal-state2 ) ---> next-internal-state2
</programlisting> </programlisting>
and a final calculation function, and a final calculation function,
<REPLACEABLE CLASS="PARAMETER">ffunc</REPLACEABLE>: <replaceable class="PARAMETER">ffunc</replaceable>:
<programlisting> <programlisting>
<REPLACEABLE CLASS="PARAMETER">ffunc</REPLACEABLE>(internal-state1, internal-state2) ---> aggregate-value <replaceable class="PARAMETER">ffunc</replaceable>(internal-state1, internal-state2) ---> aggregate-value
</programlisting> </programlisting>
</para> </para>
<para> <para>
<productname>Postgres</productname> creates up to two temporary variables <productname>Postgres</productname> creates up to two temporary variables
(referred to here as <REPLACEABLE CLASS="PARAMETER">temp1</REPLACEABLE> (referred to here as <replaceable class="PARAMETER">temp1</replaceable>
and <REPLACEABLE CLASS="PARAMETER">temp2</REPLACEABLE>) and <replaceable class="PARAMETER">temp2</replaceable>)
to hold intermediate results used as arguments to the transition functions. to hold intermediate results used as arguments to the transition functions.
</para> </para>
<para> <para>
@ -225,42 +206,42 @@ The initial value for the second transition function argument.
<listitem> <listitem>
<para> <para>
The arguments to The arguments to
<REPLACEABLE CLASS="PARAMETER">sfunc1</REPLACEABLE> <replaceable class="PARAMETER">sfunc1</replaceable>
must be must be
<REPLACEABLE CLASS="PARAMETER">temp1</REPLACEABLE> <replaceable class="PARAMETER">temp1</replaceable>
of type of type
<REPLACEABLE CLASS="PARAMETER">sfunc1_return_type</REPLACEABLE> <replaceable class="PARAMETER">sfunc1_return_type</replaceable>
and and
<REPLACEABLE CLASS="PARAMETER">column_value</REPLACEABLE> <replaceable class="PARAMETER">column_value</replaceable>
of type <REPLACEABLE CLASS="PARAMETER">data_type</REPLACEABLE>. of type <replaceable class="PARAMETER">data_type</replaceable>.
The return value must be of type The return value must be of type
<REPLACEABLE CLASS="PARAMETER">sfunc1_return_type</REPLACEABLE> <replaceable class="PARAMETER">sfunc1_return_type</replaceable>
and will be used as the first argument in the next call to and will be used as the first argument in the next call to
<REPLACEABLE CLASS="PARAMETER">sfunc1</REPLACEABLE>. <replaceable class="PARAMETER">sfunc1</replaceable>.
</para> </para>
</listitem> </listitem>
<listitem> <listitem>
<para> <para>
The argument and return value of The argument and return value of
<REPLACEABLE CLASS="PARAMETER">sfunc2</REPLACEABLE> <replaceable class="PARAMETER">sfunc2</replaceable>
must be must be
<REPLACEABLE CLASS="PARAMETER">temp2</REPLACEABLE> <replaceable class="PARAMETER">temp2</replaceable>
of type of type
<REPLACEABLE CLASS="PARAMETER">sfunc2_return_type</REPLACEABLE>. <replaceable class="PARAMETER">sfunc2_return_type</replaceable>.
</para> </para>
</listitem> </listitem>
<listitem> <listitem>
<para> <para>
The arguments to the final-calculation-function The arguments to the final-calculation-function
must be must be
<REPLACEABLE CLASS="PARAMETER">temp1</REPLACEABLE> <replaceable class="PARAMETER">temp1</replaceable>
and and
<REPLACEABLE CLASS="PARAMETER">temp2</REPLACEABLE> <replaceable class="PARAMETER">temp2</replaceable>
and its return value must and its return value must
be a <productname>Postgres</productname> be a <productname>Postgres</productname>
base type (not necessarily base type (not necessarily
<REPLACEABLE CLASS="PARAMETER">data_type</REPLACEABLE> <replaceable class="PARAMETER">data_type</replaceable>
which had been specified for BASETYPE). which had been specified for BASETYPE).
</para> </para>
</listitem> </listitem>
@ -269,10 +250,9 @@ The initial value for the second transition function argument.
FINALFUNC should be specified FINALFUNC should be specified
if and only if both state-transition functions are if and only if both state-transition functions are
specified. specified.
</para </para></listitem>
</listitem>
</itemizedlist> </itemizedlist>
</PARA> </para>
<para> <para>
An aggregate function may also require one or two initial conditions, An aggregate function may also require one or two initial conditions,
@ -281,13 +261,13 @@ The initial value for the second transition function argument.
in the database as fields of type <type>text</type>. in the database as fields of type <type>text</type>.
</para> </para>
<REFSECT2 ID="R2-SQL-CREATEAGGREGATE-3"> <refsect2 id="R2-SQL-CREATEAGGREGATE-3">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-09</DATE> <date>1998-09-09</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Notes Notes
</TITLE> </title>
<para> <para>
Use <command>DROP AGGREGATE</command> Use <command>DROP AGGREGATE</command>
to drop aggregate functions. to drop aggregate functions.
@ -307,46 +287,46 @@ The initial value for the second transition function argument.
defined, and any SFUNC2 must have a corresponding INITCOND2. defined, and any SFUNC2 must have a corresponding INITCOND2.
</para> </para>
</REFSECT2> </refsect2>
</refsect1> </refsect1>
<REFSECT1 ID="R1-SQL-CREATEAGGREGATE-2"> <refsect1 id="R1-SQL-CREATEAGGREGATE-2">
<TITLE> <title>
Usage Usage
</TITLE> </title>
<PARA> <para>
Refer to the chapter on aggregate functions Refer to the chapter on aggregate functions
in the <citetitle>PostgreSQL Programmer's Guide</citetitle> in the <citetitle>PostgreSQL Programmer's Guide</citetitle>
on aggregate functions for on aggregate functions for
complete examples of usage. complete examples of usage.
</para> </para>
</REFSECT1> </refsect1>
<REFSECT1 ID="R1-SQL-CREATEAGGREGATE-3"> <refsect1 id="R1-SQL-CREATEAGGREGATE-3">
<TITLE> <title>
Compatibility Compatibility
</TITLE> </title>
<REFSECT2 ID="R2-SQL-CREATEAGGREGATE-4"> <refsect2 id="R2-SQL-CREATEAGGREGATE-4">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-09</DATE> <date>1998-09-09</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
SQL92 SQL92
</TITLE> </title>
<PARA> <para>
<command>CREATE AGGREGATE</command> <command>CREATE AGGREGATE</command>
is a <productname>Postgres</productname> language extension. is a <productname>Postgres</productname> language extension.
There is no <command>CREATE AGGREGATE</command> in SQL92. There is no <command>CREATE AGGREGATE</command> in SQL92.
</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
sgml-omittag:t sgml-omittag:nil
sgml-shorttag:t sgml-shorttag:t
sgml-minimize-attributes:nil sgml-minimize-attributes:nil
sgml-always-quote-attributes:t sgml-always-quote-attributes:t

View File

@ -1,154 +1,152 @@
<REFENTRY ID="SQL-CREATEDATABASE"> <refentry id="SQL-CREATEDATABASE">
<REFMETA> <refmeta>
<REFENTRYTITLE> <refentrytitle>
CREATE DATABASE CREATE DATABASE
</REFENTRYTITLE> </refentrytitle>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO> <refmiscinfo>SQL - Language Statements</refmiscinfo>
</REFMETA> </refmeta>
<REFNAMEDIV> <refnamediv>
<REFNAME> <refname>
CREATE DATABASE CREATE DATABASE
</REFNAME> </refname>
<REFPURPOSE> <refpurpose>
Creates a new database Creates a new database
</REFPURPOSE> </refpurpose>
</refnamediv> </refnamediv>
<REFSYNOPSISDIV> <refsynopsisdiv>
<REFSYNOPSISDIVINFO> <refsynopsisdivinfo>
<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">
<REFSECT2INFO> <refsect2info>
<DATE>1998-04-15</DATE> <date>1998-04-15</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Inputs Inputs
</TITLE> </title>
<PARA> <para>
<VARIABLELIST>
<VARLISTENTRY> <variablelist>
<TERM> <varlistentry>
<replaceable class="parameter">name</replaceable> <term><replaceable class="parameter">name</replaceable></term>
</TERM> <listitem>
<LISTITEM> <para>
<PARA>
The name of a database to create. The name of a database to create.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="parameter">dbpath</replaceable></term>
<replaceable class="parameter">dbpath</replaceable> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
An alternate location can be specified as either an An alternate location can be specified as either an
environment variable known to the backend server environment variable known to the backend server
(e.g. '<envar>PGDATA2</envar>') or as an absolute path name (e.g. '<envar>PGDATA2</envar>') or as an absolute path name
(e.g. '<filename>/usr/local/pgsql/data</filename>'). (e.g. '<filename>/usr/local/pgsql/data</filename>').
In either case, the location must be pre-configured In either case, the location must be pre-configured
by <command>initlocation</command>. by <command>initlocation</command>.
</PARA>
</LISTITEM>
</VARLISTENTRY>
</VARIABLELIST>
</para> </para>
</REFSECT2> </listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
<REFSECT2 ID="R2-SQL-CREATEDATABASE-2"> <refsect2 id="R2-SQL-CREATEDATABASE-2">
<REFSECT2INFO> <refsect2info>
<DATE>1998-04-15</DATE> <date>1998-04-15</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Outputs Outputs
</TITLE> </title>
<PARA> <para>
<VARIABLELIST> <variablelist>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
<ReturnValue>CREATEDB</ReturnValue> CREATEDB
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
Message returned if the command completes successfully. Message returned if the command completes successfully.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
<ReturnValue>WARN: createdb: database "<replaceable class="parameter">name</replaceable>" already exists.</ReturnValue> WARN: createdb: database "<replaceable class="parameter">name</replaceable>" already exists.
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
This occurs if <replaceable class="parameter">database</replaceable> specified already exists. This occurs if <replaceable class="parameter">database</replaceable> specified already exists.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
<ReturnValue>ERROR: Unable to create database directory <replaceable class="parameter">directory</replaceable> ERROR: Unable to create database directory <replaceable class="parameter">directory</replaceable>
</ReturnValue> </computeroutput></term>
</TERM> <listitem>
<LISTITEM> <para>
<PARA>
There was a problem with creating the required directory; this operation will There was a problem with creating the required directory; this operation will
need permissions for the <literal>postgres</literal> user on the specified location. need permissions for the <literal>postgres</literal> user on the specified location.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</VARIABLELIST> </variablelist>
</para> </para>
</REFSECT2> </refsect2>
</REFSYNOPSISDIV> </refsynopsisdiv>
<REFSECT1 ID="R1-SQL-CREATEDATABASE-1"> <refsect1 id="R1-SQL-CREATEDATABASE-1">
<REFSECT1INFO> <refsect1info>
<DATE>1998-04-15</DATE> <date>1998-04-15</date>
</REFSECT1INFO> </refsect1info>
<TITLE> <title>
Description Description
</TITLE> </title>
<PARA> <para>
<command>CREATE DATABASE</command> creates a new Postgres database. <command>CREATE DATABASE</command> creates a new Postgres database.
The creator becomes the administrator of the new database. The creator becomes the administrator of the new database.
</PARA> </para>
<REFSECT2 ID="R2-SQL-CREATEDATABASE-3"> <refsect2 id="R2-SQL-CREATEDATABASE-3">
<REFSECT2INFO> <refsect2info>
<DATE>1998-04-15</DATE> <date>1998-04-15</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Notes Notes
</TITLE> </title>
<PARA> <para>
<command>CREATE DATABASE</command> is a <productname>Postgres</productname> <command>CREATE DATABASE</command> is a <productname>Postgres</productname>
language extension. language extension.
</PARA> </para>
<para> <para>
Use <command>DROP DATABASE</command> to remove a database. Use <command>DROP DATABASE</command> to remove a database.
</para> </para>
</REFSECT2> </refsect2>
</refsect1> </refsect1>
<REFSECT1 ID="R1-SQL-CREATEDATABASE-2"> <refsect1 id="R1-SQL-CREATEDATABASE-2">
<TITLE> <title>
Usage Usage
</TITLE> </title>
<PARA> <para>
To create a new database: To create a new database:
</PARA>
<ProgramListing> <programlisting>
<prompt>olly=></prompt> <userinput>create database lusiadas;</userinput> <prompt>olly=></prompt> <userinput>create database lusiadas;</userinput>
</ProgramListing> </programlisting>
<PARA> </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>
<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>
@ -164,21 +162,22 @@ CREATE DATABASE <REPLACEABLE CLASS="PARAMETER">name</REPLACEABLE> [ WITH LOCATIO
<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> </para>
</refsect1>
<REFSECT1 ID="R1-SQL-CREATEDATABASE-3"> <refsect1 id="R1-SQL-CREATEDATABASE-3">
<TITLE> <title>
Bugs Bugs
</TITLE> </title>
<PARA> <para>
There are security and data integrity issues There are security and data integrity issues
involved with using alternate database locations involved with using alternate database locations
specified with absolute path names, and by default specified with absolute path names, and by default
only an environment variable known to the backend may be only an environment variable known to the backend may be
specified for an alternate location. specified for an alternate location.
See the Administrator's Guide for more information. See the Administrator's Guide for more information.
</PARA> </para>
</refsect1> </refsect1>
<!-- <!--
@ -192,33 +191,32 @@ Hmm. This isn't an issue since the upgrade would do a dump/reload from the main
Not sure if the dump/reload would guarantee that the alternate data area gets refreshed though... Not sure if the dump/reload would guarantee that the alternate data area gets refreshed though...
--> -->
<REFSECT1 ID="R1-SQL-CREATEDATABASE-4"> <refsect1 id="R1-SQL-CREATEDATABASE-4">
<TITLE> <title>
Compatibility Compatibility
</TITLE> </title>
<REFSECT2 ID="R2-SQL-CREATEDATABASE-4"> <refsect2 id="R2-SQL-CREATEDATABASE-4">
<REFSECT2INFO> <refsect2info>
<DATE>1998-04-15</DATE> <date>1998-04-15</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
SQL92 SQL92
</TITLE> </title>
<PARA> <para>
There is no <command>CREATE DATABASE</command> statement in 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>.
</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
sgml-omittag:t sgml-omittag:nil
sgml-shorttag:t sgml-shorttag:t
sgml-minimize-attributes:nil sgml-minimize-attributes:nil
sgml-always-quote-attributes:t sgml-always-quote-attributes:t

View File

@ -32,11 +32,10 @@ CREATE FUNCTION <replaceable class="parameter">name</replaceable> ( [ <replaceab
Inputs Inputs
</title> </title>
<para> <para>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term><replaceable class="parameter">name</replaceable></term>
<replaceable class="parameter">name</replaceable>
</term>
<listitem> <listitem>
<para> <para>
The name of a function to create. The name of a function to create.
@ -44,9 +43,7 @@ CREATE FUNCTION <replaceable class="parameter">name</replaceable> ( [ <replaceab
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><replaceable class="parameter">ftype</replaceable></term>
<replaceable class="parameter">ftype</replaceable>
</term>
<listitem> <listitem>
<para> <para>
The data type of function arguments. The data type of function arguments.
@ -54,9 +51,7 @@ CREATE FUNCTION <replaceable class="parameter">name</replaceable> ( [ <replaceab
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><replaceable class="parameter">rtype</replaceable></term>
<replaceable class="parameter">rtype</replaceable>
</term>
<listitem> <listitem>
<para> <para>
The return data type. The return data type.
@ -64,9 +59,7 @@ CREATE FUNCTION <replaceable class="parameter">name</replaceable> ( [ <replaceab
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><replaceable class="parameter">definition</replaceable></term>
<replaceable class="parameter">definition</replaceable>
</term>
<listitem> <listitem>
<para> <para>
A string defining the function; the meaning depends on the language. A string defining the function; the meaning depends on the language.
@ -76,9 +69,7 @@ CREATE FUNCTION <replaceable class="parameter">name</replaceable> ( [ <replaceab
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><replaceable class="parameter">langname</replaceable></term>
<replaceable class="parameter">langname</replaceable>
</term>
<listitem> <listitem>
<para> <para>
may be '<literal>C</literal>', '<literal>sql</literal>', may be '<literal>C</literal>', '<literal>sql</literal>',
@ -105,9 +96,9 @@ CREATE FUNCTION <replaceable class="parameter">name</replaceable> ( [ <replaceab
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term><computeroutput>
<returnvalue>CREATE</returnvalue> CREATE
</term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
This is returned if the command completes successfully. This is returned if the command completes successfully.
@ -188,12 +179,11 @@ in the <citetitle>PostgreSQL Programmer's Guide</citetitle>
</title> </title>
<para> <para>
To create a simple SQL function: To create a simple SQL function:
</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> <computeroutput>
@ -202,6 +192,8 @@ in the <citetitle>PostgreSQL Programmer's Guide</citetitle>
1 1
</computeroutput> </computeroutput>
</programlisting> </programlisting>
</para>
<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
shared library. This particular routine calculates a check shared library. This particular routine calculates a check
@ -264,14 +256,13 @@ has not yet happened, but it is hoped that PSM will
SQL/PSM <command>CREATE FUNCTION</command> has the following syntax: SQL/PSM <command>CREATE FUNCTION</command> has the following syntax:
<synopsis> <synopsis>
CREATE FUNCTION <replaceable class="parameter">name</replaceable> CREATE FUNCTION <replaceable class="parameter">name</replaceable>
( [ [ IN | OUT | INOUT ] <replaceable class="parameter">eter</replaceable>eable> <replaceable ( [ [ IN | OUT | INOUT ] <replaceable class="parameter">eter</replaceable>eable>eable> <replaceable
class="parameter">type</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> </synopsis>
</para> </para>
</refsect2> </refsect2>
</refsect1> </refsect1>

View File

@ -1,80 +1,73 @@
<REFENTRY ID="SQL-CREATEINDEX"> <refentry id="SQL-CREATEINDEX">
<REFMETA> <refmeta>
<REFENTRYTITLE> <refentrytitle>
CREATE INDEX CREATE INDEX
</REFENTRYTITLE> </refentrytitle>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO> <refmiscinfo>SQL - Language Statements</refmiscinfo>
</REFMETA> </refmeta>
<REFNAMEDIV> <refnamediv>
<REFNAME> <refname>
CREATE INDEX CREATE INDEX
</REFNAME> </refname>
<REFPURPOSE> <refpurpose>
Constructs a secondary index Constructs a secondary index
</REFPURPOSE> </refpurpose>
</refnamediv> </refnamediv>
<REFSYNOPSISDIV> <refsynopsisdiv>
<REFSYNOPSISDIVINFO> <refsynopsisdivinfo>
<DATE>1998-09-09</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">r">col</replaceable>le> [, ... ]) <replaceable class="parameter">ops_name</replaceable> )
</SYNOPSIS> </synopsis>
<REFSECT2 ID="R2-SQL-CREATEINDEX-1"> <refsect2 id="R2-SQL-CREATEINDEX-1">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-09</DATE> <date>1998-09-09</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Inputs Inputs
</TITLE> </title>
<PARA> <para>
<VARIABLELIST>
<VARLISTENTRY> <variablelist>
<TERM> <varlistentry>
UNIQUE <term>UNIQUE</term>
</TERM> <listitem>
<LISTITEM> <para>
<PARA>
Causes the system to check for Causes the system to check for
duplicate values in the table when the index is created (if data duplicate values in the table 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
error. error.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="parameter">index_name</replaceable></term>
<replaceable class="parameter">index_name</replaceable> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
The name of the index to be created. The name of the index to be created.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="parameter">table</replaceable></term>
<replaceable class="parameter">table</replaceable> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
The name of the table to be indexed. The name of the table to be indexed.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="parameter">acc_name</replaceable></term>
<replaceable class="parameter">acc_name</replaceable> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
the name of the access method which is to be used for the name of the access method which is to be used for
the index. The default access method is BTREE. the index. The default access method is BTREE.
Postgres provides three access methods for secondary indexes: Postgres provides three access methods for secondary indexes:
@ -105,25 +98,23 @@ CREATE [ UNIQUE ] INDEX <replaceable class="parameter">index_name</replaceable>
</listitem> </listitem>
</varlistentry> </varlistentry>
</variablelist> </variablelist>
</PARA>
</LISTITEM> </para>
</VARLISTENTRY> </listitem>
<VARLISTENTRY> </varlistentry>
<TERM>
<replaceable class="parameter">column</replaceable> <varlistentry>
</TERM> <term><replaceable class="parameter">column</replaceable></term>
<LISTITEM> <listitem>
<PARA> <para>
The name of a column of the table. The name of a column of the table.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="parameter">ops_name</replaceable></term>
<replaceable class="parameter">ops_name</replaceable> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
An associated operator class. An associated operator class.
The following select list returns all ops_names: The following select list returns all ops_names:
@ -138,69 +129,66 @@ SELECT am.amname AS acc_name,
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> <varlistentry>
<VARLISTENTRY> <term><replaceable class="parameter">func_name</replaceable></term>
<TERM> <listitem>
<replaceable class="parameter">func_name</replaceable> <para>
</TERM>
<LISTITEM>
<PARA>
A user-defined function, which returns a value that can A user-defined function, which returns a value that can
be indexed. be indexed.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
</variablelist> </variablelist>
</para> </para>
</REFSECT2> </refsect2>
<REFSECT2 ID="R2-SQL-CREATEINDEX-2"> <refsect2 id="R2-SQL-CREATEINDEX-2">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-09</DATE> <date>1998-09-09</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Outputs Outputs
</TITLE> </title>
<PARA> <para>
<VARIABLELIST> <variablelist>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
<ReturnValue>CREATE</ReturnValue> CREATE
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
The message returned if the index is successfully created. The message returned if the index is successfully created.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
<ReturnValue>ERROR: Cannot create index: 'index_name' already exists.</ReturnValue> ERROR: Cannot create index: 'index_name' already exists.
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
This error occurs if it is impossible to create the index. This error occurs if it is impossible to create the index.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</variablelist> </variablelist>
</para> </para>
</REFSECT2> </refsect2>
</REFSYNOPSISDIV> </refsynopsisdiv>
<REFSECT1 ID="R1-SQL-CREATEINDEX-1"> <refsect1 id="R1-SQL-CREATEINDEX-1">
<REFSECT1INFO> <refsect1info>
<DATE>1998-09-09</DATE> <date>1998-09-09</date>
</REFSECT1INFO> </refsect1info>
<TITLE> <title>
Description Description
</TITLE> </title>
<PARA> <para>
<command>CREATE INDEX</command> constructs an index <command>CREATE INDEX</command> constructs an index
<replaceable class="parameter">index_name</replaceable>. <replaceable class="parameter">index_name</replaceable>.
on the specified on the specified
@ -235,35 +223,35 @@ SELECT am.amname AS acc_name,
transformation to apply them to the base data. transformation to apply them to the base data.
</para> </para>
<REFSECT2 ID="R2-SQL-CREATEINDEX-3"> <refsect2 id="R2-SQL-CREATEINDEX-3">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-09</DATE> <date>1998-09-09</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Notes Notes
</TITLE> </title>
<PARA> <para>
Currently, only the BTREE access method supports multi-column Currently, only the BTREE access method supports multi-column
indexes. Up to 7 keys may be specified. indexes. Up to 7 keys may be specified.
</PARA> </para>
<para> <para>
Use <command>DROP INDEX</command> Use <command>DROP INDEX</command>
to remove an index. to remove an index.
</para> </para>
</REFSECT2> </refsect2>
</refsect1> </refsect1>
<REFSECT1 ID="R1-SQL-CREATEINDEX-2"> <refsect1 id="R1-SQL-CREATEINDEX-2">
<TITLE> <title>
Usage Usage
</TITLE> </title>
<PARA>To create a btree index on the field <literal>title</literal> <para>To create a btree index on the field <literal>title</literal>
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> <comment>
@ -282,37 +270,36 @@ SELECT * FROM points
</programlisting> </programlisting>
--> -->
</REFSECT1> </refsect1>
<REFSECT1 ID="R1-SQL-CREATEINDEX-3"> <refsect1 id="R1-SQL-CREATEINDEX-3">
<TITLE> <title>
Compatibility Compatibility
</TITLE> </title>
<PARA> <para>
</PARA> </para>
<REFSECT2 ID="R2-SQL-CREATEINDEX-4"> <refsect2 id="R2-SQL-CREATEINDEX-4">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-09</DATE> <date>1998-09-09</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
SQL92 SQL92
</TITLE> </title>
<PARA> <para>
CREATE INDEX is a <productname>Postgres</productname> language extension. CREATE INDEX is a <productname>Postgres</productname> language extension.
</PARA> </para>
<para> <para>
There is no <command>CREATE INDEX</command> command in SQL92. There is no <command>CREATE INDEX</command> command in SQL92.
</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
sgml-omittag:t sgml-omittag:nil
sgml-shorttag:t sgml-shorttag:t
sgml-minimize-attributes:nil sgml-minimize-attributes:nil
sgml-always-quote-attributes:t sgml-always-quote-attributes:t

View File

@ -1,43 +1,42 @@
<REFENTRY ID="SQL-CREATELANGUAGE"> <refentry id="SQL-CREATELANGUAGE">
<REFMETA> <refmeta>
<REFENTRYTITLE> <refentrytitle>
CREATE LANGUAGE CREATE LANGUAGE
</REFENTRYTITLE> </refentrytitle>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO> <refmiscinfo>SQL - Language Statements</refmiscinfo>
</REFMETA> </refmeta>
<REFNAMEDIV> <refnamediv>
<REFNAME> <refname>
CREATE LANGUAGE CREATE LANGUAGE
</REFNAME> </refname>
<REFPURPOSE> <refpurpose>
Defines a new language for functions Defines a new language for functions
</REFPURPOSE> </refpurpose>
</refnamediv> </refnamediv>
<REFSYNOPSISDIV> <refsynopsisdiv>
<REFSYNOPSISDIVINFO> <refsynopsisdivinfo>
<DATE>1998-09-09</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-09-09</DATE> <date>1998-09-09</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Inputs Inputs
</TITLE> </title>
<PARA> <para>
<VARIABLELIST>
<VARLISTENTRY> <variablelist>
<TERM> <varlistentry>
<function>TRUSTED</function> <term>TRUSTED</term>
</TERM> <listitem>
<LISTITEM> <para>
<PARA>
<function> TRUSTED</function> specifies that the call handler for <function> TRUSTED</function> specifies that the call handler for
the language is safe; that is, it offers an unprivileged user the language is safe; that is, it offers an unprivileged user
no functionality to bypass access restrictions. If no functionality to bypass access restrictions. If
@ -46,42 +45,36 @@ CREATE [ TRUSTED ] PROCEDURAL LANGUAGE '<replaceable class="parameter">langname<
superuser privilege can use superuser privilege can use
this language to create new functions this language to create new functions
(like the 'C' language). (like the 'C' language).
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="parameter">langname</replaceable></term>
<replaceable class="parameter">langname</replaceable> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
The name of the new procedural language. The name of the new procedural language.
The language name is case insensitive. A procedural The language name is case insensitive. A procedural
language cannot override one of the built-in languages of language cannot override one of the built-in languages of
<productname>Postgres</productname>. <productname>Postgres</productname>.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term>HANDLER <replaceable class="parameter">call_handler</replaceable></term>
HANDLER <replaceable class="parameter">call_handler</replaceable> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
<replaceable class="parameter">call_handler</replaceable> is the name <replaceable class="parameter">call_handler</replaceable> is the name
of a previously of a previously
registered function that will be called to execute the PL registered function that will be called to execute the PL
procedures. procedures.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="parameter">comment</replaceable></term>
<replaceable class="parameter">comment</replaceable> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
The <function>LANCOMPILER</function> argument is the The <function>LANCOMPILER</function> argument is the
string that will be string that will be
inserted in the <literal>LANCOMPILER</literal> attribute inserted in the <literal>LANCOMPILER</literal> attribute
@ -89,59 +82,60 @@ superuser privilege can use
<filename>pg_language</filename> entry. At present, <filename>pg_language</filename> entry. At present,
<productname>Postgres</productname> does not use <productname>Postgres</productname> does not use
this attribute in any way. this attribute in any way.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
</variablelist> </variablelist>
</para> </para>
</REFSECT2> </refsect2>
<REFSECT2 ID="R2-SQL-CREATELANGUAGE-2"> <refsect2 id="R2-SQL-CREATELANGUAGE-2">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-09</DATE> <date>1998-09-09</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Outputs Outputs
</TITLE> </title>
<PARA> <para>
<VARIABLELIST>
<VARLISTENTRY> <variablelist>
<TERM> <varlistentry>
<ReturnValue>CREATE</ReturnValue> <term><computeroutput>
</TERM> CREATE
<LISTITEM> </computeroutput></term>
<PARA> <listitem>
<para>
This message is returned if the language is successfully This message is returned if the language is successfully
created. created.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
<ReturnValue>ERROR: PL handler function <replaceable class="parameter">funcname</replaceable>() doesn't exist</ReturnValue> ERROR: PL handler function <replaceable class="parameter">funcname</replaceable>() doesn't exist
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
This error is returned if the function This error is returned if the function
<replaceable class="parameter">funcname</replaceable>() <replaceable class="parameter">funcname</replaceable>()
is not found. is not found.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</VARIABLELIST> </variablelist>
</para> </para>
</REFSECT2> </refsect2>
</REFSYNOPSISDIV> </refsynopsisdiv>
<REFSECT1 ID="R1-SQL-CREATELANGUAGE-1"> <refsect1 id="R1-SQL-CREATELANGUAGE-1">
<REFSECT1INFO> <refsect1info>
<DATE>1998-09-09</DATE> <date>1998-09-09</date>
</REFSECT1INFO> </refsect1info>
<TITLE> <title>
Description Description
</TITLE> </title>
<PARA> <para>
Using <command>CREATE LANGUAGE</command>, a Using <command>CREATE LANGUAGE</command>, a
<productname>Postgres</productname> user can register <productname>Postgres</productname> user can register
a new language with <productname>Postgres</productname>. a new language with <productname>Postgres</productname>.
@ -150,16 +144,16 @@ Subsequently, functions and
The user must have the <productname>Postgres</productname> The user must have the <productname>Postgres</productname>
superuser privilege to 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-09-09</DATE> <date>1998-09-09</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Writing PL handlers Writing PL handlers
</TITLE> </title>
<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
<productname>Postgres</productname> as a function taking <productname>Postgres</productname> as a function taking
@ -196,7 +190,7 @@ Subsequently, functions and
</para> </para>
</listitem> </listitem>
</itemizedlist> </itemizedlist>
</PARA> </para>
<para> <para>
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
@ -213,14 +207,14 @@ Subsequently, functions and
</para> </para>
</refsect2> </refsect2>
<REFSECT2 ID="R2-SQL-CREATELANGUAGE-4"> <refsect2 id="R2-SQL-CREATELANGUAGE-4">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-09</DATE> <date>1998-09-09</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Notes Notes
</TITLE> </title>
<PARA> <para>
Use <command>CREATE FUNCTION</command> Use <command>CREATE FUNCTION</command>
to create a function. to create a function.
</para> </para>
@ -253,35 +247,34 @@ sql |postgres
</refsect2> </refsect2>
</refsect1> </refsect1>
<REFSECT1 ID="R1-SQL-CREATELANGUAGE-4"> <refsect1 id="R1-SQL-CREATELANGUAGE-4">
<TITLE> <title>
Restrictions Restrictions
</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 <productname>Postgres</productname> in the 'C' language, registered with <productname>Postgres</productname> in the 'C' language,
it inherits it inherits
all the capabilities and restrictions of 'C' functions. all the capabilities and restrictions of 'C' functions.
</para> </para>
</refsect1> </refsect1>
<REFSECT1 ID="R1-SQL-CREATELANGUAGE-5"> <refsect1 id="R1-SQL-CREATELANGUAGE-5">
<TITLE> <title>
Bugs Bugs
</TITLE> </title>
<PARA> <para>
At present, the definitions for a procedural language cannot be At present, the definitions for a procedural language cannot be
changed once they have been created. changed once they have been created.
</para> </para>
</refsect1> </refsect1>
<REFSECT1 ID="R1-SQL-CREATELANGUAGE-6"> <refsect1 id="R1-SQL-CREATELANGUAGE-6">
<TITLE> <title>
Usage Usage
</TITLE> </title>
<PARA> <para>
This is a template for a PL handler written in 'C': This is a template for a PL handler written in 'C':
</PARA> <programlisting>
<ProgramListing>
#include "executor/spi.h" #include "executor/spi.h"
#include "commands/trigger.h" #include "commands/trigger.h"
#include "utils/elog.h" #include "utils/elog.h"
@ -320,13 +313,15 @@ sql |postgres
*isNull = false; *isNull = false;
return retval; return retval;
} }
</ProgramListing> </programlisting>
</para>
<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. of the dots to complete the PL call handler.
See <command>CREATE FUNCTION</command> for information on how to compile See <command>CREATE FUNCTION</command> 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: language:
@ -334,42 +329,40 @@ See <command>CREATE FUNCTION</command> for information on how to compile
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>
</para> </para>
</REFSECT1> </refsect1>
<REFSECT1 ID="R1-SQL-CREATELANGUAGE-7"> <refsect1 id="R1-SQL-CREATELANGUAGE-7">
<TITLE> <title>
Compatibility Compatibility
</TITLE> </title>
<PARA> <para>
CREATE LANGUAGE is a <productname>Postgres</productname> 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-09-09</DATE> <date>1998-09-09</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
SQL92 SQL92
</TITLE> </title>
<PARA> <para>
There is no <command>CREATE LANGUAGE</command> statement in There is no <command>CREATE LANGUAGE</command> statement in
<acronym>SQL92</acronym>. <acronym>SQL92</acronym>.
</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
sgml-omittag:t sgml-omittag:nil
sgml-shorttag:t sgml-shorttag:t
sgml-minimize-attributes:nil sgml-minimize-attributes:nil
sgml-always-quote-attributes:t sgml-always-quote-attributes:t

View File

@ -1,23 +1,23 @@
<REFENTRY ID="SQL-CREATEOPERATOR"> <refentry id="SQL-CREATEOPERATOR">
<REFMETA> <refmeta>
<REFENTRYTITLE> <refentrytitle>
CREATE OPERATOR CREATE OPERATOR
</REFENTRYTITLE> </refentrytitle>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO> <refmiscinfo>SQL - Language Statements</refmiscinfo>
</REFMETA> </refmeta>
<REFNAMEDIV> <refnamediv>
<REFNAME> <refname>
CREATE OPERATOR CREATE OPERATOR
</REFNAME> </refname>
<REFPURPOSE> <refpurpose>
Defines a new user operator Defines a new user operator
</REFPURPOSE> </refpurpose>
</refnamediv> </refnamediv>
<REFSYNOPSISDIV> <refsynopsisdiv>
<REFSYNOPSISDIVINFO> <refsynopsisdivinfo>
<DATE>1999-04-14</DATE> <date>1999-04-14</date>
</REFSYNOPSISDIVINFO> </refsynopsisdivinfo>
<SYNOPSIS> <synopsis>
CREATE OPERATOR <replaceable>name</replaceable> ( CREATE OPERATOR <replaceable>name</replaceable> (
PROCEDURE = <replaceable class="parameter">func_name</replaceable> PROCEDURE = <replaceable class="parameter">func_name</replaceable>
[, LEFTARG = <replaceable class="parameter">type1</replaceable> ] [, LEFTARG = <replaceable class="parameter">type1</replaceable> ]
@ -30,166 +30,144 @@ CREATE OPERATOR <replaceable>name</replaceable> (
[, SORT1 = <replaceable class="parameter">left_sort_op</replaceable> ] [, SORT1 = <replaceable class="parameter">left_sort_op</replaceable> ]
[, SORT2 = <replaceable class="parameter">right_sort_op</replaceable> ] [, SORT2 = <replaceable class="parameter">right_sort_op</replaceable> ]
) )
</SYNOPSIS> </synopsis>
<REFSECT2 ID="R2-SQL-CREATEOPERATOR-1"> <refsect2 id="R2-SQL-CREATEOPERATOR-1">
<REFSECT2INFO> <refsect2info>
<DATE>1999-04-14</DATE> <date>1999-04-14</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Inputs Inputs
</TITLE> </title>
<PARA> <para>
</PARA>
<VARIABLELIST> <variablelist>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="parameter">name</replaceable></term>
<replaceable class="parameter">name</replaceable> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
The operator to be defined. See below for allowable characters. The operator to be defined. See below for allowable characters.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="parameter">func_name</replaceable></term>
<replaceable class="parameter">func_name</replaceable> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
The function used to implement this operator. The function used to implement this operator.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="parameter">type1</replaceable></term>
<replaceable class="parameter">type1</replaceable> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
The type for the left-hand side of the operator, if any. This option would be The type for the left-hand side of the operator, if any. This option would be
omitted for a right-unary operator. omitted for a right-unary operator.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="parameter">type2</replaceable></term>
<replaceable class="parameter">type2</replaceable> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
The type for the right-hand side of the operator, if any. This option would be The type for the right-hand side of the operator, if any. This option would be
omitted for a left-unary operator. omitted for a left-unary operator.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="parameter">com_op</replaceable></term>
<replaceable class="parameter">com_op</replaceable> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
The commutator for this operator. The commutator for this operator.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="parameter">neg_op</replaceable></term>
<replaceable class="parameter">neg_op</replaceable> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
The negator of this operator. The negator of this operator.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="parameter">res_proc</replaceable></term>
<replaceable class="parameter">res_proc</replaceable> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
The restriction selectivity estimator function for this operator. The restriction selectivity estimator function for this operator.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="parameter">join_proc</replaceable></term>
<replaceable class="parameter">join_proc</replaceable> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
The join selectivity estimator function for this operator. The join selectivity estimator function for this operator.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term>HASHES</term>
HASHES <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
Indicates this operator can support a hash-join algorithm. Indicates this operator can support a hash-join algorithm.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="parameter">left_sort_op</replaceable></term>
<replaceable class="parameter">left_sort_op</replaceable> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
Operator that sorts the left-hand data type of this operator. Operator that sorts the left-hand data type of this operator.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="parameter">right_sort_op</replaceable></term>
<replaceable class="parameter">right_sort_op</replaceable> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
Operator that sorts the right-hand data type of this operator. Operator that sorts the right-hand data type of this operator.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
</variablelist> </variablelist>
</para>
</refsect2>
</REFSECT2> <refsect2 id="R2-SQL-CREATEOPERATOR-2">
<refsect2info>
<REFSECT2 ID="R2-SQL-CREATEOPERATOR-2"> <date>1999-04-14</date>
<REFSECT2INFO> </refsect2info>
<DATE>1999-04-14</DATE> <title>
</REFSECT2INFO>
<TITLE>
Outputs Outputs
</TITLE> </title>
<PARA> <para>
<VARIABLELIST> <variablelist>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
<ReturnValue>CREATE</ReturnValue> CREATE
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
Message returned if the operator is successfully created. Message returned if the operator is successfully created.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</VARIABLELIST> </variablelist>
</para> </para>
</REFSECT2> </refsect2>
</REFSYNOPSISDIV> </refsynopsisdiv>
<REFSECT1 ID="R1-SQL-CREATEOPERATOR-1"> <refsect1 id="R1-SQL-CREATEOPERATOR-1">
<REFSECT1INFO> <refsect1info>
<DATE>1999-04-14</DATE> <date>1999-04-14</date>
</REFSECT1INFO> </refsect1info>
<TITLE> <title>
Description Description
</TITLE> </title>
<PARA> <para>
<command>CREATE OPERATOR</command> defines a new operator, <command>CREATE OPERATOR</command> defines a new operator,
<replaceable class="parameter">name</replaceable>. <replaceable class="parameter">name</replaceable>.
The user who defines an operator becomes its owner. The user who defines an operator becomes its owner.
@ -234,12 +212,16 @@ Operator that sorts the right-hand data type of this operator.
would probably have a commutator would probably have a commutator
operator, area-greater-than, &gt;&gt;&gt;. operator, area-greater-than, &gt;&gt;&gt;.
Hence, the query optimizer could freely convert: Hence, the query optimizer could freely convert:
<programlisting> <programlisting>
"0,0,1,1"::box &gt;&gt;&gt; MYBOXES.description "0,0,1,1"::box &gt;&gt;&gt; MYBOXES.description
</programlisting> </programlisting>
to to
<programlisting> <programlisting>
MYBOXES.description &lt;&lt;&lt; "0,0,1,1"::box</programlisting> MYBOXES.description &lt;&lt;&lt; "0,0,1,1"::box
</programlisting>
</para> </para>
<para> <para>
This allows the execution code to always use the latter This allows the execution code to always use the latter
@ -326,7 +308,7 @@ Operator that sorts the right-hand data type of this operator.
satisfy the clause. The function satisfy the clause. The function
<replaceable class="parameter">res_proc</replaceable> <replaceable class="parameter">res_proc</replaceable>
must be a registered function (meaning it is already defined using must be a registered function (meaning it is already defined using
CREATE FUNCTION) which accepts arguments of the correct <command>CREATE FUNCTION</command>) which accepts arguments of the correct
data types and returns a floating point number. The data types and returns a floating point number. The
query optimizer simply calls this function, passing the query optimizer simply calls this function, passing the
parameter "0,0,1,1" and multiplies the result by the relation parameter "0,0,1,1" and multiplies the result by the relation
@ -356,33 +338,33 @@ Operator that sorts the right-hand data type of this operator.
optimize functions, and they are performed by brute force. optimize functions, and they are performed by brute force.
Moreover, functions can have any number of arguments while Moreover, functions can have any number of arguments while
operators are restricted to one or two. operators are restricted to one or two.
</PARA> </para>
<REFSECT2 ID="R2-SQL-CREATEOPERATOR-3"> <refsect2 id="R2-SQL-CREATEOPERATOR-3">
<REFSECT2INFO> <refsect2info>
<DATE>1999-04-14</DATE> <date>1999-04-14</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Notes Notes
</TITLE> </title>
<PARA> <para>
Refer to the chapter on operators in the Refer to the chapter on operators in the
<citetitle>PostgreSQL User's Guide</citetitle> <citetitle>PostgreSQL User's Guide</citetitle>
for further information. for further information.
Refer to <command>DROP OPERATOR</command> to delete Refer to <command>DROP OPERATOR</command> to delete
user-defined operators from a database. user-defined operators from a database.
</para> </para>
</REFSECT2> </refsect2>
</refsect1> </refsect1>
<REFSECT1 ID="R1-SQL-CREATEOPERATOR-2"> <refsect1 id="R1-SQL-CREATEOPERATOR-2">
<TITLE> <title>
Usage Usage
</TITLE> </title>
<PARA>The following command defines a new operator, <para>The following command defines a new operator,
area-equality, for the BOX data type. area-equality, for the BOX data type.
</PARA> </para>
<ProgramListing> <programlisting>
CREATE OPERATOR === ( CREATE OPERATOR === (
LEFTARG = box, LEFTARG = box,
RIGHTARG = box, RIGHTARG = box,
@ -393,36 +375,37 @@ Operator that sorts the right-hand data type of this operator.
JOIN = area_join_procedure, JOIN = area_join_procedure,
HASHES, HASHES,
SORT1 = <<<, SORT1 = <<<,
SORT2 = <<<) SORT2 = <<<
</ProgramListing> );
</REFSECT1> </programlisting>
</refsect1>
<REFSECT1 ID="R1-SQL-CREATEOPERATOR-3"> <refsect1 id="R1-SQL-CREATEOPERATOR-3">
<TITLE> <title>
Compatibility Compatibility
</TITLE> </title>
<PARA> <para>
CREATE OPERATOR is a <productname>Postgres</productname> extension. CREATE OPERATOR is a <productname>Postgres</productname> extension.
</PARA> </para>
<REFSECT2 ID="R2-SQL-CREATEOPERATOR-4"> <refsect2 id="R2-SQL-CREATEOPERATOR-4">
<REFSECT2INFO> <refsect2info>
<DATE>1999-04-14</DATE> <date>1999-04-14</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
SQL92 SQL92
</TITLE> </title>
<PARA> <para>
There is no CREATE OPERATOR statement in <acronym>SQL92</acronym>. There is no CREATE OPERATOR statement in <acronym>SQL92</acronym>.
</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
sgml-omittag:t sgml-omittag:nil
sgml-shorttag:t sgml-shorttag:t
sgml-minimize-attributes:nil sgml-minimize-attributes:nil
sgml-always-quote-attributes:t sgml-always-quote-attributes:t

View File

@ -1,132 +1,123 @@
<REFENTRY ID="SQL-CREATERULE"> <refentry id="SQL-CREATERULE">
<REFMETA> <refmeta>
<REFENTRYTITLE> <refentrytitle>
CREATE RULE CREATE RULE
</REFENTRYTITLE> </refentrytitle>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO> <refmiscinfo>SQL - Language Statements</refmiscinfo>
</REFMETA> </refmeta>
<REFNAMEDIV> <refnamediv>
<REFNAME> <refname>
CREATE RULE CREATE RULE
</REFNAME> </refname>
<REFPURPOSE> <refpurpose>
Defines a new rule Defines a new rule
</REFPURPOSE> </refpurpose>
</refnamediv> </refnamediv>
<REFSYNOPSISDIV> <refsynopsisdiv>
<REFSYNOPSISDIVINFO> <refsynopsisdivinfo>
<DATE>1998-09-11</DATE> <date>1998-09-11</date>
</REFSYNOPSISDIVINFO> </refsynopsisdivinfo>
<SYNOPSIS> <synopsis>
CREATE RULE <replaceable class="parameter">name</replaceable> CREATE RULE <replaceable class="parameter">name</replaceable> AS ON <replaceable class="parameter">event</replaceable>
AS ON <replaceable class="parameter">event</replaceable>
TO <replaceable class="parameter">object</replaceable> [ WHERE <replaceable class="parameter">condition</replaceable> ] TO <replaceable class="parameter">object</replaceable> [ WHERE <replaceable class="parameter">condition</replaceable> ]
DO [ INSTEAD ] [ <replaceable class="parameter">action</replaceable> | NOTHING ] DO [ INSTEAD ] [ <replaceable class="parameter">action</replaceable> | NOTHING ]
</SYNOPSIS> </synopsis>
<REFSECT2 ID="R2-SQL-CREATERULE-1"> <refsect2 id="R2-SQL-CREATERULE-1">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-11</DATE> <date>1998-09-11</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Inputs Inputs
</TITLE> </title>
<PARA> <para>
</PARA>
<VARIABLELIST> <variablelist>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="parameter">name</replaceable></term>
<replaceable class="parameter">name</replaceable> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
The name of a rule to create. The name of a rule to create.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="parameter">event</replaceable></term>
<replaceable class="parameter">event</replaceable> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
Event is one of <literal>select</literal>, Event is one of <literal>select</literal>,
<literal>update</literal>, <literal>delete</literal> <literal>update</literal>, <literal>delete</literal>
or <literal>insert</literal>. or <literal>insert</literal>.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="parameter">object</replaceable></term>
<replaceable class="parameter">object</replaceable> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
Object is either <replaceable class="parameter">table</replaceable> Object is either <replaceable class="parameter">table</replaceable>
or <replaceable class="parameter">table</replaceable>.<replaceable class="parameter">column</replaceable>. or <replaceable class="parameter">table</replaceable>.<replaceable
</PARA> class="parameter">column</replaceable>.
</LISTITEM> </para>
</VARLISTENTRY> </listitem>
<VARLISTENTRY> </varlistentry>
<TERM> <varlistentry>
<replaceable class="parameter">condition</replaceable> <term><replaceable class="parameter">condition</replaceable></term>
</TERM> <listitem>
<LISTITEM> <para>
<PARA>
Any SQL WHERE clause. <literal>new</literal> or Any SQL WHERE clause. <literal>new</literal> or
<literal>current</literal> can appear instead of an instance <literal>current</literal> can appear instead of an instance
variable whenever an instance variable is permissible in SQL. variable whenever an instance variable is permissible in SQL.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="parameter">action</replaceable></term>
<replaceable class="parameter">action</replaceable> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
Any SQL statement. <literal>new</literal> or Any SQL statement. <literal>new</literal> or
<literal>current</literal> can appear instead of an instance <literal>current</literal> can appear instead of an instance
variable whenever an instance variable is permissible in SQL. variable whenever an instance variable is permissible in SQL.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
</VARIABLELIST> </variablelist>
</para>
</refsect2>
</REFSECT2> <refsect2 id="R2-SQL-CREATERULE-2">
<refsect2info>
<REFSECT2 ID="R2-SQL-CREATERULE-2"> <date>1998-09-11</date>
<REFSECT2INFO> </refsect2info>
<DATE>1998-09-11</DATE> <title>
</REFSECT2INFO>
<TITLE>
Outputs Outputs
</TITLE> </title>
<PARA> <para>
<VARIABLELIST>
<VARLISTENTRY> <variablelist>
<TERM> <varlistentry>
<ReturnValue>CREATE</ReturnValue> <term><computeroutput>
</TERM> CREATE
<LISTITEM> </computeroutput></term>
<PARA> <listitem>
<para>
Message returned if the rule is successfully created. Message returned if the rule is successfully created.
</para> </para>
</listitem> </listitem>
</VARLISTENTRY> </varlistentry>
</VARIABLELIST> </variablelist>
</para> </para>
</REFSECT2> </refsect2>
</REFSYNOPSISDIV> </refsynopsisdiv>
<REFSECT1 ID="R1-SQL-CREATERULE-1"> <refsect1 id="R1-SQL-CREATERULE-1">
<REFSECT1INFO> <refsect1info>
<DATE>1998-09-11</DATE> <date>1998-09-11</date>
</REFSECT1INFO> </refsect1info>
<TITLE> <title>
Description Description
</TITLE> </title>
<PARA> <para>
The semantics of a rule is that at the time an individual instance is The semantics of a rule is that at the time an individual instance is
accessed, updated, inserted or deleted, there is a current instance (for accessed, updated, inserted or deleted, there is a current instance (for
retrieves, updates and deletes) and a new instance (for updates and retrieves, updates and deletes) and a new instance (for updates and
@ -146,13 +137,13 @@ CREATE RULE <replaceable class="parameter">name</replaceable>
command that caused activation. command that caused activation.
</para> </para>
<REFSECT2 ID="R2-SQL-CREATERULE-3"> <refsect2 id="R2-SQL-CREATERULE-3">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-11</DATE> <date>1998-09-11</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Notes Notes
</TITLE> </title>
<para> <para>
A caution about SQL rules is in order. If the same class name A caution about SQL rules is in order. If the same class name
or instance variable appears in the or instance variable appears in the
@ -164,12 +155,15 @@ CREATE RULE <replaceable class="parameter">name</replaceable>
variables that are shared between these clauses. For example, the following variables that are shared between these clauses. For example, the following
two rules have the same semantics: two rules have the same semantics:
<programlisting> <programlisting>
on update to EMP.salary where EMP.name = "Joe" ON UPDATE TO emp.salary WHERE emp.name = "Joe"
do update EMP ( ... ) where ... DO UPDATE emp ( ... ) WHERE ...
on update to EMP-1.salary where EMP-2.name = "Joe"
do update EMP-3 ( ... ) where ...
</programlisting> </programlisting>
<programlisting>
ON UPDATE TO emp-1.salary WHERE emp-2.name = "Joe"
DO UPDATE emp-3 ( ... ) WHERE ...
</programlisting>
Each rule can have the optional tag INSTEAD. Each rule can have the optional tag INSTEAD.
Without Without
this tag, <replaceable class="parameter">action</replaceable> will be this tag, <replaceable class="parameter">action</replaceable> will be
@ -180,7 +174,7 @@ Without
<replaceable class="parameter">action</replaceable> part will be done <replaceable class="parameter">action</replaceable> part will be done
instead of the user command. In this later case, the instead of the user command. In this later case, the
<replaceable class="parameter">action</replaceable> can be the keyword <replaceable class="parameter">action</replaceable> can be the keyword
NOTHING. <literal>NOTHING</literal>.
</para> </para>
<para> <para>
When choosing between the rewrite and instance rule systems for a When choosing between the rewrite and instance rule systems for a
@ -198,19 +192,21 @@ Without
<example> <example>
<title>Example of a circular rewrite rule combination.</title> <title>Example of a circular rewrite rule combination.</title>
<programlisting> <programlisting>
create rule bad_rule_combination_1 as CREATE RULE bad_rule_combination_1 AS
on select to EMP ON SELECT TO emp
do instead select to TOYEMP DO INSTEAD SELECT TO toyemp;
</programlisting>
create rule bad_rule_combination_2 as <programlisting>
on select to TOYEMP CREATE RULE bad_rule_combination_2 AS
do instead select to EMP ON SELECT TO toyemp
DO INSTEAD SELECT TO emp;
</programlisting> </programlisting>
<para> <para>
This attempt to retrieve from EMP will cause This attempt to retrieve from EMP will cause
<productname>Postgres</productname> to crash. <productname>Postgres</productname> to crash.
<programlisting> <programlisting>
select * from EMP SELECT * FROM emp;
</programlisting></para> </programlisting></para>
</example> </example>
@ -219,23 +215,22 @@ select * from EMP
You must have rule definition access to a class in order You must have rule definition access to a class in order
to define a rule on it. Use <command>GRANT</command> to define a rule on it. Use <command>GRANT</command>
and <command>REVOKE</command> to change permissions. and <command>REVOKE</command> to change permissions.
</para>
</PARA> </refsect2>
</REFSECT2>
</refsect1> </refsect1>
<REFSECT1 ID="R1-SQL-CREATERULE-2"> <refsect1 id="R1-SQL-CREATERULE-2">
<TITLE> <title>
Usage Usage
</TITLE> </title>
<PARA> <para>
Make Sam get the same salary adjustment as Joe: Make Sam get the same salary adjustment as Joe:
<programlisting> <programlisting>
create rule example_1 as CREATE RULE example_1 AS
on update EMP.salary where current.name = "Joe" ON UPDATE emp.salary WHERE current.name = "Joe"
do update EMP (salary = new.salary) DO UPDATE emp (salary = new.salary)
where EMP.name = "Sam" WHERE emp.name = "Sam";
</programlisting> </programlisting>
At the time Joe receives a salary adjustment, the event At the time Joe receives a salary adjustment, the event
@ -248,12 +243,12 @@ create rule example_1 as
<para> <para>
Make Bill get Joe's salary when it is accessed: Make Bill get Joe's salary when it is accessed:
<programlisting> <programlisting>
create rule example_2 as CREATE RULE example_2 AS
on select to EMP.salary ON SELECT TO EMP.salary
where current.name = "Bill" WHERE current.name = "Bill"
do instead DO INSTEAD
select (EMP.salary) from EMP SELECT (emp.salary) from emp
where EMP.name = "Joe" WHERE emp.name = "Joe";
</programlisting> </programlisting>
</para> </para>
<para> <para>
@ -261,40 +256,40 @@ create rule example_2 as
department (<function>current_user</function> returns the name of department (<function>current_user</function> returns the name of
the current user): the current user):
<programlisting> <programlisting>
create rule example_3 as CREATE RULE example_3 AS
on select to EMP.salary ON SELECT TO emp.salary
where current.dept = "shoe" and current_user = "Joe" WHERE current.dept = "shoe" AND current_user = "Joe"
do instead nothing DO INSTEAD NOTHING;
</programlisting> </programlisting>
</para> </para>
<para> <para>
Create a view of the employees working in the toy department. Create a view of the employees working in the toy department.
<programlisting> <programlisting>
create TOYEMP(name = char16, salary = int4) CREATE toyemp(name = char16, salary = int4);
create rule example_4 as CREATE RULE example_4 AS
on select to TOYEMP ON SELECT TO toyemp
do instead DO INSTEAD
select (EMP.name, EMP.salary) from EMP SELECT (emp.name, emp.salary) FROM emp
where EMP.dept = "toy" WHERE emp.dept = "toy";
</programlisting> </programlisting>
</para> </para>
<para> <para>
All new employees must make 5,000 or less All new employees must make 5,000 or less
<programlisting> <programlisting>
create rule example_5 as CREATE RULE example_5 AS
on insert to EMP where new.salary > 5000 ON INERT TO emp WHERE new.salary > 5000
do update newset salary = 5000 DO UPDATE NEWSET salary = 5000;
</programlisting> </programlisting>
</PARA> </para>
</REFSECT1> </refsect1>
<REFSECT1 ID="R1-SQL-CREATERULE-3"> <refsect1 id="R1-SQL-CREATERULE-3">
<TITLE> <title>
Bugs Bugs
</TITLE> </title>
<para> <para>
The object in a SQL rule cannot be an array reference and The object in a <acronym>SQL</acronym> rule cannot be an array reference and
cannot have parameters. cannot have parameters.
</para> </para>
<para> <para>
@ -308,36 +303,36 @@ create rule example_5 as
text attributes. This implies that creation of rules may text attributes. This implies that creation of rules may
fail if the rule plus its various internal representations fail if the rule plus its various internal representations
exceed some value that is on the order of one page (8KB). exceed some value that is on the order of one page (8KB).
</PARA> </para>
</refsect1> </refsect1>
<REFSECT1 ID="R1-SQL-CREATERULE-4"> <refsect1 id="R1-SQL-CREATERULE-4">
<TITLE> <title>
Compatibility Compatibility
</TITLE> </title>
<PARA>
CREATE RULE statement is a <productname>Postgres</productname>
language extension.
</PARA>
<REFSECT2 ID="R2-SQL-CREATERULE-4">
<REFSECT2INFO>
<DATE>1998-09-11</DATE>
</REFSECT2INFO>
<TITLE>
SQL92
</TITLE>
<para> <para>
There is no CREATE RULE statement in <acronym>SQL92</acronym>. <command>CREATE RULE</command> statement is a <productname>Postgres</productname>
language extension.
</para>
<refsect2 id="R2-SQL-CREATERULE-4">
<refsect2info>
<date>1998-09-11</date>
</refsect2info>
<title>
SQL92
</title>
<para>
There is no <command>CREATE RULE</command> statement in <acronym>SQL92</acronym>.
</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
sgml-omittag:t sgml-omittag:nil
sgml-shorttag:t sgml-shorttag:t
sgml-minimize-attributes:nil sgml-minimize-attributes:nil
sgml-always-quote-attributes:t sgml-always-quote-attributes:t

View File

@ -1,23 +1,23 @@
<REFENTRY ID="SQL-CREATESEQUENCE"> <refentry id="SQL-CREATESEQUENCE">
<REFMETA> <refmeta>
<REFENTRYTITLE> <refentrytitle>
CREATE SEQUENCE CREATE SEQUENCE
</REFENTRYTITLE> </refentrytitle>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO> <refmiscinfo>SQL - Language Statements</refmiscinfo>
</REFMETA> </refmeta>
<REFNAMEDIV> <refnamediv>
<REFNAME> <refname>
CREATE SEQUENCE CREATE SEQUENCE
</REFNAME> </refname>
<REFPURPOSE> <refpurpose>
Creates a new sequence number generator Creates a new sequence number generator
</REFPURPOSE> </refpurpose>
</refnamediv> </refnamediv>
<REFSYNOPSISDIV> <refsynopsisdiv>
<REFSYNOPSISDIVINFO> <refsynopsisdivinfo>
<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> ]
@ -25,74 +25,66 @@ CREATE SEQUENCE <replaceable class="parameter">seqname</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-09-11</DATE> <date>1998-09-11</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Inputs Inputs
</TITLE> </title>
<PARA> <para>
</PARA>
<VARIABLELIST> <variablelist>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="parameter">seqname</replaceable></term>
<replaceable class="parameter">seqname</replaceable> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
The name of a sequence to be created. The name of a sequence to be created.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="parameter">increment</replaceable></term>
<replaceable class="parameter">increment</replaceable> <listitem>
</TERM> <para>
<LISTITEM> The
<PARA> <option>INCREMENT <replaceable class="parameter">increment</replaceable></option>
The <option>INCREMENT <replaceable class="parameter">increment</replaceable></option> clause is optional. A positive value will make an clause is optional. A positive value will make an
ascending sequence, a negative one a descending sequence. ascending sequence, a negative one a descending sequence.
The default value is one (1). The default value is one (1).
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="parameter">minvalue</replaceable></term>
<replaceable class="parameter">minvalue</replaceable> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
The optional clause <option>MINVALUE The optional clause <option>MINVALUE
<replaceable class="parameter">minvalue</replaceable></option> <replaceable class="parameter">minvalue</replaceable></option>
determines the minimum value determines the minimum value
a sequence can generate. The defaults are 1 and -2147483647 for a sequence can generate. The defaults are 1 and -2147483647 for
ascending and descending sequences, respectively. ascending and descending sequences, respectively.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="parameter">maxvalue</replaceable></term>
<replaceable class="parameter">maxvalue</replaceable> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
Use the optional clause <option>MAXVALUE Use the optional clause <option>MAXVALUE
<replaceable class="parameter">maxvalue</replaceable></option> to <replaceable class="parameter">maxvalue</replaceable></option> to
determine the maximum determine the maximum
value for the sequence. The defaults are 2147483647 and -1 for value for the sequence. The defaults are 2147483647 and -1 for
ascending and descending sequences, respectively. ascending and descending sequences, respectively.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="parameter">start</replaceable></term>
<replaceable class="parameter">start</replaceable> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
The optional <option>START The optional <option>START
<replaceable class="parameter">start</replaceable> <replaceable class="parameter">start</replaceable>
clause</option> enables the sequence to begin anywhere. clause</option> enables the sequence to begin anywhere.
@ -101,29 +93,25 @@ CREATE SEQUENCE <replaceable class="parameter">seqname</replaceable>
for ascending sequences and for ascending sequences and
<replaceable class="parameter">maxvalue</replaceable> <replaceable class="parameter">maxvalue</replaceable>
for descending ones. for descending ones.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="parameter">cache</replaceable></term>
<replaceable class="parameter">cache</replaceable> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
The <option>CACHE <replaceable class="parameter">cache</replaceable></option> option The <option>CACHE <replaceable class="parameter">cache</replaceable></option> option
enables sequence numbers to be preallocated enables sequence numbers to be preallocated
and stored in memory for faster access. The minimum and stored in memory for faster access. The minimum
value is 1 (only one value can be generated at a time, i.e. no cache) value is 1 (only one value can be generated at a time, i.e. no cache)
and this is also the default. and this is also the default.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term>CYCLE</term>
CYCLE <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
The optional CYCLE keyword may be used to enable the sequence The optional CYCLE keyword may be used to enable the sequence
to continue when the to continue when the
<replaceable class="parameter">maxvalue</replaceable> or <replaceable class="parameter">maxvalue</replaceable> or
@ -134,91 +122,92 @@ CREATE SEQUENCE <replaceable class="parameter">seqname</replaceable>
<replaceable class="parameter">minvalue</replaceable> or <replaceable class="parameter">minvalue</replaceable> or
<replaceable class="parameter">maxvalue</replaceable> is, <replaceable class="parameter">maxvalue</replaceable> is,
as appropriate. as appropriate.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
</variablelist> </variablelist>
</REFSECT2> </para>
</refsect2>
<REFSECT2 ID="R2-SQL-CREATESEQUENCE-2"> <refsect2 id="R2-SQL-CREATESEQUENCE-2">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-11</DATE> <date>1998-09-11</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Outputs Outputs
</TITLE> </title>
<PARA> <para>
<VARIABLELIST> <variablelist>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
<ReturnValue>CREATE</ReturnValue> CREATE
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
Message returned if the command is successful. Message returned if the command is successful.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
<ReturnValue>ERROR: amcreate: '<replaceable class="parameter">seqname</replaceable>' relation already exists</ReturnValue> ERROR: Relation '<replaceable class="parameter">seqname</replaceable>' already exists
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
If the sequence specified already exists. If the sequence specified already exists.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
<ReturnValue>ERROR: DefineSequence: START value (<replaceable class="parameter">start</replaceable>) can't be > MAXVALUE (<replaceable class="parameter">maxvalue</replaceable>)</ReturnValue> ERROR: DefineSequence: MINVALUE (<replaceable class="parameter">start</replaceable>) can't be >= MAXVALUE (<replaceable class="parameter">max</replaceable>)
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
If the specified starting value is out of range. If the specified starting value is out of range.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
<ReturnValue>ERROR: DefineSequence: START value (<replaceable class="parameter">start</replaceable>) can't be < MINVALUE (<replaceable class="parameter">minvalue</replaceable>)</ReturnValue> ERROR: DefineSequence: START value (<replaceable class="parameter">start</replaceable>) can't be < MINVALUE (<replaceable class="parameter">min</replaceable>)
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
If the specified starting value is out of range. If the specified starting value is out of range.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
<ReturnValue>ERROR: DefineSequence: MINVALUE (<replaceable class="parameter">minvalue</replaceable>) can't be >= MAXVALUE (<replaceable class="parameter">maxvalue</replaceable>)</ReturnValue> ERROR: DefineSequence: MINVALUE (<replaceable class="parameter">min</replaceable>) can't be >= MAXVALUE (<replaceable class="parameter">max</replaceable>)
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
If the minimum and maximum values are inconsistant. If the minimum and maximum values are inconsistant.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</VARIABLELIST> </variablelist>
</para> </para>
</REFSECT2> </refsect2>
</REFSYNOPSISDIV> </refsynopsisdiv>
<REFSECT1 ID="R1-SQL-CREATESEQUENCE-1"> <refsect1 id="R1-SQL-CREATESEQUENCE-1">
<REFSECT1INFO> <refsect1info>
<DATE>1998-09-11</DATE> <date>1998-09-11</date>
</REFSECT1INFO> </refsect1info>
<TITLE> <title>
Description Description
</TITLE> </title>
<PARA> <para>
CREATE SEQUENCE will enter a new sequence number generator <command>CREATE SEQUENCE</command> will enter a new sequence number generator
into the current data base. This involves creating and initialising a into the current data base. This involves creating and initialising a
new single-row new single-row
table with the name <replaceable class="parameter">seqname</replaceable>. table with the name <replaceable class="parameter">seqname</replaceable>.
The generator will be "owned" by the user issuing the command. The generator will be "owned" by the user issuing the command.
</PARA> </para>
<para> <para>
After a sequence is created, you may use the function After a sequence is created, you may use the function
<function>nextval(<replaceable class="parameter">seqname</replaceable>)</function> <function>nextval(<replaceable class="parameter">seqname</replaceable>)</function>
@ -280,34 +269,34 @@ SELECT last_value FROM sequence_name;
</para> </para>
</caution> </caution>
<REFSECT2 ID="R2-SQL-CREATESEQUENCE-3"> <refsect2 id="R2-SQL-CREATESEQUENCE-3">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-11</DATE> <date>1998-09-11</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Notes Notes
</TITLE> </title>
<PARA> <para>
Refer to the DROP SEQUENCE statement to remove a sequence. Refer to the <command>DROP SEQUENCE</command> statement to remove a sequence.
</PARA> </para>
<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, resulting in "holes" in the sequence. lost, resulting in "holes" in the sequence.
</para> </para>
</REFSECT2> </refsect2>
</refsect1> </refsect1>
<REFSECT1 ID="R1-SQL-CREATESEQUENCE-2"> <refsect1 id="R1-SQL-CREATESEQUENCE-2">
<TITLE> <title>
Usage Usage
</TITLE> </title>
<PARA> <para>
Create an ascending sequence called <literal>serial</literal>, 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>
@ -337,38 +326,36 @@ INSERT INTO distributors VALUES (NEXTVAL('serial'),'nothing');
END; END;
</programlisting> </programlisting>
</para> </para>
</refsect1>
</REFSECT1> <refsect1 id="R1-SQL-CREATESEQUENCE-3">
<title>
<REFSECT1 ID="R1-SQL-CREATESEQUENCE-3">
<TITLE>
Compatibility Compatibility
</TITLE> </title>
<PARA> <para>
<command>CREATE SEQUENCE</command> is a <productname>Postgres</productname> <command>CREATE SEQUENCE</command> is a <productname>Postgres</productname>
language extension. language extension.
</PARA> </para>
<REFSECT2 ID="R2-SQL-CREATESEQUENCE-4"> <refsect2 id="R2-SQL-CREATESEQUENCE-4">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-11</DATE> <date>1998-09-11</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
SQL92 SQL92
</TITLE> </title>
<PARA> <para>
There is no <command>CREATE SEQUENCE</command> statement There is no <command>CREATE SEQUENCE</command> statement
in <acronym>SQL92</acronym>. in <acronym>SQL92</acronym>.
</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
sgml-omittag:t sgml-omittag:nil
sgml-shorttag:t sgml-shorttag:t
sgml-minimize-attributes:nil sgml-minimize-attributes:nil
sgml-always-quote-attributes:t sgml-always-quote-attributes:t

View File

@ -19,10 +19,8 @@
</refsynopsisdivinfo> </refsynopsisdivinfo>
<synopsis> <synopsis>
CREATE [ TEMPORARY | TEMP ] TABLE <replaceable class="PARAMETER">table</replaceable> ( CREATE [ TEMPORARY | TEMP ] TABLE <replaceable class="PARAMETER">table</replaceable> (
<replaceable class="PARAMETER">column</replaceable> <replaceable <replaceable class="PARAMETER">column</replaceable> <replaceable class="PARAMETER">type</replaceable>
class="PARAMETER">type</replaceable> [ NULL | NOT NULL ] [ UNIQUE ] [ DEFAULT <replaceable class="PARAMETER">value</replaceable> ]
[ NULL | NOT NULL ] [ UNIQUE ] [ DEFAULT <replaceable
class="PARAMETER">value</replaceable> ]
[<replaceable>column_constraint_clause</replaceable> | PRIMARY KEY } [ ... ] ] [<replaceable>column_constraint_clause</replaceable> | PRIMARY KEY } [ ... ] ]
[, ... ] [, ... ]
[, PRIMARY KEY ( <replaceable class="PARAMETER">column</replaceable> [, ...] ) ] [, PRIMARY KEY ( <replaceable class="PARAMETER">column</replaceable> [, ...] ) ]
@ -43,9 +41,7 @@ CREATE [ TEMPORARY | TEMP ] TABLE <replaceable class="PARAMETER">table</replacea
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term>TEMPORARY</term>
TEMPORARY
</term>
<listitem> <listitem>
<para> <para>
The table is created only for this session, and is The table is created only for this session, and is
@ -57,9 +53,7 @@ CREATE [ TEMPORARY | TEMP ] TABLE <replaceable class="PARAMETER">table</replacea
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><replaceable class="PARAMETER">table</replaceable></term>
<replaceable class="PARAMETER">table</replaceable>
</term>
<listitem> <listitem>
<para> <para>
The name of a new table to be created. The name of a new table to be created.
@ -68,9 +62,7 @@ CREATE [ TEMPORARY | TEMP ] TABLE <replaceable class="PARAMETER">table</replacea
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><replaceable class="PARAMETER">column</replaceable></term>
<replaceable class="PARAMETER">column</replaceable>
</term>
<listitem> <listitem>
<para> <para>
The name of a column. The name of a column.
@ -79,9 +71,7 @@ CREATE [ TEMPORARY | TEMP ] TABLE <replaceable class="PARAMETER">table</replacea
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><replaceable class="PARAMETER">type</replaceable></term>
<replaceable class="PARAMETER">type</replaceable>
</term>
<listitem> <listitem>
<para> <para>
The type of the column. This may include array specifiers. The type of the column. This may include array specifiers.
@ -92,9 +82,7 @@ CREATE [ TEMPORARY | TEMP ] TABLE <replaceable class="PARAMETER">table</replacea
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>DEFAULT <replaceable class="PARAMETER">value</replaceable></term>
DEFAULT <replaceable class="PARAMETER">value</replaceable>
</term>
<listitem> <listitem>
<para> <para>
A default value for a column. A default value for a column.
@ -104,9 +92,7 @@ CREATE [ TEMPORARY | TEMP ] TABLE <replaceable class="PARAMETER">table</replacea
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><replaceable>column_constraint_clause</replaceable></term>
<replaceable>column_constraint_clause</replaceable>
</term>
<listitem> <listitem>
<para> <para>
The optional column constraint clauses specify a list of integrity The optional column constraint clauses specify a list of integrity
@ -123,9 +109,7 @@ requires the <replaceable class="PARAMETER">column_constraint_clause</replaceabl
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><replaceable>table_constraint_clause</replaceable></term>
<replaceable>table_constraint_clause</replaceable>
</term>
<listitem> <listitem>
<para> <para>
The optional table CONSTRAINT clause specifies a list of integrity The optional table CONSTRAINT clause specifies a list of integrity
@ -143,9 +127,7 @@ requires the <replaceable class="PARAMETER">column_constraint_clause</replaceabl
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>INHERITS <replaceable class="PARAMETER">inherited_table</replaceable></term>
INHERITS <replaceable class="PARAMETER">inherited_table</replaceable>
</term>
<listitem> <listitem>
<para> <para>
The optional INHERITS clause specifies a collection of table The optional INHERITS clause specifies a collection of table
@ -181,9 +163,9 @@ requires the <replaceable class="PARAMETER">column_constraint_clause</replaceabl
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term><computeroutput>
<returnvalue>CREATE</returnvalue> CREATE
</term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
Message returned if table is successfully created. Message returned if table is successfully created.
@ -192,16 +174,16 @@ requires the <replaceable class="PARAMETER">column_constraint_clause</replaceabl
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><computeroutput>
<returnvalue>ERROR</returnvalue> ERROR
</term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
Message returned if table creation failed. Message returned if table creation failed.
This is usually accompanied by some descriptive text, such as: This is usually accompanied by some descriptive text, such as:
<programlisting> <computeroutput>
amcreate: "<replaceable class="parameter">table</replaceable>" relation already exists ERROR: Relation '<replaceable class="parameter">table</replaceable>' already exists
</programlisting> </computeroutput>
which occurs at runtime, if the table specified already exists which occurs at runtime, if the table specified already exists
in the database. in the database.
</para> </para>
@ -209,12 +191,12 @@ amcreate: "<replaceable class="parameter">table</replaceable>" relation already
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><computeroutput>
<returnvalue>ERROR: DEFAULT: type mismatched</returnvalue> ERROR: DEFAULT: type mismatched
</term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
if data type of default value doesn't match the If data type of default value doesn't match the
column definition's data type. column definition's data type.
</para> </para>
</listitem> </listitem>
@ -266,11 +248,10 @@ DEFAULT <replaceable class="PARAMETER">value</replaceable>
Inputs Inputs
</title> </title>
<para> <para>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term><replaceable class="parameter">value</replaceable></term>
<replaceable class="parameter">value</replaceable>
</term>
<listitem> <listitem>
<para> <para>
The possible values for the default value expression are: The possible values for the default value expression are:
@ -306,6 +287,7 @@ DEFAULT <replaceable class="PARAMETER">value</replaceable>
Outputs Outputs
</title> </title>
<para> <para>
None.
</para> </para>
</refsect2> </refsect2>
@ -396,17 +378,11 @@ Hence, functions which are "non-cacheable" such as
<function>CURRENT_TIMESTAMP</function> may not produce the desired <function>CURRENT_TIMESTAMP</function> may not produce the desired
effect. For the particular case of date/time types, one can work effect. For the particular case of date/time types, one can work
around this behavior by using around this behavior by using
<quote> <quote>DEFAULT TEXT 'now'</quote>
DEFAULT TEXT 'now'
</quote>
instead of instead of
<quote> <quote>DEFAULT 'now'</quote>
DEFAULT 'now'
</quote>
or or
<quote> <quote>DEFAULT CURRENT_TIMESTAMP</quote>.
DEFAULT CURRENT_TIMESTAMP
</quote>.
This forces <productname>Postgres</productname> to consider the constant a string This forces <productname>Postgres</productname> to consider the constant a string
type and then to convert the value to <type>timestamp</type> at runtime. type and then to convert the value to <type>timestamp</type> at runtime.
</para> </para>
@ -418,6 +394,7 @@ type and then to convert the value to <type>timestamp</type> at runtime.
<title> <title>
Usage Usage
</title> </title>
<para> <para>
To assign a constant value as the default for the To assign a constant value as the default for the
columns <literal>did</literal> and <literal>number</literal>, columns <literal>did</literal> and <literal>number</literal>,
@ -471,9 +448,7 @@ CREATE TABLE distributors (
<para> <para>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term><replaceable class="parameter">name</replaceable></term>
<replaceable class="parameter">name</replaceable>
</term>
<listitem> <listitem>
<para> <para>
An arbitrary name given to the integrity constraint. An arbitrary name given to the integrity constraint.
@ -486,9 +461,7 @@ which should ensure uniqueness for
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>NULL</term>
NULL
</term>
<listitem> <listitem>
<para> <para>
The column is allowed to contain NULL values. This is the default. The column is allowed to contain NULL values. This is the default.
@ -497,9 +470,7 @@ The column is allowed to contain NULL values. This is the default.
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>NOT NULL</term>
NOT NULL
</term>
<listitem> <listitem>
<para> <para>
The column is not allowed to contain NULL values. The column is not allowed to contain NULL values.
@ -510,9 +481,7 @@ This is equivalent to the column constraint
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>UNIQUE</term>
UNIQUE
</term>
<listitem> <listitem>
<para> <para>
The column must have unique values. In <productname>Postgres</productname> The column must have unique values. In <productname>Postgres</productname>
@ -522,9 +491,7 @@ this is enforced by an implicit creation of a unique index on the table.
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>PRIMARY KEY</term>
PRIMARY KEY
</term>
<listitem> <listitem>
<para> <para>
This column is a primary key, which implies that uniqueness is This column is a primary key, which implies that uniqueness is
@ -612,20 +579,16 @@ as a unique identifier for rows.
Outputs Outputs
</title> </title>
<para> <para>
</para>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term><replaceable>status</replaceable></term>
<replaceable>status</replaceable>
</term>
<listitem> <listitem>
<para> <para>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term><computeroutput>
<returnvalue>ERROR: ExecAppend: Fail to add null value in not ERROR: ExecAppend: Fail to add null value in not null attribute "<replaceable class="parameter">column</replaceable>".
null attribute "<replaceable class="parameter">column</replaceable>".</returnvalue> </computeroutput></term>
</term>
<listitem> <listitem>
<para> <para>
This error occurs at runtime if one tries to insert a null value This error occurs at runtime if one tries to insert a null value
@ -638,6 +601,7 @@ as a unique identifier for rows.
</listitem> </listitem>
</varlistentry> </varlistentry>
</variablelist> </variablelist>
</para>
</refsect3> </refsect3>
<refsect3 id="R3-SQL-NOTNULL-2"> <refsect3 id="R3-SQL-NOTNULL-2">
@ -688,11 +652,10 @@ as a unique identifier for rows.
<refsect3> <refsect3>
<title>Inputs</title> <title>Inputs</title>
<para> <para>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term>CONSTRAINT <replaceable class="parameter">name</replaceable></term>
CONSTRAINT <replaceable class="parameter">name</replaceable>
</term>
<listitem> <listitem>
<para> <para>
An arbitrary label given to a constraint. An arbitrary label given to a constraint.
@ -708,16 +671,14 @@ as a unique identifier for rows.
<para> <para>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term><replaceable>status</replaceable></term>
<replaceable>status</replaceable>
</term>
<listitem> <listitem>
<para> <para>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term><computeroutput>
<returnvalue>ERROR: Cannot insert a duplicate key into a unique index.</returnvalue> ERROR: Cannot insert a duplicate key into a unique index.
</term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
This error occurs at runtime if one tries to insert a This error occurs at runtime if one tries to insert a
@ -780,6 +741,7 @@ Usage
name VARCHAR(40) UNIQUE name VARCHAR(40) UNIQUE
); );
</programlisting> </programlisting>
which is equivalent to the following specified as a table constraint: which is equivalent to the following specified as a table constraint:
<programlisting> <programlisting>
CREATE TABLE distributors ( CREATE TABLE distributors (
@ -806,11 +768,10 @@ The CHECK Constraint
<refsect3 id="R3-SQL-CHECK-1"> <refsect3 id="R3-SQL-CHECK-1">
<title>Inputs</title> <title>Inputs</title>
<para> <para>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term><replaceable class="parameter">name</replaceable></term>
<returnvalue><replaceable class="parameter">name</replaceable></returnvalue>
</term>
<listitem> <listitem>
<para> <para>
An arbitrary name given to a constraint. An arbitrary name given to a constraint.
@ -818,9 +779,7 @@ The CHECK Constraint
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><replaceable>condition</replaceable></term>
<replaceable>condition</replaceable>
</term>
<listitem> <listitem>
<para> <para>
Any valid conditional expression evaluating to a boolean result. Any valid conditional expression evaluating to a boolean result.
@ -839,22 +798,18 @@ The CHECK Constraint
Outputs Outputs
</title> </title>
<para> <para>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term><replaceable>status</replaceable></term>
<replaceable>status</replaceable>
</term>
<listitem> <listitem>
<para> <para>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term><computeroutput>
<returnvalue> ERROR: ExecAppend: rejected due to CHECK constraint "<replaceable class="parameter">table_column</replaceable>".
ERROR: ExecAppend: rejected due to CHECK constraint </computeroutput></term>
"<replaceable class="parameter">table_column</replaceable>".
</returnvalue>
</term>
<listitem> <listitem>
<para> <para>
This error occurs at runtime if one tries to insert an illegal This error occurs at runtime if one tries to insert an illegal
@ -902,9 +857,7 @@ The CHECK Constraint
<para> <para>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term>CONSTRAINT <replaceable class="PARAMETER">name</replaceable></term>
CONSTRAINT <replaceable class="PARAMETER">name</replaceable>
</term>
<listitem> <listitem>
<para> <para>
An arbitrary name for the constraint. An arbitrary name for the constraint.
@ -919,9 +872,9 @@ CONSTRAINT <replaceable class="PARAMETER">name</replaceable>
<title>Outputs</title> <title>Outputs</title>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term><computeroutput>
<returnvalue>ERROR: Cannot insert a duplicate key into a unique index.</returnvalue> ERROR: Cannot insert a duplicate key into a unique index.
</term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
This occurs at run-time if one tries to insert a duplicate value into This occurs at run-time if one tries to insert a duplicate value into
@ -979,8 +932,7 @@ disallow this.
</title> </title>
<para> <para>
<synopsis> <synopsis>
[ CONSTRAINT name ] { PRIMARY KEY | UNIQUE } ( <replaceable [ CONSTRAINT name ] { PRIMARY KEY | UNIQUE } ( <replaceable class="parameter">column</replaceable> [, ...] )
class="parameter">column</replaceable> [, ...] )
[ CONSTRAINT name ] CHECK ( <replaceable>constraint</replaceable> ) [ CONSTRAINT name ] CHECK ( <replaceable>constraint</replaceable> )
</synopsis> </synopsis>
</para> </para>
@ -993,11 +945,10 @@ disallow this.
</title> </title>
<para> <para>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term>CONSTRAINT <replaceable class="parameter">name</replaceable></term>
CONSTRAINT <replaceable class="parameter">name</replaceable>
</term>
<listitem> <listitem>
<para> <para>
An arbitrary name given to an integrity constraint. An arbitrary name given to an integrity constraint.
@ -1005,9 +956,7 @@ disallow this.
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><replaceable class="parameter">column</replaceable> [, ...]</term>
<replaceable class="parameter">column</replaceable> [, ...]
</term>
<listitem> <listitem>
<para> <para>
The column name(s) for which to define a unique index The column name(s) for which to define a unique index
@ -1016,9 +965,7 @@ disallow this.
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>CHECK ( <replaceable class="parameter">constraint</replaceable> )</term>
CHECK ( <replaceable class="parameter">constraint</replaceable> )
</term>
<listitem> <listitem>
<para> <para>
A boolean expression to be evaluated as the constraint. A boolean expression to be evaluated as the constraint.
@ -1083,17 +1030,14 @@ disallow this.
</title> </title>
<para> <para>
<synopsis> <synopsis>
[ CONSTRAINT <replaceable class="parameter">name</replaceable> ] [ CONSTRAINT <replaceable class="parameter">name</replaceable> ] UNIQUE ( <replaceable class="parameter">column</replaceable> [, ...] )
UNIQUE ( <replaceable class="parameter">column</replaceable> [, ...] )
</synopsis> </synopsis>
</para> </para>
<refsect3> <refsect3>
<title>Inputs</title> <title>Inputs</title>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term>CONSTRAINT <replaceable class="parameter">name</replaceable></term>
CONSTRAINT <replaceable class="parameter">name</replaceable>
</term>
<listitem> <listitem>
<para> <para>
An arbitrary name given to a constraint. An arbitrary name given to a constraint.
@ -1101,9 +1045,7 @@ disallow this.
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><replaceable class="parameter">column</replaceable></term>
<replaceable class="parameter">column</replaceable>
</term>
<listitem> <listitem>
<para> <para>
A name of a column in a table. A name of a column in a table.
@ -1118,16 +1060,12 @@ disallow this.
<para> <para>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term><replaceable>status</replaceable></term>
<replaceable>status</replaceable>
</term>
<listitem> <listitem>
<para> <para>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term>ERROR: Cannot insert a duplicate key into a unique index</term>
ERROR: Cannot insert a duplicate key into a unique index.
</term>
<listitem> <listitem>
<para> <para>
This error occurs at runtime if one tries to insert a This error occurs at runtime if one tries to insert a
@ -1186,18 +1124,16 @@ disallow this.
</title> </title>
<para> <para>
<synopsis> <synopsis>
[ CONSTRAINT <replaceable class="PARAMETER">name</replaceable> ] [ CONSTRAINT <replaceable class="PARAMETER">name</replaceable> ] PRIMARY KEY ( <replaceable class="PARAMETER">column</replaceable> [, ...] )
PRIMARY KEY ( <replaceable class="PARAMETER">column</replaceable> [, ...] )
</synopsis> </synopsis>
</para> </para>
<refsect3> <refsect3>
<title>Inputs</title> <title>Inputs</title>
<para> <para>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term>CONSTRAINT <replaceable class="PARAMETER">name</replaceable></term>
CONSTRAINT <returnvalue><replaceable class="PARAMETER">name</replaceable></returnvalue>
</term>
<listitem> <listitem>
<para> <para>
An arbitrary name for the constraint. An arbitrary name for the constraint.
@ -1205,9 +1141,7 @@ disallow this.
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><replaceable class="PARAMETER">column</replaceable> [, ...]</term>
<replaceable class="PARAMETER">column</replaceable> [, ...]
</term>
<listitem> <listitem>
<para> <para>
The names of one or more columns in the table. The names of one or more columns in the table.
@ -1222,9 +1156,7 @@ disallow this.
<title>Outputs</title> <title>Outputs</title>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term><replaceable>status</replaceable></term>
<replaceable>status</replaceable>
</term>
<listitem> <listitem>
<para> <para>
<variablelist> <variablelist>
@ -1252,7 +1184,9 @@ disallow this.
(non duplicate), non-null values. The column definitions of (non duplicate), non-null values. The column definitions of
the specified columns do not have to include a NOT NULL the specified columns do not have to include a NOT NULL
constraint to be included in a PRIMARY KEY constraint. constraint to be included in a PRIMARY KEY constraint.
</para>
<para>
The PRIMARY KEY table constraint is similar to that for column constraints, The PRIMARY KEY table constraint is similar to that for column constraints,
with the additional capability of encompassing multiple columns. with the additional capability of encompassing multiple columns.
</para> </para>
@ -1271,8 +1205,8 @@ disallow this.
Usage Usage
</title> </title>
<para> <para>
Create table films and table distributors Create table films and table distributors:
</para>
<programlisting> <programlisting>
CREATE TABLE films ( CREATE TABLE films (
code CHARACTER(5) CONSTRAINT firstkey PRIMARY KEY, code CHARACTER(5) CONSTRAINT firstkey PRIMARY KEY,
@ -1290,21 +1224,23 @@ disallow this.
name VARCHAR(40) NOT NULL CHECK (name &lt;&gt; '') name VARCHAR(40) NOT NULL CHECK (name &lt;&gt; '')
); );
</programlisting> </programlisting>
</para>
<para> <para>
Create a table with a 2-dimensional array Create a table with a 2-dimensional array:
</para>
<programlisting> <programlisting>
CREATE TABLE array ( CREATE TABLE array (
vector INT[][] vector INT[][]
); );
</programlisting> </programlisting>
</para>
<para> <para>
Define a UNIQUE table constraint for the table films. Define a UNIQUE table constraint for the table films.
UNIQUE table constraints can be defined on one or more UNIQUE table constraints can be defined on one or more
columns of the table columns of the table:
</para>
<programlisting> <programlisting>
CREATE TABLE films ( CREATE TABLE films (
code CHAR(5), code CHAR(5),
@ -1316,20 +1252,22 @@ disallow this.
CONSTRAINT production UNIQUE(date_prod) CONSTRAINT production UNIQUE(date_prod)
); );
</programlisting> </programlisting>
</para>
<para> <para>
Define a CHECK column constraint. Define a CHECK column constraint:
</para>
<programlisting> <programlisting>
CREATE TABLE distributors ( CREATE TABLE distributors (
did DECIMAL(3) CHECK (did > 100), did DECIMAL(3) CHECK (did > 100),
name VARCHAR(40) name VARCHAR(40)
); );
</programlisting> </programlisting>
</para>
<para> <para>
Define a CHECK table constraint Define a CHECK table constraint:
</para>
<programlisting> <programlisting>
CREATE TABLE distributors ( CREATE TABLE distributors (
did DECIMAL(3), did DECIMAL(3),
@ -1337,12 +1275,13 @@ disallow this.
CONSTRAINT con1 CHECK (did > 100 AND name > '') CONSTRAINT con1 CHECK (did > 100 AND name > '')
); );
</programlisting> </programlisting>
</para>
<para> <para>
Define a PRIMARY KEY table constraint for the table films. Define a PRIMARY KEY table constraint for the table films.
PRIMARY KEY table constraints can be defined on one or more PRIMARY KEY table constraints can be defined on one or more
columns of the table columns of the table:
</para>
<programlisting> <programlisting>
CREATE TABLE films ( CREATE TABLE films (
code CHAR(05), code CHAR(05),
@ -1354,24 +1293,28 @@ disallow this.
CONSTRAINT code_title PRIMARY KEY(code,title) CONSTRAINT code_title PRIMARY KEY(code,title)
); );
</programlisting> </programlisting>
</para>
<para> <para>
Defines a PRIMARY KEY column constraint for table distributors. Defines a PRIMARY KEY column constraint for table distributors.
PRIMARY KEY column constraints can only be defined on one column PRIMARY KEY column constraints can only be defined on one column
of the table (the following two examples are equivalent) of the table (the following two examples are equivalent):
</para>
<programlisting> <programlisting>
CREATE TABLE distributors ( CREATE TABLE distributors (
did DECIMAL(03), did DECIMAL(03),
name CHAR VARYING(40), name CHAR VARYING(40),
PRIMARY KEY(did) PRIMARY KEY(did)
); );
</programlisting>
<programlisting>
CREATE TABLE distributors ( CREATE TABLE distributors (
did DECIMAL(03) PRIMARY KEY, did DECIMAL(03) PRIMARY KEY,
name VARCHAR(40) name VARCHAR(40)
); );
</programlisting> </programlisting>
</para>
<refsect2 id="R2-SQL-CREATETABLE-3"> <refsect2 id="R2-SQL-CREATETABLE-3">
<refsect2info> <refsect2info>
@ -1401,18 +1344,19 @@ disallow this.
SQL92 SQL92
</title> </title>
<para> <para>
In addition to the normal CREATE TABLE, SQL92 also defines a In addition to the locally-visible temporary table, SQL92 also defines a
CREATE TEMPORARY TABLE statement: CREATE GLOBAL TEMPORARY TABLE statement, and optionally an
</para> ON COMMIT clause:
<synopsis> <synopsis>
CREATE [ {GLOBAL | LOCAL} ] TEMPORARY TABLE table ( CREATE GLOBAL TEMPORARY TABLE <replaceable class="parameter">table</replaceable> ( <replaceable class="parameter">column</replaceable> <replaceable class="parameter">type</replaceable> [
column type [DEFAULT value] [CONSTRAINT column_constraint] [, ...] ) DEFAULT <replaceable class="parameter">value</replaceable> ] [ CONSTRAINT <replaceable class="parameter">column_constraint</replaceable> ] [, ...] )
[CONSTRAINT table_constraint ] [ CONSTRAINT <replaceable class="parameter">table_constraint</replaceable> ] [ ON COMMIT { DELETE | PRESERVE } ROWS ]
[ ON COMMIT {DELETE | PRESERVE} ROWS ]
</synopsis> </synopsis>
</para>
<para> <para>
For temporary tables, the CREATE TEMPORARY TABLE statement For temporary tables, the CREATE GLOBAL TEMPORARY TABLE statement
names a new table and defines the table's columns and names a new table visible to other clients and defines the table's columns and
constraints. constraints.
</para> </para>
<para> <para>
@ -1423,24 +1367,14 @@ disallow this.
</para> </para>
<para> <para>
To create a temporary table: To create a temporary table:
</para>
<programlisting> <programlisting>
CREATE TEMPORARY TABLE actors ( CREATE TEMPORARY TABLE actors (
id DECIMAL(03), id DECIMAL(03),
name VARCHAR(40), name VARCHAR(40),
CONSTRAINT actor_id CHECK (id &lt; 150) CONSTRAINT actor_id CHECK (id &lt; 150)
) ON COMMIT DELETE ROWS ) ON COMMIT DELETE ROWS;
</programlisting> </programlisting>
<para>
Temporary tables are not currently available
in <productname>Postgres</productname>.
<tip>
<para>
In the current release of <productname>Postgres</productname>
(v6.5), to create a temporary
table you must create and drop the table by explicit commands.
</para>
</tip>
</para> </para>
<refsect3 id="R3-SQL-UNIQUECLAUSE-1"> <refsect3 id="R3-SQL-UNIQUECLAUSE-1">
@ -1454,23 +1388,24 @@ disallow this.
SQL92 specifies some additional capabilities for UNIQUE: SQL92 specifies some additional capabilities for UNIQUE:
</para> </para>
<para> <para>
Table Constraint definition Table Constraint definition:
</para>
<synopsis> <synopsis>
[ CONSTRAINT name ] [ CONSTRAINT name ] UNIQUE ( column [, ...] )
UNIQUE ( column [, ...] )
[ { INITIALLY DEFERRED | INITIALLY IMMEDIATE } ] [ { INITIALLY DEFERRED | INITIALLY IMMEDIATE } ]
[ [ NOT ] DEFERRABLE ] [ [ NOT ] DEFERRABLE ]
</synopsis> </synopsis>
</para>
<para> <para>
Column Constraint definition Column Constraint definition:
</para>
<synopsis> <synopsis>
[ CONSTRAINT name ] [ CONSTRAINT name ] UNIQUE
UNIQUE
[ {INITIALLY DEFERRED | INITIALLY IMMEDIATE} ] [ {INITIALLY DEFERRED | INITIALLY IMMEDIATE} ]
[ [ NOT ] DEFERRABLE ] [ [ NOT ] DEFERRABLE ]
</synopsis> </synopsis>
</para>
</refsect3> </refsect3>
<refsect3 id="R3-SQL-NULL-1"> <refsect3 id="R3-SQL-NULL-1">
@ -1501,12 +1436,12 @@ disallow this.
<para> <para>
SQL92 specifies some additional capabilities for NOT NULL: SQL92 specifies some additional capabilities for NOT NULL:
</para>
<synopsis> <synopsis>
[ CONSTRAINT name ] NOT NULL [ CONSTRAINT name ] NOT NULL
[ {INITIALLY DEFERRED | INITIALLY IMMEDIATE} ] [ {INITIALLY DEFERRED | INITIALLY IMMEDIATE} ]
[ [ NOT ] DEFERRABLE ] [ [ NOT ] DEFERRABLE ]
</synopsis> </synopsis>
</para>
</refsect3> </refsect3>
<!-- <!--
@ -1571,37 +1506,34 @@ the column. Not our problem...
</para> </para>
<para> <para>
Domain constraint: Domain constraint:
</para>
<synopsis> <synopsis>
[ CONSTRAINT name ] [ CONSTRAINT name ] CHECK constraint
CHECK constraint
[ {INITIALLY DEFERRED | INITIALLY IMMEDIATE} ] [ {INITIALLY DEFERRED | INITIALLY IMMEDIATE} ]
[ [ NOT ] DEFERRABLE ] [ [ NOT ] DEFERRABLE ]
</synopsis> </synopsis>
</para>
<para> <para>
Table constraint definition: Table constraint definition:
</para>
<synopsis> <synopsis>
[ CONSTRAINT name ] [ CONSTRAINT name ] { PRIMARY KEY ( <replaceable class="parameter">column</replaceable>, ... ) | FOREIGN KEY constraint | UNIQUE constraint | CHECK constraint }
{ PRIMARY KEY constraint |
FOREIGN KEY constraint |
UNIQUE constraint |
CHECK constraint }
[ {INITIALLY DEFERRED | INITIALLY IMMEDIATE} ]
[ [ NOT ] DEFERRABLE ]</synopsis>
<para>
Column constraint definition:
</para>
<synopsis>
[ CONSTRAINT name ]
{ NOT NULL constraint |
PRIMARY KEY constraint |
FOREIGN KEY constraint |
UNIQUE constraint |
CHECK constraint }
[ {INITIALLY DEFERRED | INITIALLY IMMEDIATE} ] [ {INITIALLY DEFERRED | INITIALLY IMMEDIATE} ]
[ [ NOT ] DEFERRABLE ] [ [ NOT ] DEFERRABLE ]
</synopsis> </synopsis>
</para>
<para>
Column constraint definition:
<synopsis>
[ CONSTRAINT name ] { NOT NULL | PRIMARY KEY | FOREIGN KEY constraint | UNIQUE | CHECK constraint }
[ {INITIALLY DEFERRED | INITIALLY IMMEDIATE} ]
[ [ NOT ] DEFERRABLE ]
</synopsis>
</para>
<para> <para>
A CONSTRAINT definition may contain one deferment attribute A CONSTRAINT definition may contain one deferment attribute
clause and/or one initial constraint mode clause, in any order. clause and/or one initial constraint mode clause, in any order.
@ -1679,22 +1611,21 @@ affect a column or a table.
--> -->
<para> <para>
table constraint definition: table constraint definition:
</para>
<synopsis> <synopsis>
[ CONSTRAINT name ] [ CONSTRAINT name ] CHECK ( VALUE condition )
CHECK ( VALUE condition )
[ {INITIALLY DEFERRED | INITIALLY IMMEDIATE} ] [ {INITIALLY DEFERRED | INITIALLY IMMEDIATE} ]
[ [ NOT ] DEFERRABLE ] [ [ NOT ] DEFERRABLE ]
</synopsis> </synopsis>
</para>
<para> <para>
column constraint definition: column constraint definition:
</para>
<synopsis> <synopsis>
[ CONSTRAINT name ] [ CONSTRAINT name ] CHECK ( VALUE condition )
CHECK ( VALUE condition )
[ {INITIALLY DEFERRED | INITIALLY IMMEDIATE} ] [ {INITIALLY DEFERRED | INITIALLY IMMEDIATE} ]
[ [ NOT ] DEFERRABLE ] [ [ NOT ] DEFERRABLE ]
</synopsis> </synopsis>
</para>
<!-- <!--
<para> <para>
domain constraint definition: domain constraint definition:
@ -1719,7 +1650,6 @@ affect a column or a table.
--> -->
</refsect3> </refsect3>
<refsect3 id="R3-SQL-PRIMARYKEY-1"> <refsect3 id="R3-SQL-PRIMARYKEY-1">
<refsect3info> <refsect3info>
<date>1998-09-11</date> <date>1998-09-11</date>
@ -1732,22 +1662,20 @@ affect a column or a table.
</para> </para>
<para> <para>
Table Constraint definition: Table Constraint definition:
</para>
<synopsis> <synopsis>
[ CONSTRAINT name ] [ CONSTRAINT name ] PRIMARY KEY ( column [, ...] )
PRIMARY KEY ( column [, ...] )
[ {INITIALLY DEFERRED | INITIALLY IMMEDIATE} ] [ {INITIALLY DEFERRED | INITIALLY IMMEDIATE} ]
[ [ NOT ] DEFERRABLE ] [ [ NOT ] DEFERRABLE ]
</synopsis> </synopsis>
</para>
<para> <para>
Column Constraint definition: Column Constraint definition:
</para>
<synopsis> <synopsis>
[ CONSTRAINT name ] [ CONSTRAINT name ] PRIMARY KEY
PRIMARY KEY
[ {INITIALLY DEFERRED | INITIALLY IMMEDIATE} ] [ {INITIALLY DEFERRED | INITIALLY IMMEDIATE} ]
[ [ NOT ] DEFERRABLE ] [ [ NOT ] DEFERRABLE ]
</synopsis> </synopsis>
</para>
</refsect3> </refsect3>
</refsect2> </refsect2>
</refsect1> </refsect1>

View File

@ -33,9 +33,7 @@ CREATE TABLE <replaceable>table</replaceable> [ (<replaceable>column</replaceabl
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term><replaceable>table</replaceable></term>
<replaceable>table</replaceable>
</term>
<listitem> <listitem>
<para> <para>
The name of a new table to be created. The name of a new table to be created.
@ -44,9 +42,7 @@ CREATE TABLE <replaceable>table</replaceable> [ (<replaceable>column</replaceabl
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><replaceable>column</replaceable></term>
<replaceable>column</replaceable>
</term>
<listitem> <listitem>
<para> <para>
The name of a column. Multiple column names can be specified using The name of a column. Multiple column names can be specified using
@ -56,9 +52,7 @@ a comma-delimited list of column names.
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><replaceable>select_clause</replaceable></term>
<replaceable>select_clause</replaceable>
</term>
<listitem> <listitem>
<para> <para>
A valid query statement. Refer to SELECT for a description of the A valid query statement. Refer to SELECT for a description of the
@ -78,7 +72,8 @@ allowed syntax.
Outputs Outputs
</title> </title>
<para> <para>
Refer to CREATE TABLE and SELECT for a summary of possible output Refer to <command>CREATE TABLE</command>
and <command>SELECT</command> for a summary of possible output
messages. messages.
</para> </para>
</refsect2> </refsect2>
@ -92,9 +87,9 @@ allowed syntax.
Description Description
</title> </title>
<para> <para>
CREATE TABLE AS enables a table to be created from the contents of <command>CREATE TABLE AS</command> enables a table to be created from the contents of
an existing table. It has functionality equivalent to SELECT TABLE INTO, an existing table. It has functionality equivalent to <command>SELECT TABLE INTO</command>,
but with perhaps a more obvious syntax. but with perhaps a more direct syntax.
</para> </para>
</refsect1> </refsect1>
</refentry> </refentry>

View File

@ -1,120 +1,113 @@
<REFENTRY ID="SQL-CREATETRIGGER"> <refentry id="SQL-CREATETRIGGER">
<REFMETA> <refmeta>
<REFENTRYTITLE> <refentrytitle>
CREATE TRIGGER CREATE TRIGGER
</REFENTRYTITLE> </refentrytitle>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO> <refmiscinfo>SQL - Language Statements</refmiscinfo>
</REFMETA> </refmeta>
<REFNAMEDIV> <refnamediv>
<REFNAME> <refname>
CREATE TRIGGER CREATE TRIGGER
</REFNAME> </refname>
<REFPURPOSE> <refpurpose>
Creates a new trigger Creates a new trigger
</REFPURPOSE> </refpurpose>
</refnamediv> </refnamediv>
<REFSYNOPSISDIV> <refsynopsisdiv>
<REFSYNOPSISDIVINFO> <refsynopsisdivinfo>
<DATE>1998-09-21</DATE> <date>1998-09-21</date>
</REFSYNOPSISDIVINFO> </refsynopsisdivinfo>
<SYNOPSIS> <synopsis>
CREATE TRIGGER <REPLACEABLE CLASS="PARAMETER">name</REPLACEABLE> { BEFORE | AFTER } CREATE TRIGGER <replaceable class="PARAMETER">name</replaceable> { BEFORE | AFTER } { <replaceable class="PARAMETER">event</replaceable> [OR ...] }
{ <REPLACEABLE CLASS="PARAMETER">event</REPLACEABLE> [OR ...] } ON <replaceable class="PARAMETER">table</replaceable> FOR EACH { ROW | STATEMENT }
ON <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE> FOR EACH { ROW | STATEMENT } EXECUTE PROCEDURE <replaceable class="PARAMETER">ER">func</replaceable>BLE> ( <replaceable class="PARAMETER">arguments</replaceable> )
EXECUTE PROCEDURE <REPLACEABLE CLASS="PARAMETER">funcname</REPLACEABLE> ( <REPLACEABLE CLASS="PARAMETER">arguments</REPLACEABLE> ) </synopsis>
</SYNOPSIS>
<REFSECT2 ID="R2-SQL-CREATETRIGGER-1"> <refsect2 id="R2-SQL-CREATETRIGGER-1">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-21</DATE> <date>1998-09-21</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Inputs Inputs
</TITLE> </title>
<PARA> <para>
</PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
<ReturnValue><replaceable class="parameter">name</replaceable></ReturnValue>
</TERM>
<LISTITEM>
<PARA>
The name of an existing trigger.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
<ReturnValue><replaceable class="parameter">table</replaceable></ReturnValue>
</TERM>
<LISTITEM>
<PARA>
The name of a table.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
<ReturnValue><replaceable class="parameter">event</replaceable></ReturnValue>
</TERM>
<LISTITEM>
<PARA>
One of INSERT, DELETE or UPDATE.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
<ReturnValue><replaceable class="parameter">funcname</replaceable></ReturnValue>
</TERM>
<LISTITEM>
<PARA>
A user-supplied function.
</PARA>
</LISTITEM>
</VARLISTENTRY>
</variablelist>
</REFSECT2>
<REFSECT2 ID="R2-SQL-CREATETRIGGER-2"> <variablelist>
<REFSECT2INFO> <varlistentry>
<DATE>1998-09-21</DATE> <term><replaceable class="parameter">name</replaceable></term>
</REFSECT2INFO> <listitem>
<TITLE> <para>
The name of an existing trigger.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">table</replaceable></term>
<listitem>
<para>
The name of a table.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">event</replaceable></term>
<listitem>
<para>
One of INSERT, DELETE or UPDATE.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">funcname</replaceable></term>
<listitem>
<para>
A user-supplied function.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
<refsect2 id="R2-SQL-CREATETRIGGER-2">
<refsect2info>
<date>1998-09-21</date>
</refsect2info>
<title>
Outputs Outputs
</TITLE> </title>
<PARA> <para>
<VARIABLELIST>
<VARLISTENTRY> <variablelist>
<TERM> <varlistentry>
<ReturnValue>CREATE</ReturnValue> <term><computeroutput>
</TERM> CREATE
<LISTITEM> </computeroutput></term>
<PARA> <listitem>
<para>
This message is returned if the trigger is successfully created. This message is returned if the trigger is successfully created.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</VARIABLELIST> </variablelist>
</para> </para>
</REFSECT2> </refsect2>
</REFSYNOPSISDIV> </refsynopsisdiv>
<REFSECT1 ID="R1-SQL-CREATETRIGGER-1"> <refsect1 id="R1-SQL-CREATETRIGGER-1">
<REFSECT1INFO> <refsect1info>
<DATE>1998-09-21</DATE> <date>1998-09-21</date>
</REFSECT1INFO> </refsect1info>
<TITLE> <title>
Description Description
</TITLE> </title>
<PARA> <para>
<command>CREATE TRIGGER</command> will enter a new trigger into the current <command>CREATE TRIGGER</command> will enter a new trigger into the current
data base. The trigger will be associated with the relation data base. The trigger will be associated with the relation
<replaceable class="parameter">relname</replaceable> and will execute <replaceable class="parameter">relname</replaceable> and will execute
the specified function <replaceable class="parameter">funcname</replaceable>. the specified function <replaceable class="parameter">funcname</replaceable>.
</PARA> </para>
<PARA> <para>
The trigger can be specified to fire either before the The trigger can be specified to fire either before the
operation is attempted on a tuple (before constraints operation is attempted on a tuple (before constraints
are checked and the INSERT, UPDATE or DELETE is attempted) or are checked and the INSERT, UPDATE or DELETE is attempted) or
@ -125,82 +118,84 @@ CREATE TRIGGER <REPLACEABLE CLASS="PARAMETER">name</REPLACEABLE> { BEFORE | AFTE
being inserted (for INSERT and UPDATE operations only). If being inserted (for INSERT and UPDATE operations only). If
the trigger fires after the event, all changes, including the the trigger fires after the event, all changes, including the
last insertion, update, or deletion, are "visible" to the trigger. last insertion, update, or deletion, are "visible" to the trigger.
</PARA> </para>
<PARA> <para>
Refer to the chapters on SPI and Triggers in the Refer to the chapters on SPI and Triggers in the
<citetitle>PostgreSQL Programmer's Guide</citetitle> for more <citetitle>PostgreSQL Programmer's Guide</citetitle> for more
information. information.
</PARA> </para>
<REFSECT2 ID="R2-SQL-CREATETRIGGER-3"> <refsect2 id="R2-SQL-CREATETRIGGER-3">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-21</DATE> <date>1998-09-21</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Notes Notes
</TITLE> </title>
<PARA> <para>
<command>CREATE TRIGGER</command> is a <productname>Postgres</productname> <command>CREATE TRIGGER</command> is a <productname>Postgres</productname>
language extension. language extension.
</PARA> </para>
<PARA> <para>
Only the relation owner may create a trigger on this relation. Only the relation owner may create a trigger on this relation.
</PARA> </para>
<PARA> <para>
As of the current release (v6.4), STATEMENT triggers are not implemented. As of the current release (v6.4), STATEMENT triggers are not implemented.
</PARA> </para>
<PARA> <para>
Refer to <command>DROP TRIGGER</command> for information on how to Refer to <command>DROP TRIGGER</command> for information on how to
remove triggers. remove triggers.
</PARA> </para>
</REFSECT2> </refsect2>
</refsect1> </refsect1>
<REFSECT1 ID="R1-SQL-CREATETRIGGER-2"> <refsect1 id="R1-SQL-CREATETRIGGER-2">
<TITLE> <title>
Usage Usage
</TITLE> </title>
<PARA> <para>
Check if the specified distributor code exists in the distributors Check if the specified distributor code exists in the distributors
table before appending or updating a row in the table films: table before appending or updating a row in the table films:
</PARA>
<ProgramListing> <programlisting>
CREATE TRIGGER if_dist_exists CREATE TRIGGER if_dist_exists
BEFORE INSERT OR UPDATE ON films FOR EACH ROW BEFORE INSERT OR UPDATE ON films FOR EACH ROW
EXECUTE PROCEDURE check_primary_key ('did', 'distributors', 'did'); EXECUTE PROCEDURE check_primary_key ('did', 'distributors', 'did');
</ProgramListing> </programlisting>
<PARA> </para>
<para>
Before cancelling a distributor or updating its code, remove every Before cancelling a distributor or updating its code, remove every
reference to the table films: reference to the table films:
</PARA> <programlisting>
<ProgramListing>
CREATE TRIGGER if_film_exists CREATE TRIGGER if_film_exists
BEFORE DELETE OR UPDATE ON distributors FOR EACH ROW BEFORE DELETE OR UPDATE ON distributors FOR EACH ROW
EXECUTE PROCEDURE check_foreign_key (1, 'CASCADE', 'did', 'films', 'did'); EXECUTE PROCEDURE check_foreign_key (1, 'CASCADE', 'did', 'films', 'did');
</ProgramListing> </programlisting>
</REFSECT1> </para>
</refsect1>
<REFSECT1 ID="R1-SQL-CREATETRIGGER-3"> <refsect1 id="R1-SQL-CREATETRIGGER-3">
<TITLE> <title>
Compatibility Compatibility
</TITLE> </title>
<PARA> <para>
</PARA> </para>
<REFSECT2 ID="R2-SQL-CREATETRIGGER-4"> <refsect2 id="R2-SQL-CREATETRIGGER-4">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-21</DATE> <date>1998-09-21</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
SQL92 SQL92
</TITLE> </title>
<PARA> <para>
There is no <command>CREATE TRIGGER</command> in <acronym>SQL92</acronym>. There is no <command>CREATE TRIGGER</command> in <acronym>SQL92</acronym>.
</PARA> </para>
<PARA>
<para>
The second example above may also be done by using a FOREIGN KEY The second example above may also be done by using a FOREIGN KEY
constraint as in: constraint as in:
</PARA>
<ProgramListing> <programlisting>
CREATE TABLE distributors ( CREATE TABLE distributors (
did DECIMAL(3), did DECIMAL(3),
name VARCHAR(40), name VARCHAR(40),
@ -208,19 +203,21 @@ CREATE TRIGGER <REPLACEABLE CLASS="PARAMETER">name</REPLACEABLE> { BEFORE | AFTE
FOREIGN KEY(did) REFERENCES films FOREIGN KEY(did) REFERENCES films
ON UPDATE CASCADE ON DELETE CASCADE ON UPDATE CASCADE ON DELETE CASCADE
); );
</ProgramListing> </programlisting>
<PARA> </para>
<para>
However, foreign keys are not yet implemented (as of version 6.4) in However, foreign keys are not yet implemented (as of version 6.4) in
<productname>Postgres</productname>. <productname>Postgres</productname>.
</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
sgml-omittag:t sgml-omittag:nil
sgml-shorttag:t sgml-shorttag:t
sgml-minimize-attributes:nil sgml-minimize-attributes:nil
sgml-always-quote-attributes:t sgml-always-quote-attributes:t

View File

@ -1,23 +1,23 @@
<REFENTRY ID="SQL-CREATETYPE"> <refentry id="SQL-CREATETYPE">
<REFMETA> <refmeta>
<REFENTRYTITLE> <refentrytitle>
CREATE TYPE CREATE TYPE
</REFENTRYTITLE> </refentrytitle>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO> <refmiscinfo>SQL - Language Statements</refmiscinfo>
</REFMETA> </refmeta>
<REFNAMEDIV> <refnamediv>
<REFNAME> <refname>
CREATE TYPE CREATE TYPE
</REFNAME> </refname>
<REFPURPOSE> <refpurpose>
Defines a new base data type Defines a new base data type
</REFPURPOSE> </refpurpose>
</refnamediv> </refnamediv>
<REFSYNOPSISDIV> <refsynopsisdiv>
<REFSYNOPSISDIVINFO> <refsynopsisdivinfo>
<DATE>1998-09-21</DATE> <date>1998-09-21</date>
</REFSYNOPSISDIVINFO> </refsynopsisdivinfo>
<SYNOPSIS> <synopsis>
CREATE TYPE <replaceable class="parameter">typename</replaceable> ( CREATE TYPE <replaceable class="parameter">typename</replaceable> (
INPUT = <replaceable class="parameter">input_function</replaceable> INPUT = <replaceable class="parameter">input_function</replaceable>
, OUTPUT = <replaceable class="parameter">output_function</replaceable> , OUTPUT = <replaceable class="parameter">output_function</replaceable>
@ -30,177 +30,158 @@ CREATE TYPE <replaceable class="parameter">typename</replaceable> (
[ , RECEIVE = <replaceable class="parameter">receive_function</replaceable> ] [ , RECEIVE = <replaceable class="parameter">receive_function</replaceable> ]
[ , PASSEDBYVALUE ] [ , PASSEDBYVALUE ]
) )
</SYNOPSIS> </synopsis>
<REFSECT2 ID="R2-SQL-CREATETYPE-1"> <refsect2 id="R2-SQL-CREATETYPE-1">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-21</DATE> <date>1998-09-21</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Inputs Inputs
</TITLE> </title>
<PARA> <para>
</PARA>
<VARIABLELIST> <variablelist>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="parameter">typename</replaceable></term>
<replaceable class="parameter">typename</replaceable> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
The name of a type to be created. The name of a type to be created.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term>INTERNALLENGTH <replaceable class="parameter">internallength</replaceable></term>
INTERNALLENGTH <replaceable class="parameter">internallength</replaceable> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
A literal value, which specifies the internal length of A literal value, which specifies the internal length of
the new type. the new type.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term>EXTERNALLENGTH <replaceable class="parameter">externallength</replaceable></term>
EXTERNALLENGTH <replaceable class="parameter">externallength</replaceable> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
A literal value, which specifies the external length of A literal value, which specifies the external length of
the new type. the new type.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term>INPUT <replaceable class="parameter">input_function</replaceable></term>
INPUT <replaceable class="parameter">input_function</replaceable> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
The name of a function, created by CREATE FUNCTION, which The name of a function, created by CREATE FUNCTION, which
converts data from its external form to the type's converts data from its external form to the type's
internal form. internal form.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term>OUTPUT <replaceable class="parameter">output_function</replaceable></term>
OUTPUT <replaceable class="parameter">output_function</replaceable> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
The name of a function, created by CREATE FUNCTION, which The name of a function, created by CREATE FUNCTION, which
converts data from its internal form to a form suitable converts data from its internal form to a form suitable
for display. for display.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="parameter">element</replaceable></term>
<replaceable class="parameter">element</replaceable> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
The type being created is an array; this specifies The type being created is an array; this specifies
the type of the array elements. the type of the array elements.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="parameter">delimiter</replaceable></term>
<replaceable class="parameter">delimiter</replaceable> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
The delimiter character for the array. The delimiter character for the array.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="parameter">default</replaceable></term>
<replaceable class="parameter">default</replaceable <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
The default text to be displayed to indicate "data The default text to be displayed to indicate "data
not present" not present"
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="parameter">send_function</replaceable></term>
<replaceable class="parameter">send_function</replaceable> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
The name of a function, created by CREATE FUNCTION, which The name of a function, created by CREATE FUNCTION, which
converts data of this type into a form suitable for converts data of this type into a form suitable for
transmission to another machine. transmission to another machine.
<comment>Is this right?</comment> <comment>Is this right?</comment>
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="parameter">receive_function</replaceable></term>
<replaceable class="parameter">receive_function</replaceable> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
The name of a function, created by CREATE FUNCTION, which The name of a function, created by CREATE FUNCTION, which
converts data of this type from a form suitable for converts data of this type from a form suitable for
transmission from another machine to internal form. transmission from another machine to internal form.
<comment>Is this right?</comment> <comment>Is this right?</comment>
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
</variablelist> </variablelist>
</REFSECT2> </para>
</refsect2>
<REFSECT2 ID="R2-SQL-CREATETYPE-2"> <refsect2 id="R2-SQL-CREATETYPE-2">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-21</DATE> <date>1998-09-21</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Outputs Outputs
</TITLE> </title>
<PARA> <para>
<VARIABLELIST> <variablelist>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
<ReturnValue>CREATE</ReturnValue> CREATE
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
Message returned if the type is successfully created. Message returned if the type is successfully created.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</VARIABLELIST> </variablelist>
</para> </para>
</REFSECT2> </refsect2>
</REFSYNOPSISDIV> </refsynopsisdiv>
<REFSECT1 ID="R1-SQL-CREATETYPE-1"> <refsect1 id="R1-SQL-CREATETYPE-1">
<REFSECT1INFO> <refsect1info>
<DATE>1998-09-21</DATE> <date>1998-09-21</date>
</REFSECT1INFO> </refsect1info>
<TITLE> <title>
Description Description
</TITLE> </title>
<PARA> <para>
CREATE TYPE allows the user to register a new user data <command>CREATE TYPE</command> allows the user to register a new user data
type with Postgres for use in the current data base. The type with Postgres for use in the current data base. The
user who defines a type becomes its owner. user who defines a type becomes its owner.
<replaceable class="parameter">Typename</replaceable> is <replaceable class="parameter">typename</replaceable> is
the name of the new type and must be unique within the the name of the new type and must be unique within the
types defined for this database. types defined for this database.
</para> </para>
<PARA> <para>
CREATE TYPE requires the registration of two functions <command>CREATE TYPE</command> requires the registration of two functions
(using create function) before defining the type. The (using create function) before defining the type. The
representation of a new base type is determined by representation of a new base type is determined by
<replaceable class="parameter">input_function</replaceable>, which <replaceable class="parameter">input_function</replaceable>, which
@ -212,7 +193,7 @@ EXTERNALLENGTH <replaceable class="parameter">externallength</replaceable>
the input and output functions must be declared to take the input and output functions must be declared to take
one or two arguments of type "<literal>opaque</literal>". one or two arguments of type "<literal>opaque</literal>".
</para> </para>
<PARA> <para>
New base data types can be fixed length, in which case New base data types can be fixed length, in which case
<replaceable class="parameter">internallength</replaceable> is a <replaceable class="parameter">internallength</replaceable> is a
positive integer, or variable length, positive integer, or variable length,
@ -221,33 +202,33 @@ EXTERNALLENGTH <replaceable class="parameter">externallength</replaceable>
as the Postgres-supplied data type, "<literal>text</literal>". as the Postgres-supplied data type, "<literal>text</literal>".
To indicate that a type is variable-length, set To indicate that a type is variable-length, set
<replaceable class="parameter">internallength</replaceable> <replaceable class="parameter">internallength</replaceable>
to VARIABLE. to <option>VARIABLE</option>.
The external representation is similarly specified using the The external representation is similarly specified using the
<replaceable class="parameter">externallength</replaceable> <replaceable class="parameter">externallength</replaceable>
keyword. keyword.
</para> </para>
<PARA> <para>
To indicate that a type is an array and to indicate that a To indicate that a type is an array and to indicate that a
type has array elements, indicate the type of the array type has array elements, indicate the type of the array
element using the element keyword. For example, to define element using the element keyword. For example, to define
an array of 4 byte integers ("int4"), specify an array of 4 byte integers ("int4"), specify
<programlisting>ELEMENT = int4</programlisting> <programlisting>ELEMENT = int4</programlisting>
</para> </para>
<PARA> <para>
To indicate the delimiter to be used on arrays of this To indicate the delimiter to be used on arrays of this
type, <replaceable class="parameter">delimiter</replaceable> type, <replaceable class="parameter">delimiter</replaceable>
can be can be
set to a specific character. The default delimiter is the comma set to a specific character. The default delimiter is the comma
("<literal>,</literal>"). ("<literal>,</literal>").
</para> </para>
<PARA> <para>
A default value is optionally available in case a user A default value is optionally available in case a user
wants some specific bit pattern to mean "data not present." wants some specific bit pattern to mean "data not present."
Specify the default with the DEFAULT keyword. Specify the default with the <literal>DEFAULT</literal> keyword.
<comment>How does the user specify that bit pattern and associate <comment>How does the user specify that bit pattern and associate
it with the fact that the data is not present></comment> it with the fact that the data is not present></comment>
</para> </para>
<PARA> <para>
The optional functions The optional functions
<replaceable class="parameter">send_function</replaceable> and <replaceable class="parameter">send_function</replaceable> and
<replaceable class="parameter">receive_function</replaceable> <replaceable class="parameter">receive_function</replaceable>
@ -265,25 +246,27 @@ it with the fact that the data is not present></comment>
characters do not have to be converted if passed from characters do not have to be converted if passed from
a Sun-4 to a DECstation, but many other types do. a Sun-4 to a DECstation, but many other types do.
</para> </para>
<PARA> <para>
The optional flag, PASSEDBYVALUE, indicates that operators The optional flag, <option>PASSEDBYVALUE</option>, indicates that operators
and functions which use this data type should be passed an and functions which use this data type should be passed an
argument by value rather than by reference. Note that you argument by value rather than by reference. Note that you
may not pass by value types whose internal representation is may not pass by value types whose internal representation is
more than four bytes. more than four bytes.
</para> </para>
<PARA> <para>
For new base types, a user can define operators, functions For new base types, a user can define operators, functions
and aggregates using the appropriate facilities described and aggregates using the appropriate facilities described
in this section. in this section.
</para> </para>
<refsect2> <refsect2>
<title>Array Types</title> <title>Array Types</title>
<para> <para>
Two generalized built-in functions, array_in and Two generalized built-in functions, array_in and
array_out, exist for quick creation of variable-length array_out, exist for quick creation of variable-length
array types. These functions operate on arrays of any array types. These functions operate on arrays of any
existing Postgres type.</para> existing Postgres type.
</para>
</refsect2> </refsect2>
<refsect2> <refsect2>
@ -307,32 +290,30 @@ it with the fact that the data is not present></comment>
</para> </para>
<programlisting> <programlisting>
CREATE TYPE box (INTERNALLENGTH = 8, CREATE TYPE box (INTERNALLENGTH = 8,
INPUT = my_procedure_1, OUTPUT = my_procedure_2) INPUT = my_procedure_1, OUTPUT = my_procedure_2);
CREATE TABLE myboxes (id INT4, description box);
CREATE TABLE myboxes (id INT4, description box)
</programlisting> </programlisting>
<para> <para>
This command creates a variable length array type with This command creates a variable length array type with
integer elements. integer elements.
</para>
<programlisting>
CREATE TYPE int4array
(INPUT = array_in, OUTPUT = array_out,
INTERNALLENGTH = VARIABLE, ELEMENT = int4)
CREATE TABLE myarrays (id int4, numbers int4array) <programlisting>
CREATE TYPE int4array (INPUT = array_in, OUTPUT = array_out,
INTERNALLENGTH = VARIABLE, ELEMENT = int4);
CREATE TABLE myarrays (id int4, numbers int4array);
</programlisting> </programlisting>
</para>
<para> <para>
This command creates a large object type and uses it in This command creates a large object type and uses it in
a class definition. a class definition:
</para>
<programlisting>
CREATE TYPE bigobj
(INPUT = lo_filein, OUTPUT = lo_fileout,
INTERNALLENGTH = VARIABLE)
CREATE TABLE big_objs (id int4, obj bigobj) <programlisting>
CREATE TYPE bigobj (INPUT = lo_filein, OUTPUT = lo_fileout,
INTERNALLENGTH = VARIABLE);
CREATE TABLE big_objs (id int4, obj bigobj);
</programlisting> </programlisting>
</para>
<refsect2> <refsect2>
<title>Restrictions</title> <title>Restrictions</title>
<para> <para>
@ -344,44 +325,43 @@ it with the fact that the data is not present></comment>
</para> </para>
</refsect2> </refsect2>
<REFSECT2 ID="R2-SQL-CREATETYPE-3"> <refsect2 id="R2-SQL-CREATETYPE-3">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-21</DATE> <date>1998-09-21</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Notes Notes
</TITLE> </title>
<PARA> <para>
Refer to <command>DROP TYPE</command> to remove an existing type. Refer to <command>DROP TYPE</command> to remove an existing type.
</PARA> </para>
<PARA> <para>
See also <command>CREATE FUNCTION</command>, See also <command>CREATE FUNCTION</command>,
<command>CREATE OPERATOR</command> and the chapter on Large Objects <command>CREATE OPERATOR</command> and the chapter on Large Objects
in the <citetitle>PostgreSQL Programmer's Guide</citetitle>. in the <citetitle>PostgreSQL Programmer's Guide</citetitle>.
</para> </para>
</REFSECT2> </refsect2>
</refsect1> </refsect1>
<REFSECT1 ID="R1-SQL-CREATETYPE-3"> <refsect1 id="R1-SQL-CREATETYPE-3">
<TITLE> <title>
Compatibility Compatibility
</TITLE> </title>
<REFSECT2 ID="R2-SQL-CREATETYPE-4"> <refsect2 id="R2-SQL-CREATETYPE-4">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-21</DATE> <date>1998-09-21</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
SQL3 SQL3
</TITLE> </title>
<PARA> <para>
<command>CREATE TYPE</command> is an <acronym>SQL3</acronym> statement. <command>CREATE TYPE</command> is an <acronym>SQL3</acronym> statement.
</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

View File

@ -36,9 +36,7 @@ CREATE USER<replaceable class="PARAMETER"> username</replaceable>
<para> <para>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term><replaceable class="parameter">username</replaceable></term>
<returnvalue><replaceable class="parameter">username</replaceable></returnvalue>
</term>
<listitem> <listitem>
<para> <para>
The name of the user. The name of the user.
@ -47,9 +45,7 @@ CREATE USER<replaceable class="PARAMETER"> username</replaceable>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><replaceable class="parameter">password</replaceable></term>
<returnvalue><replaceable class="parameter">password</replaceable></returnvalue>
</term>
<listitem> <listitem>
<para> <para>
The WITH PASSWORD clause sets the user's password within The WITH PASSWORD clause sets the user's password within
@ -81,9 +77,8 @@ CREATE USER<replaceable class="PARAMETER"> username</replaceable>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>CREATEDB</term>
<returnvalue> CREATEDB/NOCREATEDB</returnvalue> <term>NOCREATEDB</term>
</term>
<listitem> <listitem>
<para> <para>
These clauses define a user's ability to create databases. These clauses define a user's ability to create databases.
@ -96,9 +91,8 @@ CREATE USER<replaceable class="PARAMETER"> username</replaceable>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>CREATEUSER</term>
<returnvalue>CREATEUSER/NOCREATEUSER</returnvalue> <term>NOCREATEUSER</term>
</term>
<listitem> <listitem>
<para> <para>
These clauses determine whether a user will be permitted to These clauses determine whether a user will be permitted to
@ -111,9 +105,7 @@ CREATE USER<replaceable class="PARAMETER"> username</replaceable>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><replaceable class="parameter">groupname</replaceable></term>
<returnvalue><replaceable class="parameter">groupname</replaceable></returnvalue>
</term>
<listitem> <listitem>
<para> <para>
A name of a group into which to insert the user as a new member. A name of a group into which to insert the user as a new member.
@ -122,9 +114,7 @@ CREATE USER<replaceable class="PARAMETER"> username</replaceable>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><replaceable class="parameter">abstime</replaceable></term>
<returnvalue><replaceable class="parameter">abstime</replaceable></returnvalue>
</term>
<listitem> <listitem>
<para> <para>
The VALID UNTIL clause sets an absolute time after which the The VALID UNTIL clause sets an absolute time after which the
@ -155,29 +145,15 @@ CREATE USER<replaceable class="PARAMETER"> username</replaceable>
<para> <para>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term><computeroutput>
<returnvalue>CREATE USER</returnvalue> CREATE USER
</term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
Message returned if the command completes successfully. Message returned if the command completes successfully.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term>
<returnvalue>ERROR: removeUser: user "<replaceable
class="parameter">username</replaceable>" does not exist</returnvalue>
</term>
<listitem>
<para>
if "<replaceable class="parameter">username</replaceable>" not found.
</para>
<comment>I don't understand this and I don't know how to get
this error message.</comment>
</listitem>
</varlistentry>
</variablelist> </variablelist>
</para> </para>
</refsect2> </refsect2>
@ -196,19 +172,23 @@ CREATE USER<replaceable class="PARAMETER"> username</replaceable>
</para> </para>
<para> <para>
The new user will be given a <filename>usesysid</filename> of: The new user will be given a <filename>usesysid</filename> of:
'<command>SELECT MAX(usesysid) + 1 FROM pg_shadow</command>'.
<programlisting>
SELECT MAX(usesysid) + 1 FROM pg_shadow;
</programlisting>
This means that This means that
<productname>Postgres</productname> users' <filename>usesysid</filename>s will not <productname>Postgres</productname> users' <filename>usesysid</filename>s will not
correspond to their operating correspond to their operating
system(OS) user ids. The exception to this rule is system(OS) user ids. The exception to this rule is
the '<literal>postgres</literal>' user, whose OS user id the <literal>postgres</literal> superuser, whose OS user id
is used as the is used as the
<filename>usesysid</filename> during the initdb process. <filename>usesysid</filename> during the initdb process.
If you still want the If you still want the
OS user id and the <filename>usesysid</filename> to match OS user id and the <filename>usesysid</filename> to match
for any given user, for any given user,
use the "createuser" script provided with the <productname>Postgres</productname> use the <application>createuser</application> script provided with
distribution. the <productname>Postgres</productname> distribution.
</para> </para>
<refsect2 id="R2-SQL-CREATEUSER-3"> <refsect2 id="R2-SQL-CREATEUSER-3">
@ -219,11 +199,13 @@ CREATE USER<replaceable class="PARAMETER"> username</replaceable>
Notes Notes
</title> </title>
<para> <para>
CREATE USER statement is a <productname>Postgres</productname> language extension. <command>CREATE USER</command> statement is a
<productname>Postgres</productname> language extension.
</para> </para>
<para> <para>
Use DROP USER or ALTER USER statements to remove or modify a user Use <command>DROP USER</command> or <command>ALTER USER</command>
account.</para> statements to remove or modify a user account.
</para>
<para> <para>
Refer to the <filename>pg_shadow</filename> table for further information. Refer to the <filename>pg_shadow</filename> table for further information.
</para> </para>
@ -251,31 +233,37 @@ CREATE USER<replaceable class="PARAMETER"> username</replaceable>
</title> </title>
<para> <para>
Create a user with no password: Create a user with no password:
</para>
<programlisting> <programlisting>
CREATE USER jonathan CREATE USER jonathan
</programlisting> </programlisting>
</para>
<para> <para>
Create a user with a password: Create a user with a password:
</para>
<programlisting> <programlisting>
CREATE USER davide WITH PASSWORD jw8s0F4 CREATE USER davide WITH PASSWORD jw8s0F4
</programlisting> </programlisting>
</para>
<para> <para>
Create a user with a password, whose account is valid until the end of 2001. Create a user with a password, whose account is valid until the end of 2001.
Note that after one second has ticked in 2002, the account is not Note that after one second has ticked in 2002, the account is not
valid: valid:
</para>
<programlisting> <programlisting>
CREATE USER miriam WITH PASSWORD jw8s0F4 VALID UNTIL 'Jan 1 2002' CREATE USER miriam WITH PASSWORD jw8s0F4 VALID UNTIL 'Jan 1 2002'
</programlisting> </programlisting>
</para>
<para> <para>
Create an account where the user can create databases: Create an account where the user can create databases:
</para>
<programlisting> <programlisting>
CREATE USER manuel WITH PASSWORD jw8s0F4 CREATEDB CREATE USER manuel WITH PASSWORD jw8s0F4 CREATEDB
</programlisting> </programlisting>
</para>
</refsect1> </refsect1>
<refsect1 id="R1-SQL-CREATEUSER-3"> <refsect1 id="R1-SQL-CREATEUSER-3">
@ -293,7 +281,7 @@ CREATE USER<replaceable class="PARAMETER"> username</replaceable>
SQL92 SQL92
</title> </title>
<para> <para>
There is no CREATE USER statement in SQL92. There is no <command>CREATE USER</command> statement in SQL92.
</para> </para>
</refsect2> </refsect2>
</refsect1> </refsect1>

View File

@ -1,101 +1,95 @@
<REFENTRY ID="SQL-CREATEVIEW"> <refentry id="SQL-CREATEVIEW">
<REFMETA> <refmeta>
<REFENTRYTITLE> <refentrytitle>
CREATE VIEW CREATE VIEW
</REFENTRYTITLE> </refentrytitle>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO> <refmiscinfo>SQL - Language Statements</refmiscinfo>
</REFMETA> </refmeta>
<REFNAMEDIV> <refnamediv>
<REFNAME> <refname>
CREATE VIEW CREATE VIEW
</REFNAME> </refname>
<REFPURPOSE> <refpurpose>
Constructs a virtual table Constructs a virtual table
</REFPURPOSE> </refpurpose>
</refnamediv> </refnamediv>
<REFSYNOPSISDIV> <refsynopsisdiv>
<REFSYNOPSISDIVINFO> <refsynopsisdivinfo>
<DATE>1998-09-21</DATE> <date>1998-09-21</date>
</REFSYNOPSISDIVINFO> </refsynopsisdivinfo>
<SYNOPSIS> <synopsis>
CREATE VIEW <REPLACEABLE CLASS="PARAMETER">view</REPLACEABLE> CREATE VIEW <replaceable class="PARAMETER">view</replaceable>
AS SELECT <REPLACEABLE CLASS="PARAMETER">query</REPLACEABLE> AS SELECT <replaceable class="PARAMETER">query</replaceable>
</SYNOPSIS> </synopsis>
<REFSECT2 ID="R2-SQL-CREATEVIEW-1"> <refsect2 id="R2-SQL-CREATEVIEW-1">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-21</DATE> <date>1998-09-21</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Inputs Inputs
</TITLE> </title>
<PARA> <para>
<VARIABLELIST> <variablelist>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="parameter">view</replaceable></term>
<ReturnValue><replaceable class="parameter">view</replaceable></ReturnValue> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
The name of a view to be created. The name of a view to be created.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="parameter">query</replaceable></term>
<ReturnValue><replaceable class="parameter">query</replaceable></ReturnValue> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
An SQL query which will provide the columns and rows of the view. An SQL query which will provide the columns and rows of the view.
</PARA> </para>
<PARA> <para>
Refer to the SELECT statement for more information Refer to the SELECT statement for more information
about valid arguments. about valid arguments.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
</variablelist> </variablelist>
</para> </para>
</REFSECT2> </refsect2>
<REFSECT2 ID="R2-SQL-CREATEVIEW-2"> <refsect2 id="R2-SQL-CREATEVIEW-2">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-21</DATE> <date>1998-09-21</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Outputs Outputs
</TITLE> </title>
<PARA> <para>
<VARIABLELIST> <variablelist>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
<ReturnValue>CREATE</ReturnValue> CREATE
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
The message returned if the view is successfully created. The message returned if the view is successfully created.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
<ReturnValue> ERROR: Relation '<replaceable class="parameter">view</replaceable>' already exists
WARN amcreate: "<replaceable class="parameter">view</replaceable>" relation already exists </computeroutput></term>
</ReturnValue> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
This error occurs if the view specified already exists in the database. This error occurs if the view specified already exists in the database.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
<ReturnValue>NOTICE create: attribute named "<replaceable class="parameter">column</replaceable>" has an unknown type</ReturnValue> NOTICE create: attribute named "<replaceable class="parameter">column</replaceable>" has an unknown type
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
The view will be created having a column with an unknown type The view will be created having a column with an unknown type
if you do not specify it. For example, the following command gives if you do not specify it. For example, the following command gives
an error: an error:
@ -109,58 +103,58 @@ An SQL query which will provide the columns and rows of the view.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</VARIABLELIST> </variablelist>
</para> </para>
</REFSECT2> </refsect2>
</REFSYNOPSISDIV> </refsynopsisdiv>
<REFSECT1 ID="R1-SQL-CREATEVIEW-1"> <refsect1 id="R1-SQL-CREATEVIEW-1">
<REFSECT1INFO> <refsect1info>
<DATE>1998-09-21</DATE> <date>1998-09-21</date>
</REFSECT1INFO> </refsect1info>
<TITLE> <title>
Description Description
</TITLE> </title>
<PARA> <para>
CREATE VIEW will define a view of a table. This view is <command>CREATE VIEW</command> will define a view of a table. This view is
not physically materialized. Specifically, a query not physically materialized. Specifically, a query
rewrite retrieve rule is automatically generated rewrite retrieve rule is automatically generated
to support retrieve operations on views. to support retrieve operations on views.
</PARA> </para>
<REFSECT2 ID="R2-SQL-CREATEVIEW-3"> <refsect2 id="R2-SQL-CREATEVIEW-3">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-21</DATE> <date>1998-09-21</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Notes Notes
</TITLE> </title>
<PARA> <para>
Use the DROP VIEW statement to drop views. Use the <command>DROP VIEW</command> statement to drop views.
</PARA> </para>
</refsect2> </refsect2>
<REFSECT2 ID="R2-SQL-CREATEVIEW-4"> <refsect2 id="R2-SQL-CREATEVIEW-4">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-21</DATE> <date>1998-09-21</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Bugs Bugs
</TITLE> </title>
<para> <para>
Currently, views are read only. Currently, views are read only.
</para> </para>
</REFSECT2> </refsect2>
</refsect1> </refsect1>
<REFSECT1 ID="R1-SQL-CREATEVIEW-2"> <refsect1 id="R1-SQL-CREATEVIEW-2">
<TITLE> <title>
Usage Usage
</TITLE> </title>
<PARA> <para>
Create a view consisting of all Comedy films: Create a view consisting of all Comedy films:
</PARA>
<ProgramListing> <programlisting>
CREATE VIEW kinds AS CREATE VIEW kinds AS
SELECT * SELECT *
FROM films FROM films
@ -172,89 +166,77 @@ code |title |did| date_prod|kind |len
-----+-------------------------+---+----------+----------+------ -----+-------------------------+---+----------+----------+------
UA502|Bananas |105|1971-07-13|Comedy | 01:22 UA502|Bananas |105|1971-07-13|Comedy | 01:22
C_701|There's a Girl in my Soup|107|1970-06-11|Comedy | 01:36 C_701|There's a Girl in my Soup|107|1970-06-11|Comedy | 01:36
</ProgramListing> </programlisting>
</para>
</refsect1>
</REFSECT1> <refsect1 id="R1-SQL-CREATEVIEW-3">
<title>
<REFSECT1 ID="R1-SQL-CREATEVIEW-3">
<TITLE>
Compatibility Compatibility
</TITLE> </title>
<PARA> <para>
</PARA> </para>
<REFSECT2 ID="R2-SQL-CREATEVIEW-5"> <refsect2 id="R2-SQL-CREATEVIEW-5">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-21</DATE> <date>1998-09-21</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
SQL92 SQL92
</TITLE> </title>
<PARA> <para>
SQL92 specifies some additional capabilities for the CREATE VIEW statement: SQL92 specifies some additional capabilities for the
</PARA> <command>CREATE VIEW</command> statement:
</para>
<synopsis> <synopsis>
CREATE VIEW <replaceable class="parameter">view</replaceable> [ <replaceable class="parameter">column</replaceable> [, ...] ] CREATE VIEW <replaceable class="parameter">view</replaceable> [ <replaceable class="parameter">column</replaceable> [, ...] ]
AS SELECT <replaceable class="parameter">expression</replaceable> [ AS <replaceable class="parameter">colname</replaceable> ] [, ...] AS SELECT <replaceable class="parameter">expression</replaceable> [ AS <replaceable class="parameter">colname</replaceable> ] [, ...]
FROM <replaceable class="parameter">table</replaceable> FROM <replaceable class="parameter">table</replaceable> [ WHERE <replaceable class="parameter">condition</replaceable> ]
[ WHERE <replaceable class="parameter">condition</replaceable> ]
[ WITH [ CASCADE | LOCAL ] CHECK OPTION ] [ WITH [ CASCADE | LOCAL ] CHECK OPTION ]
</synopsis> </synopsis>
<VARIABLELIST> <para>
<VARLISTENTRY> The optional clauses for the full SQL92 command are:
<TERM>
</TERM> <variablelist>
<LISTITEM> <varlistentry>
<PARA> <term>CHECK OPTION</term>
<VARIABLELIST> <listitem>
<VARLISTENTRY> <para>
<TERM> This option is to do with updatable views.
CHECK OPTION
</TERM>
<LISTITEM>
<PARA> This option is to do with updatable views.
All INSERTs and UPDATEs on the view will be All INSERTs and UPDATEs on the view will be
checked to ensure data satisfy the view-defining checked to ensure data satisfy the view-defining
condition. If they do not, the update will be rejected. condition. If they do not, the update will be rejected.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term>LOCAL</term>
LOCAL <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
Check for integrity on this view. Check for integrity on this view.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term>CASCADE</term>
CASCADE <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
Check for integrity on this view and on any dependent Check for integrity on this view and on any dependent
view. CASCADE is assumed if neither CASCADE nor LOCAL is specified. view. CASCADE is assumed if neither CASCADE nor LOCAL is specified.
</PARA>
</LISTITEM>
</VARLISTENTRY>
</variablelist>
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</variablelist> </variablelist>
</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
sgml-omittag:t sgml-omittag:nil
sgml-shorttag:t sgml-shorttag:t
sgml-minimize-attributes:nil sgml-minimize-attributes:nil
sgml-always-quote-attributes:t sgml-always-quote-attributes:t

View File

@ -1,56 +1,51 @@
<REFENTRY ID="APP-CREATEDB"> <refentry id="APP-CREATEDB">
<REFMETA> <refmeta>
<REFENTRYTITLE> <refentrytitle>
<application>createdb</application> <application>createdb</application>
</REFENTRYTITLE> </refentrytitle>
<REFMISCINFO>Application</REFMISCINFO> <refmiscinfo>Application</refmiscinfo>
</REFMETA> </refmeta>
<REFNAMEDIV> <refnamediv>
<REFNAME> <refname>
<application>createdb</application> <application>createdb</application>
</REFNAME> </refname>
<REFPURPOSE> <refpurpose>
Create a new <productname>Postgres</productname> database Create a new <productname>Postgres</productname> database
</REFPURPOSE> </refpurpose>
</refnamediv> </refnamediv>
<REFSYNOPSISDIV> <refsynopsisdiv>
<REFSYNOPSISDIVINFO> <refsynopsisdivinfo>
<DATE>1998-10-02</DATE> <date>1998-10-02</date>
</REFSYNOPSISDIVINFO> </refsynopsisdivinfo>
<SYNOPSIS> <synopsis>
createdb [ <replaceable class="parameter">dbname</replaceable> ] createdb [ <replaceable class="parameter">dbname</replaceable> ]
createdb [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replaceable class="parameter">port</replaceable> ] createdb [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replaceable class="parameter">port</replaceable> ]
[ -D <replaceable class="parameter">datadir</replaceable> ] [ -D <replaceable class="parameter">datadir</replaceable> ] [ -u ] [ <replaceable class="parameter">dbname</replaceable> ]
[ -u ] [ <replaceable class="parameter">dbname</replaceable> ] </synopsis>
</SYNOPSIS>
<REFSECT2 ID="R2-APP-CREATEDB-1"> <refsect2 id="R2-APP-CREATEDB-1">
<REFSECT2INFO> <refsect2info>
<DATE>1998-10-02</DATE> <date>1998-10-02</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Inputs Inputs
</TITLE> </title>
<PARA> <para>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term>-h <replaceable class="parameter">host</replaceable></term>
-h <replaceable class="parameter">host</replaceable>
</term>
<listitem> <listitem>
<para> <para>
Specifies the hostname of the machine on which the Specifies the hostname of the machine on which the
<application>postmaster</application> <application>postmaster</application>
is running. Defaults to using a local Unix domain socket is running. Defaults to using a local Unix domain socket
rather than an IP connection.. rather than an IP connection.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-p <replaceable class="parameter">port</replaceable></term>
-p <replaceable class="parameter">port</replaceable>
</term>
<listitem> <listitem>
<para> <para>
Specifies the Internet TCP/IP port or local Unix domain socket file Specifies the Internet TCP/IP port or local Unix domain socket file
@ -63,9 +58,7 @@
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-u</term>
-u
</term>
<listitem> <listitem>
<para> <para>
Use password authentication. Use password authentication.
@ -77,9 +70,7 @@
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-D <replaceable class="parameter">datadir</replaceable></term>
-D <replaceable class="parameter">datadir</replaceable>
</term>
<listitem> <listitem>
<para> <para>
Specifies the alternate database location for this database installation. Specifies the alternate database location for this database installation.
@ -90,9 +81,7 @@
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><replaceable class="parameter">dbname</replaceable></term>
<replaceable class="parameter">dbname</replaceable>
</term>
<listitem> <listitem>
<para> <para>
Specifies the name of the database to be created. The name must be Specifies the name of the database to be created. The name must be
@ -109,26 +98,25 @@
</para> </para>
</refsect2> </refsect2>
<REFSECT2 ID="R2-APP-CREATEDB-2"> <refsect2 id="R2-APP-CREATEDB-2">
<REFSECT2INFO> <refsect2info>
<DATE>1998-10-02</DATE> <date>1998-10-02</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Outputs Outputs
</TITLE> </title>
<PARA> <para>
<application>createdb</application> will create files in the <application>createdb</application> will create files in the
<filename><envar>PGDATA</envar>/<replaceable class="parameter">dbname</replaceable>/</filename> <filename><envar>PGDATA</envar>/<replaceable class="parameter">dbname</replaceable>/</filename>
data area for the new database. data area for the new database.
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term><computeroutput>
Connection to database 'template1' failed. Connection to database 'template1' failed.
connectDB() failed: Is the postmaster running and accepting connections connectDB() failed: Is the postmaster running and accepting connections at 'UNIX Socket' on port '<replaceable class="parameter">port</replaceable>'?
at 'UNIX Socket' on port '<replaceable class="parameter">port</replaceable>'?
createdb: database creation failed on <replaceable class="parameter">dbname</replaceable>. createdb: database creation failed on <replaceable class="parameter">dbname</replaceable>.
</term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
<application>createdb</application> could not attach to the <application>createdb</application> could not attach to the
@ -143,11 +131,11 @@
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><computeroutput>
Connection to database 'template1' failed. Connection to database 'template1' failed.
FATAL 1: SetUserId: user '<replaceable class="parameter">username</replaceable>' is not in 'pg_shadow' FATAL 1: SetUserId: user '<replaceable class="parameter">username</replaceable>' is not in 'pg_shadow'
createdb: database creation failed on <replaceable class="parameter">dbname</replaceable>. createdb: database creation failed on <replaceable class="parameter">dbname</replaceable>.
</term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
You do not have a valid entry in the relation <literal>pg_shadow</literal> You do not have a valid entry in the relation <literal>pg_shadow</literal>
@ -158,10 +146,10 @@
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><computeroutput>
ERROR: user '<replaceable class="parameter">username</replaceable>' is not allowed to create/destroy databases ERROR: user '<replaceable class="parameter">username</replaceable>' is not allowed to create/destroy databases
createdb: database creation failed on <replaceable class="parameter">dbname</replaceable>. createdb: database creation failed on <replaceable class="parameter">dbname</replaceable>.
</term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
You do not have permission to create new databases. You do not have permission to create new databases.
@ -171,10 +159,10 @@
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><computeroutput>
ERROR: createdb: database '<replaceable class="parameter">dbname</replaceable>' already exists. ERROR: createdb: database '<replaceable class="parameter">dbname</replaceable>' already exists.
createdb: database creation failed on <replaceable class="parameter">dbname</replaceable>. createdb: database creation failed on <replaceable class="parameter">dbname</replaceable>.
</term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
The database already exists. The database already exists.
@ -183,9 +171,9 @@
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><computeroutput>
createdb: database creation failed on <replaceable class="parameter">dbname</replaceable>. createdb: database creation failed on <replaceable class="parameter">dbname</replaceable>.
</term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
An internal error occurred in <application>psql</application> An internal error occurred in <application>psql</application>
@ -201,21 +189,21 @@
<note> <note>
<para> <para>
<application>createdb</application> internally runs <application>createdb</application> internally runs
CREATE DATABASE from <application>psql</application> <command>CREATE DATABASE</command> from <application>psql</application>
while connected to the <literal>template1</literal> database. while connected to the <literal>template1</literal> database.
</para> </para>
</note> </note>
</refsect2> </refsect2>
</refsynopsisdiv> </refsynopsisdiv>
<REFSECT1 ID="R1-APP-CREATEDB-1"> <refsect1 id="R1-APP-CREATEDB-1">
<REFSECT1INFO> <refsect1info>
<DATE>1998-10-02</DATE> <date>1998-10-02</date>
</REFSECT1INFO> </refsect1info>
<TITLE> <title>
Description Description
</TITLE> </title>
<PARA> <para>
<application>createdb</application> creates a new <application>createdb</application> creates a new
<productname>Postgres</productname> database. <productname>Postgres</productname> database.
The person who executes this command becomes The person who executes this command becomes
@ -236,31 +224,51 @@
<envar>PGREALM</envar> <envar>PGREALM</envar>
environment variables will be passed on to environment variables will be passed on to
<application>psql</application> <application>psql</application>
and processed as described in <xref linkend="app-psql" endterm="psql-ref">. and processed as described in <xref endterm="psql-ref"
linkend="app-psql">.
</para> </para>
</refsect1> </refsect1>
<REFSECT1 ID="R1-APP-CREATEDB-2"> <refsect1 id="R1-APP-CREATEDB-2">
<REFSECT1INFO> <refsect1info>
<DATE>1998-10-02</DATE> <date>1998-10-02</date>
</REFSECT1INFO> </refsect1info>
<TITLE> <title>
Usage Usage
</TITLE> </title>
<PARA> <para>
To create the database <literal>demo</literal> To create the database <literal>demo</literal>
using the postmaster on the local host, port 5432: using the postmaster on the local host, port 5432:
<programlisting> <programlisting>
createdb demo $ createdb demo
</programlisting> </programlisting>
</para>
<para>
To create the database <literal>demo</literal> To create the database <literal>demo</literal>
using the postmaster on host eden, port 5000: using the postmaster on host eden, port 5000:
<programlisting> <programlisting>
createdb -p 5000 -h eden demo $ createdb -p 5000 -h eden demo
</programlisting> </programlisting>
</para> </para>
</refsect1> </refsect1>
</REFENTRY> </refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:nil
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../reference.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:"/usr/lib/sgml/catalog"
sgml-local-ecat-files:nil
End:
-->

View File

@ -1,57 +1,53 @@
<REFENTRY ID="APP-CREATEUSER"> <refentry id="APP-CREATEUSER">
<REFMETA> <refmeta>
<REFENTRYTITLE> <refentrytitle>
<application>createuser</application> <application>createuser</application>
</REFENTRYTITLE> </refentrytitle>
<REFMISCINFO>Application</REFMISCINFO> <refmiscinfo>Application</refmiscinfo>
</REFMETA> </refmeta>
<REFNAMEDIV> <refnamediv>
<REFNAME> <refname>
<application>createuser</application> <application>createuser</application>
</REFNAME> </refname>
<REFPURPOSE> <refpurpose>
Create a new <productname>Postgres</productname> user Create a new <productname>Postgres</productname> user
</REFPURPOSE> </refpurpose>
</refnamediv> </refnamediv>
<REFSYNOPSISDIV> <refsynopsisdiv>
<REFSYNOPSISDIVINFO> <refsynopsisdivinfo>
<DATE>1998-10-02</DATE> <date>1998-10-02</date>
</REFSYNOPSISDIVINFO> </refsynopsisdivinfo>
<SYNOPSIS> <synopsis>
createuser [ <replaceable class="parameter">username</replaceable> ] createuser [ <replaceable class="parameter">username</replaceable> ]
createuser [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replaceable class="parameter">port</replaceable> ] createuser [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replaceable class="parameter">port</replaceable> ]
[ -i <replaceable class="parameter">userid</replaceable> ] [ -i <replaceable class="parameter">userid</replaceable> ] [ -d | -D ] [ -u | -U ]
[ -d | -D ] [ -u | -U ] [ <replaceable class="parameter">username</replaceable> ] [ <replaceable class="parameter">username</replaceable> ]
</SYNOPSIS> </synopsis>
<REFSECT2 ID="R2-APP-CREATEUSER-1"> <refsect2 id="R2-APP-CREATEUSER-1">
<REFSECT2INFO> <refsect2info>
<DATE>1998-10-02</DATE> <date>1998-10-02</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Inputs Inputs
</TITLE> </title>
<PARA> <para>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term>-h <replaceable class="parameter">host</replaceable></term>
-h <replaceable class="parameter">host</replaceable>
</term>
<listitem> <listitem>
<para> <para>
Specifies the hostname of the machine on which the Specifies the hostname of the machine on which the
<application>postmaster</application> <application>postmaster</application>
is running. Defaults to using a local Unix domain socket is running. Defaults to using a local Unix domain socket
rather than an IP connection.. rather than an IP connection.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-p <replaceable class="parameter">port</replaceable></term>
-p <replaceable class="parameter">port</replaceable>
</term>
<listitem> <listitem>
<para> <para>
Specifies the Internet TCP/IP port or local Unix domain socket file Specifies the Internet TCP/IP port or local Unix domain socket file
@ -64,9 +60,7 @@ createuser [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replac
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-d</term>
-d
</term>
<listitem> <listitem>
<para> <para>
Allows the user to create databases. Allows the user to create databases.
@ -75,9 +69,7 @@ createuser [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replac
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-D</term>
-D
</term>
<listitem> <listitem>
<para> <para>
Forbids the user to create databases. Forbids the user to create databases.
@ -86,13 +78,12 @@ createuser [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replac
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-i <replaceable class="parameter">userid</replaceable></term>
-i <replaceable class="parameter">userid</replaceable>
</term>
<listitem> <listitem>
<para> <para>
Specifies the numeric identifier to be associated with this user. Specifies the numeric identifier to be associated with this user.
This identifier must be unique among all <productname>Postgres</productname> users, and is not required This identifier must be unique among all
<productname>Postgres</productname> users, and is not required
to match the operating system UID. to match the operating system UID.
You will be prompted for an identifier if none is specified on the command line, You will be prompted for an identifier if none is specified on the command line,
and it will suggest an identifier matching the UID. and it will suggest an identifier matching the UID.
@ -101,9 +92,7 @@ createuser [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replac
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-u</term>
-u
</term>
<listitem> <listitem>
<para> <para>
Allows the user to create other users. Allows the user to create other users.
@ -112,9 +101,7 @@ createuser [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replac
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-U</term>
-U
</term>
<listitem> <listitem>
<para> <para>
Forbids the user to create other users. Forbids the user to create other users.
@ -123,9 +110,7 @@ createuser [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replac
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><replaceable class="parameter">username</replaceable></term>
<replaceable class="parameter">username</replaceable>
</term>
<listitem> <listitem>
<para> <para>
Specifies the name of the <productname>Postgres</productname> user to be created. Specifies the name of the <productname>Postgres</productname> user to be created.
@ -134,30 +119,28 @@ createuser [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replac
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</variablelist> </variablelist>
</para> </para>
</refsect2> </refsect2>
<REFSECT2 ID="R2-APP-CREATEUSER-2"> <refsect2 id="R2-APP-CREATEUSER-2">
<REFSECT2INFO> <refsect2info>
<DATE>1998-10-02</DATE> <date>1998-10-02</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Outputs Outputs
</TITLE> </title>
<PARA> <para>
<application>createuser</application> will add an entry in the <application>createuser</application> will add an entry in the
<literal>pg_user</literal> or <literal>pg_shadow</literal> system table. <literal>pg_user</literal> or <literal>pg_shadow</literal> system table.
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term><computeroutput>
Connection to database 'template1' failed. Connection to database 'template1' failed.
connectDB() failed: Is the postmaster running and accepting connections connectDB() failed: Is the postmaster running and accepting connections at 'UNIX Socket' on port '<replaceable class="parameter">port</replaceable>'?
at 'UNIX Socket' on port '<replaceable class="parameter">port</replaceable>'?
createuser: database access failed. createuser: database access failed.
</term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
<application>createuser</application> could not attach to the <application>createuser</application> could not attach to the
@ -172,11 +155,11 @@ createuser [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replac
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><computeroutput>
Connection to database 'template1' failed. Connection to database 'template1' failed.
FATAL 1: SetUserId: user '<replaceable class="parameter">username</replaceable>' is not in 'pg_shadow' FATAL 1: SetUserId: user '<replaceable class="parameter">username</replaceable>' is not in 'pg_shadow'
createuser: database access failed. createuser: database access failed.
</term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
You do not have a valid entry in the relation <literal>pg_shadow</literal> You do not have a valid entry in the relation <literal>pg_shadow</literal>
@ -187,9 +170,9 @@ createuser [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replac
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><computeroutput>
createuser: <replaceable class="parameter">username</replaceable> cannot create users. createuser: <replaceable class="parameter">username</replaceable> cannot create users.
</term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
You do not have permission to create new users; contact your You do not have permission to create new users; contact your
@ -199,21 +182,21 @@ createuser [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replac
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><computeroutput>
createuser: user "<replaceable class="parameter">username</replaceable>" already exists createuser: user "<replaceable class="parameter">username</replaceable>" already exists
</term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
The user to be added already has an entry in the <literal>pg_shadow</literal> The user to be added already has an entry in the
class. <literal>pg_shadow</literal> class.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><computeroutput>
database access failed database access failed
</term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
An internal error occurred in <application>psql</application> An internal error occurred in <application>psql</application>
@ -223,28 +206,27 @@ createuser [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replac
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</variablelist> </variablelist>
</para> </para>
<note> <note>
<para> <para>
<application>createuser</application> internally runs <application>createuser</application> internally runs
CREATE USER from <application>psql</application> <command>CREATE USER</command> from <application>psql</application>
while connected to the <literal>template1</literal> database. while connected to the <literal>template1</literal> database.
</para> </para>
</note> </note>
</refsect2> </refsect2>
</refsynopsisdiv> </refsynopsisdiv>
<REFSECT1 ID="R1-APP-CREATEUSER-1"> <refsect1 id="R1-APP-CREATEUSER-1">
<REFSECT1INFO> <refsect1info>
<DATE>1998-10-02</DATE> <date>1998-10-02</date>
</REFSECT1INFO> </refsect1info>
<TITLE> <title>
Description Description
</TITLE> </title>
<PARA> <para>
<application>createuser</application> creates a <application>createuser</application> creates a
new <productname>Postgres</productname> user. new <productname>Postgres</productname> user.
Only users with <literal>usesuper</literal> set in Only users with <literal>usesuper</literal> set in
@ -264,13 +246,15 @@ createuser [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replac
<envar>PGREALM</envar> <envar>PGREALM</envar>
environment variables will be passed on to environment variables will be passed on to
<application>psql</application> <application>psql</application>
and processed as described in <xref linkend="app-psql" endterm="psql-ref">. and processed as described in <xref endterm="psql-ref" linkend="app-psql">.
</para>
<para>
Once invoked, <application>createuser</application> Once invoked, <application>createuser</application>
will ask a series of questions to obtain parameters not specified on will ask a series of questions to obtain parameters not specified on
the command line. The new user's database login name and a numeric the command line. The new user's database login name and a numeric
user identifier must be specified. user identifier must be specified.
</para>
<note> <note>
<para> <para>
The <productname>Postgres</productname> user identifier The <productname>Postgres</productname> user identifier
@ -278,6 +262,7 @@ createuser [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replac
they are assigned to be the same. they are assigned to be the same.
</para> </para>
</note> </note>
</para>
<para> <para>
You must also describe the privileges of the new user for security purposes. You must also describe the privileges of the new user for security purposes.
@ -287,4 +272,21 @@ createuser [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replac
is allowed to create other new users. is allowed to create other new users.
</para> </para>
</refsect1> </refsect1>
</REFENTRY> </refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:nil
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../reference.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:"/usr/lib/sgml/catalog"
sgml-local-ecat-files:nil
End:
-->

View File

@ -1,207 +1,192 @@
<REFENTRY ID="SQL-DECLARE"> <refentry id="SQL-DECLARE">
<REFMETA> <refmeta>
<REFENTRYTITLE> <refentrytitle>
DECLARE DECLARE
</REFENTRYTITLE> </refentrytitle>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO> <refmiscinfo>SQL - Language Statements</refmiscinfo>
</REFMETA> </refmeta>
<REFNAMEDIV> <refnamediv>
<REFNAME> <refname>
DECLARE DECLARE
</REFNAME> </refname>
<REFPURPOSE> <refpurpose>
Defines a cursor for table access Defines a cursor for table access
</REFPURPOSE> </refpurpose>
</refnamediv> </refnamediv>
<REFSYNOPSISDIV> <refsynopsisdiv>
<REFSYNOPSISDIVINFO> <refsynopsisdivinfo>
<DATE>1998-09-04</DATE> <date>1998-09-04</date>
</REFSYNOPSISDIVINFO> </refsynopsisdivinfo>
<SYNOPSIS> <synopsis>
DECLARE <replaceable class="parameter">cursor</replaceable> [ BINARY ] [ INSENSITIVE ] [ SCROLL ] DECLARE <replaceable class="parameter">cursor</replaceable> [ BINARY ] [ INSENSITIVE ] [ SCROLL ]
CURSOR FOR <replaceable class="parameter">query</replaceable> CURSOR FOR <replaceable class="parameter">query</replaceable>
[ FOR { READ ONLY | UPDATE [ OF <replaceable class="parameter">column</replaceable> [, ...] ] ] [ FOR { READ ONLY | UPDATE [ OF <replaceable class="parameter">column</replaceable> [, ...] ] ]
</SYNOPSIS> </synopsis>
<REFSECT2 ID="R2-SQL-DECLARE-1"> <refsect2 id="R2-SQL-DECLARE-1">
<REFSECT2INFO> <refsect2info>
<DATE>1998-04-15</DATE> <date>1998-04-15</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Inputs Inputs
</TITLE> </title>
<PARA> <para>
</PARA> <variablelist>
<VARIABLELIST> <varlistentry>
<VARLISTENTRY> <term><replaceable class="parameter">cursor</replaceable></term>
<TERM> <listitem>
<replaceable class="parameter">cursor</replaceable> <para>
</TERM>
<LISTITEM>
<PARA>
The name of the cursor to be used in subsequent FETCH operations.. The name of the cursor to be used in subsequent FETCH operations..
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term>BINARY</term>
BINARY <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
Causes the cursor to fetch data in binary Causes the cursor to fetch data in binary
rather than in text format. rather than in text format.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term>INSENSITIVE</term>
INSENSITIVE <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
<acronym>SQL92</acronym> keyword indicating that data retrieved <acronym>SQL92</acronym> keyword indicating that data retrieved
from the cursor should be unaffected by updates from other processes or cursors. from the cursor should be unaffected by updates from other processes or cursors.
Since cursor operations occur within transactions Since cursor operations occur within transactions
in <productname>Postgres</productname> this is always the case. in <productname>Postgres</productname> this is always the case.
This keyword has no effect. This keyword has no effect.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term>SCROLL</term>
SCROLL <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
<acronym>SQL92</acronym> keyword indicating that data may be retrieved <acronym>SQL92</acronym> keyword indicating that data may be retrieved
in multiple rows per FETCH operation. Since this is allowed at all times in multiple rows per FETCH operation. Since this is allowed at all times
by <productname>Postgres</productname> this keyword has no effect. by <productname>Postgres</productname> this keyword has no effect.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="parameter">query</replaceable></term>
<replaceable class="parameter">query</replaceable> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
An SQL query which will provide the rows to be governed by the An SQL query which will provide the rows to be governed by the
cursor. cursor.
Refer to the SELECT statement for further information about Refer to the SELECT statement for further information about
valid arguments. valid arguments.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term>READ ONLY</term>
READ ONLY <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
<acronym>SQL92</acronym> keyword indicating that the cursor will be used <acronym>SQL92</acronym> keyword indicating that the cursor will be used
in a readonly mode. Since this is the only cursor access mode in a readonly mode. Since this is the only cursor access mode
available in <productname>Postgres</productname> this keyword has no effect. available in <productname>Postgres</productname> this keyword has no effect.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term>UPDATE</term>
UPDATE <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
<acronym>SQL92</acronym> keyword indicating that the cursor will be used <acronym>SQL92</acronym> keyword indicating that the cursor will be used
to update tables. Since cursor updates are not currently to update tables. Since cursor updates are not currently
supported in <productname>Postgres</productname> this keyword supported in <productname>Postgres</productname> this keyword
provokes an informational error message. provokes an informational error message.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="parameter">column</replaceable></term>
<replaceable class="parameter">column</replaceable> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
Column(s) to be updated. Column(s) to be updated.
Since cursor updates are not currently Since cursor updates are not currently
supported in <productname>Postgres</productname> the UPDATE clause supported in <productname>Postgres</productname> the UPDATE clause
provokes an informational error message. provokes an informational error message.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
</VARIABLELIST> </variablelist>
</REFSECT2> </para>
</refsect2>
<REFSECT2 ID="R2-SQL-DECLARE-2"> <refsect2 id="R2-SQL-DECLARE-2">
<REFSECT2INFO> <refsect2info>
<DATE>1998-04-15</DATE> <date>1998-04-15</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Outputs Outputs
</TITLE> </title>
<PARA> <para>
<VARIABLELIST> <variablelist>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
SELECT SELECT
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
The message returned if the SELECT is run successfully. The message returned if the SELECT is run successfully.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
NOTICE NOTICE
BlankPortalAssignName: portal "<replaceable class="parameter">cursor</replaceable>" already exists BlankPortalAssignName: portal "<replaceable class="parameter">cursor</replaceable>" already exists
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
This error occurs if cursor "<replaceable class="parameter">cursor</replaceable>" is already declared. This error occurs if <replaceable class="parameter">cursor</replaceable> is already declared.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
ERROR: Named portals may only be used in begin/end transaction blocks
</TERM>
<LISTITEM>
<PARA>
This error occurs if the cursor is not declared within a transaction block.
</PARA>
</LISTITEM>
</VARLISTENTRY>
</VARIABLELIST>
</para> </para>
</REFSECT2> </listitem>
</REFSYNOPSISDIV> </varlistentry>
<REFSECT1 ID="R1-SQL-DECLARE-1"> <varlistentry>
<REFSECT1INFO> <term><computeroutput>
<DATE>1998-09-04</DATE> ERROR: Named portals may only be used in begin/end transaction blocks
</REFSECT1INFO> </computeroutput></term>
<TITLE> <listitem>
<para>
This error occurs if the cursor is not declared within a transaction block.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
</refsynopsisdiv>
<refsect1 id="R1-SQL-DECLARE-1">
<refsect1info>
<date>1998-09-04</date>
</refsect1info>
<title>
Description Description
</TITLE> </title>
<PARA> <para>
DECLARE allows a user to create cursors, which can be used to retrieve <command>DECLARE</command> allows a user to create cursors, which can be used to retrieve
a small number of rows at a time out of a larger query. Cursors can return a small number of rows at a time out of a larger query. Cursors can return
data either in text or in binary foramt. data either in text or in binary foramt.
</PARA> </para>
<PARA>
<para>
Normal cursors return data in text format, either ASCII or another Normal cursors return data in text format, either ASCII or another
encoding scheme depending on how the <productname>Postgres</productname> encoding scheme depending on how the <productname>Postgres</productname>
backend was built. Since backend was built. Since
@ -211,17 +196,20 @@ backend was built. Since
Once the information comes back in text form, the client Once the information comes back in text form, the client
application may have to convert it to a binary format to application may have to convert it to a binary format to
manipulate it anyway. manipulate it anyway.
</PARA> </para>
<PARA>
<para>
BINARY cursors give you back the data in the native binary BINARY cursors give you back the data in the native binary
representation. So binary cursors will tend to be a representation. So binary cursors will tend to be a
little faster since they suffer less conversion overhead. little faster since they suffer less conversion overhead.
</para> </para>
<para> <para>
As an example, if a query returns a value of one from an integer column, As an example, if a query returns a value of one from an integer column,
you would get a string of '1' with a default cursor you would get a string of '1' with a default cursor
whereas with a binary cursor you would get whereas with a binary cursor you would get
a 4-byte value equal to control-A ('^A'). a 4-byte value equal to control-A ('^A').
<caution> <caution>
<para> <para>
BINARY cursors should be used carefully. User applications such BINARY cursors should be used carefully. User applications such
@ -230,7 +218,8 @@ whereas with a binary cursor you would get
</para> </para>
</caution> </caution>
</para> </para>
<PARA>
<para>
However, string representation is architecture-neutral whereas binary However, string representation is architecture-neutral whereas binary
representation can differ between different machine architectures. representation can differ between different machine architectures.
Therefore, if your client machine and server machine use different Therefore, if your client machine and server machine use different
@ -245,19 +234,19 @@ whereas with a binary cursor you would get
effort on the client side. effort on the client side.
</para> </para>
</tip> </tip>
</PARA> </para>
<REFSECT2 ID="R2-SQL-DECLARE-3"> <refsect2 id="R2-SQL-DECLARE-3">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-04</DATE> <date>1998-09-04</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Notes Notes
</TITLE> </title>
<PARA> <para>
Cursors are only available in transactions. Cursors are only available in transactions.
</PARA> </para>
<PARA> <para>
<productname>Postgres</productname> <productname>Postgres</productname>
does not have an explicit <command>OPEN cursor</command> does not have an explicit <command>OPEN cursor</command>
statement; a cursor is considered to be open when it is declared. statement; a cursor is considered to be open when it is declared.
@ -271,39 +260,39 @@ whereas with a binary cursor you would get
involving DECLARE and OPEN statements. involving DECLARE and OPEN statements.
</para> </para>
</note> </note>
</para>
</PARA> </refsect2>
</REFSECT2>
</refsect1> </refsect1>
<REFSECT1 ID="R1-SQL-DECLARESTATEMENT-2"> <refsect1 id="R1-SQL-DECLARESTATEMENT-2">
<TITLE> <title>
Usage Usage
</TITLE> </title>
<PARA> <para>
To declare a cursor: To declare a cursor:
</PARA>
<ProgramListing> <programlisting>
DECLARE liahona CURSOR DECLARE liahona CURSOR
FOR SELECT * FROM films; FOR SELECT * FROM films;
</ProgramListing> </programlisting>
</REFSECT1> </para>
</refsect1>
<REFSECT1 ID="R1-SQL-DECLARESTATEMENT-3"> <refsect1 id="R1-SQL-DECLARESTATEMENT-3">
<TITLE> <title>
Compatibility Compatibility
</TITLE> </title>
<PARA> <para>
</PARA> </para>
<REFSECT2 ID="R2-SQL-DECLARESTATEMENT-4"> <refsect2 id="R2-SQL-DECLARESTATEMENT-4">
<REFSECT2INFO> <refsect2info>
<DATE>1998-04-15</DATE> <date>1998-04-15</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
SQL92 SQL92
</TITLE> </title>
<PARA> <para>
<acronym>SQL92</acronym> allows cursors only in embedded <acronym>SQL</acronym> <acronym>SQL92</acronym> allows cursors only in embedded <acronym>SQL</acronym>
and in modules. <productname>Postgres</productname> permits cursors to be used and in modules. <productname>Postgres</productname> permits cursors to be used
interactively. interactively.
@ -314,12 +303,12 @@ DECLARE liahona CURSOR
</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
sgml-omittag:t sgml-omittag:nil
sgml-shorttag:t sgml-shorttag:t
sgml-minimize-attributes:nil sgml-minimize-attributes:nil
sgml-always-quote-attributes:t sgml-always-quote-attributes:t

View File

@ -1,128 +1,122 @@
<REFENTRY ID="SQL-DELETE"> <refentry id="SQL-DELETE">
<REFMETA> <refmeta>
<REFENTRYTITLE> <refentrytitle>
DELETE DELETE
</REFENTRYTITLE> </refentrytitle>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO> <refmiscinfo>SQL - Language Statements</refmiscinfo>
</REFMETA> </refmeta>
<REFNAMEDIV> <refnamediv>
<REFNAME> <refname>
DELETE DELETE
</REFNAME> </refname>
<REFPURPOSE> <refpurpose>
Deletes rows from a table Deletes rows from a table
</REFPURPOSE> </refpurpose>
</refnamediv> </refnamediv>
<REFSYNOPSISDIV> <refsynopsisdiv>
<REFSYNOPSISDIVINFO> <refsynopsisdivinfo>
<DATE>1998-04-15</DATE> <date>1998-04-15</date>
</REFSYNOPSISDIVINFO> </refsynopsisdivinfo>
<SYNOPSIS> <synopsis>
DELETE FROM <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE> [ WHERE <REPLACEABLE CLASS="PARAMETER">condition</REPLACEABLE> ] DELETE FROM <replaceable class="PARAMETER">table</replaceable> [ WHERE <replaceable class="PARAMETER">condition</replaceable> ]
</SYNOPSIS> </synopsis>
<REFSECT2 ID="R2-SQL-DELETE-1"> <refsect2 id="R2-SQL-DELETE-1">
<REFSECT2INFO> <refsect2info>
<DATE>1998-04-15</DATE> <date>1998-04-15</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Inputs Inputs
</TITLE> </title>
<PARA> <para>
</PARA> <variablelist>
<VARIABLELIST> <varlistentry>
<VARLISTENTRY> <term><replaceable class="parameter">table</replaceable></term>
<TERM> <listitem>
<replaceable class="parameter">table</replaceable> <para>
</TERM>
<LISTITEM>
<PARA>
The name of an existing table. The name of an existing table.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="parameter">condition</replaceable></term>
<replaceable class="parameter">condition</replaceable> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
This is an SQL selection query which returns the rows which This is an SQL selection query which returns the rows which
are to be deleted. are to be deleted.
</PARA> </para>
<PARA> <para>
Refer to the SELECT statement for further description Refer to the SELECT statement for further description
of the WHERE clause. of the WHERE clause.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
</variablelist> </variablelist>
</REFSECT2> </para>
</refsect2>
<REFSECT2 ID="R2-SQL-DELETE-2"> <refsect2 id="R2-SQL-DELETE-2">
<REFSECT2INFO> <refsect2info>
<DATE>1998-04-15</DATE> <date>1998-04-15</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Outputs Outputs
</TITLE> </title>
<PARA> <para>
<VARIABLELIST> <variablelist>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
<ReturnValue> DELETE <replaceable class="parameter">count</replaceable></ReturnValue> DELETE <replaceable class="parameter">count</replaceable>
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
Message returned if items are successfully deleted. The Message returned if items are successfully deleted. The
<replaceable class="parameter">count</replaceable> is the number <replaceable class="parameter">count</replaceable> is the number
of rows deleted. of rows deleted.
</PARA> </para>
<PARA> <para>
If <replaceable class="parameter">count</replaceable> is 0, If <replaceable class="parameter">count</replaceable> is 0,
no rows were deleted. no rows were deleted.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</VARIABLELIST> </variablelist>
</para> </para>
</REFSECT2> </refsect2>
</REFSYNOPSISDIV> </refsynopsisdiv>
<REFSECT1 ID="R1-SQL-DELETE-1"> <refsect1 id="R1-SQL-DELETE-1">
<REFSECT1INFO> <refsect1info>
<DATE>1998-04-15</DATE> <date>1998-04-15</date>
</REFSECT1INFO> </refsect1info>
<TITLE> <title>
Description Description
</TITLE> </title>
<PARA> <para>
DELETE removes rows which satisfy the WHERE <replaceable class="parameter">condition</replaceable>, <command>DELETE</command> removes rows which satisfy the WHERE
from the specified table. clause from the specified table.
</PARA> </para>
<PARA> <para>
If the <replaceable class="parameter">condition</replaceable> is absent, If the <firstterm>condition</firstterm> (WHERE clause) is absent,
the effect is to delete all rows in the table. the effect is to delete all rows in the table.
The result is a valid, but empty table. The result is a valid, but empty table.
</PARA> </para>
<PARA> <para>
You must have write access to the table in order to modify You must have write access to the table in order to modify
it, as well as read access to any table whose values are it, as well as read access to any table whose values are
read in the <replaceable class="parameter">condition</replaceable>. read in the <replaceable class="parameter">condition</replaceable>.
</PARA> </para>
</REFSECT1> </refsect1>
<REFSECT1 ID="R1-SQL-DELETE-2"> <refsect1 id="R1-SQL-DELETE-2">
<TITLE> <title>
Usage Usage
</TITLE> </title>
<PARA> <para>
Remove all films but musicals: Remove all films but musicals:
</PARA> <programlisting>
<ProgramListing> DELETE FROM films WHERE kind &lt;&gt; 'Musical';
DETETE FROM films WHERE kind &lt;&gt; 'Musical';
SELECT * FROM films; SELECT * FROM films;
code |title |did| date_prod|kind |len code |title |did| date_prod|kind |len
@ -131,52 +125,56 @@ UA501|West Side Story |105|1961-01-03|Musical | 02:32
TC901|The King and I |109|1956-08-11|Musical | 02:13 TC901|The King and I |109|1956-08-11|Musical | 02:13
WD101|Bed Knobs and Broomsticks|111| |Musical | 01:57 WD101|Bed Knobs and Broomsticks|111| |Musical | 01:57
(3 rows) (3 rows)
</ProgramListing> </programlisting>
</para>
<para> <para>
Clear the table <literal>films</literal>: Clear the table <literal>films</literal>:
</para>
<programlisting> <programlisting>
DELETE FROM films; DELETE FROM films;
SELECT * FROM films; SELECT * FROM films;
code|title|did|date_prod|kind|len code|title|did|date_prod|kind|len
----+-----+---+---------+----+--- ----+-----+---+---------+----+---
(0 rows) (0 rows)
</programlisting> </programlisting>
</REFSECT1> </para>
</refsect1>
<REFSECT1 ID="R1-SQL-DELETE-3"> <refsect1 id="R1-SQL-DELETE-3">
<TITLE> <title>
Compatibility Compatibility
</TITLE> </title>
<PARA> <para>
</PARA> </para>
<REFSECT2 ID="R2-SQL-DELETE-4"> <refsect2 id="R2-SQL-DELETE-4">
<REFSECT2INFO> <refsect2info>
<DATE>1998-04-15</DATE> <date>1998-04-15</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
SQL92 SQL92
</TITLE> </title>
<PARA> <para>
<acronym>SQL92</acronym> allows a positioned DELETE statement: <acronym>SQL92</acronym> allows a positioned DELETE statement:
</PARA>
<synopsis> <synopsis>
DELETE FROM <replaceable class="parameter">table</replaceable> WHERE CURRENT OF <replaceable class="parameter">cursor</replaceable> DELETE FROM <replaceable class="parameter">table</replaceable> WHERE
CURRENT OF <replaceable class="parameter">cursor</replaceable>
</synopsis> </synopsis>
<para>
where <replaceable class="parameter">cursor</replaceable> identifies an open cursor. Interactive cursors in <productname>Postgres</productname> are read-only. where <replaceable class="parameter">cursor</replaceable>
identifies an open cursor.
Interactive cursors in <productname>Postgres</productname> are read-only.
</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
sgml-omittag:t sgml-omittag:nil
sgml-shorttag:t sgml-shorttag:t
sgml-minimize-attributes:nil sgml-minimize-attributes:nil
sgml-always-quote-attributes:t sgml-always-quote-attributes:t

View File

@ -1,56 +1,52 @@
<REFENTRY ID="APP-DESTROYDB"> <refentry id="APP-DESTROYDB">
<REFMETA> <refmeta>
<REFENTRYTITLE> <refentrytitle>
<application>destroydb</application> <application>destroydb</application>
</REFENTRYTITLE> </refentrytitle>
<REFMISCINFO>Application</REFMISCINFO> <refmiscinfo>Application</refmiscinfo>
</REFMETA> </refmeta>
<REFNAMEDIV> <refnamediv>
<REFNAME> <refname>
<application>destroydb</application> <application>destroydb</application>
</REFNAME> </refname>
<REFPURPOSE> <refpurpose>
Remove an existing <productname>Postgres</productname> database Remove an existing <productname>Postgres</productname> database
</REFPURPOSE> </refpurpose>
</refnamediv> </refnamediv>
<REFSYNOPSISDIV> <refsynopsisdiv>
<REFSYNOPSISDIVINFO> <refsynopsisdivinfo>
<DATE>1998-10-02</DATE> <date>1998-10-02</date>
</REFSYNOPSISDIVINFO> </refsynopsisdivinfo>
<SYNOPSIS> <synopsis>
destroydb [ <replaceable class="parameter">dbname</replaceable> ] destroydb [ <replaceable class="parameter">dbname</replaceable> ]
destroydb [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replaceable class="parameter">port</replaceable> ] destroydb [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replaceable class="parameter">port</replaceable> ]
[ -i ] [ <replaceable class="parameter">dbname</replaceable> ] [ -i ] [ <replaceable class="parameter">dbname</replaceable> ]
</SYNOPSIS> </synopsis>
<REFSECT2 ID="R2-APP-DESTROYDB-1"> <refsect2 id="R2-APP-DESTROYDB-1">
<REFSECT2INFO> <refsect2info>
<DATE>1998-10-02</DATE> <date>1998-10-02</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Inputs Inputs
</TITLE> </title>
<PARA> <para>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term>-h <replaceable class="parameter">host</replaceable></term>
-h <replaceable class="parameter">host</replaceable>
</term>
<listitem> <listitem>
<para> <para>
Specifies the hostname of the machine on which the Specifies the hostname of the machine on which the
<application>postmaster</application> <application>postmaster</application>
is running. Defaults to using a local Unix domain socket is running. Defaults to using a local Unix domain socket
rather than an IP connection.. rather than an IP connection.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-p <replaceable class="parameter">port</replaceable></term>
-p <replaceable class="parameter">port</replaceable>
</term>
<listitem> <listitem>
<para> <para>
Specifies the Internet TCP/IP port or local Unix domain socket file Specifies the Internet TCP/IP port or local Unix domain socket file
@ -63,9 +59,7 @@ destroydb [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replace
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-i</term>
-i
</term>
<listitem> <listitem>
<para> <para>
Run in interactive mode. Run in interactive mode.
@ -75,9 +69,7 @@ destroydb [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replace
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><replaceable class="parameter">dbname</replaceable></term>
<replaceable class="parameter">dbname</replaceable>
</term>
<listitem> <listitem>
<para> <para>
Specifies the name of the database to be destroyed. The database Specifies the name of the database to be destroyed. The database
@ -90,31 +82,30 @@ destroydb [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replace
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</variablelist> </variablelist>
</para> </para>
</refsect2> </refsect2>
<REFSECT2 ID="R2-APP-DESTROYDB-2"> <refsect2 id="R2-APP-DESTROYDB-2">
<REFSECT2INFO> <refsect2info>
<DATE>1998-10-02</DATE> <date>1998-10-02</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Outputs Outputs
</TITLE> </title>
<PARA> <para>
<application>destroydb</application> will remove files from the <application>destroydb</application> will remove files from the
<filename><envar>PGDATA</envar>/<replaceable class="parameter">dbname</replaceable>/</filename> <filename><envar>PGDATA</envar>/<replaceable class="parameter">dbname</replaceable>/</filename>
data area for the existing database. data area for the existing database.
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term><computeroutput>
Connection to database 'template1' failed. Connection to database 'template1' failed.
connectDB() failed: Is the postmaster running and accepting connections connectDB() failed: Is the postmaster running and accepting connections
at 'UNIX Socket' on port '<replaceable class="parameter">port</replaceable>'? at 'UNIX Socket' on port '<replaceable class="parameter">port</replaceable>'?
destroydb: database destroy failed on <replaceable class="parameter">dbname</replaceable>. destroydb: database destroy failed on <replaceable class="parameter">dbname</replaceable>.
</term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
<application>destroydb</application> could not attach to the <application>destroydb</application> could not attach to the
@ -129,11 +120,11 @@ destroydb [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replace
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><computeroutput>
Connection to database 'template1' failed. Connection to database 'template1' failed.
FATAL 1: SetUserId: user '<replaceable class="parameter">username</replaceable>' is not in 'pg_shadow' FATAL 1: SetUserId: user '<replaceable class="parameter">username</replaceable>' is not in 'pg_shadow'
destroydb: database destroy failed on <replaceable class="parameter">dbname</replaceable>. destroydb: database destroy failed on <replaceable class="parameter">dbname</replaceable>.
</term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
You do not have a valid entry in the relation <literal>pg_shadow</literal> You do not have a valid entry in the relation <literal>pg_shadow</literal>
@ -144,10 +135,10 @@ destroydb [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replace
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><computeroutput>
ERROR: user '<replaceable class="parameter">username</replaceable>' is not allowed to create/destroy databases ERROR: user '<replaceable class="parameter">username</replaceable>' is not allowed to create/destroy databases
destroydb: database destroy failed on <replaceable class="parameter">dbname</replaceable>. destroydb: database destroy failed on <replaceable class="parameter">dbname</replaceable>.
</term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
You do not have permission to destroy (or create) databases. You do not have permission to destroy (or create) databases.
@ -157,10 +148,10 @@ destroydb [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replace
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><computeroutput>
ERROR: destroydb: database '<replaceable class="parameter">dbname</replaceable>' does not exist. ERROR: destroydb: database '<replaceable class="parameter">dbname</replaceable>' does not exist.
destroydb: database destroy failed on <replaceable class="parameter">dbname</replaceable>. destroydb: database destroy failed on <replaceable class="parameter">dbname</replaceable>.
</term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
The database to be removed does not have an entry in the The database to be removed does not have an entry in the
@ -170,10 +161,10 @@ destroydb [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replace
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><computeroutput>
ERROR: destroydb: database '<replaceable class="parameter">dbname</replaceable>' is not owned by you. ERROR: destroydb: database '<replaceable class="parameter">dbname</replaceable>' is not owned by you.
destroydb: database destroy failed on <replaceable class="parameter">dbname</replaceable>. destroydb: database destroy failed on <replaceable class="parameter">dbname</replaceable>.
</term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
You are not the Database Administrator (DBA) for the specified database. You are not the Database Administrator (DBA) for the specified database.
@ -182,9 +173,9 @@ destroydb [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replace
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><computeroutput>
destroydb: database destroy failed on <replaceable class="parameter">dbname</replaceable>. destroydb: database destroy failed on <replaceable class="parameter">dbname</replaceable>.
</term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
An internal error occurred in <application>psql</application> An internal error occurred in <application>psql</application>
@ -194,7 +185,6 @@ destroydb [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replace
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</variablelist> </variablelist>
</para> </para>
<note> <note>
@ -207,14 +197,14 @@ destroydb [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replace
</refsect2> </refsect2>
</refsynopsisdiv> </refsynopsisdiv>
<REFSECT1 ID="R1-APP-DESTROYDB-1"> <refsect1 id="R1-APP-DESTROYDB-1">
<REFSECT1INFO> <refsect1info>
<DATE>1998-10-02</DATE> <date>1998-10-02</date>
</REFSECT1INFO> </refsect1info>
<TITLE> <title>
Description Description
</TITLE> </title>
<PARA> <para>
<application>destroydb</application> destroys an existing <application>destroydb</application> destroys an existing
<productname>Postgres</productname> database. <productname>Postgres</productname> database.
The person who executes this command must be The person who executes this command must be
@ -240,18 +230,19 @@ destroydb [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replace
<envar>PGREALM</envar> <envar>PGREALM</envar>
environment variables will be passed on to environment variables will be passed on to
<application>psql</application> <application>psql</application>
and processed as described in <xref linkend="app-psql" endterm="psql-ref">. and processed as described in <xref endterm="psql-ref"
linkend="app-psql">.
</para> </para>
</refsect1> </refsect1>
<REFSECT1 ID="R1-APP-DESTROYDB-2"> <refsect1 id="R1-APP-DESTROYDB-2">
<REFSECT1INFO> <refsect1info>
<DATE>1998-10-02</DATE> <date>1998-10-02</date>
</REFSECT1INFO> </refsect1info>
<TITLE> <title>
Usage Usage
</TITLE> </title>
<PARA> <para>
To destroy the database <literal>demo</literal> To destroy the database <literal>demo</literal>
using the postmaster on the local host, port 5432: using the postmaster on the local host, port 5432:
<programlisting> <programlisting>
@ -266,4 +257,21 @@ destroydb [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replace
</programlisting> </programlisting>
</para> </para>
</refsect1> </refsect1>
</REFENTRY> </refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:nil
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../reference.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:"/usr/lib/sgml/catalog"
sgml-local-ecat-files:nil
End:
-->

View File

@ -1,56 +1,52 @@
<REFENTRY ID="APP-DESTROYUSER"> <refentry id="APP-DESTROYUSER">
<REFMETA> <refmeta>
<REFENTRYTITLE> <refentrytitle>
<application>destroyuser</application> <application>destroyuser</application>
</REFENTRYTITLE> </refentrytitle>
<REFMISCINFO>Application</REFMISCINFO> <refmiscinfo>Application</refmiscinfo>
</REFMETA> </refmeta>
<REFNAMEDIV> <refnamediv>
<REFNAME> <refname>
<application>destroyuser</application> <application>destroyuser</application>
</REFNAME> </refname>
<REFPURPOSE> <refpurpose>
Destroy a <productname>Postgres</productname> user and associated databases Destroy a <productname>Postgres</productname> user and associated databases
</REFPURPOSE> </refpurpose>
</refnamediv> </refnamediv>
<REFSYNOPSISDIV> <refsynopsisdiv>
<REFSYNOPSISDIVINFO> <refsynopsisdivinfo>
<DATE>1998-10-02</DATE> <date>1998-10-02</date>
</REFSYNOPSISDIVINFO> </refsynopsisdivinfo>
<SYNOPSIS> <synopsis>
destroyuser [ <replaceable class="parameter">username</replaceable> ] destroyuser [ <replaceable class="parameter">username</replaceable> ]
destroyuser [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replaceable class="parameter">port</replaceable> ] destroyuser [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replaceable class="parameter">port</replaceable> ]
[ <replaceable class="parameter">username</replaceable> ] [ <replaceable class="parameter">username</replaceable> ]
</SYNOPSIS> </synopsis>
<REFSECT2 ID="R2-APP-DESTROYUSER-1"> <refsect2 id="R2-APP-DESTROYUSER-1">
<REFSECT2INFO> <refsect2info>
<DATE>1998-10-02</DATE> <date>1998-10-02</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Inputs Inputs
</TITLE> </title>
<PARA> <para>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term>-h <replaceable class="parameter">host</replaceable></term>
-h <replaceable class="parameter">host</replaceable>
</term>
<listitem> <listitem>
<para> <para>
Specifies the hostname of the machine on which the Specifies the hostname of the machine on which the
<application>postmaster</application> <application>postmaster</application>
is running. Defaults to using a local Unix domain socket is running. Defaults to using a local Unix domain socket
rather than an IP connection.. rather than an IP connection.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-p <replaceable class="parameter">port</replaceable></term>
-p <replaceable class="parameter">port</replaceable>
</term>
<listitem> <listitem>
<para> <para>
Specifies the Internet TCP/IP port or local Unix domain socket file Specifies the Internet TCP/IP port or local Unix domain socket file
@ -63,9 +59,7 @@ destroyuser [ -h <replaceable class="parameter">host</replaceable> ] [ -p <repla
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><replaceable class="parameter">username</replaceable></term>
<replaceable class="parameter">username</replaceable>
</term>
<listitem> <listitem>
<para> <para>
Specifies the name of the <productname>Postgres</productname> user to be removed. Specifies the name of the <productname>Postgres</productname> user to be removed.
@ -74,19 +68,18 @@ destroyuser [ -h <replaceable class="parameter">host</replaceable> ] [ -p <repla
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</variablelist> </variablelist>
</para> </para>
</refsect2> </refsect2>
<REFSECT2 ID="R2-APP-DESTROYUSER-2"> <refsect2 id="R2-APP-DESTROYUSER-2">
<REFSECT2INFO> <refsect2info>
<DATE>1998-10-02</DATE> <date>1998-10-02</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Outputs Outputs
</TITLE> </title>
<PARA> <para>
<application>destroyuser</application> will remove an entry in the <application>destroyuser</application> will remove an entry in the
<literal>pg_user</literal> or <literal>pg_shadow</literal> system table, <literal>pg_user</literal> or <literal>pg_shadow</literal> system table,
and will remove all databases for which that user is the administrator and will remove all databases for which that user is the administrator
@ -94,12 +87,12 @@ destroyuser [ -h <replaceable class="parameter">host</replaceable> ] [ -p <repla
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term><computeroutput>
Connection to database 'template1' failed. Connection to database 'template1' failed.
connectDB() failed: Is the postmaster running and accepting connections connectDB() failed: Is the postmaster running and accepting connections
at 'UNIX Socket' on port '<replaceable class="parameter">port</replaceable>'? at 'UNIX Socket' on port '<replaceable class="parameter">port</replaceable>'?
destroyuser: database access failed. destroyuser: database access failed.
</term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
<application>destroyuser</application> could not attach to the <application>destroyuser</application> could not attach to the
@ -114,11 +107,11 @@ destroyuser [ -h <replaceable class="parameter">host</replaceable> ] [ -p <repla
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><computeroutput>
Connection to database 'template1' failed. Connection to database 'template1' failed.
FATAL 1: SetUserId: user '<replaceable class="parameter">username</replaceable>' is not in 'pg_shadow' FATAL 1: SetUserId: user '<replaceable class="parameter">username</replaceable>' is not in 'pg_shadow'
destroyuser: database access failed. destroyuser: database access failed.
</term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
You do not have a valid entry in the relation <literal>pg_shadow</literal> You do not have a valid entry in the relation <literal>pg_shadow</literal>
@ -129,9 +122,9 @@ destroyuser [ -h <replaceable class="parameter">host</replaceable> ] [ -p <repla
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><computeroutput>
destroyuser: <replaceable class="parameter">username</replaceable> cannot delete users. destroyuser: <replaceable class="parameter">username</replaceable> cannot delete users.
</term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
You do not have permission to delete users; contact your You do not have permission to delete users; contact your
@ -141,21 +134,21 @@ destroyuser [ -h <replaceable class="parameter">host</replaceable> ] [ -p <repla
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><computeroutput>
destroyuser: user "<replaceable class="parameter">username</replaceable>" already exists destroyuser: user "<replaceable class="parameter">username</replaceable>" already exists
</term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
The user to be added already has an entry in the <literal>pg_shadow</literal> The user to be added already has an entry in the
class. <literal>pg_shadow</literal> class.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><computeroutput>
database access failed database access failed
</term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
An internal error occurred in <application>psql</application> An internal error occurred in <application>psql</application>
@ -167,9 +160,9 @@ destroyuser [ -h <replaceable class="parameter">host</replaceable> ] [ -p <repla
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><computeroutput>
destroydb on <replaceable class="parameter">dbname</replaceable> failed - exiting destroydb on <replaceable class="parameter">dbname</replaceable> failed - exiting
</term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
An internal error occurred in <application>psql</application> An internal error occurred in <application>psql</application>
@ -180,9 +173,9 @@ destroyuser [ -h <replaceable class="parameter">host</replaceable> ] [ -p <repla
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><computeroutput>
delete of user <replaceable class="parameter">username</replaceable> was UNSUCCESSFUL delete of user <replaceable class="parameter">username</replaceable> was UNSUCCESSFUL
</term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
An internal error occurred in <application>psql</application> An internal error occurred in <application>psql</application>
@ -190,28 +183,27 @@ destroyuser [ -h <replaceable class="parameter">host</replaceable> ] [ -p <repla
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</variablelist> </variablelist>
</para> </para>
<note> <note>
<para> <para>
<application>destroyuser</application> internally runs <application>destroyuser</application> internally runs
DROP USER from <application>psql</application> <command>DROP USER</command> from <application>psql</application>
while connected to the <literal>template1</literal> database. while connected to the <literal>template1</literal> database.
</para> </para>
</note> </note>
</refsect2> </refsect2>
</refsynopsisdiv> </refsynopsisdiv>
<REFSECT1 ID="R1-APP-DESTROYUSER-1"> <refsect1 id="R1-APP-DESTROYUSER-1">
<REFSECT1INFO> <refsect1info>
<DATE>1998-10-02</DATE> <date>1998-10-02</date>
</REFSECT1INFO> </refsect1info>
<TITLE> <title>
Description Description
</TITLE> </title>
<PARA> <para>
<application>destroyuser</application> removes an existing <application>destroyuser</application> removes an existing
<productname>Postgres</productname> user <productname>Postgres</productname> user
and the databases for which that user and the databases for which that user
@ -233,7 +225,8 @@ destroyuser [ -h <replaceable class="parameter">host</replaceable> ] [ -p <repla
<envar>PGREALM</envar> <envar>PGREALM</envar>
environment variables will be passed on to environment variables will be passed on to
<application>psql</application> <application>psql</application>
and processed as described in <xref linkend="app-psql" endterm="psql-ref">. and processed as described in <xref endterm="psql-ref"
linkend="app-psql">.
</para> </para>
<para> <para>
Once invoked, <application>destroyuser</application> Once invoked, <application>destroyuser</application>
@ -241,4 +234,21 @@ destroyuser [ -h <replaceable class="parameter">host</replaceable> ] [ -p <repla
process and permit you to abort the removal of the user if desired. process and permit you to abort the removal of the user if desired.
</para> </para>
</refsect1> </refsect1>
</REFENTRY> </refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:nil
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../reference.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:"/usr/lib/sgml/catalog"
sgml-local-ecat-files:nil
End:
-->

View File

@ -1,168 +1,164 @@
<REFENTRY ID="SQL-DROPAGGREGATE"> <refentry id="SQL-DROPAGGREGATE">
<REFMETA> <refmeta>
<REFENTRYTITLE> <refentrytitle>
DROP AGGREGATE DROP AGGREGATE
</REFENTRYTITLE> </refentrytitle>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO> <refmiscinfo>SQL - Language Statements</refmiscinfo>
</REFMETA> </refmeta>
<REFNAMEDIV> <refnamediv>
<REFNAME> <refname>
DROP AGGREGATE DROP AGGREGATE
</REFNAME> </refname>
<REFPURPOSE> <refpurpose>
Removes the definition of an aggregate function Removes the definition of an aggregate function
</REFPURPOSE> </refpurpose>
</refnamediv> </refnamediv>
<REFSYNOPSISDIV> <refsynopsisdiv>
<REFSYNOPSISDIVINFO> <refsynopsisdivinfo>
<DATE>1998-04-15</DATE> <date>1998-04-15</date>
</REFSYNOPSISDIVINFO> </refsynopsisdivinfo>
<SYNOPSIS> <synopsis>
DROP AGGREGATE <REPLACEABLE CLASS="PARAMETER">name</REPLACEABLE> <REPLACEABLE CLASS="PARAMETER">type</REPLACEABLE> DROP AGGREGATE <replaceable class="PARAMETER">name</replaceable> <replaceable class="PARAMETER">type</replaceable>
</SYNOPSIS> </synopsis>
<REFSECT2 ID="R2-SQL-DROPAGGREGATE-1"> <refsect2 id="R2-SQL-DROPAGGREGATE-1">
<REFSECT2INFO> <refsect2info>
<DATE>1998-04-15</DATE> <date>1998-04-15</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Inputs Inputs
</TITLE> </title>
<PARA> <para>
</PARA> <variablelist>
<VARIABLELIST> <varlistentry>
<VARLISTENTRY> <term><replaceable class="parameter">name</replaceable></term>
<TERM> <listitem>
<replaceable class="parameter">name</replaceable> <para>
</TERM>
<LISTITEM>
<PARA>
The name of an existing aggregate function. The name of an existing aggregate function.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="parameter">type</replaceable></term>
<replaceable class="parameter">type</replaceable> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
The type of an existing aggregate function. The type of an existing aggregate function.
(Refer to the <citetitle>PostgreSQL User's Guide</citetitle> for (Refer to the <citetitle>PostgreSQL User's Guide</citetitle> for
further information about data types). further information about data types).
<comment>This should become a cross-reference rather than a <comment>This should become a cross-reference rather than a
hard-coded chapter number</comment> hard-coded chapter number</comment>
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
</variablelist> </variablelist>
</REFSECT2> </para>
</refsect2>
<REFSECT2 ID="R2-SQL-DROPAGGREGATE-2"> <refsect2 id="R2-SQL-DROPAGGREGATE-2">
<REFSECT2INFO> <refsect2info>
<DATE>1998-04-15</DATE> <date>1998-04-15</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Outputs Outputs
</TITLE> </title>
<PARA> <para>
<VARIABLELIST> <variablelist>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
<ReturnValue>DROP</ReturnValue> DROP
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
Message returned if the command is successful. Message returned if the command is successful.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
<ReturnValue>WARN RemoveAggregate: aggregate '<replaceable class="parameter">name</replaceable>' for '<replaceable class="parameter">type</replaceable>' does not exist</ReturnValue> WARN RemoveAggregate: aggregate '<replaceable class="parameter">agg</replaceable>' for '<replaceable class="parameter">type</replaceable>' does not exist
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
This message occurs if the aggregate function specified does not This message occurs if the aggregate function specified does not
exist in the database. exist in the database.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</VARIABLELIST> </variablelist>
</para> </para>
</REFSECT2> </refsect2>
</REFSYNOPSISDIV> </refsynopsisdiv>
<REFSECT1 ID="R1-SQL-DROPAGGREGATE-1"> <refsect1 id="R1-SQL-DROPAGGREGATE-1">
<REFSECT1INFO> <refsect1info>
<DATE>1998-04-15</DATE> <date>1998-04-15</date>
</REFSECT1INFO> </refsect1info>
<TITLE> <title>
Description Description
</TITLE> </title>
<PARA> <para>
<command>DROP AGGREGATE</command> will remove all references to an existing <command>DROP AGGREGATE</command> will remove all references to an existing
aggregate definition. To execute this command the current aggregate definition. To execute this command the current
user must be the owner of the aggregate. user must be the owner of the aggregate.
</PARA> </para>
<REFSECT2 ID="R2-SQL-DROPAGGREGATE-3"> <refsect2 id="R2-SQL-DROPAGGREGATE-3">
<REFSECT2INFO> <refsect2info>
<DATE>1998-04-15</DATE> <date>1998-04-15</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Notes Notes
</TITLE> </title>
<PARA> <para>
The <command>DROP AGGREGATE</command> statement is a The <command>DROP AGGREGATE</command> statement is a
<productname>Postgres</productname> <productname>Postgres</productname>
language extension. language extension.
</PARA> </para>
<PARA> <para>
Refer to the <command>CREATE AGGREGATE</command> statement to Refer to the <command>CREATE AGGREGATE</command> statement to
create aggregate functions. create aggregate functions.
</PARA> </para>
</REFSECT2>
</REFSECT1>
<REFSECT1 ID="R1-SQL-DROPAGGREGATE-2">
<TITLE>
Usage
</TITLE>
<PARA>
To remove the <literal>myavg</literal> aggregate for type
<literal>int4</literal>:
</PARA>
<ProgramListing>
DROP AGGREGATE myavg int4;
</ProgramListing>
</REFSECT1>
<REFSECT1 ID="R1-SQL-DROPAGGREGATE-3">
<TITLE>
Compatibility
</TITLE>
<PARA>
</PARA>
<REFSECT2 ID="R2-SQL-DROPAGGREGATE-4">
<REFSECT2INFO>
<DATE>1998-04-15</DATE>
</REFSECT2INFO>
<TITLE>
SQL92
</TITLE>
<PARA>
There is no DROP AGGREGATE statement in <acronym>SQL92</acronym>.
</PARA>
</refsect2> </refsect2>
</refsect1> </refsect1>
</REFENTRY>
<refsect1 id="R1-SQL-DROPAGGREGATE-2">
<title>
Usage
</title>
<para>
To remove the <literal>myavg</literal> aggregate for type
<literal>int4</literal>:
</para>
<programlisting>
DROP AGGREGATE myavg int4;
</programlisting>
</refsect1>
<refsect1 id="R1-SQL-DROPAGGREGATE-3">
<title>
Compatibility
</title>
<para>
</para>
<refsect2 id="R2-SQL-DROPAGGREGATE-4">
<refsect2info>
<date>1998-04-15</date>
</refsect2info>
<title>
SQL92
</title>
<para>
There is no DROP AGGREGATE statement in <acronym>SQL92</acronym>.
</para>
</refsect2>
</refsect1>
</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
sgml-omittag:t sgml-omittag:nil
sgml-shorttag:t sgml-shorttag:t
sgml-minimize-attributes:nil sgml-minimize-attributes:nil
sgml-always-quote-attributes:t sgml-always-quote-attributes:t

View File

@ -1,118 +1,116 @@
<REFENTRY ID="SQL-DROPDATABASE"> <refentry id="SQL-DROPDATABASE">
<REFMETA> <refmeta>
<REFENTRYTITLE> <refentrytitle>
DROP DATABASE DROP DATABASE
</REFENTRYTITLE> </refentrytitle>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO> <refmiscinfo>SQL - Language Statements</refmiscinfo>
</REFMETA> </refmeta>
<REFNAMEDIV> <refnamediv>
<REFNAME> <refname>
DROP DATABASE DROP DATABASE
</REFNAME> </refname>
<REFPURPOSE> <refpurpose>
Destroys an existing database Destroys an existing database
</REFPURPOSE> </refpurpose>
</refnamediv> </refnamediv>
<REFSYNOPSISDIV> <refsynopsisdiv>
<REFSYNOPSISDIVINFO> <refsynopsisdivinfo>
<DATE>1998-04-15</DATE> <date>1998-04-15</date>
</REFSYNOPSISDIVINFO> </refsynopsisdivinfo>
<SYNOPSIS> <synopsis>
DROP DATABASE <REPLACEABLE CLASS="PARAMETER">name</REPLACEABLE> DROP DATABASE <replaceable class="PARAMETER">name</replaceable>
</SYNOPSIS> </synopsis>
<REFSECT2 ID="R2-SQL-DROPDATABASE-1"> <refsect2 id="R2-SQL-DROPDATABASE-1">
<REFSECT2INFO> <refsect2info>
<DATE>1998-04-15</DATE> <date>1998-04-15</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Inputs Inputs
</TITLE> </title>
<PARA> <para>
</PARA> <variablelist>
<VARIABLELIST> <varlistentry>
<VARLISTENTRY> <term><replaceable class="PARAMETER">name</replaceable></term>
<TERM> <listitem>
<ReturnValue><REPLACEABLE CLASS="PARAMETER">name</REPLACEABLE></ReturnValue> <para>
</TERM>
<LISTITEM>
<PARA>
The name of an existing database to remove. The name of an existing database to remove.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
</variablelist> </variablelist>
</REFSECT2> </para>
</refsect2>
<REFSECT2 ID="R2-SQL-DROPDATABASE-2"> <refsect2 id="R2-SQL-DROPDATABASE-2">
<REFSECT2INFO> <refsect2info>
<DATE>1998-04-15</DATE> <date>1998-04-15</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Outputs Outputs
</TITLE> </title>
<PARA> <para>
<VARIABLELIST> <variablelist>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
<ReturnValue>DESTROYDB</ReturnValue> DESTROYDB
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
This message is returned if the command is successful. This message is returned if the command is successful.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
<ReturnValue>WARN: destroydb: database "<replaceable class="parameter">name</replaceable>" does not exist.</ReturnValue> WARN: destroydb: database "<replaceable class="parameter">name</replaceable>" does not exist.
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
This message occurs if the specified database does not exist.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
<ReturnValue>ERROR: destroydb cannot be executed on an open database</ReturnValue>
</TERM>
<LISTITEM>
<PARA>
This message occurs if the specified database does not exist. This message occurs if the specified database does not exist.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</VARIABLELIST> <varlistentry>
<term><computeroutput>
ERROR: destroydb cannot be executed on an open database
</computeroutput></term>
<listitem>
<para>
This message occurs if the specified database does not exist.
</para> </para>
</REFSECT2> </listitem>
</REFSYNOPSISDIV> </varlistentry>
</variablelist>
</para>
</refsect2>
</refsynopsisdiv>
<REFSECT1 ID="R1-SQL-DROPDATABASE-1"> <refsect1 id="R1-SQL-DROPDATABASE-1">
<REFSECT1INFO> <refsect1info>
<DATE>1998-04-15</DATE> <date>1998-04-15</date>
</REFSECT1INFO> </refsect1info>
<TITLE> <title>
Description Description
</TITLE> </title>
<PARA> <para>
<command>DROP DATABASE</command> removes the catalog entries for an existing <command>DROP DATABASE</command> removes the catalog entries for an existing
database and deletes the directory containing the data. database and deletes the directory containing the data.
It can only be executed by the database administrator It can only be executed by the database administrator
(See the <command>CREATE DATABASE</command> command for details). (See the <command>CREATE DATABASE</command> command for details).
</PARA> </para>
<REFSECT2 ID="R2-SQL-DROPDATABASE-3"> <refsect2 id="R2-SQL-DROPDATABASE-3">
<REFSECT2INFO> <refsect2info>
<DATE>1998-04-15</DATE> <date>1998-04-15</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Notes Notes
</TITLE> </title>
<para> <para>
DROP DATABASE statement is a <productname>Postgres</productname> <command>DROP DATABASE</command> statement is a <productname>Postgres</productname>
language extension. language extension.
<tip> <tip>
@ -122,40 +120,40 @@ database. It is usually preferable to use the
<command>destroydb</command> script instead. <command>destroydb</command> script instead.
</para> </para>
</tip> </tip>
</para> </para>
<para> <para>
Refer to the <command>CREATE DATABASE</command> statement for Refer to the <command>CREATE DATABASE</command> statement for
information on how to create a database. information on how to create a database.
</para> </para>
</refsect2> </refsect2>
</REFSECT1> </refsect1>
<REFSECT1 ID="R1-SQL-DROPDATABASE-3"> <refsect1 id="R1-SQL-DROPDATABASE-3">
<TITLE> <title>
Compatibility Compatibility
</TITLE> </title>
<PARA> <para>
</PARA> </para>
<REFSECT2 ID="R2-SQL-DROPDATABASE-4"> <refsect2 id="R2-SQL-DROPDATABASE-4">
<REFSECT2INFO> <refsect2info>
<DATE>1998-04-15</DATE> <date>1998-04-15</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
SQL92 SQL92
</TITLE> </title>
<PARA> <para>
There is no <command>DROP DATABASE</command> in <acronym>SQL92</acronym>. There is no <command>DROP DATABASE</command> in <acronym>SQL92</acronym>.
</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
sgml-omittag:t sgml-omittag:nil
sgml-shorttag:t sgml-shorttag:t
sgml-minimize-attributes:nil sgml-minimize-attributes:nil
sgml-always-quote-attributes:t sgml-always-quote-attributes:t

View File

@ -1,179 +1,173 @@
<REFENTRY ID="SQL-DROPFUNCTION"> <refentry id="SQL-DROPFUNCTION">
<REFMETA> <refmeta>
<REFENTRYTITLE> <refentrytitle>
DROP FUNCTION DROP FUNCTION
</REFENTRYTITLE> </refentrytitle>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO> <refmiscinfo>SQL - Language Statements</refmiscinfo>
</REFMETA> </refmeta>
<REFNAMEDIV> <refnamediv>
<REFNAME> <refname>
DROP FUNCTION DROP FUNCTION
</REFNAME> </refname>
<REFPURPOSE> <refpurpose>
Removes a user-defined C function Removes a user-defined C function
</REFPURPOSE> </refpurpose>
</refnamediv> </refnamediv>
<REFSYNOPSISDIV> <refsynopsisdiv>
<REFSYNOPSISDIVINFO> <refsynopsisdivinfo>
<DATE>1998-04-15</DATE> <date>1998-04-15</date>
</REFSYNOPSISDIVINFO> </refsynopsisdivinfo>
<SYNOPSIS> <synopsis>
DROP FUNCTION <replaceable class="parameter">name</replaceable> ( [ <replaceable class="parameter">type</replaceable> [, ...] ] ) DROP FUNCTION <replaceable class="parameter">name</replaceable> ( [ <replaceable class="parameter">type</replaceable> [, ...] ] )
</SYNOPSIS> </synopsis>
<REFSECT2 ID="R2-SQL-DROPFUNCTION-1"> <refsect2 id="R2-SQL-DROPFUNCTION-1">
<REFSECT2INFO> <refsect2info>
<DATE>1998-04-15</DATE> <date>1998-04-15</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Inputs Inputs
</TITLE> </title>
<PARA> <para>
</PARA> <variablelist>
<VARIABLELIST> <varlistentry>
<VARLISTENTRY> <term><replaceable class="parameter"> name</replaceable></term>
<TERM> <listitem>
<replaceable class="parameter"> name</replaceable> <para>
</TERM>
<LISTITEM>
<PARA>
The name of an existing function. The name of an existing function.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="parameter">type</replaceable></term>
<replaceable class="parameter">type</replaceable> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
The type of function parameters. The type of function parameters.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
</variablelist> </variablelist>
</REFSECT2> </para>
</refsect2>
<REFSECT2 ID="R2-SQL-DROPFUNCTION-2"> <refsect2 id="R2-SQL-DROPFUNCTION-2">
<REFSECT2INFO> <refsect2info>
<DATE>1998-04-15</DATE> <date>1998-04-15</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Outputs Outputs
</TITLE> </title>
<PARA> <para>
<VARIABLELIST> <variablelist>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
<ReturnValue>DROP</ReturnValue> DROP
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
Message returned if the command completes successfully. Message returned if the command completes successfully.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
<ReturnValue>WARN RemoveFunction: Function "<replaceable class="parameter">name</replaceable>" ("<replaceable class="parameter">types</replaceable>") does not exist</ReturnValue> WARN RemoveFunction: Function "<replaceable class="parameter">name</replaceable>" ("<replaceable class="parameter">types</replaceable>") does not exist
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
This message is given if the function specified does not This message is given if the function specified does not
exist in the current database. exist in the current database.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</VARIABLELIST> </variablelist>
</para> </para>
</REFSECT2> </refsect2>
</REFSYNOPSISDIV> </refsynopsisdiv>
<REFSECT1 ID="R1-SQL-DROPFUNCTION-1"> <refsect1 id="R1-SQL-DROPFUNCTION-1">
<REFSECT1INFO> <refsect1info>
<DATE>1998-04-15</DATE> <date>1998-04-15</date>
</REFSECT1INFO> </refsect1info>
<TITLE> <title>
Description Description
</TITLE> </title>
<PARA> <para>
DROP FUNCTION will remove references to an existing C DROP FUNCTION will remove references to an existing C
function. To execute this command the user must be the function. To execute this command the user must be the
owner of the function. The input argument types to the owner of the function. The input argument types to the
function must be specified, as only the function with the function must be specified, as only the function with the
given name and argument types will be removed. given name and argument types will be removed.
</PARA> </para>
<REFSECT2 ID="R2-SQL-DROPFUNCTION-3"> <refsect2 id="R2-SQL-DROPFUNCTION-3">
<REFSECT2INFO> <refsect2info>
<DATE>1998-04-15</DATE> <date>1998-04-15</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Notes Notes
</TITLE> </title>
<PARA> <para>
Refer to <citerefentry> Refer to <command>CREATE FUNCTION</command>
<refentrytitle>
CREATE FUNCTION
</refentrytitle>
</citerefentry>
to create aggregate functions. to create aggregate functions.
</PARA> </para>
</REFSECT2> </refsect2>
</refsect1> </refsect1>
<REFSECT1 ID="R1-SQL-DROPFUNCTION-2"> <refsect1 id="R1-SQL-DROPFUNCTION-2">
<TITLE> <title>
Usage Usage
</TITLE> </title>
<PARA> <para>
This command removes the square root function: This command removes the square root function:
</PARA>
<ProgramListing>
DROP FUNCTION sqrt(int4);
</ProgramListing>
</REFSECT1>
<REFSECT1 ID="R1-SQL-DROPFUNCTION-3"> <programlisting>
<TITLE> DROP FUNCTION sqrt(int4);
</programlisting>
</para>
</refsect1>
<refsect1 id="R1-SQL-DROPFUNCTION-3">
<title>
Bugs Bugs
</TITLE> </title>
<PARA> <para>
No checks are made to ensure that types, operators or access No checks are made to ensure that types, operators or access
methods that rely on the function have been removed first. methods that rely on the function have been removed first.
</PARA> </para>
</REFSECT1> </refsect1>
<REFSECT1 ID="R1-SQL-DROPFUNCTION-4"> <refsect1 id="R1-SQL-DROPFUNCTION-4">
<TITLE> <title>
Compatibility Compatibility
</TITLE> </title>
<PARA> <para>
DROP FUNCTION is a <productname>Postgres</productname> language extension. DROP FUNCTION is a <productname>Postgres</productname> language extension.
</PARA> </para>
<REFSECT2 ID="R2-SQL-DROPFUNCTION-4"> <refsect2 id="R2-SQL-DROPFUNCTION-4">
<REFSECT2INFO> <refsect2info>
<DATE>1998-04-15</DATE> <date>1998-04-15</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
SQL/PSM SQL/PSM
</TITLE> </title>
<PARA> <para>
SQL/PSM is a proposed standard to enable function extensibility. SQL/PSM is a proposed standard to enable function extensibility.
The SQL/PSM DROP FUNCTION statement has the following syntax: The SQL/PSM DROP FUNCTION statement has the following syntax:
<programlisting> <programlisting>
DROP [ SPECIFIC ] FUNCTION <replaceable class="parameter">name</replaceable> { RESTRICT | CASCADE }</programlisting> DROP [ SPECIFIC ] FUNCTION <replaceable class="parameter">name</replaceable> { RESTRICT | CASCADE }
</PARA> </programlisting>
</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
sgml-omittag:t sgml-omittag:nil
sgml-shorttag:t sgml-shorttag:t
sgml-minimize-attributes:nil sgml-minimize-attributes:nil
sgml-always-quote-attributes:t sgml-always-quote-attributes:t

View File

@ -1,157 +1,156 @@
<REFENTRY ID="SQL-DROPINDEX"> <refentry id="SQL-DROPINDEX">
<REFMETA> <refmeta>
<REFENTRYTITLE> <refentrytitle>
DROP INDEX DROP INDEX
</REFENTRYTITLE> </refentrytitle>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO> <refmiscinfo>SQL - Language Statements</refmiscinfo>
</REFMETA> </refmeta>
<REFNAMEDIV> <refnamediv>
<REFNAME> <refname>
DROP INDEX DROP INDEX
</REFNAME> </refname>
<REFPURPOSE> <refpurpose>
Removes an index from a database Removes an index from a database
</REFPURPOSE> </refpurpose>
</refnamediv> </refnamediv>
<REFSYNOPSISDIV> <refsynopsisdiv>
<REFSYNOPSISDIVINFO> <refsynopsisdivinfo>
<DATE>1998-04-15</DATE> <date>1998-04-15</date>
</REFSYNOPSISDIVINFO> </refsynopsisdivinfo>
<SYNOPSIS> <synopsis>
DROP INDEX <REPLACEABLE CLASS="PARAMETER">index_name</REPLACEABLE> DROP INDEX <replaceable class="PARAMETER">index_name</replaceable>
</SYNOPSIS> </synopsis>
<REFSECT2 ID="R2-SQL-DROPINDEX-1"> <refsect2 id="R2-SQL-DROPINDEX-1">
<REFSECT2INFO> <refsect2info>
<DATE>1998-04-15</DATE> <date>1998-04-15</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Inputs Inputs
</TITLE> </title>
<PARA> <para>
</PARA> <variablelist>
<VARIABLELIST> <varlistentry>
<VARLISTENTRY> <term><replaceable class="PARAMETER">index_name</replaceable></term>
<TERM> <listitem>
<ReturnValue><REPLACEABLE CLASS="PARAMETER">index_name</REPLACEABLE></ReturnValue> <para>
</TERM>
<LISTITEM>
<PARA>
The name of the index to remove. The name of the index to remove.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
</variablelist> </variablelist>
</REFSECT2> </para>
</refsect2>
<REFSECT2 ID="R2-SQL-DROPINDEX-2"> <refsect2 id="R2-SQL-DROPINDEX-2">
<REFSECT2INFO> <refsect2info>
<DATE>1998-04-15</DATE> <date>1998-04-15</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Outputs Outputs
</TITLE> </title>
<PARA> <para>
<VARIABLELIST> <variablelist>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
<ReturnValue>DROP</ReturnValue> DROP
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
The message returned if the index is successfully dropped. The message returned if the index is successfully dropped.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
<ReturnValue>ERROR: index "<REPLACEABLE CLASS="PARAMETER">index_name</REPLACEABLE>" nonexistent</ReturnValue> ERROR: index "<replaceable class="PARAMETER">index_name</replaceable>" nonexistent
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
This message occurs if <REPLACEABLE CLASS="PARAMETER">index_name</REPLACEABLE> This message occurs if <replaceable class="PARAMETER">index_name</replaceable>
is not an index in the database. is not an index in the database.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</VARIABLELIST> </variablelist>
</para> </para>
</REFSECT2> </refsect2>
</REFSYNOPSISDIV> </refsynopsisdiv>
<REFSECT1 ID="R1-SQL-DROPINDEX-1"> <refsect1 id="R1-SQL-DROPINDEX-1">
<REFSECT1INFO> <refsect1info>
<DATE>1998-04-15</DATE> <date>1998-04-15</date>
</REFSECT1INFO> </refsect1info>
<TITLE> <title>
Description Description
</TITLE> </title>
<PARA> <para>
<command>DROP INDEX</command> drops an existing index from the database <command>DROP INDEX</command> drops an existing index from the database
system. To execute this command you must be the owner of system. To execute this command you must be the owner of
the index. the index.
</PARA> </para>
<REFSECT2 ID="R2-SQL-DROPINDEX-3"> <refsect2 id="R2-SQL-DROPINDEX-3">
<REFSECT2INFO> <refsect2info>
<DATE>1998-04-15</DATE> <date>1998-04-15</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Notes Notes
</TITLE> </title>
<PARA> <para>
<command>DROP INDEX</command> is a <productname>Postgres</productname> <command>DROP INDEX</command> is a <productname>Postgres</productname>
language extension. language extension.
</PARA> </para>
<PARA> <para>
Refer to the <command>CREATE INDEX</command> statement for Refer to the <command>CREATE INDEX</command> statement for
information on how to create indexes. information on how to create indexes.
</PARA> </para>
</REFSECT2> </refsect2>
</refsect1> </refsect1>
<REFSECT1 ID="R1-SQL-DROPINDEX-2"> <refsect1 id="R1-SQL-DROPINDEX-2">
<TITLE> <title>
Usage Usage
</TITLE> </title>
<PARA> <para>
This command will remove the <literal>title_idx</literal> index: This command will remove the <literal>title_idx</literal> index:
</PARA>
<ProgramListing> <programlisting>
DROP INDEX title_idx; DROP INDEX title_idx;
</ProgramListing> </programlisting>
</REFSECT1> </para>
</refsect1>
<REFSECT1 ID="R1-SQL-DROPINDEX-3"> <refsect1 id="R1-SQL-DROPINDEX-3">
<TITLE> <title>
Compatibility Compatibility
</TITLE> </title>
<PARA> <para>
</PARA> </para>
<REFSECT2 ID="R2-SQL-DROPINDEX-4"> <refsect2 id="R2-SQL-DROPINDEX-4">
<REFSECT2INFO> <refsect2info>
<DATE>1998-04-15</DATE> <date>1998-04-15</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
SQL92 SQL92
</TITLE> </title>
<PARA> <para>
<acronym>SQL92</acronym> defines commands by which to access <acronym>SQL92</acronym> defines commands by which to access
a generic relational database. a generic relational database.
Indexes are an implementation-dependent feature and hence Indexes are an implementation-dependent feature and hence
there are no index-specific commands or definitions in the there are no index-specific commands or definitions in the
<acronym>SQL92</acronym> language. <acronym>SQL92</acronym> language.
</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
sgml-omittag:t sgml-omittag:nil
sgml-shorttag:t sgml-shorttag:t
sgml-minimize-attributes:nil sgml-minimize-attributes:nil
sgml-always-quote-attributes:t sgml-always-quote-attributes:t

View File

@ -1,172 +1,170 @@
<REFENTRY ID="SQL-DROPLANGUAGE"> <refentry id="SQL-DROPLANGUAGE">
<REFMETA> <refmeta>
<REFENTRYTITLE> <refentrytitle>
DROP LANGUAGE DROP LANGUAGE
</REFENTRYTITLE> </refentrytitle>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO> <refmiscinfo>SQL - Language Statements</refmiscinfo>
</REFMETA> </refmeta>
<REFNAMEDIV> <refnamediv>
<REFNAME> <refname>
DROP LANGUAGE DROP LANGUAGE
</REFNAME> </refname>
<REFPURPOSE> <refpurpose>
Removes a user-defined procedural language Removes a user-defined procedural language
</REFPURPOSE> </refpurpose>
</refnamediv> </refnamediv>
<REFSYNOPSISDIV> <refsynopsisdiv>
<REFSYNOPSISDIVINFO> <refsynopsisdivinfo>
<DATE>1998-04-15</DATE> <date>1998-04-15</date>
</REFSYNOPSISDIVINFO> </refsynopsisdivinfo>
<SYNOPSIS> <synopsis>
DROP PROCEDURAL LANGUAGE '<REPLACEABLE CLASS="PARAMETER">langname</REPLACEABLE>' DROP PROCEDURAL LANGUAGE '<replaceable class="PARAMETER">name</replaceable>'
</SYNOPSIS> </synopsis>
<REFSECT2 ID="R2-SQL-DROPLANGUAGE-1"> <refsect2 id="R2-SQL-DROPLANGUAGE-1">
<REFSECT2INFO> <refsect2info>
<DATE>1998-04-15</DATE> <date>1998-04-15</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Inputs Inputs
</TITLE> </title>
<PARA> <para>
</PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
<REPLACEABLE CLASS="PARAMETER">langname</REPLACEABLE>
</TERM>
<LISTITEM>
<PARA>
The name of an existing language.
</PARA>
</LISTITEM>
</VARLISTENTRY>
</variablelist>
</REFSECT2>
<REFSECT2 ID="R2-SQL-DROPLANGUAGE-2"> <variablelist>
<REFSECT2INFO> <varlistentry>
<DATE>1998-04-15</DATE> <term><replaceable class="PARAMETER">name</replaceable></term>
</REFSECT2INFO> <listitem>
<TITLE> <para>
Outputs The name of an existing procedural language.
</TITLE>
<PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
<ReturnValue>DROP</ReturnValue>
</TERM>
<LISTITEM>
<PARA>
This message is returned if the language is successfully dropped.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
<ReturnValue>
ERROR: Language "<replaceable class="parameter">langname</replaceable>" doesn't exist</ReturnValue>
</TERM>
<LISTITEM>
<PARA>
This message occurs if the language
"<replaceable class="parameter">langname</replaceable>" is
not found.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</VARIABLELIST> </variablelist>
</para> </para>
</REFSECT2>
</REFSYNOPSISDIV>
<REFSECT1 ID="R1-SQL-DROPLANGUAGE-1">
<REFSECT1INFO>
<DATE>1998-04-15</DATE>
</REFSECT1INFO>
<TITLE>
Description
</TITLE>
<PARA>
<command>DROP PROCEDURAL LANGUAGE</command> will remove the definition
of the previously registered procedural language having the name
'<replaceable class="parameter">langname</replaceable>'.
</PARA>
<REFSECT2 ID="R2-SQL-DROPLANGUAGE-3">
<REFSECT2INFO>
<DATE>1998-04-15</DATE>
</REFSECT2INFO>
<TITLE>
Notes
</TITLE>
<PARA>
The <command>DROP PROCEDURAL LANGUAGE</command> statement is
a <productname>Postgres</productname> language extension.
</PARA>
<PARA>
Refer to <command>CREATE PROCEDURAL LANGUAGE</command>
for information on how to create procedural languages.
</PARA>
</refsect2> </refsect2>
<REFSECT2 ID="R2-SQL-DROPLANGUAGE-4"> <refsect2 id="R2-SQL-DROPLANGUAGE-2">
<REFSECT2INFO> <refsect2info>
<DATE>1998-04-15</DATE> <date>1998-04-15</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Outputs
</title>
<para>
<variablelist>
<varlistentry>
<term><computeroutput>
DROP
</computeroutput></term>
<listitem>
<para>
This message is returned if the language is successfully dropped.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><computeroutput>
ERROR: Language "<replaceable class="parameter">name</replaceable>" doesn't exist
</computeroutput></term>
<listitem>
<para>
This message occurs if a language called
<replaceable class="parameter">name</replaceable> is
not found in the database.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
</refsynopsisdiv>
<refsect1 id="R1-SQL-DROPLANGUAGE-1">
<refsect1info>
<date>1998-04-15</date>
</refsect1info>
<title>
Description
</title>
<para>
<command>DROP PROCEDURAL LANGUAGE</command> will remove the definition
of the previously registered procedural language called
<replaceable class="parameter">name</replaceable>.
</para>
<refsect2 id="R2-SQL-DROPLANGUAGE-3">
<refsect2info>
<date>1998-04-15</date>
</refsect2info>
<title>
Notes
</title>
<para>
The <command>DROP PROCEDURAL LANGUAGE</command> statement is
a <productname>Postgres</productname> language extension.
</para>
<para>
Refer to <command>CREATE PROCEDURAL LANGUAGE</command>
for information on how to create procedural languages.
</para>
</refsect2>
<refsect2 id="R2-SQL-DROPLANGUAGE-4">
<refsect2info>
<date>1998-04-15</date>
</refsect2info>
<title>
Bugs Bugs
</TITLE> </title>
<PARA> <para>
No checks are made if functions or trigger procedures registered No checks are made if functions or trigger procedures registered
in this language still exist. To re-enable them without having in this language still exist. To re-enable them without having
to drop and recreate all the functions, the pg_proc's prolang to drop and recreate all the functions, the pg_proc's prolang
attribute of the functions must be adjusted to the new object attribute of the functions must be adjusted to the new object
ID of the recreated pg_language entry for the PL. ID of the recreated pg_language entry for the PL.
</PARA> </para>
</REFSECT2>
</refsect1>
<REFSECT1 ID="R1-SQL-DROPLANGUAGE-2">
<TITLE>
Usage
</TITLE>
<PARA>
This command removes the PL/Sample language:
</PARA>
<ProgramListing>
DROP PROCEDURAL LANGUAGE 'plsample'
</ProgramListing>
</REFSECT1>
<REFSECT1 ID="R1-SQL-DROPLANGUAGE-3">
<TITLE>
Compatibility
</TITLE>
<PARA>
</PARA>
<REFSECT2 ID="R2-SQL-DROPLANGUAGE-5">
<REFSECT2INFO>
<DATE>1998-04-15</DATE>
</REFSECT2INFO>
<TITLE>
SQL92
</TITLE>
<PARA>
There is no <command>DROP PROCEDURAL LANGUAGE</command> in
<acronym>SQL92</acronym>.
</PARA>
</refsect2> </refsect2>
</refsect1> </refsect1>
</REFENTRY>
<refsect1 id="R1-SQL-DROPLANGUAGE-2">
<title>
Usage
</title>
<para>
This command removes the PL/Sample language:
<programlisting>
DROP PROCEDURAL LANGUAGE 'plsample';
</programlisting>
</para>
</refsect1>
<refsect1 id="R1-SQL-DROPLANGUAGE-3">
<title>
Compatibility
</title>
<para>
</para>
<refsect2 id="R2-SQL-DROPLANGUAGE-5">
<refsect2info>
<date>1998-04-15</date>
</refsect2info>
<title>
SQL92
</title>
<para>
There is no <command>DROP PROCEDURAL LANGUAGE</command> in
<acronym>SQL92</acronym>.
</para>
</refsect2>
</refsect1>
</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
sgml-omittag:t sgml-omittag:nil
sgml-shorttag:t sgml-shorttag:t
sgml-minimize-attributes:nil sgml-minimize-attributes:nil
sgml-always-quote-attributes:t sgml-always-quote-attributes:t

View File

@ -1,207 +1,204 @@
<REFENTRY ID="SQL-DROPOPERATOR"> <refentry id="SQL-DROPOPERATOR">
<REFMETA> <refmeta>
<REFENTRYTITLE> <refentrytitle>
DROP OPERATOR DROP OPERATOR
</REFENTRYTITLE> </refentrytitle>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO> <refmiscinfo>SQL - Language Statements</refmiscinfo>
</REFMETA> </refmeta>
<REFNAMEDIV> <refnamediv>
<REFNAME> <refname>
DROP OPERATOR DROP OPERATOR
</REFNAME> </refname>
<REFPURPOSE> <refpurpose>
Removes an operator from the database Removes an operator from the database
</REFPURPOSE> </refpurpose>
</refnamediv> </refnamediv>
<REFSYNOPSISDIV> <refsynopsisdiv>
<REFSYNOPSISDIVINFO> <refsynopsisdivinfo>
<DATE>1998-09-22</DATE> <date>1998-09-22</date>
</REFSYNOPSISDIVINFO> </refsynopsisdivinfo>
<SYNOPSIS> <synopsis>
DROP OPERATOR <REPLACEABLE CLASS="PARAMETER">id</REPLACEABLE> ( <REPLACEABLE CLASS="PARAMETER">type</REPLACEABLE> | NONE [,...] ) DROP OPERATOR <replaceable class="PARAMETER">id</replaceable> ( <replaceable class="PARAMETER">type</replaceable> | NONE [,...] )
</SYNOPSIS> </synopsis>
<REFSECT2 ID="R2-SQL-DROPOPERATOR-1"> <refsect2 id="R2-SQL-DROPOPERATOR-1">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-22</DATE> <date>1998-09-22</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Inputs Inputs
</TITLE> </title>
<PARA> <para>
</PARA> <variablelist>
<VARIABLELIST> <varlistentry>
<VARLISTENTRY> <term><replaceable class="parameter">id</replaceable></term>
<TERM> <listitem>
<replaceable class="parameter">id</replaceable> <para>
</TERM>
<LISTITEM>
<PARA>
The identifier of an existing operator. The identifier of an existing operator.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="parameter">type</replaceable></term>
<replaceable class="parameter">type</replaceable> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
The type of function parameters. The type of function parameters.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
</variablelist> </variablelist>
</REFSECT2> </para>
</refsect2>
<REFSECT2 ID="R2-SQL-DROPOPERATOR-2"> <refsect2 id="R2-SQL-DROPOPERATOR-2">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-22</DATE> <date>1998-09-22</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Outputs Outputs
</TITLE> </title>
<PARA> <para>
<VARIABLELIST> <variablelist>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
<ReturnValue>DROP</ReturnValue> DROP
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
The message returned if the command is successful. The message returned if the command is successful.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
<ReturnValue>ERROR: RemoveOperator: binary operator '<REPLACEABLE CLASS="PARAMETER">id</REPLACEABLE>' taking '<REPLACEABLE CLASS="PARAMETER">type1</REPLACEABLE>' and '<REPLACEABLE CLASS="PARAMETER">type2</REPLACEABLE>' does not exist</ReturnValue> ERROR: RemoveOperator: binary operator '<replaceable class="PARAMETER">oper</replaceable>' taking '<replaceable class="PARAMETER">type</replaceable>' and '<replaceable class="PARAMETER">type2</replaceable>' does not exist
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
This message occurs if the specified binary operator does not exist. This message occurs if the specified binary operator does not exist.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
<ReturnValue>ERROR: RemoveOperator: left unary operator '<REPLACEABLE CLASS="PARAMETER">id</REPLACEABLE>' taking '<REPLACEABLE CLASS="PARAMETER">type</REPLACEABLE>' does not exist</ReturnValue> ERROR: RemoveOperator: left unary operator '<replaceable class="PARAMETER">oper</replaceable>' taking '<replaceable class="PARAMETER">type</replaceable>' does not exist
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
This message occurs if the specified left unary operator This message occurs if the specified left unary operator
specified does not exist. specified does not exist.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
<ReturnValue>ERROR: RemoveOperator: right unary operator '<REPLACEABLE CLASS="PARAMETER">id</REPLACEABLE>' taking '<REPLACEABLE CLASS="PARAMETER">type</REPLACEABLE>' does not exist</ReturnValue> ERROR: RemoveOperator: right unary operator '<replaceable class="PARAMETER">oper</replaceable>' taking '<replaceable class="PARAMETER">type</replaceable>' does not exist
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
This message occurs if the specified right unary operator This message occurs if the specified right unary operator
specified does not exist. specified does not exist.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</VARIABLELIST> </variablelist>
</para> </para>
</REFSECT2> </refsect2>
</REFSYNOPSISDIV> </refsynopsisdiv>
<REFSECT1 ID="R1-SQL-DROPOPERATOR-1"> <refsect1 id="R1-SQL-DROPOPERATOR-1">
<REFSECT1INFO> <refsect1info>
<DATE>1998-09-22</DATE> <date>1998-09-22</date>
</REFSECT1INFO> </refsect1info>
<TITLE> <title>
Description Description
</TITLE> </title>
<PARA> <para>
The DROP OPERATOR statement drops an existing operator from the <command>DROP OPERATOR</command> drops an existing operator from the
database. database.
To execute this command you must be the owner of the operator. To execute this command you must be the owner of the operator.
</PARA> </para>
<PARA> <para>
The left or right type of a left or right unary The left or right type of a left or right unary
operator, respectively, may be specified as NONE. operator, respectively, may be specified as <literal>NONE</literal>.
</PARA> </para>
<REFSECT2 ID="R2-SQL-DROPOPERATOR-3"> <refsect2 id="R2-SQL-DROPOPERATOR-3">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-22</DATE> <date>1998-09-22</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Notes Notes
</TITLE> </title>
<PARA> <para>
The <command>DROP OPERATOR</command> statement is a The <command>DROP OPERATOR</command> statement is a
<productname>Postgres</productname> <productname>Postgres</productname>
language extension. language extension.
</PARA> </para>
<PARA> <para>
Refer to <command>CREATE OPERATOR</command> for Refer to <command>CREATE OPERATOR</command> for
information on how to create operators. information on how to create operators.
</PARA> </para>
<PARA> <para>
It is the user's responsibility to remove any access methods and It is the user's responsibility to remove any access methods and
operator classes that rely on the deleted operator. operator classes that rely on the deleted operator.
</PARA> </para>
</REFSECT2>
</refsect1>
<REFSECT1 ID="R1-SQL-DROPOPERATOR-2">
<TITLE>
Usage
</TITLE>
<PARA>
Remove power operator <literal>a^n</literal> for <literal>int4</literal>:
</PARA>
<ProgramListing>
DROP OPERATOR ^ (int4, int4);
</ProgramListing>
<PARA>
Remove left unary operator <literal>!a</literal> for booleans:
</PARA>
<ProgramListing>
DROP OPERATOR ! (none, bool);
</ProgramListing>
<PARA>
Remove right unary factorial operator <literal>a!</literal> for
<literal>int4</literal>:
</PARA>
<ProgramListing>
DROP OPERATOR ! (int4, none);
</ProgramListing>
</REFSECT1>
<REFSECT1 ID="R1-SQL-DROPOPERATOR-3">
<TITLE>
Compatibility
</TITLE>
<PARA>
</PARA>
<REFSECT2 ID="R2-SQL-DROPOPERATOR-4">
<REFSECT2INFO>
<DATE>1998-09-22</DATE>
</REFSECT2INFO>
<TITLE>
SQL92
</TITLE>
<PARA>
There is no <command>DROP OPERATOR</command> in <acronym>SQL92</acronym>.
</PARA>
</refsect2> </refsect2>
</refsect1> </refsect1>
</REFENTRY>
<refsect1 id="R1-SQL-DROPOPERATOR-2">
<title>
Usage
</title>
<para>
Remove power operator <literal>a^n</literal> for <literal>int4</literal>:
<programlisting>
DROP OPERATOR ^ (int4, int4);
</programlisting>
</para>
<para>
Remove left unary negation operator (<literal>b !</literal>) for booleans:
<programlisting>
DROP OPERATOR ! (none, bool);
</programlisting>
</para>
<para>
Remove right unary factorial operator (<literal>! i</literal>) for
<literal>int4</literal>:
<programlisting>
DROP OPERATOR ! (int4, none);
</programlisting>
</para>
</refsect1>
<refsect1 id="R1-SQL-DROPOPERATOR-3">
<title>
Compatibility
</title>
<para>
</para>
<refsect2 id="R2-SQL-DROPOPERATOR-4">
<refsect2info>
<date>1998-09-22</date>
</refsect2info>
<title>
SQL92
</title>
<para>
There is no <command>DROP OPERATOR</command> in <acronym>SQL92</acronym>.
</para>
</refsect2>
</refsect1>
</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
sgml-omittag:t sgml-omittag:nil
sgml-shorttag:t sgml-shorttag:t
sgml-minimize-attributes:nil sgml-minimize-attributes:nil
sgml-always-quote-attributes:t sgml-always-quote-attributes:t

View File

@ -1,168 +1,166 @@
<REFENTRY ID="SQL-DROPRULE"> <refentry id="SQL-DROPRULE">
<REFMETA> <refmeta>
<REFENTRYTITLE> <refentrytitle>
DROP RULE DROP RULE
</REFENTRYTITLE> </refentrytitle>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO> <refmiscinfo>SQL - Language Statements</refmiscinfo>
</REFMETA> </refmeta>
<REFNAMEDIV> <refnamediv>
<REFNAME> <refname>
DROP RULE DROP RULE
</REFNAME> </refname>
<REFPURPOSE> <refpurpose>
Removes an existing rule from the database Removes an existing rule from the database
</REFPURPOSE> </refpurpose>
</refnamediv> </refnamediv>
<REFSYNOPSISDIV> <refsynopsisdiv>
<REFSYNOPSISDIVINFO> <refsynopsisdivinfo>
<DATE>1998-09-22</DATE> <date>1998-09-22</date>
</REFSYNOPSISDIVINFO> </refsynopsisdivinfo>
<SYNOPSIS> <synopsis>
DROP RULE <REPLACEABLE CLASS="PARAMETER">name</REPLACEABLE> DROP RULE <replaceable class="PARAMETER">name</replaceable>
</SYNOPSIS> </synopsis>
<REFSECT2 ID="R2-SQL-DROPRULE-1"> <refsect2 id="R2-SQL-DROPRULE-1">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-22</DATE> <date>1998-09-22</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Inputs Inputs
</TITLE> </title>
<PARA> <para>
</PARA> <variablelist>
<VARIABLELIST> <varlistentry>
<VARLISTENTRY> <term><replaceable class="parameter">name</replaceable></term>
<TERM> <listitem>
<replaceable class="parameter">name</replaceable> <para>
</TERM>
<LISTITEM>
<PARA>
The name of an existing rule to drop. The name of an existing rule to drop.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
</variablelist> </variablelist>
</REFSECT2> </para>
</refsect2>
<REFSECT2 ID="R2-SQL-DROPRULE-2"> <refsect2 id="R2-SQL-DROPRULE-2">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-22</DATE> <date>1998-09-22</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Outputs Outputs
</TITLE> </title>
<PARA> <para>
<VARIABLELIST> <variablelist>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
<ReturnValue>DROP</ReturnValue> DROP
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
Message returned if successfully. Message returned if successfully.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
<ReturnValue>ERROR: RewriteGetRuleEventRel: rule "<replaceable class="parameter">name</replaceable>" not found</ReturnValue> ERROR: RewriteGetRuleEventRel: rule "<replaceable class="parameter">name</replaceable>" not found
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
This message occurs if the specified rule does not exist. This message occurs if the specified rule does not exist.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</VARIABLELIST> </variablelist>
</para> </para>
</REFSECT2> </refsect2>
</REFSYNOPSISDIV> </refsynopsisdiv>
<REFSECT1 ID="R1-SQL-DROPRULE-1"> <refsect1 id="R1-SQL-DROPRULE-1">
<REFSECT1INFO> <refsect1info>
<DATE>1998-09-22</DATE> <date>1998-09-22</date>
</REFSECT1INFO> </refsect1info>
<TITLE> <title>
Description Description
</TITLE> </title>
<PARA> <para>
<command>DROP RULE</command> drops a rule from the specified <command>DROP RULE</command> drops a rule from the specified
<productname>Postgres</productname> rule <productname>Postgres</productname> rule
system. <productname>Postgres</productname> system. <productname>Postgres</productname>
will immediately cease enforcing it and will immediately cease enforcing it and
will purge its definition from the system catalogs. will purge its definition from the system catalogs.
</PARA> </para>
<REFSECT2 ID="R2-SQL-DROPRULE-3"> <refsect2 id="R2-SQL-DROPRULE-3">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-22</DATE> <date>1998-09-22</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Notes Notes
</TITLE> </title>
<PARA> <para>
The <command>DROP RULE</command> statement is a The <command>DROP RULE</command> statement is a
<productname>Postgres</productname> <productname>Postgres</productname>
language extension. language extension.
</PARA> </para>
<PARA> <para>
Refer to <command>CREATE RULE</command> for Refer to <command>CREATE RULE</command> for
information on how to create rules. information on how to create rules.
</PARA> </para>
</refsect2> </refsect2>
<REFSECT2 ID="R2-SQL-DROPRULE-4"> <refsect2 id="R2-SQL-DROPRULE-4">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-22</DATE> <date>1998-09-22</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Bugs Bugs
</TITLE> </title>
<PARA> <para>
Once a rule is dropped, access to historical information Once a rule is dropped, access to historical information
the rule has written may disappear. the rule has written may disappear.
</PARA> </para>
</REFSECT2>
</refsect1>
<REFSECT1 ID="R1-SQL-DROPRULE-2">
<TITLE>
Usage
</TITLE>
<PARA>
To drop the rewrite rule <literal>newrule</literal>:
</PARA>
<ProgramListing>
DROP RULE newrule
</ProgramListing>
</REFSECT1>
<REFSECT1 ID="R1-SQL-DROPRULE-3">
<TITLE>
Compatibility
</TITLE>
<PARA>
</PARA>
<REFSECT2 ID="R2-SQL-DROPRULE-5">
<REFSECT2INFO>
<DATE>1998-09-22</DATE>
</REFSECT2INFO>
<TITLE>
SQL92
</TITLE>
<PARA>
There is no <command>DROP RULE</command> in SQL92.
</PARA>
</refsect2> </refsect2>
</refsect1> </refsect1>
</REFENTRY>
<refsect1 id="R1-SQL-DROPRULE-2">
<title>
Usage
</title>
<para>
To drop the rewrite rule <literal>newrule</literal>:
<programlisting>
DROP RULE newrule;
</programlisting>
</para>
</refsect1>
<refsect1 id="R1-SQL-DROPRULE-3">
<title>
Compatibility
</title>
<para>
</para>
<refsect2 id="R2-SQL-DROPRULE-5">
<refsect2info>
<date>1998-09-22</date>
</refsect2info>
<title>
SQL92
</title>
<para>
There is no <command>DROP RULE</command> in SQL92.
</para>
</refsect2>
</refsect1>
</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
sgml-omittag:t sgml-omittag:nil
sgml-shorttag:t sgml-shorttag:t
sgml-minimize-attributes:nil sgml-minimize-attributes:nil
sgml-always-quote-attributes:t sgml-always-quote-attributes:t

View File

@ -1,155 +1,153 @@
<REFENTRY ID="SQL-DROPSEQUENCE"> <refentry id="SQL-DROPSEQUENCE">
<REFMETA> <refmeta>
<REFENTRYTITLE> <refentrytitle>
DROP SEQUENCE DROP SEQUENCE
</REFENTRYTITLE> </refentrytitle>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO> <refmiscinfo>SQL - Language Statements</refmiscinfo>
</REFMETA> </refmeta>
<REFNAMEDIV> <refnamediv>
<REFNAME> <refname>
DROP SEQUENCE DROP SEQUENCE
</REFNAME> </refname>
<REFPURPOSE> <refpurpose>
Removes an existing sequence Removes an existing sequence
</REFPURPOSE> </refpurpose>
</refnamediv> </refnamediv>
<REFSYNOPSISDIV> <refsynopsisdiv>
<REFSYNOPSISDIVINFO> <refsynopsisdivinfo>
<DATE>1998-09-22</DATE> <date>1998-09-22</date>
</REFSYNOPSISDIVINFO> </refsynopsisdivinfo>
<SYNOPSIS> <synopsis>
DROP SEQUENCE <REPLACEABLE CLASS="PARAMETER">seqname</REPLACEABLE> [, ...] DROP SEQUENCE <replaceable class="PARAMETER">name</replaceable> [, ...]
</SYNOPSIS> </synopsis>
<REFSECT2 ID="R2-SQL-DROPSEQUENCE-1"> <refsect2 id="R2-SQL-DROPSEQUENCE-1">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-22</DATE> <date>1998-09-22</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Inputs Inputs
</TITLE> </title>
<PARA> <para>
</PARA> <variablelist>
<VARIABLELIST> <varlistentry>
<VARLISTENTRY> <term><replaceable class="PARAMETER">name</replaceable></term>
<TERM> <listitem>
<REPLACEABLE CLASS="PARAMETER">seqname</REPLACEABLE> <para>
</TERM>
<LISTITEM>
<PARA>
The name of a sequence. The name of a sequence.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
</variablelist> </variablelist>
</REFSECT2> </para>
</refsect2>
<REFSECT2 ID="R2-SQL-DROPSEQUENCE-2"> <refsect2 id="R2-SQL-DROPSEQUENCE-2">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-22</DATE> <date>1998-09-22</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Outputs Outputs
</TITLE> </title>
<PARA> <para>
<VARIABLELIST> <variablelist>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
<ReturnValue>DROP</ReturnValue> DROP
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
The message returned if the sequence is successfully dropped. The message returned if the sequence is successfully dropped.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
<ReturnValue>WARN: Relation "<replaceable class="parameter">seqname</replaceable>" does not exist.</ReturnValue> WARN: Relation "<replaceable class="parameter">name</replaceable>" does not exist.
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
This message occurs if the specified sequence does not exist. This message occurs if the specified sequence does not exist.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</VARIABLELIST> </variablelist>
</para> </para>
</REFSECT2> </refsect2>
</REFSYNOPSISDIV> </refsynopsisdiv>
<REFSECT1 ID="R1-SQL-DROPSEQUENCE-1"> <refsect1 id="R1-SQL-DROPSEQUENCE-1">
<REFSECT1INFO> <refsect1info>
<DATE>1998-09-22</DATE> <date>1998-09-22</date>
</REFSECT1INFO> </refsect1info>
<TITLE> <title>
Description Description
</TITLE> </title>
<PARA> <para>
<command>DROP SEQUENCE</command> removes sequence number generators from the <command>DROP SEQUENCE</command> removes sequence number generators from the
data base. With the current implementation of sequences as data base. With the current implementation of sequences as
special tables it works just like the <command>DROP TABLE</command> special tables it works just like the <command>DROP TABLE</command>
statement. statement.
</PARA> </para>
<REFSECT2 ID="R2-SQL-DROPSEQUENCE-3"> <refsect2 id="R2-SQL-DROPSEQUENCE-3">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-22</DATE> <date>1998-09-22</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Notes Notes
</TITLE> </title>
<PARA> <para>
The <command>DROP SEQUENCE</command> statement is a The <command>DROP SEQUENCE</command> statement is a
<productname>Postgres</productname> <productname>Postgres</productname>
language extension. language extension.
</PARA> </para>
<PARA> <para>
Refer to the <command>CREATE SEQUENCE</command> statement for Refer to the <command>CREATE SEQUENCE</command> statement for
information on how to create a sequence. information on how to create a sequence.
</PARA> </para>
</REFSECT2>
</refsect1>
<REFSECT1 ID="R1-SQL-DROPSEQUENCE-2">
<TITLE>
Usage
</TITLE>
<PARA>
To remove sequence <literal>serial</literal> from database:
</PARA>
<ProgramListing>
DROP SEQUENCE serial
</ProgramListing>
</REFSECT1>
<REFSECT1 ID="R1-SQL-DROPSEQUENCE-3">
<TITLE>
Compatibility
</TITLE>
<PARA>
</PARA>
<REFSECT2 ID="R2-SQL-DROPSEQUENCE-4">
<REFSECT2INFO>
<DATE>1998-09-22</DATE>
</REFSECT2INFO>
<TITLE>
SQL92
</TITLE>
<PARA>
There is no <command>DROP SEQUENCE</command> in <acronym>SQL92</acronym>.
</PARA>
</refsect2> </refsect2>
</refsect1> </refsect1>
</REFENTRY>
<refsect1 id="R1-SQL-DROPSEQUENCE-2">
<title>
Usage
</title>
<para>
To remove sequence <literal>serial</literal> from database:
<programlisting>
DROP SEQUENCE serial;
</programlisting>
</para>
</refsect1>
<refsect1 id="R1-SQL-DROPSEQUENCE-3">
<title>
Compatibility
</title>
<para>
</para>
<refsect2 id="R2-SQL-DROPSEQUENCE-4">
<refsect2info>
<date>1998-09-22</date>
</refsect2info>
<title>
SQL92
</title>
<para>
There is no <command>DROP SEQUENCE</command> in <acronym>SQL92</acronym>.
</para>
</refsect2>
</refsect1>
</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
sgml-omittag:t sgml-omittag:nil
sgml-shorttag:t sgml-shorttag:t
sgml-minimize-attributes:nil sgml-minimize-attributes:nil
sgml-always-quote-attributes:t sgml-always-quote-attributes:t

View File

@ -1,146 +1,145 @@
<REFENTRY ID="SQL-DROPTABLE"> <refentry id="SQL-DROPTABLE">
<REFMETA> <refmeta>
<REFENTRYTITLE> <refentrytitle>
DROP TABLE DROP TABLE
</REFENTRYTITLE> </refentrytitle>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO> <refmiscinfo>SQL - Language Statements</refmiscinfo>
</REFMETA> </refmeta>
<REFNAMEDIV> <refnamediv>
<REFNAME> <refname>
DROP TABLE DROP TABLE
</REFNAME> </refname>
<REFPURPOSE> <refpurpose>
Removes existing tables from a database Removes existing tables from a database
</REFPURPOSE> </refpurpose>
</refnamediv> </refnamediv>
<REFSYNOPSISDIV> <refsynopsisdiv>
<REFSYNOPSISDIVINFO> <refsynopsisdivinfo>
<DATE>1998-09-22</DATE> <date>1998-09-22</date>
</REFSYNOPSISDIVINFO> </refsynopsisdivinfo>
<SYNOPSIS> <synopsis>
DROP TABLE <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE> [, ...] DROP TABLE <replaceable class="PARAMETER">name</replaceable> [, ...]
</SYNOPSIS> </synopsis>
<REFSECT2 ID="R2-SQL-DROPTABLE-1"> <refsect2 id="R2-SQL-DROPTABLE-1">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-22</DATE> <date>1998-09-22</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Inputs Inputs
</TITLE> </title>
<PARA> <para>
</PARA> <variablelist>
<VARIABLELIST> <varlistentry>
<VARLISTENTRY> <term><replaceable class="PARAMETER">name</replaceable></term>
<TERM> <listitem>
<ReturnValue><REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE></ReturnValue> <para>
</TERM>
<LISTITEM>
<PARA>
The name of an existing table or view to drop. The name of an existing table or view to drop.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
</variablelist> </variablelist>
</REFSECT2> </para>
</refsect2>
<REFSECT2 ID="R2-SQL-DROPTABLE-2"> <refsect2 id="R2-SQL-DROPTABLE-2">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-22</DATE> <date>1998-09-22</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Outputs Outputs
</TITLE> </title>
<PARA> <para>
<VARIABLELIST> <variablelist>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
<ReturnValue>DROP</ReturnValue> DROP
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
The message returned if the command completes successfully. The message returned if the command completes successfully.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
<ReturnValue> ERROR Relation "<replaceable class="parameter">table</replaceable>" Does Not Exist!</ReturnValue> ERROR Relation "<replaceable class="parameter">name</replaceable>" Does Not Exist!
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
If the specified table or view does not exist in the database. If the specified table or view does not exist in the database.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</VARIABLELIST> </variablelist>
</para> </para>
</REFSECT2> </refsect2>
</REFSYNOPSISDIV> </refsynopsisdiv>
<REFSECT1 ID="R1-SQL-DROPTABLE-1"> <refsect1 id="R1-SQL-DROPTABLE-1">
<REFSECT1INFO> <refsect1info>
<DATE>1998-09-22</DATE> <date>1998-09-22</date>
</REFSECT1INFO> </refsect1info>
<TITLE> <title>
Description Description
</TITLE> </title>
<PARA> <para>
<command>DROP TABLE</command> removes tables and views from the database. <command>DROP TABLE</command> removes tables and views from the database.
Only its owner may destroy a table or view. A table Only its owner may destroy a table or view. A table
may be emptied of rows, but not destroyed, by using <command>DELETE</command>. may be emptied of rows, but not destroyed, by using <command>DELETE</command>.
</PARA> </para>
<PARA> <para>
If a table being destroyed has secondary indexes on it, If a table being destroyed has secondary indexes on it,
they will be removed first. The removal of just a they will be removed first. The removal of just a
secondary index will not affect the contents of the underlying table. secondary index will not affect the contents of the underlying table.
</PARA> </para>
<REFSECT2 ID="R2-SQL-DROPTABLE-3"> <refsect2 id="R2-SQL-DROPTABLE-3">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-22</DATE> <date>1998-09-22</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Notes Notes
</TITLE> </title>
<PARA> <para>
Refer to <command>CREATE TABLE</command> and Refer to <command>CREATE TABLE</command> and
<command>ALTER TABLE</command> for information on <command>ALTER TABLE</command> for information on
how to create or modify tables. how to create or modify tables.
</PARA> </para>
</REFSECT2> </refsect2>
</refsect1> </refsect1>
<REFSECT1 ID="R1-SQL-DROPTABLE-2"> <refsect1 id="R1-SQL-DROPTABLE-2">
<TITLE> <title>
Usage Usage
</TITLE> </title>
<PARA> <para>
To destroy the <literal>films</literal> and To destroy two tables, <literal>films</literal> and
<command>distributors</command> tables: <command>distributors</command>:
</PARA>
<ProgramListing>
DROP TABLE films, distributors
</ProgramListing>
</REFSECT1>
<REFSECT1 ID="R1-SQL-DROPTABLE-3"> <programlisting>
<TITLE> DROP TABLE films, distributors;
</programlisting>
</para>
</refsect1>
<refsect1 id="R1-SQL-DROPTABLE-3">
<title>
Compatibility Compatibility
</TITLE> </title>
<PARA> <para>
</PARA> </para>
<REFSECT2 ID="R2-SQL-DROPTABLE-4"> <refsect2 id="R2-SQL-DROPTABLE-4">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-22</DATE> <date>1998-09-22</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
SQL92 SQL92
</TITLE> </title>
<PARA> <para>
SQL92 specifies some additional capabilities for DROP TABLE: SQL92 specifies some additional capabilities for DROP TABLE:
</PARA> </para>
<synopsis> <synopsis>
DROP TABLE <replaceable class="parameter">table</replaceable> { RESTRICT | CASCADE } DROP TABLE <replaceable class="parameter">table</replaceable> { RESTRICT | CASCADE }
</synopsis> </synopsis>
@ -172,12 +171,12 @@ DROP TABLE <replaceable class="parameter">table</replaceable> { RESTRICT | CASCA
</tip> </tip>
</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
sgml-omittag:t sgml-omittag:nil
sgml-shorttag:t sgml-shorttag:t
sgml-minimize-attributes:nil sgml-minimize-attributes:nil
sgml-always-quote-attributes:t sgml-always-quote-attributes:t

View File

@ -1,184 +1,162 @@
<REFENTRY ID="SQL-DROPTRIGGER"> <refentry id="SQL-DROPTRIGGER">
<REFMETA> <refmeta>
<REFENTRYTITLE> <refentrytitle>
DROP TRIGGER DROP TRIGGER
</REFENTRYTITLE> </refentrytitle>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO> <refmiscinfo>SQL - Language Statements</refmiscinfo>
</REFMETA> </refmeta>
<REFNAMEDIV> <refnamediv>
<REFNAME> <refname>
DROP TRIGGER DROP TRIGGER
</REFNAME> </refname>
<REFPURPOSE> <refpurpose>
Removes the definition of a trigger Removes the definition of a trigger
</REFPURPOSE> </refpurpose>
</refnamediv> </refnamediv>
<REFSYNOPSISDIV> <refsynopsisdiv>
<REFSYNOPSISDIVINFO> <refsynopsisdivinfo>
<DATE>1998-09-22</DATE> <date>1998-09-22</date>
</REFSYNOPSISDIVINFO> </refsynopsisdivinfo>
<SYNOPSIS> <synopsis>
DROP TRIGGER <REPLACEABLE CLASS="PARAMETER">name</REPLACEABLE> ON <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE> DROP TRIGGER <replaceable class="PARAMETER">name</replaceable> ON <replaceable class="PARAMETER">table</replaceable>
</SYNOPSIS> </synopsis>
<REFSECT2 ID="R2-SQL-DROPTRIGGER-1"> <refsect2 id="R2-SQL-DROPTRIGGER-1">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-22</DATE> <date>1998-09-22</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Inputs Inputs
</TITLE> </title>
<PARA> <para>
</PARA>
<VARIABLELIST> <variablelist>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="PARAMETER">name</replaceable></term>
<REPLACEABLE CLASS="PARAMETER">name</REPLACEABLE> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
The name of an existing trigger. The name of an existing trigger.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="PARAMETER">table</replaceable></term>
<REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
The name of a table. The name of a table.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
</variablelist> </variablelist>
</REFSECT2> </para>
</refsect2>
<REFSECT2 ID="R2-SQL-DROPTRIGGER-2"> <refsect2 id="R2-SQL-DROPTRIGGER-2">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-22</DATE> <date>1998-09-22</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Outputs Outputs
</TITLE> </title>
<PARA> <para>
<VARIABLELIST> <variablelist>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
<ReturnValue>DROP</ReturnValue> DROP
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
The message returned if the trigger is successfully dropped. The message returned if the trigger is successfully dropped.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
<ReturnValue>ERROR: DropTrigger: there is no trigger <REPLACEABLE CLASS="PARAMETER">name</REPLACEABLE> on relation "<replaceable class="parameter">table</replaceable>"</ReturnValue> ERROR: DropTrigger: there is no trigger <replaceable class="PARAMETER">name</replaceable> on relation "<replaceable class="parameter">table</replaceable>"
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
This message occurs if the trigger specified does not exist. This message occurs if the trigger specified does not exist.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</VARIABLELIST> </variablelist>
</para> </para>
</REFSECT2> </refsect2>
</REFSYNOPSISDIV> </refsynopsisdiv>
<REFSECT1 ID="R1-SQL-DROPTRIGGER-1"> <refsect1 id="R1-SQL-DROPTRIGGER-1">
<REFSECT1INFO> <refsect1info>
<DATE>1998-09-22</DATE> <date>1998-09-22</date>
</REFSECT1INFO> </refsect1info>
<TITLE> <title>
Description Description
</TITLE> </title>
<PARA> <para>
<command>DROP TRIGGER</command> will remove all references to an existing <command>DROP TRIGGER</command> will remove all references to an existing
trigger definition. To execute this command the current trigger definition. To execute this command the current
user must be the owner of the trigger. user must be the owner of the trigger.
</PARA> </para>
<REFSECT2 ID="R2-SQL-DROPTRIGGER-3"> <refsect2 id="R2-SQL-DROPTRIGGER-3">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-22</DATE> <date>1998-09-22</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Notes Notes
</TITLE> </title>
<PARA> <para>
<command>DROP TRIGGER</command> is a <productname>Postgres</productname> <command>DROP TRIGGER</command> is a <productname>Postgres</productname>
language extension. language extension.
</PARA> </para>
<PARA> <para>
Refer to <command>CREATE TRIGGER</command> for Refer to <command>CREATE TRIGGER</command> for
information on how to create triggers. information on how to create triggers.
</PARA> </para>
</REFSECT2>
</refsect1>
<REFSECT1 ID="R1-SQL-DROPTRIGGER-2">
<TITLE>
Usage
</TITLE>
<PARA>
Destroy the <literal>if_dist_exists</literal> trigger
on table <literal>films</literal>:
</PARA>
<ProgramListing>
DROP TRIGGER if_dist_exists ON films;
</ProgramListing>
</REFSECT1>
<REFSECT1 ID="R1-SQL-DROPTRIGGER-3">
<TITLE>
Compatibility
</TITLE>
<PARA>
</PARA>
<REFSECT2 ID="R2-SQL-DROPTRIGGER-4">
<REFSECT2INFO>
<DATE>1998-09-22</DATE>
</REFSECT2INFO>
<TITLE>
SQL92
</TITLE>
<PARA>
There is no <command>DROP TRIGGER</command> statement in
<acronym>SQL92</acronym>.
</PARA>
</refsect2> </refsect2>
</refsect1> </refsect1>
</REFENTRY>
<!-- <refsect1 id="R1-SQL-DROPTRIGGER-2">
<REPLACEABLE CLASS="PARAMETER"> <title>
</REPLACEABLE> Usage
<ReturnValue></ReturnValue> </title>
<PARA> <para>
</PARA> Destroy the <literal>if_dist_exists</literal> trigger
<VARIABLELIST> on table <literal>films</literal>:
<VARLISTENTRY>
<TERM>&bull; <programlisting>
</TERM> DROP TRIGGER if_dist_exists ON films;
<LISTITEM> </programlisting>
<PARA> </para>
</PARA> </refsect1>
</LISTITEM>
</VARLISTENTRY> <refsect1 id="R1-SQL-DROPTRIGGER-3">
</VARIABLELIST> <title>
<PARA> Compatibility
</PARA> </title>
--> <para>
</para>
<refsect2 id="R2-SQL-DROPTRIGGER-4">
<refsect2info>
<date>1998-09-22</date>
</refsect2info>
<title>
SQL92
</title>
<para>
There is no <command>DROP TRIGGER</command> statement in
<acronym>SQL92</acronym>.
</para>
</refsect2>
</refsect1>
</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
sgml-omittag:t sgml-omittag:nil
sgml-shorttag:t sgml-shorttag:t
sgml-minimize-attributes:nil sgml-minimize-attributes:nil
sgml-always-quote-attributes:t sgml-always-quote-attributes:t

View File

@ -1,172 +1,170 @@
<REFENTRY ID="SQL-DROPTYPE"> <refentry id="SQL-DROPTYPE">
<REFMETA> <refmeta>
<REFENTRYTITLE> <refentrytitle>
DROP TYPE DROP TYPE
</REFENTRYTITLE> </refentrytitle>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO> <refmiscinfo>SQL - Language Statements</refmiscinfo>
</REFMETA> </refmeta>
<REFNAMEDIV> <refnamediv>
<REFNAME> <refname>
DROP TYPE DROP TYPE
</REFNAME> </refname>
<REFPURPOSE> <refpurpose>
Removes a user-defined type from the system catalogs Removes a user-defined type from the system catalogs
</REFPURPOSE> </refpurpose>
</refnamediv> </refnamediv>
<REFSYNOPSISDIV> <refsynopsisdiv>
<REFSYNOPSISDIVINFO> <refsynopsisdivinfo>
<DATE>1998-09-22</DATE> <date>1998-09-22</date>
</REFSYNOPSISDIVINFO> </refsynopsisdivinfo>
<SYNOPSIS> <synopsis>
DROP TYPE <REPLACEABLE CLASS="PARAMETER">typename</REPLACEABLE> DROP TYPE <replaceable class="PARAMETER">typename</replaceable>
</SYNOPSIS> </synopsis>
<REFSECT2 ID="R2-SQL-DROPTYPE-1"> <refsect2 id="R2-SQL-DROPTYPE-1">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-22</DATE> <date>1998-09-22</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Inputs Inputs
</TITLE> </title>
<PARA> <para>
</PARA> <variablelist>
<VARIABLELIST> <varlistentry>
<VARLISTENTRY> <term><replaceable class="PARAMETER">typename</replaceable></term>
<TERM> <listitem>
<REPLACEABLE CLASS="PARAMETER">typename</REPLACEABLE> <para>
</TERM>
<LISTITEM>
<PARA>
The name of an existing type. The name of an existing type.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
</variablelist> </variablelist>
</REFSECT2> </para>
</refsect2>
<REFSECT2 ID="R2-SQL-DROPTYPE-2"> <refsect2 id="R2-SQL-DROPTYPE-2">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-22</DATE> <date>1998-09-22</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Outputs Outputs
</TITLE> </title>
<PARA> <para>
<VARIABLELIST> <variablelist>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
<ReturnValue>DROP</ReturnValue> DROP
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
The message returned if the command is successful. The message returned if the command is successful.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
<ReturnValue>ERROR: RemoveType: type '<replaceable class="parameter">typename</replaceable>' does not exist</ReturnValue> ERROR: RemoveType: type '<replaceable class="parameter">typename</replaceable>' does not exist
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
This message occurs if the specified type is not found. This message occurs if the specified type is not found.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</VARIABLELIST> </variablelist>
</para> </para>
</REFSECT2> </refsect2>
</REFSYNOPSISDIV> </refsynopsisdiv>
<REFSECT1 ID="R1-SQL-DROPTYPE-1"> <refsect1 id="R1-SQL-DROPTYPE-1">
<REFSECT1INFO> <refsect1info>
<DATE>1998-09-22</DATE> <date>1998-09-22</date>
</REFSECT1INFO> </refsect1info>
<TITLE> <title>
Description Description
</TITLE> </title>
<PARA> <para>
<command>DROP TYPE</command> will remove a user type from the <command>DROP TYPE</command> will remove a user type from the
system catalogs. system catalogs.
</PARA> </para>
<PARA> <para>
Only the owner of a type can remove it. Only the owner of a type can remove it.
</PARA> </para>
<REFSECT2 ID="R2-SQL-DROPTYPE-3"> <refsect2 id="R2-SQL-DROPTYPE-3">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-22</DATE> <date>1998-09-22</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Notes Notes
</TITLE> </title>
<PARA> <para>
DROP TYPE statement is a <productname>Postgres</productname> DROP TYPE statement is a <productname>Postgres</productname>
language extension. language extension.
</PARA> </para>
<PARA> <para>
Refer to <command>CREATE TYPE</command> for Refer to <command>CREATE TYPE</command> for
inforamation on how to create types. inforamation on how to create types.
</PARA> </para>
<PARA> <para>
It is the user's responsibility to remove any operators, It is the user's responsibility to remove any operators,
functions, aggregates, access methods, subtypes, and classes functions, aggregates, access methods, subtypes, and classes
that use a deleted type. that use a deleted type.
</PARA> </para>
</refsect2> </refsect2>
<REFSECT2 ID="R2-SQL-DROPTYPE-4"> <refsect2 id="R2-SQL-DROPTYPE-4">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-22</DATE> <date>1998-09-22</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Bugs Bugs
</TITLE> </title>
<PARA> <para>
If a built-in type is removed, the behavior of the backend If a built-in type is removed, the behavior of the backend
is unpredictable. is unpredictable.
</PARA> </para>
</refsect2> </refsect2>
</refsect1> </refsect1>
<REFSECT1 ID="R1-SQL-DROPTYPE-2"> <refsect1 id="R1-SQL-DROPTYPE-2">
<TITLE> <title>
Usage Usage
</TITLE> </title>
<PARA> <para>
To remove the <literal>box</literal> type: To remove the <literal>box</literal> type:
</PARA>
<ProgramListing>
DROP TYPE box
</ProgramListing>
</REFSECT1>
<REFSECT1 ID="R1-SQL-DROPTYPE-3"> <programlisting>
<TITLE> DROP TYPE box;
</programlisting>
</para>
</refsect1>
<refsect1 id="R1-SQL-DROPTYPE-3">
<title>
Compatibility Compatibility
</TITLE> </title>
<PARA> <para>
</PARA> </para>
<REFSECT2 ID="R2-SQL-DROPTYPE-5"> <refsect2 id="R2-SQL-DROPTYPE-5">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-22</DATE> <date>1998-09-22</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
SQL3 SQL3
</TITLE> </title>
<PARA> <para>
DROP TYPE is a <acronym>SQL3</acronym> statement. DROP TYPE is a <acronym>SQL3</acronym> statement.
</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
sgml-omittag:t sgml-omittag:nil
sgml-shorttag:t sgml-shorttag:t
sgml-minimize-attributes:nil sgml-minimize-attributes:nil
sgml-always-quote-attributes:t sgml-always-quote-attributes:t

View File

@ -1,91 +1,90 @@
<REFENTRY ID="SQL-DROPUSER"> <refentry id="SQL-DROPUSER">
<REFMETA> <refmeta>
<REFENTRYTITLE> <refentrytitle>
DROP USER DROP USER
</REFENTRYTITLE> </refentrytitle>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO> <refmiscinfo>SQL - Language Statements</refmiscinfo>
</REFMETA> </refmeta>
<REFNAMEDIV> <refnamediv>
<REFNAME> <refname>
DROP USER DROP USER
</REFNAME> </refname>
<REFPURPOSE> <refpurpose>
Removes an user account information Removes an user account information
</REFPURPOSE> </refpurpose>
</refnamediv> </refnamediv>
<REFSYNOPSISDIV> <refsynopsisdiv>
<REFSYNOPSISDIVINFO> <refsynopsisdivinfo>
<DATE>1998-09-22</DATE> <date>1998-09-22</date>
</REFSYNOPSISDIVINFO> </refsynopsisdivinfo>
<SYNOPSIS> <synopsis>
DROP USER <REPLACEABLE CLASS="PARAMETER">username</REPLACEABLE> DROP USER <replaceable class="PARAMETER">name</replaceable>
</SYNOPSIS> </synopsis>
<REFSECT2 ID="R2-SQL-DROPUSER-1"> <refsect2 id="R2-SQL-DROPUSER-1">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-22</DATE> <date>1998-09-22</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Inputs Inputs
</TITLE> </title>
<PARA> <para>
</PARA>
<VARIABLELIST> <variablelist>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="PARAMETER">name</replaceable></term>
<REPLACEABLE CLASS="PARAMETER">username</REPLACEABLE> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
The name of an existing user. The name of an existing user.
</PARA>
</LISTITEM>
</VARLISTENTRY>
</variablelist>
</REFSECT2>
<REFSECT2 ID="R2-SQL-DROPUSER-2">
<REFSECT2INFO>
<DATE>1998-09-22</DATE>
</REFSECT2INFO>
<TITLE>
Outputs
</TITLE>
<PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
<ReturnValue>DROP</ReturnValue>
</TERM>
<LISTITEM>
<PARA>
The message returned if the user is successfully deleted.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
<ReturnValue>ERROR: removeUser: user "<replaceable class="parameter">username</replaceable>" does not exist.</ReturnValue>
</TERM>
<LISTITEM>
<PARA>
This message occurs if the username is not found.
</PARA>
</LISTITEM>
</VARLISTENTRY>
</VARIABLELIST>
</para> </para>
</REFSECT2> </listitem>
</REFSYNOPSISDIV> </varlistentry>
</variablelist>
</para>
</refsect2>
<REFSECT1 ID="R1-SQL-DROPUSER-1"> <refsect2 id="R2-SQL-DROPUSER-2">
<REFSECT1INFO> <refsect2info>
<DATE>1998-09-22</DATE> <date>1998-09-22</date>
</REFSECT1INFO> </refsect2info>
<TITLE> <title>
Outputs
</title>
<para>
<variablelist>
<varlistentry>
<term><computeroutput>
DROP
</computeroutput></term>
<listitem>
<para>
The message returned if the user is successfully deleted.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><computeroutput>
ERROR: removeUser: user "<replaceable class="parameter">name</replaceable>" does not exist.
</computeroutput></term>
<listitem>
<para>
This message occurs if the username is not found.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
</refsynopsisdiv>
<refsect1 id="R1-SQL-DROPUSER-1">
<refsect1info>
<date>1998-09-22</date>
</refsect1info>
<title>
Description Description
</TITLE> </title>
<PARA> <para>
<command>DROP USER</command> removes the specified <command>DROP USER</command> removes the specified
user from the database, user from the database,
along with any databases owned by the user. It along with any databases owned by the user. It
@ -93,65 +92,64 @@ DROP USER <REPLACEABLE CLASS="PARAMETER">username</REPLACEABLE>
named user in databases not owned by the user. This statement named user in databases not owned by the user. This statement
can be used in place of the <application>destroyuser</application> can be used in place of the <application>destroyuser</application>
script, regardless of how the user was created. script, regardless of how the user was created.
</PARA> </para>
<REFSECT2 ID="R2-SQL-DROPUSER-3"> <refsect2 id="R2-SQL-DROPUSER-3">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-22</DATE> <date>1998-09-22</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Notes Notes
</TITLE> </title>
<PARA> <para>
<command>DROP USER</command> is a <productname>Postgres</productname> <command>DROP USER</command> is a <productname>Postgres</productname>
language extension. language extension.
</PARA> </para>
<PARA> <para>
Refer to <command>CREATE USER</command> and Refer to <command>CREATE USER</command> and
<command>ALTER USER</command> for information on <command>ALTER USER</command> for information on
how to create or modify user accounts. how to create or modify user accounts.
</PARA> </para>
</REFSECT2>
</refsect1>
<REFSECT1 ID="R1-SQL-DROPUSER-2">
<TITLE>
Usage
</TITLE>
<PARA>
To drop a user account:
</PARA>
<ProgramListing>
DROP USER Jonathan;
</ProgramListing>
</REFSECT1>
<REFSECT1 ID="R1-SQL-DROPUSER-3">
<TITLE>
Compatibility
</TITLE>
<PARA>
</PARA>
<REFSECT2 ID="R2-SQL-DROPUSER-4">
<REFSECT2INFO>
<DATE>1998-09-22</DATE>
</REFSECT2INFO>
<TITLE>
SQL92
</TITLE>
<PARA>
There is no <command>DROP USER</command> in <acronym>SQL92</acronym>.
</PARA>
</refsect2> </refsect2>
</refsect1> </refsect1>
</REFENTRY>
<refsect1 id="R1-SQL-DROPUSER-2">
<title>
Usage
</title>
<para>
To drop a user account:
<programlisting>
DROP USER Jonathan;
</programlisting>
</para>
</refsect1>
<refsect1 id="R1-SQL-DROPUSER-3">
<title>
Compatibility
</title>
<para>
</para>
<refsect2 id="R2-SQL-DROPUSER-4">
<refsect2info>
<date>1998-09-22</date>
</refsect2info>
<title>
SQL92
</title>
<para>
There is no <command>DROP USER</command> in <acronym>SQL92</acronym>.
</para>
</refsect2>
</refsect1>
</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
sgml-omittag:t sgml-omittag:nil
sgml-shorttag:t sgml-shorttag:t
sgml-minimize-attributes:nil sgml-minimize-attributes:nil
sgml-always-quote-attributes:t sgml-always-quote-attributes:t

View File

@ -1,76 +1,74 @@
<REFENTRY ID="SQL-DROPVIEW"> <refentry id="SQL-DROPVIEW">
<REFMETA> <refmeta>
<REFENTRYTITLE> <refentrytitle>
DROP VIEW DROP VIEW
</REFENTRYTITLE> </refentrytitle>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO> <refmiscinfo>SQL - Language Statements</refmiscinfo>
</REFMETA> </refmeta>
<REFNAMEDIV> <refnamediv>
<REFNAME> <refname>
DROP VIEW DROP VIEW
</REFNAME> </refname>
<REFPURPOSE> <refpurpose>
Removes an existing view from a database Removes an existing view from a database
</REFPURPOSE> </refpurpose>
</refnamediv> </refnamediv>
<REFSYNOPSISDIV> <refsynopsisdiv>
<REFSYNOPSISDIVINFO> <refsynopsisdivinfo>
<DATE>1998-09-22</DATE> <date>1998-09-22</date>
</REFSYNOPSISDIVINFO> </refsynopsisdivinfo>
<SYNOPSIS> <synopsis>
DROP VIEW <REPLACEABLE CLASS="PARAMETER">view</REPLACEABLE> DROP VIEW <replaceable class="PARAMETER">name</replaceable>
</SYNOPSIS> </synopsis>
<REFSECT2 ID="R2-SQL-DROPVIEW-1"> <refsect2 id="R2-SQL-DROPVIEW-1">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-22</DATE> <date>1998-09-22</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Inputs Inputs
</TITLE> </title>
<PARA> <para>
</PARA>
<VARIABLELIST> <variablelist>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="PARAMETER">name</replaceable></term>
<REPLACEABLE CLASS="PARAMETER">view</REPLACEABLE> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
The name of an existing view. The name of an existing view.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
</variablelist> </variablelist>
</REFSECT2> </para>
</refsect2>
<REFSECT2 ID="R2-SQL-DROPVIEW-2"> <refsect2 id="R2-SQL-DROPVIEW-2">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-22</DATE> <date>1998-09-22</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Outputs Outputs
</TITLE> </title>
<PARA> <para>
<VARIABLELIST> <variablelist>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
<ReturnValue>DROP</ReturnValue> DROP
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
The message returned if the command is successful. The message returned if the command is successful.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
<ReturnValue> ERROR: RewriteGetRuleEventRel: rule "_RET<replaceable class="PARAMETER">name</replaceable>" not found
ERROR: RewriteGetRuleEventRel: rule "_RET<REPLACEABLE CLASS="PARAMETER">view</REPLACEABLE>" not found</ReturnValue> </computeroutput></term>
</TERM> <listitem>
<LISTITEM> <para>
<PARA>
This message occurs if the specified view does not exist in This message occurs if the specified view does not exist in
the database. the database.
</para> </para>
@ -78,83 +76,83 @@ DROP VIEW <REPLACEABLE CLASS="PARAMETER">view</REPLACEABLE>
</varlistentry> </varlistentry>
</variablelist> </variablelist>
</para> </para>
</REFSECT2> </refsect2>
</REFSYNOPSISDIV> </refsynopsisdiv>
<REFSECT1 ID="R1-SQL-DROPVIEW-1"> <refsect1 id="R1-SQL-DROPVIEW-1">
<REFSECT1INFO> <refsect1info>
<DATE>1998-09-22</DATE> <date>1998-09-22</date>
</REFSECT1INFO> </refsect1info>
<TITLE> <title>
Description Description
</TITLE> </title>
<PARA> <para>
<command>DROP VIEW</command> drops an existing view from the database. <command>DROP VIEW</command> drops an existing view from the database.
To execute this command you must be the owner of the To execute this command you must be the owner of the
view. view.
</PARA> </para>
<REFSECT2 ID="R2-SQL-DROPVIEW-3"> <refsect2 id="R2-SQL-DROPVIEW-3">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-22</DATE> <date>1998-09-22</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Notes Notes
</TITLE> </title>
<PARA> <para>
The <productname>Postgres</productname> The <productname>Postgres</productname>
<command>DROP TABLE</command> statement also drops views. <command>DROP TABLE</command> statement also drops views.
</PARA> </para>
<PARA> <para>
Refer to <command>CREATE VIEW</command> Refer to <command>CREATE VIEW</command>
for information on how to create views. for information on how to create views.
</PARA> </para>
</REFSECT2> </refsect2>
</refsect1> </refsect1>
<REFSECT1 ID="R1-SQL-DROPVIEW-2"> <refsect1 id="R1-SQL-DROPVIEW-2">
<TITLE> <title>
Usage Usage
</TITLE> </title>
<PARA> <para>
This command will remove the view called <literal>kinds</literal>: This command will remove the view called <literal>kinds</literal>:
</PARA> </para>
<ProgramListing> <programlisting>
DROP VIEW kinds; DROP VIEW kinds;
</ProgramListing> </programlisting>
</REFSECT1> </refsect1>
<REFSECT1 ID="R1-SQL-DROPVIEW-3"> <refsect1 id="R1-SQL-DROPVIEW-3">
<TITLE> <title>
Compatibility Compatibility
</TITLE> </title>
<PARA> <para>
</PARA> </para>
<REFSECT2 ID="R2-SQL-DROPVIEW-4"> <refsect2 id="R2-SQL-DROPVIEW-4">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-22</DATE> <date>1998-09-22</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
SQL92 SQL92
</TITLE> </title>
<PARA> <para>
<acronym>SQL92</acronym> specifies some additional capabilities for <acronym>SQL92</acronym> specifies some additional capabilities for
<command>DROP VIEW</command>: <command>DROP VIEW</command>:
</PARA>
<synopsis> <synopsis>
DROP VIEW <replaceable class="parameter">view</replaceable> { RESTRICT | CASCADE } DROP VIEW <replaceable class="parameter">view</replaceable> { RESTRICT | CASCADE }
</synopsis> </synopsis>
</para>
<REFSECT3 ID="R3-SQL-DROPVIEW-1"> <refsect3 id="R3-SQL-DROPVIEW-1">
<REFSECT3INFO> <refsect3info>
<DATE>1998-09-22</DATE> <date>1998-09-22</date>
</REFSECT3INFO> </refsect3info>
<TITLE> <title>
Inputs Inputs
</TITLE> </title>
<PARA> <para>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term>RESTRICT</term> <term>RESTRICT</term>
@ -178,31 +176,27 @@ DROP VIEW <replaceable class="parameter">view</replaceable> { RESTRICT | CASCADE
</para> </para>
</refsect3> </refsect3>
<REFSECT3 ID="R3-SQL-DROPVIEW-2"> <refsect3 id="R3-SQL-DROPVIEW-2">
<REFSECT3INFO> <refsect3info>
<DATE>1998-09-22</DATE> <date>1998-09-22</date>
</REFSECT3INFO> </refsect3info>
<TITLE> <title>
Notes Notes
</TITLE> </title>
<para>
<tip>
<para> <para>
At present, to remove a referenced view from a At present, to remove a referenced view from a
<productname>Postgres</productname> database, <productname>Postgres</productname> database,
you must drop it explicitly. you must drop it explicitly.
</para> </para>
</tip>
</para>
</refsect3> </refsect3>
</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
sgml-omittag:t sgml-omittag:nil
sgml-shorttag:t sgml-shorttag:t
sgml-minimize-attributes:nil sgml-minimize-attributes:nil
sgml-always-quote-attributes:t sgml-always-quote-attributes:t

View File

@ -1,105 +1,101 @@
<REFENTRY ID="SQL-EXPLAIN"> <refentry id="SQL-EXPLAIN">
<REFMETA> <refmeta>
<REFENTRYTITLE> <refentrytitle>
EXPLAIN EXPLAIN
</REFENTRYTITLE> </refentrytitle>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO> <refmiscinfo>SQL - Language Statements</refmiscinfo>
</REFMETA> </refmeta>
<REFNAMEDIV> <refnamediv>
<REFNAME> <refname>
EXPLAIN EXPLAIN
</REFNAME> </refname>
<REFPURPOSE> <refpurpose>
Shows statement execution details Shows statement execution details
</REFPURPOSE> </refpurpose>
</refnamediv> </refnamediv>
<REFSYNOPSISDIV> <refsynopsisdiv>
<REFSYNOPSISDIVINFO> <refsynopsisdivinfo>
<DATE>1998-09-01</DATE> <date>1998-09-01</date>
</REFSYNOPSISDIVINFO> </refsynopsisdivinfo>
<SYNOPSIS> <synopsis>
EXPLAIN [ VERBOSE ] <REPLACEABLE CLASS="PARAMETER">query</REPLACEABLE> EXPLAIN [ VERBOSE ] <replaceable class="PARAMETER">query</replaceable>
</SYNOPSIS> </synopsis>
<REFSECT2 ID="R2-SQL-EXPLAIN-1"> <refsect2 id="R2-SQL-EXPLAIN-1">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-01</DATE> <date>1998-09-01</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Inputs Inputs
</TITLE> </title>
<PARA> <para>
<VARIABLELIST> <variablelist>
<VARLISTENTRY> <varlistentry>
<TERM> <term>VERBOSE</term>
VERBOSE <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
Flag to show detailed query plan. Flag to show detailed query plan.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="PARAMETER">query</replaceable></term>
<REPLACEABLE CLASS="PARAMETER">query</REPLACEABLE> <listitem>
</TERM> <para>
<LISTITEM> Any <replaceable class="PARAMETER">query</replaceable>.
<PARA>
Any <REPLACEABLE CLASS="PARAMETER">query</REPLACEABLE>.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</VARIABLELIST> </variablelist>
</para> </para>
</REFSECT2> </refsect2>
<REFSECT2 ID="R2-SQL-EXPLAIN-2"> <refsect2 id="R2-SQL-EXPLAIN-2">
<REFSECT2INFO> <refsect2info>
<DATE>1998-04-15</DATE> <date>1998-04-15</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Outputs Outputs
</TITLE> </title>
<PARA> <para>
<VARIABLELIST> <variablelist>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
NOTICE: QUERY PLAN: NOTICE: QUERY PLAN:
<replaceable>plan</replaceable> <replaceable>plan</replaceable>
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
Explicit query plan from the <productname>Postgres</productname> backend. Explicit query plan from the <productname>Postgres</productname> backend.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
EXPLAIN EXPLAIN
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
Flag sent after query plan is shown. Flag sent after query plan is shown.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</VARIABLELIST> </variablelist>
</para> </para>
</REFSECT2> </refsect2>
</REFSYNOPSISDIV> </refsynopsisdiv>
<REFSECT1 ID="R1-SQL-EXPLAIN-1"> <refsect1 id="R1-SQL-EXPLAIN-1">
<REFSECT1INFO> <refsect1info>
<DATE>1998-04-15</DATE> <date>1998-04-15</date>
</REFSECT1INFO> </refsect1info>
<TITLE> <title>
Description Description
</TITLE> </title>
<PARA> <para>
This command outputs details about the supplied query. This command outputs details about the supplied query.
The default output is the computed query cost. The default output is the computed query cost.
The cost value is only meaningful to the optimizer in comparing The cost value is only meaningful to the optimizer in comparing
@ -107,14 +103,15 @@ Description
VERBOSE displays the full query plan and cost to your screen, VERBOSE displays the full query plan and cost to your screen,
and pretty-prints the plan to the postmaster log file. and pretty-prints the plan to the postmaster log file.
</para> </para>
<REFSECT2 ID="R2-SQL-EXPLAIN-3">
<REFSECT2INFO> <refsect2 id="R2-SQL-EXPLAIN-3">
<DATE>1998-04-15</DATE> <refsect2info>
</REFSECT2INFO> <date>1998-04-15</date>
<TITLE> </refsect2info>
<title>
Notes Notes
</TITLE> </title>
<PARA> <para>
There is only sparse documentation on the optimizer's use of cost There is only sparse documentation on the optimizer's use of cost
information in <productname>Postgres</productname>. information in <productname>Postgres</productname>.
General information on cost estimation for query optimization General information on cost estimation for query optimization
@ -123,64 +120,61 @@ Refer to the <citetitle>Programmer's Guide</citetitle>
in the chapters on indexes and the genetic query optimizer for in the chapters on indexes and the genetic query optimizer for
more information. more information.
</para> </para>
</REFSECT2> </refsect2>
</refsect1> </refsect1>
<REFSECT1 ID="R1-SQL-EXPLAIN-2"> <refsect1 id="R1-SQL-EXPLAIN-2">
<TITLE> <title>
Usage Usage
</TITLE> </title>
<PARA> <para>
To show a query plan for a simple query: To show a query plan for a simple query:
<ProgramListing> <programlisting>
postgres=> explain select * from foo; EXPLAIN select * from foo;
NOTICE: QUERY PLAN: NOTICE: QUERY PLAN:
Seq Scan on foo (cost=0.00 rows=0 width=4) Seq Scan on foo (cost=0.00 rows=0 width=4)
EXPLAIN EXPLAIN
</ProgramListing> </programlisting>
</para> </para>
</REFSECT1> </refsect1>
<REFSECT1 ID="R1-SQL-EXPLAIN-3"> <refsect1 id="R1-SQL-EXPLAIN-3">
<TITLE> <title>
Compatibility Compatibility
</TITLE> </title>
<PARA> <para>
</PARA> </para>
<REFSECT2 ID="R2-SQL-EXPLAIN-4"> <refsect2 id="R2-SQL-EXPLAIN-4">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-01</DATE> <date>1998-09-01</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
SQL92 SQL92
</TITLE> </title>
<PARA> <para>
There is no EXPLAIN statement defined in SQL92. There is no <command>EXPLAIN</command> statement defined in SQL92.
</para> </para>
</refsect2> </refsect2>
</refsect1> </refsect1>
</REFENTRY> </refentry>
<!-- <!-- Keep this comment at the end of the file
<REPLACEABLE CLASS="PARAMETER"> Local variables:
</REPLACEABLE> mode: sgml
<ReturnValue></ReturnValue> sgml-omittag:nil
<PARA> sgml-shorttag:t
</PARA> sgml-minimize-attributes:nil
<VARIABLELIST> sgml-always-quote-attributes:t
<VARLISTENTRY> sgml-indent-step:1
<TERM>&bull; sgml-indent-data:t
</TERM> sgml-parent-document:nil
<LISTITEM> sgml-default-dtd-file:"../reference.ced"
<PARA> sgml-exposed-tags:nil
</PARA> sgml-local-catalogs:"/usr/lib/sgml/catalog"
</LISTITEM> sgml-local-ecat-files:nil
</VARLISTENTRY> End:
</VARIABLELIST>
<PARA>
</PARA>
--> -->

View File

@ -1,105 +1,88 @@
<REFENTRY ID="SQL-FETCH"> <refentry id="SQL-FETCH">
<REFMETA> <refmeta>
<REFENTRYTITLE> <refentrytitle>
FETCH FETCH
</REFENTRYTITLE> </refentrytitle>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO> <refmiscinfo>SQL - Language Statements</refmiscinfo>
</REFMETA> </refmeta>
<REFNAMEDIV> <refnamediv>
<REFNAME> <refname>
FETCH FETCH
</REFNAME> </refname>
<REFPURPOSE> <refpurpose>
Gets rows using a cursor Gets rows using a cursor
</REFPURPOSE> </refpurpose>
</refnamediv> </refnamediv>
<REFSYNOPSISDIV> <refsynopsisdiv>
<REFSYNOPSISDIVINFO> <refsynopsisdivinfo>
<DATE>1998-09-01</DATE> <date>1998-09-01</date>
</REFSYNOPSISDIVINFO> </refsynopsisdivinfo>
<SYNOPSIS> <synopsis>
FETCH [ <REPLACEABLE CLASS="PARAMETER">selector</REPLACEABLE> ] [ <REPLACEABLE CLASS="PARAMETER">count</REPLACEABLE> ] FETCH [ <replaceable class="PARAMETER">selector</replaceable> ] [ <replaceable class="PARAMETER">count</replaceable> ] { IN | FROM } <replaceable class="PARAMETER">cursor</replaceable>
{ IN | FROM } <REPLACEABLE CLASS="PARAMETER">cursor</REPLACEABLE> FETCH [ RELATIVE ] [ { [ <replaceable class="PARAMETER">#</replaceable> | ALL | NEXT | PRIOR ] } ] FROM ] <replaceable class="PARAMETER">cursor</replaceable>
FETCH [ RELATIVE ] [ { [ <REPLACEABLE CLASS="PARAMETER">#</REPLACEABLE> | ALL | NEXT | PRIOR ] } ] </synopsis>
FROM ] <REPLACEABLE CLASS="PARAMETER">cursor</REPLACEABLE>
</SYNOPSIS>
<REFSECT2 ID="R2-SQL-FETCH-1"> <refsect2 id="R2-SQL-FETCH-1">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-01</DATE> <date>1998-09-01</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Inputs Inputs
</TITLE> </title>
<PARA> <para>
<VARIABLELIST> <variablelist>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="PARAMETER">selector</replaceable></term>
<REPLACEABLE CLASS="PARAMETER">selector</REPLACEABLE> <listitem>
</TERM> <para>
<LISTITEM> <replaceable class="PARAMETER">selector</replaceable>
<PARA>
<REPLACEABLE CLASS="PARAMETER">selector</REPLACEABLE>
defines the fetch direction. It can be one defines the fetch direction. It can be one
the following: the following:
</para>
</listitem> <variablelist>
</varlistentry> <varlistentry>
</variablelist> <term>FORWARD</term>
<VARIABLELIST> <listitem>
<VARLISTENTRY> <para>
<TERM>
FORWARD
</TERM>
<LISTITEM>
<PARA>
fetch next row(s). This is the default fetch next row(s). This is the default
if <REPLACEABLE CLASS="PARAMETER">selector</REPLACEABLE> is omitted. if <replaceable class="PARAMETER">selector</replaceable> is omitted.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term>BACKWARD</term>
BACKWARD <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
fetch previous row(s). fetch previous row(s).
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term>RELATIVE</term>
RELATIVE <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
Noise word for SQL92 compatibility. Noise word for SQL92 compatibility.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</variablelist>
<VARLISTENTRY>
<TERM>
<REPLACEABLE CLASS="PARAMETER">count</REPLACEABLE>
</TERM>
<LISTITEM>
<PARA>
<REPLACEABLE CLASS="PARAMETER">count</REPLACEABLE>
determines how many rows to fetch. It can be one of the following:
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term><replaceable class="PARAMETER">count</replaceable></term>
<listitem>
<para>
<replaceable class="PARAMETER">count</replaceable>
determines how many rows to fetch. It can be one of the following:
<VARLISTENTRY> <variablelist>
<TERM> <varlistentry>
<REPLACEABLE CLASS="PARAMETER">#</REPLACEABLE> <term><replaceable class="PARAMETER">#</replaceable></term>
</TERM> <listitem>
<LISTITEM> <para>
<PARA>
A signed integer that specify how many rows to fetch. A signed integer that specify how many rows to fetch.
Note that a negative integer is equivalent to changing the sense of Note that a negative integer is equivalent to changing the sense of
FORWARD and BACKWARD. FORWARD and BACKWARD.
@ -107,103 +90,106 @@ FORWARD and BACKWARD.
</listitem> </listitem>
</varlistentry> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term>
ALL ALL
</TERM> </term>
<LISTITEM> <listitem>
<PARA> <para>
Retrieve all remaining rows. Retrieve all remaining rows.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term>
NEXT NEXT
</TERM> </term>
<LISTITEM> <listitem>
<PARA> <para>
Equivalent to specifying a count of <command>1</command>. Equivalent to specifying a count of <command>1</command>.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term>
PRIOR PRIOR
</TERM> </term>
<LISTITEM> <listitem>
<PARA> <para>
Equivalent to specifying a count of <command>-1</command>. Equivalent to specifying a count of <command>-1</command>.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</variablelist>
</para>
</listitem>
</varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="PARAMETER">cursor</replaceable></term>
<REPLACEABLE CLASS="PARAMETER">cursor</REPLACEABLE> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
An open cursor's name. An open cursor's name.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</variablelist> </variablelist>
</para> </para>
</REFSECT2> </refsect2>
<REFSECT2 ID="R2-SQL-FETCH-2"> <refsect2 id="R2-SQL-FETCH-2">
<REFSECT2INFO> <refsect2info>
<DATE>1998-04-15</DATE> <date>1998-04-15</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Outputs Outputs
</TITLE> </title>
<PARA> <para>
FETCH returns the results of the query defined by the specified cursor. <command>FETCH</command> returns the results of the query defined by the specified cursor.
The following messages will be returned if the query fails: The following messages will be returned if the query fails:
</para>
<VARIABLELIST> <variablelist>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
NOTICE: PerformPortalFetch: portal "<REPLACEABLE CLASS="PARAMETER">cursor</REPLACEABLE>" not found NOTICE: PerformPortalFetch: portal "<replaceable class="PARAMETER">cursor</replaceable>" not found
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
If <REPLACEABLE CLASS="PARAMETER">cursor</REPLACEABLE> If <replaceable class="PARAMETER">cursor</replaceable>
is not previously declared. is not previously declared.
The cursor must be declared within a transaction block. The cursor must be declared within a transaction block.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
NOTICE: FETCH/ABSOLUTE not supported, using RELATIVE NOTICE: FETCH/ABSOLUTE not supported, using RELATIVE
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
<productname>Postgres</productname> does not support absolute <productname>Postgres</productname> does not support absolute
positioning of cursors. positioning of cursors.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
ERROR: FETCH/RELATIVE at current position is not supported ERROR: FETCH/RELATIVE at current position is not supported
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
<acronym>SQL92</acronym> allows one to repetatively retrieve the cursor <acronym>SQL92</acronym> allows one to repetatively retrieve the cursor
at its "current position" using the syntax at its "current position" using the syntax
<programlisting> <synopsis>
FETCH RELATIVE 0 FROM <REPLACEABLE CLASS="PARAMETER">cursor</REPLACEABLE> FETCH RELATIVE 0 FROM <replaceable class="PARAMETER">cursor</replaceable>
</programlisting> </synopsis>
</para>
<para>
<productname>Postgres</productname> does not currently support <productname>Postgres</productname> does not currently support
this notion; in fact the value zero is reserved to indicate that this notion; in fact the value zero is reserved to indicate that
all rows should be retrieved and is equivalent to specifying the ALL keyword. all rows should be retrieved and is equivalent to specifying the ALL keyword.
@ -215,23 +201,23 @@ and returns this error message.
</varlistentry> </varlistentry>
</variablelist> </variablelist>
</para>
</refsect2>
</refsynopsisdiv>
</REFSECT2> <refsect1 id="R1-SQL-FETCH-1">
</REFSYNOPSISDIV> <refsect1info>
<date>1998-04-15</date>
<REFSECT1 ID="R1-SQL-FETCH-1"> </refsect1info>
<REFSECT1INFO> <title>
<DATE>1998-04-15</DATE>
</REFSECT1INFO>
<TITLE>
Description Description
</TITLE> </title>
<PARA> <para>
FETCH allows a user to retrieve rows using a cursor. FETCH allows a user to retrieve rows using a cursor.
The number of rows retrieved is specified by The number of rows retrieved is specified by
<REPLACEABLE CLASS="PARAMETER">#</REPLACEABLE>. <replaceable class="PARAMETER">#</replaceable>.
If the number of rows remaining in the cursor is less If the number of rows remaining in the cursor is less
than <REPLACEABLE CLASS="PARAMETER">#</REPLACEABLE>, than <replaceable class="PARAMETER">#</replaceable>,
then only those available are fetched. then only those available are fetched.
Substituting the keyword ALL in place of a number will Substituting the keyword ALL in place of a number will
cause all remaining rows in the cursor to be retrieved. cause all remaining rows in the cursor to be retrieved.
@ -273,28 +259,29 @@ not generally possible, as is also the case with VIEW updates.
the data that they store spans multiple user queries. the data that they store spans multiple user queries.
</para> </para>
<REFSECT2 ID="R2-SQL-FETCH-3"> <refsect2 id="R2-SQL-FETCH-3">
<REFSECT2INFO> <refsect2info>
<DATE>1998-04-15</DATE> <date>1998-04-15</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Notes Notes
</TITLE> </title>
<PARA> <para>
Refer to MOVE statements to change cursor position. Use <command>MOVE</command> to change cursor position.
Refer to DECLARE statements to declare a cursor. <command>DECLARE</command> will define a cursor.
Refer to BEGIN WORK, COMMIT WORK, ROLLBACK WORK statements Refer to <command>BEGIN</command>, <command>COMMIT</command>, and
<command>ROLLBACK</command>
for further information about transactions. for further information about transactions.
</para> </para>
</REFSECT2> </refsect2>
</refsect1> </refsect1>
<REFSECT1 ID="R1-SQL-FETCH-2"> <refsect1 id="R1-SQL-FETCH-2">
<TITLE> <title>
Usage Usage
</TITLE> </title>
<PARA> <para>
<ProgramListing> <programlisting>
--set up and use a cursor: --set up and use a cursor:
-- --
BEGIN WORK; BEGIN WORK;
@ -326,56 +313,52 @@ Usage
-- --
CLOSE liahona; CLOSE liahona;
COMMIT WORK; COMMIT WORK;
</ProgramListing> </programlisting>
</para> </para>
</REFSECT1> </refsect1>
<REFSECT1 ID="R1-SQL-FETCH-3"> <refsect1 id="R1-SQL-FETCH-3">
<TITLE> <title>
Compatibility Compatibility
</TITLE> </title>
<PARA> <para>
The non-embedded use of cursors is a <productname>Postgres</productname> The non-embedded use of cursors is a <productname>Postgres</productname>
extension. The syntax and usage of cursors is being compared extension. The syntax and usage of cursors is being compared
against the embedded form of cursors defined in <acronym>SQL92</acronym>. against the embedded form of cursors defined in <acronym>SQL92</acronym>.
</PARA> </para>
<REFSECT2 ID="R2-SQL-FETCH-4"> <refsect2 id="R2-SQL-FETCH-4">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-01</DATE> <date>1998-09-01</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
SQL92 SQL92
</TITLE> </title>
<PARA> <para>
<acronym>SQL92</acronym> allows absolute positioning of the cursor for <acronym>SQL92</acronym> allows absolute positioning of the cursor for
FETCH, and allows placing the results into explicit variables. FETCH, and allows placing the results into explicit variables.
<synopsis> <synopsis>
FETCH ABSOLUTE <REPLACEABLE CLASS="PARAMETER">#</REPLACEABLE> FETCH ABSOLUTE <replaceable class="PARAMETER">#</replaceable>
FROM <REPLACEABLE CLASS="PARAMETER">cursor</REPLACEABLE> FROM <replaceable class="PARAMETER">cursor</replaceable>
INTO :<REPLACEABLE CLASS="PARAMETER">variable</REPLACEABLE> [, ...] INTO :<replaceable class="PARAMETER">variable</replaceable> [, ...]
</synopsis> </synopsis>
<VARIABLELIST> <variablelist>
<VARLISTENTRY> <varlistentry>
<TERM> <term>ABSOLUTE</term>
ABSOLUTE <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
The cursor should be positioned to the specified absolute The cursor should be positioned to the specified absolute
row number. All row numbers in <productname>Postgres</productname> row number. All row numbers in <productname>Postgres</productname>
are relative numbers so this capability is not supported. are relative numbers so this capability is not supported.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term>:<replaceable class="PARAMETER">variable</replaceable></term>
:<REPLACEABLE CLASS="PARAMETER">variable</REPLACEABLE> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
Target host variable(s). Target host variable(s).
</para> </para>
</listitem> </listitem>
@ -384,24 +367,21 @@ Target host variable(s).
</para> </para>
</refsect2> </refsect2>
</refsect1> </refsect1>
</REFENTRY> </refentry>
<!-- <!-- Keep this comment at the end of the file
<REPLACEABLE CLASS="PARAMETER"> Local variables:
</REPLACEABLE> mode: sgml
<ReturnValue></ReturnValue> sgml-omittag:nil
<PARA> sgml-shorttag:t
</PARA> sgml-minimize-attributes:nil
<VARIABLELIST> sgml-always-quote-attributes:t
<VARLISTENTRY> sgml-indent-step:1
<TERM>&bull; sgml-indent-data:t
</TERM> sgml-parent-document:nil
<LISTITEM> sgml-default-dtd-file:"../reference.ced"
<PARA> sgml-exposed-tags:nil
</PARA> sgml-local-catalogs:"/usr/lib/sgml/catalog"
</LISTITEM> sgml-local-ecat-files:nil
</VARLISTENTRY> End:
</VARIABLELIST>
<PARA>
</PARA>
--> -->

View File

@ -1,130 +1,114 @@
<REFENTRY ID="SQL-GRANT"> <refentry id="SQL-GRANT">
<REFMETA> <refmeta>
<REFENTRYTITLE> <refentrytitle>
GRANT GRANT
</REFENTRYTITLE> </refentrytitle>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO> <refmiscinfo>SQL - Language Statements</refmiscinfo>
</REFMETA> </refmeta>
<REFNAMEDIV> <refnamediv>
<REFNAME> <refname>
GRANT GRANT
</REFNAME> </refname>
<REFPURPOSE> <refpurpose>
Grants access privilege to a user, a group or all users Grants access privilege to a user, a group or all users
</REFPURPOSE> </refpurpose>
</refnamediv> </refnamediv>
<REFSYNOPSISDIV> <refsynopsisdiv>
<REFSYNOPSISDIVINFO> <refsynopsisdivinfo>
<DATE>1998-09-23</DATE> <date>1998-09-23</date>
</REFSYNOPSISDIVINFO> </refsynopsisdivinfo>
<SYNOPSIS> <synopsis>
GRANT <REPLACEABLE CLASS="PARAMETER">privilege</REPLACEABLE> [, ...] GRANT <replaceable class="PARAMETER">privilege</replaceable> [, ...] ON <replaceable class="PARAMETER">object</replaceable> [, ...]
ON <REPLACEABLE CLASS="PARAMETER">object</REPLACEABLE> [, ...] TO { PUBLIC | GROUP <replaceable class="PARAMETER">group</replaceable> | <replaceable class="PARAMETER">username</replaceable> }
TO { PUBLIC | GROUP <REPLACEABLE CLASS="PARAMETER">group</REPLACEABLE> | <REPLACEABLE CLASS="PARAMETER">username</REPLACEABLE> } </synopsis>
</SYNOPSIS>
<REFSECT2 ID="R2-SQL-GRANT-1"> <refsect2 id="R2-SQL-GRANT-1">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-23</DATE> <date>1998-09-23</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Inputs Inputs
</TITLE> </title>
<PARA> <para>
<VARIABLELIST> <variablelist>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="PARAMETER">privilege</replaceable></term>
<REPLACEABLE CLASS="PARAMETER">privilege</REPLACEABLE> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
The possible privileges are: The possible privileges are:
</para>
</listitem> <variablelist>
</varlistentry> <varlistentry>
<VARLISTENTRY> <term>SELECT</term>
<TERM> <listitem>
SELECT <para>
</TERM>
<LISTITEM>
<PARA>
Access all of the columns of a specific Access all of the columns of a specific
table/view. table/view.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term>INSERT</term>
INSERT <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
Insert data into all columns of a Insert data into all columns of a
specific table. specific table.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term>UPDATE</term>
UPDATE <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
Update all columns of a specific Update all columns of a specific
table. table.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term>DELETE</term>
DELETE <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
Delete rows from a specific table. Delete rows from a specific table.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term>RULE</term>
RULE <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
Define rules on the table/view Define rules on the table/view
(See CREATE RULE statement). (See CREATE RULE statement).
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term>ALL</term>
ALL <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
Grant all privileges. Grant all privileges.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</variablelist>
</para>
</listitem>
</varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="PARAMETER">object</replaceable></term>
<REPLACEABLE CLASS="PARAMETER">object</REPLACEABLE> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
The name of an object to which to grant access. The name of an object to which to grant access.
The possible objects are: The possible objects are:
</para>
<para> <itemizedlist spacing="compact" mark="bullet">
<itemizedlist mark="bullet" spacing="compact">
<listitem> <listitem>
<para> <para>
table table
@ -153,91 +137,87 @@
</listitem> </listitem>
</varlistentry> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term>PUBLIC</term>
PUBLIC <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
A short form representing all users. A short form representing all users.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<VARLISTENTRY>
<TERM> <varlistentry>
GROUP <REPLACEABLE CLASS="PARAMETER">group</REPLACEABLE> <term>GROUP <replaceable class="PARAMETER">group</replaceable></term>
</TERM> <listitem>
<LISTITEM> <para>
<PARA> A <replaceable class="PARAMETER">group</replaceable> to whom to grant privileges.
A <REPLACEABLE CLASS="PARAMETER">group</REPLACEABLE> to whom to grant privileges.
In the current release, the group must be created explicitly as described below. In the current release, the group must be created explicitly as described below.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term>
<REPLACEABLE CLASS="PARAMETER">username</REPLACEABLE> <replaceable class="PARAMETER">username</replaceable>
</TERM> </term>
<LISTITEM> <listitem>
<PARA> <para>
The name of a user to whom grant privileges. PUBLIC is a short form The name of a user to whom grant privileges. PUBLIC is a short form
representing all users. representing all users.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</VARIABLELIST> </variablelist>
</para> </para>
</REFSECT2> </refsect2>
<REFSECT2 ID="R2-SQL-GRANT-2"> <refsect2 id="R2-SQL-GRANT-2">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-23</DATE> <date>1998-09-23</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Outputs Outputs
</TITLE> </title>
<PARA> <para>
<VARIABLELIST> <variablelist>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
CHANGE CHANGE
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
Message returned if successful. Message returned if successful.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
ERROR: ChangeAcl: class "<REPLACEABLE CLASS="PARAMETER">object</REPLACEABLE>" ERROR: ChangeAcl: class "<replaceable class="PARAMETER">object</replaceable>" not found
not found </computeroutput></term>
</TERM> <listitem>
<LISTITEM> <para>
<PARA>
Message returned if the specified object is not available or Message returned if the specified object is not available or
if it is impossible if it is impossible
to give privileges to the specified group or users. to give privileges to the specified group or users.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</VARIABLELIST> </variablelist>
</para> </para>
</REFSECT2> </refsect2>
</REFSYNOPSISDIV> </refsynopsisdiv>
<REFSECT1 ID="R1-SQL-GRANT-1"> <refsect1 id="R1-SQL-GRANT-1">
<REFSECT1INFO> <refsect1info>
<DATE>1998-09-23</DATE> <date>1998-09-23</date>
</REFSECT1INFO> </refsect1info>
<TITLE> <title>
Description Description
</TITLE> </title>
<PARA> <para>
GRANT allows the creator of an object to give specific permissions to <command>GRANT</command> allows the creator of an object to give specific permissions to
all users (PUBLIC) or to a certain user or group. all users (PUBLIC) or to a certain user or group.
Users other than the creator don't have any access permission Users other than the creator don't have any access permission
unless the creator GRANTs permissions, after the object unless the creator GRANTs permissions, after the object
@ -252,15 +232,23 @@
also drop the object. also drop the object.
</para> </para>
<REFSECT2 ID="R2-SQL-GRANT-3"> <refsect2 id="R2-SQL-GRANT-3">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-23</DATE> <date>1998-09-23</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Notes Notes
</TITLE> </title>
<PARA>
Use the <command>psql \z</command> command <para>
Currently, to grant privileges in <productname>Postgres</productname>
to only few columns, you must
create a view having desired columns and then grant privileges
to that view.
</para>
<para>
Use <command>psql \z</command>
for further information about permissions for further information about permissions
on existing objects: on existing objects:
<programlisting> <programlisting>
@ -290,189 +278,167 @@
INSERT INTO pg_group VALUES ('todos'); INSERT INTO pg_group VALUES ('todos');
CREATE USER miriam IN GROUP todos; CREATE USER miriam IN GROUP todos;
</programlisting> </programlisting>
Refer to REVOKE statements to revoke access privileges.
</para> </para>
</tip> </tip>
</para> </para>
</REFSECT2>
<para>
Refer to REVOKE statements to revoke access privileges.
</para>
</refsect2>
</refsect1> </refsect1>
<REFSECT1 ID="R1-SQL-GRANT-2"> <refsect1 id="R1-SQL-GRANT-2">
<TITLE> <title>
Usage Usage
</TITLE> </title>
<PARA> <para>
<ProgramListing> Grant insert privilege to all users on table films:
-- grant insert privilege to all users on table films:
--
GRANT INSERT ON films TO PUBLIC;
</programlisting>
<programlisting> <programlisting>
-- grant all privileges to user manuel on view kinds: GRANT INSERT ON films TO PUBLIC;
-- </programlisting>
GRANT ALL ON kinds TO manuel;
</ProgramListing>
</para> </para>
</REFSECT1>
<REFSECT1 ID="R1-SQL-GRANT-3"> <para>
<TITLE> Grant all privileges to user manuel on view kinds:
<programlisting>
GRANT ALL ON kinds TO manuel;
</programlisting>
</para>
</refsect1>
<refsect1 id="R1-SQL-GRANT-3">
<title>
Compatibility Compatibility
</TITLE> </title>
<PARA> <para>
</PARA> </para>
<REFSECT2 ID="R2-SQL-GRANT-4"> <refsect2 id="R2-SQL-GRANT-4">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-23</DATE> <date>1998-09-23</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
SQL92 SQL92
</TITLE> </title>
<PARA> <para>
The <acronym>SQL92</acronym> syntax for GRANT allows setting privileges The <acronym>SQL92</acronym> syntax for GRANT allows setting privileges
for individual columns for individual columns
within a table, and allows setting a privilege to grant within a table, and allows setting a privilege to grant
the same privileges to others. the same privileges to others:
<SYNOPSIS> <synopsis>
GRANT <REPLACEABLE CLASS="PARAMETER">privilege</REPLACEABLE> [, ...] GRANT <replaceable class="PARAMETER">privilege</replaceable> [, ...]
ON <REPLACEABLE CLASS="PARAMETER">object</REPLACEABLE> [ ( <REPLACEABLE CLASS="PARAMETER">column</REPLACEABLE> [, ...] ) ] [, ...] ON <replaceable class="PARAMETER">object</replaceable> [ ( <replaceable class="PARAMETER">column</replaceable> [, ...] ) ] [, ...]
TO { PUBLIC | <REPLACEABLE CLASS="PARAMETER">username</REPLACEABLE> [, ...] } TO { PUBLIC | <replaceable class="PARAMETER">username</replaceable> [, ...] } [ WITH GRANT OPTION ]
[ WITH GRANT OPTION ] </synopsis>
</SYNOPSIS> </para>
<para>
Fields are compatible with the those in the <acronym>Postgres</acronym> Fields are compatible with the those in the <acronym>Postgres</acronym>
implementation, with the following additions: implementation, with the following additions:
<VARIABLELIST> <variablelist>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="PARAMETER">privilege</replaceable></term>
<REPLACEABLE CLASS="PARAMETER">privilege</REPLACEABLE> <listitem>
SELECT <para>
</TERM>
<LISTITEM>
<PARA>
<acronym>SQL92</acronym> permits additional privileges to be specified: <acronym>SQL92</acronym> permits additional privileges to be specified:
<variablelist>
<varlistentry>
<term>SELECT</term>
<listitem>
<para>
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term>REFERENCES</term>
REFERENCES <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
Allowed to reference some or all of the columns of a specific Allowed to reference some or all of the columns of a specific
table/view in integrity constraints. table/view in integrity constraints.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term>USAGE</term>
USAGE <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
Allowed to use a domain, character set, collation Allowed to use a domain, character set, collation
or translation. or translation.
If an object specifies anything other than a table/view, If an object specifies anything other than a table/view,
<REPLACEABLE CLASS="PARAMETER">privilege</REPLACEABLE> <replaceable class="PARAMETER">privilege</replaceable>
must specify only USAGE. must specify only USAGE.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</variablelist> </variablelist>
<tip>
<para>
Currently, to grant privileges in <productname>Postgres</productname>
to only few columns, you must
create a view having desired columns and then grant privileges
to that view.
</para>
</tip>
<variablelist>
<VARLISTENTRY>
<TERM>
<REPLACEABLE CLASS="PARAMETER">object</REPLACEABLE>
</TERM>
<LISTITEM>
<PARA>
<variablelist>
<VARLISTENTRY>
<TERM>
<REPLACEABLE CLASS="PARAMETER">object</REPLACEABLE>
</TERM>
<LISTITEM>
<PARA>
<acronym>SQL92</acronym> allows an additional non-functional keyword:
<simplelist>
<member>
[ TABLE ] table
</member>
</simplelist>
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="PARAMETER">object</replaceable></term>
CHARACTER SET <listitem>
</TERM> <para>
<LISTITEM>
<PARA> <variablelist>
<varlistentry>
<term>[ TABLE ] <replaceable class="PARAMETER">table</replaceable></term>
<listitem>
<para>
<acronym>SQL92</acronym> allows the additional
non-functional keyword <literal>TABLE</literal>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>CHARACTER SET</term>
<listitem>
<para>
Allowed to use the specified character set. Allowed to use the specified character set.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term>COLLATION</term>
COLLATION <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
Allowed to use the specified collation sequence. Allowed to use the specified collation sequence.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term>TRANSLATION</term>
TRANSLATION <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
Allowed to use the specified character set translation. Allowed to use the specified character set translation.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term>DOMAIN</term>
DOMAIN <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
Allowed to use the specified domain. Allowed to use the specified domain.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term>WITH GRANT OPTION</term>
WITH GRANT OPTION <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
Allowed to grant the same privilege to others. Allowed to grant the same privilege to others.
</para> </para>
</listitem> </listitem>
@ -485,24 +451,21 @@
</para> </para>
</refsect2> </refsect2>
</refsect1> </refsect1>
</REFENTRY> </refentry>
<!-- <!-- Keep this comment at the end of the file
<REPLACEABLE CLASS="PARAMETER"> Local variables:
</REPLACEABLE> mode: sgml
<ReturnValue></ReturnValue> sgml-omittag:nil
<PARA> sgml-shorttag:t
</PARA> sgml-minimize-attributes:nil
<VARIABLELIST> sgml-always-quote-attributes:t
<VARLISTENTRY> sgml-indent-step:1
<TERM>&bull; sgml-indent-data:t
</TERM> sgml-parent-document:nil
<LISTITEM> sgml-default-dtd-file:"../reference.ced"
<PARA> sgml-exposed-tags:nil
</PARA> sgml-local-catalogs:"/usr/lib/sgml/catalog"
</LISTITEM> sgml-local-ecat-files:nil
</VARLISTENTRY> End:
</VARIABLELIST>
<PARA>
</PARA>
--> -->

View File

@ -1,49 +1,44 @@
<REFENTRY ID="APP-INITDB"> <refentry id="APP-INITDB">
<REFMETA> <refmeta>
<REFENTRYTITLE> <refentrytitle>
<application>initdb</application> <application>initdb</application>
</REFENTRYTITLE> </refentrytitle>
<REFMISCINFO>Application</REFMISCINFO> <refmiscinfo>Application</refmiscinfo>
</REFMETA> </refmeta>
<REFNAMEDIV> <refnamediv>
<REFNAME> <refname>
<application>initdb</application> <application>initdb</application>
</REFNAME> </refname>
<REFPURPOSE> <refpurpose>
Create a new <productname>Postgres</productname> database installation Create a new <productname>Postgres</productname> database installation
</REFPURPOSE> </refpurpose>
</refnamediv> </refnamediv>
<REFSYNOPSISDIV> <refsynopsisdiv>
<REFSYNOPSISDIVINFO> <refsynopsisdivinfo>
<DATE>1998-10-02</DATE> <date>1998-10-02</date>
</REFSYNOPSISDIVINFO> </refsynopsisdivinfo>
<SYNOPSIS> <synopsis>
initdb [ --pgdata=<replaceable class="parameter">dbdir</replaceable> | -r <replaceable class="parameter">dbdir</replaceable> ] initdb [ --pgdata=<replaceable class="parameter">dbdir</replaceable> | -r <replaceable class="parameter">dbdir</replaceable> ]
[ --pglib=<replaceable class="parameter">libdir</replaceable> | -l <replaceable class="parameter">libdir</replaceable> ] [ --pglib=<replaceable class="parameter">libdir</replaceable> | -l <replaceable class="parameter">libdir</replaceable> ]
[ --template=<replaceable class="parameter">template</replaceable> | -t <replaceable class="parameter">template</replaceable> ] [ --template=<replaceable class="parameter">template</replaceable> | -t <replaceable class="parameter">template</replaceable> ]
[ --username=<replaceable class="parameter">name</replaceable> | -u <replaceable class="parameter">name</replaceable> ] [ --username=<replaceable class="parameter">name</replaceable> | -u <replaceable class="parameter">name</replaceable> ]
[ --noclean | -n ] [ --debug | -d ] [ --noclean | -n ] [ --debug | -d ]
</SYNOPSIS> </synopsis>
<REFSECT2 ID="R2-APP-INITDB-1"> <refsect2 id="R2-APP-INITDB-1">
<REFSECT2INFO> <refsect2info>
<DATE>1998-10-02</DATE> <date>1998-10-02</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Inputs Inputs
</TITLE> </title>
<PARA> <para>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term>--pglib=<replaceable class="parameter">libdir</replaceable></term>
--pglib=<replaceable class="parameter">libdir</replaceable> <term>-l <replaceable class="parameter">libdir</replaceable></term>
</term> <term><envar>PGLIB</envar></term>
<term>
-l <replaceable class="parameter">libdir</replaceable>
</term>
<term>
<envar>PGLIB</envar>
</term>
<listitem> <listitem>
<para> <para>
Where are the files that make up <productname>Postgres</productname>? Where are the files that make up <productname>Postgres</productname>?
@ -62,15 +57,9 @@ initdb [ --pgdata=<replaceable class="parameter">dbdir</replaceable> | -r <repla
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>--pgdata=<replaceable class="parameter">dbdir</replaceable></term>
--pgdata=<replaceable class="parameter">dbdir</replaceable> <term>-r <replaceable class="parameter">dbdir</replaceable></term>
</term> <term><envar>PGDATA</envar></term>
<term>
-r <replaceable class="parameter">dbdir</replaceable>
</term>
<term>
<envar>PGDATA</envar>
</term>
<listitem> <listitem>
<para> <para>
Where in your Unix filesystem do you want the database data to go? Where in your Unix filesystem do you want the database data to go?
@ -80,15 +69,9 @@ initdb [ --pgdata=<replaceable class="parameter">dbdir</replaceable> | -r <repla
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>--username=<replaceable class="parameter">name</replaceable></term>
--username=<replaceable class="parameter">name</replaceable> <term>-u <replaceable class="parameter">name</replaceable></term>
</term> <term><envar>PGUSER</envar></term>
<term>
-u <replaceable class="parameter">name</replaceable>
</term>
<term>
<envar>PGUSER</envar>
</term>
<listitem> <listitem>
<para> <para>
Who will be the <productname>Postgres</productname> superuser Who will be the <productname>Postgres</productname> superuser
@ -110,17 +93,14 @@ initdb [ --pgdata=<replaceable class="parameter">dbdir</replaceable> | -r <repla
</varlistentry> </varlistentry>
</variablelist> </variablelist>
</para> </para>
<para> <para>
Other, less commonly used, parameters are also available: Other, less commonly used, parameters are also available:
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term>--template=<replaceable class="parameter">template</replaceable></term>
--template=<replaceable class="parameter">template</replaceable> <term>-t <replaceable class="parameter">template</replaceable></term>
</term>
<term>
-t <replaceable class="parameter">template</replaceable>
</term>
<listitem> <listitem>
<para> <para>
Replace the <literal>template1</literal> Replace the <literal>template1</literal>
@ -141,12 +121,8 @@ initdb [ --pgdata=<replaceable class="parameter">dbdir</replaceable> | -r <repla
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>--noclean</term>
--noclean <term>-n</term>
</term>
<term>
-n
</term>
<listitem> <listitem>
<para> <para>
By default, when <application>initdb</application> By default, when <application>initdb</application>
@ -160,12 +136,8 @@ initdb [ --pgdata=<replaceable class="parameter">dbdir</replaceable> | -r <repla
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>--debug</term>
--debug <term>-d</term>
</term>
<term>
-d
</term>
<listitem> <listitem>
<para> <para>
Print debugging output from the bootstrap backend. Print debugging output from the bootstrap backend.
@ -178,14 +150,13 @@ initdb [ --pgdata=<replaceable class="parameter">dbdir</replaceable> | -r <repla
</variablelist> </variablelist>
</para> </para>
<para> <para>
Files are also input to <application>initdb</application>: Files are also input to <application>initdb</application>:
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term><application>postconfig</application></term>
<application>postconfig</application>
</term>
<listitem> <listitem>
<para> <para>
If appearing somewhere in the Unix command search path If appearing somewhere in the Unix command search path
@ -197,9 +168,7 @@ initdb [ --pgdata=<replaceable class="parameter">dbdir</replaceable> | -r <repla
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><filename><envar>PGLIB</envar>/global1.bki.source</filename></term>
<filename><envar>PGLIB</envar>/global1.bki.source</filename>
</term>
<listitem> <listitem>
<para> <para>
Contents for the shared catalog tables in the new database system. This Contents for the shared catalog tables in the new database system. This
@ -209,9 +178,7 @@ initdb [ --pgdata=<replaceable class="parameter">dbdir</replaceable> | -r <repla
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><filename><envar>PGLIB</envar>/local1_template1.bki.source</filename></term>
<filename><envar>PGLIB</envar>/local1_template1.bki.source</filename>
</term>
<listitem> <listitem>
<para> <para>
Contents for the template1 tables in the new database system. This Contents for the template1 tables in the new database system. This
@ -224,29 +191,30 @@ initdb [ --pgdata=<replaceable class="parameter">dbdir</replaceable> | -r <repla
</para> </para>
</refsect2> </refsect2>
<REFSECT2 ID="R2-APP-INITDB-2"> <refsect2 id="R2-APP-INITDB-2">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-26</DATE> <date>1998-09-26</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Outputs Outputs
</TITLE> </title>
<PARA> <para>
<application>initdb</application> will create files in the <envar>PGDATA</envar> <application>initdb</application> will create files in the
<envar>PGDATA</envar>
data area which are the system tables and framework for a complete data area which are the system tables and framework for a complete
installation. installation.
</para> </para>
</refsect2> </refsect2>
</refsynopsisdiv> </refsynopsisdiv>
<REFSECT1 ID="R1-APP-INITDB-1"> <refsect1 id="R1-APP-INITDB-1">
<REFSECT1INFO> <refsect1info>
<DATE>1998-09-26</DATE> <date>1998-09-26</date>
</REFSECT1INFO> </refsect1info>
<TITLE> <title>
Description Description
</TITLE> </title>
<PARA> <para>
<application>initdb</application> creates a new <application>initdb</application> creates a new
<productname>Postgres</productname> database system. <productname>Postgres</productname> database system.
A database system is a A database system is a
@ -273,15 +241,31 @@ initdb [ --pgdata=<replaceable class="parameter">dbdir</replaceable> | -r <repla
<para> <para>
There are three ways to give parameters to <application>initdb</application>. There are three ways to give parameters to <application>initdb</application>.
First, you can use <application>initdb</application> command options. <itemizedlist>
Second, you can set environment <listitem>
<para>
You can use <application>initdb</application> command options.
</para>
</listitem>
<listitem>
<para>
You can set environment
variables before invoking <application>initdb</application>. variables before invoking <application>initdb</application>.
Third, you can have a program called <application>postconfig</application> </para>
</listitem>
<listitem>
<para>
You can have a program called <application>postconfig</application>
in your Unix command search path. in your Unix command search path.
<application>initdb</application> invokes that program and that program then writes <application>initdb</application> invokes that program and that program then writes
<application>initdb</application> parameters to its standard output stream. <application>initdb</application> parameters to its standard output stream.
This third option is not a common thing to do, however. This third option is not a common thing to do, however.
</para> </para>
</listitem>
</itemizedlist>
</para>
<para> <para>
Command options always override parameters specified any other way. Command options always override parameters specified any other way.
The values returned by <application>postconfig</application> The values returned by <application>postconfig</application>
@ -290,12 +274,13 @@ initdb [ --pgdata=<replaceable class="parameter">dbdir</replaceable> | -r <repla
program may base its output on the environment variables if you want program may base its output on the environment variables if you want
their values to be used. their values to be used.
</para> </para>
<para> <para>
The value that <application>postconfig</application> The value that <application>postconfig</application>
outputs must have the format outputs must have the format
<programlisting> <synopsis>
<replaceable>var1</replaceable>=<replaceable class="parameter">value1</replaceable> <replaceable>var2</replaceable>=<replaceable class="parameter">value2</replaceable> ... <replaceable>var1</replaceable>=<replaceable class="parameter">value1</replaceable> <replaceable class="parameter">var2</replaceable>=<replaceable class="parameter">value2</replaceable> ...
</programlisting> </synopsis>
It can output nothing if it doesn't want to supply any parameters. It can output nothing if it doesn't want to supply any parameters.
The <replaceable>var</replaceable> values are equal to The <replaceable>var</replaceable> values are equal to
@ -310,4 +295,21 @@ initdb [ --pgdata=<replaceable class="parameter">dbdir</replaceable> | -r <repla
<filename>/tmp/postgres_test</filename>. <filename>/tmp/postgres_test</filename>.
</para> </para>
</refsect1> </refsect1>
</REFENTRY> </refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:nil
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../reference.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:"/usr/lib/sgml/catalog"
sgml-local-ecat-files:nil
End:
-->

View File

@ -1,67 +1,56 @@
<REFENTRY ID="APP-INITLOCATION"> <refentry id="APP-INITLOCATION">
<REFMETA> <refmeta>
<REFENTRYTITLE> <refentrytitle>
<application>initlocation</application> <application>initlocation</application>
</REFENTRYTITLE> </refentrytitle>
<REFMISCINFO>Application</REFMISCINFO> <refmiscinfo>Application</refmiscinfo>
</REFMETA> </refmeta>
<REFNAMEDIV> <refnamediv>
<REFNAME> <refname>
<application>initlocation</application> <application>initlocation</application>
</REFNAME> </refname>
<REFPURPOSE> <refpurpose>
Create a secondary <productname>Postgres</productname> database storage area Create a secondary <productname>Postgres</productname> database storage area
</REFPURPOSE> </refpurpose>
</refnamediv> </refnamediv>
<REFSYNOPSISDIV> <refsynopsisdiv>
<REFSYNOPSISDIVINFO> <refsynopsisdivinfo>
<DATE>1998-10-02</DATE> <date>1998-10-02</date>
</REFSYNOPSISDIVINFO> </refsynopsisdivinfo>
<SYNOPSIS> <synopsis>
initlocation [ --location=<replaceable class="parameter">altdir</replaceable> | -D <replaceable class="parameter">altdir</replaceable> ] initlocation [ --location=<replaceable class="parameter">er">al</replaceable>ble> | -D <replaceable class="parameter">altdir</replaceable> ]
[ --username=<replaceable class="parameter">name</replaceable> | -u <replaceable class="parameter">name</replaceable> ] [ --username=<replaceable class="parameter">name</replaceable> | -u <replaceable class="parameter">name</replaceable> ]
[ <replaceable class="parameter">altdir</replaceable> ] [ <replaceable class="parameter">altdir</replaceable> ]
</SYNOPSIS> </synopsis>
<REFSECT2 ID="R2-APP-INITLOCATION-1"> <refsect2 id="R2-APP-INITLOCATION-1">
<REFSECT2INFO> <refsect2info>
<DATE>1998-10-02</DATE> <date>1998-10-02</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Inputs Inputs
</TITLE> </title>
<PARA> <para>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term>--location=<replaceable class="parameter">altdir</replaceable></term>
--location=<replaceable class="parameter">altdir</replaceable> <term>-D <replaceable class="parameter">altdir</replaceable></term>
</term> <term><replaceable class="parameter">altdir</replaceable></term>
<term>
-D <replaceable class="parameter">altdir</replaceable>
</term>
<term>
<replaceable class="parameter">altdir</replaceable>
</term>
<listitem> <listitem>
<para> <para>
Where in your Unix filesystem do you want alternate databases to go? Where in your Unix filesystem do you want alternate databases to go?
The top level directory is called the <envar>PGDATA</envar> directory, so you The top level directory is called the <envar>PGDATA</envar> directory, so you
might want to point your first alternate location at <envar>PGDATA2</envar>. might want to point your first alternate location at
<envar>PGDATA2</envar>.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>--username=<replaceable class="parameter">name</replaceable></term>
--username=<replaceable class="parameter">name</replaceable> <term>-u <replaceable class="parameter">name</replaceable></term>
</term> <term><envar>PGUSER</envar></term>
<term>
-u <replaceable class="parameter">name</replaceable>
</term>
<term>
<envar>PGUSER</envar>
</term>
<listitem> <listitem>
<para> <para>
Who will be the Unix filesystem owner of this database storage area? Who will be the Unix filesystem owner of this database storage area?
@ -84,30 +73,29 @@ initlocation [ --location=<replaceable class="parameter">altdir</replaceable> |
</note> </note>
</listitem> </listitem>
</varlistentry> </varlistentry>
</variablelist> </variablelist>
</para> </para>
</refsect2> </refsect2>
<REFSECT2 ID="R2-APP-INITLOCATION-2"> <refsect2 id="R2-APP-INITLOCATION-2">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-26</DATE> <date>1998-09-26</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Outputs Outputs
</TITLE> </title>
<PARA> <para>
<application>initlocation</application> will create directories in <application>initlocation</application> will create directories in
the specified place. the specified place.
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term><computeroutput>
We are initializing the database area with username postgres (uid=500). We are initializing the database area with username postgres (uid=500).
This user will own all the files and must also own the server process. This user will own all the files and must also own the server process.
Creating Postgres database system directory <replaceable class="parameter">altdir</replaceable> Creating Postgres database system directory <replaceable class="parameter">altdir</replaceable>
Creating Postgres database system directory <replaceable class="parameter">altdir</replaceable> Creating Postgres database system directory <replaceable class="parameter">altdir</replaceable>
</term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
Successful completion. Successful completion.
@ -116,12 +104,12 @@ initlocation [ --location=<replaceable class="parameter">altdir</replaceable> |
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><computeroutput>
We are initializing the database area with username postgres (uid=500). We are initializing the database area with username postgres (uid=500).
This user will own all the files and must also own the server process. This user will own all the files and must also own the server process.
Creating Postgres database system directory /usr/local/src/testlocation Creating Postgres database system directory /usr/local/src/testlocation
mkdir: cannot make directory `<replaceable class="parameter">altdir</replaceable>': Permission denied mkdir: cannot make directory `<replaceable class="parameter">altdir</replaceable>': Permission denied
</term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
You do not have filesystem permission to write to the specified directory area. You do not have filesystem permission to write to the specified directory area.
@ -130,12 +118,12 @@ initlocation [ --location=<replaceable class="parameter">altdir</replaceable> |
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><computeroutput>
Valid username not given. You must specify the username for Valid username not given. You must specify the username for
the Postgres superuser for the database system you are the Postgres superuser for the database system you are
initializing, either with the --username option or by default initializing, either with the --username option or by default
to the USER environment variable. to the USER environment variable.
</term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
The username which you have specified is not the The username which you have specified is not the
@ -145,11 +133,11 @@ initlocation [ --location=<replaceable class="parameter">altdir</replaceable> |
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><computeroutput>
Can't tell what username to use. You don't have the USER Can't tell what username to use. You don't have the USER
environment variable set to your username and didn't specify the environment variable set to your username and didn't specify the
--username option --username option
</term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
Specify the <option>--username</option> command line option. Specify the <option>--username</option> command line option.
@ -162,14 +150,14 @@ initlocation [ --location=<replaceable class="parameter">altdir</replaceable> |
</refsect2> </refsect2>
</refsynopsisdiv> </refsynopsisdiv>
<REFSECT1 ID="R1-APP-INITLOCATION-1"> <refsect1 id="R1-APP-INITLOCATION-1">
<REFSECT1INFO> <refsect1info>
<DATE>1998-09-26</DATE> <date>1998-09-26</date>
</REFSECT1INFO> </refsect1info>
<TITLE> <title>
Description Description
</TITLE> </title>
<PARA> <para>
<application>initlocation</application> <application>initlocation</application>
creates a new <productname>Postgres</productname> secondary database storage area. creates a new <productname>Postgres</productname> secondary database storage area.
A secondary storage area contains a required tree of directories with A secondary storage area contains a required tree of directories with
@ -181,6 +169,7 @@ initlocation [ --location=<replaceable class="parameter">altdir</replaceable> |
</para> </para>
<para> <para>
There are two kinds of arguments for <application>initlocation</application>. There are two kinds of arguments for <application>initlocation</application>.
First, you can specify an environment variable (e.g. <envar>PGDATA2</envar>). First, you can specify an environment variable (e.g. <envar>PGDATA2</envar>).
This environment variable should be known to the backend for later use in This environment variable should be known to the backend for later use in
<command>CREATE DATABASE/WITH LOCATION</command> <command>CREATE DATABASE/WITH LOCATION</command>
@ -207,22 +196,38 @@ initlocation [ --location=<replaceable class="parameter">altdir</replaceable> |
</note> </note>
</refsect1> </refsect1>
<REFSECT1 ID="R1-APP-INITLOCATION-2"> <refsect1 id="R1-APP-INITLOCATION-2">
<REFSECT1INFO> <refsect1info>
<DATE>1998-09-26</DATE> <date>1998-09-26</date>
</REFSECT1INFO> </refsect1info>
<TITLE> <title>
Usage Usage
</TITLE> </title>
<PARA> <para>
To create a database in an alternate location, using an environment variable: To create a database in an alternate location, using an environment variable:
<programlisting> <programlisting>
% setenv PGDATA2 /opt/postgres/data % setenv PGDATA2 /opt/postgres/data
% initlocation PGDATA2 % initlocation PGDATA2
% createdb -D PGDATA2 % createdb -D PGDATA2
</programlisting> </programlisting>
</para> </para>
</refsect1> </refsect1>
</REFENTRY> </refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:nil
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../reference.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:"/usr/lib/sgml/catalog"
sgml-local-ecat-files:nil
End:
-->

View File

@ -1,133 +1,125 @@
<REFENTRY ID="SQL-INSERT"> <refentry id="SQL-INSERT">
<REFMETA> <refmeta>
<REFENTRYTITLE> <refentrytitle>
INSERT INSERT
</REFENTRYTITLE> </refentrytitle>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO> <refmiscinfo>SQL - Language Statements</refmiscinfo>
</REFMETA> </refmeta>
<REFNAMEDIV> <refnamediv>
<REFNAME> <refname>
INSERT INSERT
</REFNAME> </refname>
<REFPURPOSE> <refpurpose>
Inserts new rows into a table Inserts new rows into a table
</REFPURPOSE> </refpurpose>
</refnamediv> </refnamediv>
<REFSYNOPSISDIV> <refsynopsisdiv>
<REFSYNOPSISDIVINFO> <refsynopsisdivinfo>
<DATE>1998-09-23</DATE> <date>1998-09-23</date>
</REFSYNOPSISDIVINFO> </refsynopsisdivinfo>
<SYNOPSIS> <synopsis>
INSERT INTO <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE> [ ( <REPLACEABLE CLASS="PARAMETER">column</REPLACEABLE> [, ...] ) ] INSERT INTO <replaceable class="PARAMETER">table</replaceable> [ ( <replaceable class="PARAMETER">column</replaceable> [, ...] ) ]
{ VALUES ( <REPLACEABLE CLASS="PARAMETER">expression</REPLACEABLE> [, ...] ) | SELECT <REPLACEABLE CLASS="PARAMETER">query</REPLACEABLE> } { VALUES ( <replaceable class="PARAMETER">expression</replaceable> [, ...] ) | SELECT <replaceable class="PARAMETER">query</replaceable> }
</SYNOPSIS> </synopsis>
<REFSECT2 ID="R2-SQL-INSERT-1"> <refsect2 id="R2-SQL-INSERT-1">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-23</DATE> <date>1998-09-23</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Inputs Inputs
</TITLE> </title>
<PARA> <para>
</PARA>
<VARIABLELIST> <variablelist>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="PARAMETER">table</replaceable></term>
<REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
The name of an existing table. The name of an existing table.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="PARAMETER">column</replaceable></term>
<REPLACEABLE CLASS="PARAMETER">column</REPLACEABLE> <listitem>
</TERM> <para>
<LISTITEM> The name of a column in <replaceable class="PARAMETER">table</replaceable>.
<PARA>
The name of a column in <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE>.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="PARAMETER">expression</replaceable></term>
<REPLACEABLE CLASS="PARAMETER">expression</REPLACEABLE> <listitem>
</TERM> <para>
<LISTITEM> A valid expression or value to assign to <replaceable
<PARA> class="PARAMETER">column</replaceable>.
A valid expression or value to assign to <REPLACEABLE CLASS="PARAMETER">column</REPLACEABLE>.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="PARAMETER">query</replaceable></term>
<REPLACEABLE CLASS="PARAMETER">query</REPLACEABLE> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
A valid query. Refer to the SELECT statement for a further description A valid query. Refer to the SELECT statement for a further description
of valid arguments. of valid arguments.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</variablelist>
</para>
</refsect2>
</VARIABLELIST> <refsect2 id="R2-SQL-INSERT-2">
<refsect2info>
</REFSECT2> <date>1998-09-23</date>
</refsect2info>
<REFSECT2 ID="R2-SQL-INSERT-2"> <title>
<REFSECT2INFO>
<DATE>1998-09-23</DATE>
</REFSECT2INFO>
<TITLE>
Outputs Outputs
</TITLE> </title>
<PARA> <para>
<VARIABLELIST> <variablelist>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
<ReturnValue>INSERT <replaceable>oid</replaceable></ReturnValue> 1 INSERT <replaceable>oid</replaceable> 1
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
Message returned if only one row was inserted. Message returned if only one row was inserted.
<ReturnValue><replaceable>oid</replaceable></ReturnValue> <returnvalue><replaceable>oid</replaceable></returnvalue>
is the numeric <acronym>OID</acronym> of the inserted row. is the numeric <acronym>OID</acronym> of the inserted row.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
<ReturnValue>INSERT 0 <replaceable>#</replaceable></ReturnValue> INSERT 0 <replaceable>#</replaceable>
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
Message returned if more than one rows were inserted. Message returned if more than one rows were inserted.
<ReturnValue><replaceable>#</replaceable></ReturnValue> <returnvalue><replaceable>#</replaceable></returnvalue>
is the number of rows inserted. is the number of rows inserted.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</VARIABLELIST> </variablelist>
</para> </para>
</REFSECT2> </refsect2>
</REFSYNOPSISDIV> </refsynopsisdiv>
<REFSECT1 ID="R1-SQL-INSERT-1"> <refsect1 id="R1-SQL-INSERT-1">
<REFSECT1INFO> <refsect1info>
<DATE>1998-09-02</DATE> <date>1998-09-02</date>
</REFSECT1INFO> </refsect1info>
<TITLE> <title>
Description Description
</TITLE> </title>
<PARA> <para>
INSERT allows one to insert new rows into a table. One can insert <command>INSERT</command> allows one to insert new rows into a table. One can insert
a single row at time or several rows as a result of a query. a single row at time or several rows as a result of a query.
The columns in the target list may be listed in any order. The columns in the target list may be listed in any order.
In every column not present in the target list will be inserted In every column not present in the target list will be inserted
@ -143,95 +135,101 @@ Inserts new rows into a table
</para> </para>
</refsect1> </refsect1>
<REFSECT1 ID="R1-SQL-INSERT-2"> <refsect1 id="R1-SQL-INSERT-2">
<TITLE> <title>
Usage Usage
</TITLE> </title>
<PARA> <para>
<ProgramListing> Insert a single row into table <literal>films</literal>:
--Insert a single row into table films;
--(in the second example the column date_prod is omitted <programlisting>
--therefore will be stored in it a default value of NULL):
--
INSERT INTO films VALUES INSERT INTO films VALUES
('UA502','Bananas',105,'1971-07-13','Comedy',INTERVAL '82 minute'); ('UA502','Bananas',105,'1971-07-13','Comedy',INTERVAL '82 minute');
</programlisting>
</para>
<para>
In this second example the column <literal>date_prod</literal> is
omitted and therefore it will have the default value of NULL:
<programlisting>
INSERT INTO films (code, title, did, date_prod, kind) INSERT INTO films (code, title, did, date_prod, kind)
VALUES ('T_601', 'Yojimbo', 106, DATE '1961-06-16', 'Drama'); VALUES ('T_601', 'Yojimbo', 106, DATE '1961-06-16', 'Drama');
</ProgramListing> </programlisting>
</para>
<ProgramListing> <para>
--Insert a single row into table distributors, note that Insert a single row into table distributors; note that
--only column "name" is specified, to the non specified only column <literal>name</literal> is specified, so the omitted
--column "did" will be assigned its default value: column <literal>did</literal> will be assigned its default value:
--
<programlisting>
INSERT INTO distributors (name) VALUES ('British Lion'); INSERT INTO distributors (name) VALUES ('British Lion');
</ProgramListing> </programlisting>
</para>
<ProgramListing> <para>
--Insert several rows into table films from table tmp: Insert several rows into table films from table <literal>tmp</literal>:
--
INSERT INTO films
SELECT * FROM tmp;
</ProgramListing>
<ProgramListing> <programlisting>
--Insert into arrays: INSERT INTO films SELECT * FROM tmp;
</programlisting>
</para>
<para>
Insert into arrays (refer to <citetitle>The PostgreSQL User's Guide</citetitle> for further
information about arrays):
<programlisting>
-- Create an empty 3x3 gameboard for noughts-and-crosses -- Create an empty 3x3 gameboard for noughts-and-crosses
-- (all of these queries create the same board attribute) -- (all of these queries create the same board attribute)
--(Refer to the <citetitle>PostgreSQL User's Guide</citetitle> for further
--information about arrays).
INSERT INTO tictactoe (game, board[1:3][1:3]) INSERT INTO tictactoe (game, board[1:3][1:3])
VALUES (1,'{{"","",""},{},{"",""}}'); VALUES (1,'{{"","",""},{},{"",""}}');
INSERT INTO tictactoe (game, board[3][3]) INSERT INTO tictactoe (game, board[3][3])
VALUES (2,'{}'); VALUES (2,'{}');
INSERT INTO tictactoe (game, board) INSERT INTO tictactoe (game, board)
VALUES (3,'{{,,},{,,},{,,}}'); VALUES (3,'{{,,},{,,},{,,}}');
</ProgramListing> </programlisting>
</para> </para>
</REFSECT1> </refsect1>
<REFSECT1 ID="R1-SQL-INSERT-3"> <refsect1 id="R1-SQL-INSERT-3">
<TITLE> <title>
Compatibility Compatibility
</TITLE> </title>
<PARA> <para>
</PARA> </para>
<REFSECT2 ID="R2-SQL-INSERT-4"> <refsect2 id="R2-SQL-INSERT-4">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-23</DATE> <date>1998-09-23</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
SQL92 SQL92
</TITLE> </title>
<PARA> <para>
The INSERT statement is fully compatible with <acronym>SQL92</acronym>. <command>INSERT</command> is fully compatible with <acronym>SQL92</acronym>.
Possible limitations in features of the Possible limitations in features of the
<REPLACEABLE CLASS="PARAMETER">query</REPLACEABLE> <replaceable class="PARAMETER">query</replaceable>
clause are documented for the SELECT statement. clause are documented for the SELECT statement.
</para> </para>
</refsect2> </refsect2>
</refsect1> </refsect1>
</REFENTRY> </refentry>
<!-- <!-- Keep this comment at the end of the file
<REPLACEABLE CLASS="PARAMETER"> Local variables:
</REPLACEABLE> mode: sgml
<ReturnValue></ReturnValue> sgml-omittag:nil
<PARA> sgml-shorttag:t
</PARA> sgml-minimize-attributes:nil
<VARIABLELIST> sgml-always-quote-attributes:t
<VARLISTENTRY> sgml-indent-step:1
<TERM>&bull; sgml-indent-data:t
</TERM> sgml-parent-document:nil
<LISTITEM> sgml-default-dtd-file:"../reference.ced"
<PARA> sgml-exposed-tags:nil
</PARA> sgml-local-catalogs:"/usr/lib/sgml/catalog"
</LISTITEM> sgml-local-ecat-files:nil
</VARLISTENTRY> End:
</VARIABLELIST>
<PARA>
</PARA>
--> -->

View File

@ -1,100 +1,98 @@
<REFENTRY ID="SQL-LISTEN"> <refentry id="SQL-LISTEN">
<REFMETA> <refmeta>
<REFENTRYTITLE> <refentrytitle>
LISTEN LISTEN
</REFENTRYTITLE> </refentrytitle>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO> <refmiscinfo>SQL - Language Statements</refmiscinfo>
</REFMETA> </refmeta>
<REFNAMEDIV> <refnamediv>
<REFNAME> <refname>
LISTEN LISTEN
</REFNAME> </refname>
<REFPURPOSE> <refpurpose>
Listen for notification on a notify condition Listen for a response on a notify condition
</REFPURPOSE> </refpurpose>
</refnamediv> </refnamediv>
<REFSYNOPSISDIV> <refsynopsisdiv>
<REFSYNOPSISDIVINFO> <refsynopsisdivinfo>
<DATE>1998-10-07</DATE> <date>1998-10-07</date>
</REFSYNOPSISDIVINFO> </refsynopsisdivinfo>
<SYNOPSIS> <synopsis>
LISTEN <REPLACEABLE CLASS="PARAMETER">notifyname</REPLACEABLE> LISTEN <replaceable class="PARAMETER">name</replaceable>
</SYNOPSIS> </synopsis>
<REFSECT2 ID="R2-SQL-LISTEN-1"> <refsect2 id="R2-SQL-LISTEN-1">
<REFSECT2INFO> <refsect2info>
<DATE>1998-10-07</DATE> <date>1998-10-07</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Inputs Inputs
</TITLE> </title>
<PARA> <para>
</PARA>
<VARIABLELIST> <variablelist>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="PARAMETER">name</replaceable></term>
<REPLACEABLE CLASS="PARAMETER">notifyname</REPLACEABLE> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
Name of notify condition. Name of notify condition.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</VARIABLELIST> </variablelist>
</para>
</refsect2>
</REFSECT2> <refsect2 id="R2-SQL-LISTEN-2">
<refsect2info>
<REFSECT2 ID="R2-SQL-LISTEN-2"> <date>1998-09-24</date>
<REFSECT2INFO> </refsect2info>
<DATE>1998-09-24</DATE> <title>
</REFSECT2INFO>
<TITLE>
Outputs Outputs
</TITLE> </title>
<PARA> <para>
<VARIABLELIST> <variablelist>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
<returnvalue>LISTEN</returnvalue> LISTEN
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
Message returned upon successful completion of registration. Message returned upon successful completion of registration.
</PARA> </para>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
<returnvalue>NOTICE Async_Listen: We are already listening on notifyname</returnvalue>
</TERM>
<LISTITEM>
<PARA>
If this backend is already registered for that notify condition.
</PARA>
</listitem> </listitem>
</varlistentry> </varlistentry>
</VARIABLELIST> <varlistentry>
<term><computeroutput>
NOTICE Async_Listen: We are already listening on <replaceable class="PARAMETER">name</replaceable>
</computeroutput></term>
<listitem>
<para>
If this backend is already registered for that notify condition.
</para> </para>
</REFSECT2> </listitem>
</REFSYNOPSISDIV> </varlistentry>
</variablelist>
</para>
</refsect2>
</refsynopsisdiv>
<REFSECT1 ID="R1-SQL-LISTEN-1"> <refsect1 id="R1-SQL-LISTEN-1">
<REFSECT1INFO> <refsect1info>
<DATE>1998-10-07</DATE> <date>1998-10-07</date>
</REFSECT1INFO> </refsect1info>
<TITLE> <title>
Description Description
</TITLE> </title>
<PARA> <para>
LISTEN registers the current <productname>Postgres</productname> backend as a <command>LISTEN</command> registers the current <productname>Postgres</productname> backend as a
listener on the notify condition listener on the notify condition
<REPLACEABLE CLASS="PARAMETER">notifyname</REPLACEABLE>. <replaceable class="PARAMETER">name</replaceable>.
</para> </para>
<para> <para>
Whenever the command Whenever the command
<command>NOTIFY <REPLACEABLE CLASS="PARAMETER">notifyname</REPLACEABLE></command> <command>NOTIFY <replaceable class="PARAMETER">name</replaceable></command>
is invoked, either by this backend or another one connected to is invoked, either by this backend or another one connected to
the same database, all the backends currently listening on that notify the same database, all the backends currently listening on that notify
condition are notified, and each will in turn notify its connected condition are notified, and each will in turn notify its connected
@ -102,7 +100,7 @@ LISTEN <REPLACEABLE CLASS="PARAMETER">notifyname</REPLACEABLE>
for more information. for more information.
</para> </para>
<para> <para>
A backend can be deregistered for a given notify condition with the A backend can be unregistered for a given notify condition with the
<command>UNLISTEN</command> command. Also, a backend's listen registrations <command>UNLISTEN</command> command. Also, a backend's listen registrations
are automatically cleared when the backend process exits. are automatically cleared when the backend process exits.
</para> </para>
@ -124,62 +122,78 @@ LISTEN <REPLACEABLE CLASS="PARAMETER">notifyname</REPLACEABLE>
<command>NOTIFY</command>. <command>NOTIFY</command>.
</para> </para>
<REFSECT2 ID="R2-SQL-LISTEN-3"> <refsect2 id="R2-SQL-LISTEN-3">
<REFSECT2INFO> <refsect2info>
<DATE>1998-10-07</DATE> <date>1998-10-07</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Notes Notes
</TITLE> </title>
<para> <para>
<REPLACEABLE CLASS="PARAMETER">notifyname</REPLACEABLE> <replaceable class="PARAMETER">name</replaceable>
can be any string valid as a name; can be any string valid as a name;
it need not correspond to the name of any actual table. If it need not correspond to the name of any actual table. If
<REPLACEABLE CLASS="PARAMETER">notifyname</REPLACEABLE> <replaceable class="PARAMETER">notifyname</replaceable>
is enclosed in double-quotes, it need not even be a syntactically is enclosed in double-quotes, it need not even be a syntactically
valid name, but can be any string up to 31 characters long. valid name, but can be any string up to 31 characters long.
</para> </para>
<para> <para>
In some previous releases of In some previous releases of
<productname>Postgres</productname>, <productname>Postgres</productname>,
<REPLACEABLE CLASS="PARAMETER">notifyname</REPLACEABLE> <replaceable class="PARAMETER">name</replaceable>
had to be enclosed in double-quotes when it did not correspond to any existing had to be enclosed in double-quotes when it did not correspond to any existing
table name, even if syntactically valid as a name. That is no longer required. table name, even if syntactically valid as a name. That is no longer required.
</para> </para>
</REFSECT2> </refsect2>
</refsect1> </refsect1>
<REFSECT1 ID="R1-SQL-LISTEN-2"> <refsect1 id="R1-SQL-LISTEN-2">
<TITLE> <title>
Usage Usage
</TITLE> </title>
<PARA> <para>
<ProgramListing> Configure and execute a listen/notify sequence from <application>psql</application>:
-- Configure and execute a listen/notify sequence from psql <programlisting>
postgres=> listen virtual; LISTEN virtual;
LISTEN NOTIFY virtual;
postgres=> notify virtual;
NOTIFY
ASYNC NOTIFY of 'virtual' from backend pid '11239' received ASYNC NOTIFY of 'virtual' from backend pid '11239' received
</ProgramListing> </programlisting>
</para> </para>
</REFSECT1> </refsect1>
<REFSECT1 ID="R1-SQL-LISTEN-3"> <refsect1 id="R1-SQL-LISTEN-3">
<TITLE> <title>
Compatibility Compatibility
</TITLE> </title>
<REFSECT2 ID="R2-SQL-LISTEN-4"> <refsect2 id="R2-SQL-LISTEN-4">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-01</DATE> <date>1998-09-01</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
SQL92 SQL92
</TITLE> </title>
<PARA> <para>
There is no <command>LISTEN</command> in <acronym>SQL92</acronym>. There is no <command>LISTEN</command> in <acronym>SQL92</acronym>.
</para> </para>
</refsect2> </refsect2>
</refsect1> </refsect1>
</REFENTRY> </refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:nil
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../reference.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:"/usr/lib/sgml/catalog"
sgml-local-ecat-files:nil
End:
-->

View File

@ -1,97 +1,92 @@
<REFENTRY ID="SQL-LOAD"> <refentry id="SQL-LOAD">
<REFMETA> <refmeta>
<REFENTRYTITLE> <refentrytitle>
LOAD LOAD
</REFENTRYTITLE> </refentrytitle>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO> <refmiscinfo>SQL - Language Statements</refmiscinfo>
</REFMETA> </refmeta>
<REFNAMEDIV> <refnamediv>
<REFNAME> <refname>
LOAD LOAD
</REFNAME> </refname>
<REFPURPOSE> <refpurpose>
Dynamically loads an object file Dynamically loads an object file
</REFPURPOSE> </refpurpose>
</refnamediv> </refnamediv>
<REFSYNOPSISDIV> <refsynopsisdiv>
<REFSYNOPSISDIVINFO> <refsynopsisdivinfo>
<DATE>1998-09-24</DATE> <date>1998-09-24</date>
</REFSYNOPSISDIVINFO> </refsynopsisdivinfo>
<SYNOPSIS> <synopsis>
<REPLACEABLE CLASS="PARAMETER"> LOAD '<replaceable class="PARAMETER">filename</replaceable>'
</REPLACEABLE> </synopsis>
LOAD '<REPLACEABLE CLASS="PARAMETER">filename</REPLACEABLE>'
</SYNOPSIS>
<REFSECT2 ID="R2-SQL-LOAD-1"> <refsect2 id="R2-SQL-LOAD-1">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-01</DATE> <date>1998-09-01</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Inputs Inputs
</TITLE> </title>
<PARA> <para>
</PARA> <variablelist>
<VARIABLELIST> <varlistentry>
<VARLISTENTRY> <term><replaceable class="PARAMETER">filename</replaceable></term>
<TERM> <listitem>
<REPLACEABLE CLASS="PARAMETER">filename</REPLACEABLE> <para>
</TERM>
<LISTITEM>
<PARA>
Object file for dynamic loading. Object file for dynamic loading.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</VARIABLELIST> </variablelist>
</para>
</refsect2>
</REFSECT2> <refsect2 id="R2-SQL-LOAD-2">
<refsect2info>
<REFSECT2 ID="R2-SQL-LOAD-2"> <date>1998-09-24</date>
<REFSECT2INFO> </refsect2info>
<DATE>1998-09-24</DATE> <title>
</REFSECT2INFO>
<TITLE>
Outputs Outputs
</TITLE> </title>
<PARA> <para>
<VARIABLELIST> <variablelist>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
<returnvalue>LOAD</returnvalue> LOAD
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
Message returned on successful completion. Message returned on successful completion.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
<returnvalue>ERROR: LOAD: could not open file '<REPLACEABLE CLASS="PARAMETER">filename</REPLACEABLE>'</returnvalue> ERROR: LOAD: could not open file '<replaceable class="PARAMETER">filename</replaceable>'
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
Message returned if the specified file is not found. The file must be visible Message returned if the specified file is not found. The file must be visible
<emphasis>to the <productname>Postgres</productname> backend</emphasis>, <emphasis>to the <productname>Postgres</productname> backend</emphasis>,
with the appropriate full path name specified, to avoid this message. with the appropriate full path name specified, to avoid this message.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</VARIABLELIST> </variablelist>
</para> </para>
</REFSECT2> </refsect2>
</REFSYNOPSISDIV> </refsynopsisdiv>
<REFSECT1 ID="R1-SQL-LOAD-1"> <refsect1 id="R1-SQL-LOAD-1">
<REFSECT1INFO> <refsect1info>
<DATE>1998-09-24</DATE> <date>1998-09-24</date>
</REFSECT1INFO> </refsect1info>
<TITLE> <title>
Description Description
</TITLE> </title>
<PARA> <para>
Loads an object (or ".o") file into the Loads an object (or ".o") file into the
<productname>Postgres</productname> backend address space. Once a <productname>Postgres</productname> backend address space. Once a
file is loaded, all functions in that file can be accessed. This file is loaded, all functions in that file can be accessed. This
@ -107,14 +102,14 @@
recompiled. Only objects created from C language files are supported recompiled. Only objects created from C language files are supported
at this time. at this time.
</para> </para>
<REFSECT2 ID="R2-SQL-LOAD-3"> <refsect2 id="R2-SQL-LOAD-3">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-24</DATE> <date>1998-09-24</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Notes Notes
</TITLE> </title>
<PARA> <para>
Functions in loaded object files should not call functions in other Functions in loaded object files should not call functions in other
object files loaded through the object files loaded through the
<command>LOAD</command> <command>LOAD</command>
@ -123,7 +118,8 @@
Postgres itself. They should not call functions defined in a different Postgres itself. They should not call functions defined in a different
loaded file <literal>B</literal>. loaded file <literal>B</literal>.
This is because if <literal>B</literal> is reloaded, the Postgres loader is This is because if <literal>B</literal> is reloaded, the Postgres loader is
not able to relocate the calls from the functions in <literal>A</literal> into not able to relocate the calls from the functions in
<literal>A</literal> into
the new address space of <literal>B</literal>. the new address space of <literal>B</literal>.
If <literal>B</literal> is not reloaded, however, there will If <literal>B</literal> is not reloaded, however, there will
not be a problem. not be a problem.
@ -141,39 +137,56 @@
to a new platform, <command>LOAD</command> to a new platform, <command>LOAD</command>
will have to work in order to support ADTs. will have to work in order to support ADTs.
</para> </para>
</REFSECT2> </refsect2>
</refsect1> </refsect1>
<REFSECT1 ID="R1-SQL-LOAD-2"> <refsect1 id="R1-SQL-LOAD-2">
<TITLE> <title>
Usage Usage
</TITLE> </title>
<PARA> <para>
<ProgramListing> Load the file <filename>/usr/postgres/demo/circle.o</filename>:
--Load the file /usr/postgres/demo/circle.o
-- <programlisting>
LOAD '/usr/postgres/demo/circle.o' LOAD '/usr/postgres/demo/circle.o'
</ProgramListing> </programlisting>
</para> </para>
</REFSECT1> </refsect1>
<REFSECT1 ID="R1-SQL-LOAD-3"> <refsect1 id="R1-SQL-LOAD-3">
<TITLE> <title>
Compatibility Compatibility
</TITLE> </title>
<PARA> <para>
</PARA> </para>
<REFSECT2 ID="R2-SQL-LOAD-4"> <refsect2 id="R2-SQL-LOAD-4">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-24</DATE> <date>1998-09-24</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
SQL92 SQL92
</TITLE> </title>
<PARA> <para>
There is no <command>LOAD</command> in <acronym>SQL92</acronym>. There is no <command>LOAD</command> in <acronym>SQL92</acronym>.
</para> </para>
</refsect2> </refsect2>
</refsect1> </refsect1>
</REFENTRY> </refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:nil
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../reference.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:"/usr/lib/sgml/catalog"
sgml-local-ecat-files:nil
End:
-->

View File

@ -34,9 +34,7 @@ LOCK [ TABLE ] <replaceable class="PARAMETER">table</replaceable> IN SHARE ROW E
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term><replaceable class="PARAMETER">table</replaceable></term>
<replaceable class="PARAMETER">table</replaceable>
</term>
<listitem> <listitem>
<para> <para>
The name of an existing table to lock. The name of an existing table to lock.
@ -45,9 +43,7 @@ LOCK [ TABLE ] <replaceable class="PARAMETER">table</replaceable> IN SHARE ROW E
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>ACCESS SHARE MODE</term>
ACCESS SHARE MODE
</term>
<listitem> <listitem>
<note> <note>
<para> <para>
@ -68,9 +64,7 @@ LOCK [ TABLE ] <replaceable class="PARAMETER">table</replaceable> IN SHARE ROW E
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>ROW SHARE MODE</term>
ROW SHARE MODE
</term>
<listitem> <listitem>
<note> <note>
<para> <para>
@ -85,9 +79,7 @@ LOCK [ TABLE ] <replaceable class="PARAMETER">table</replaceable> IN SHARE ROW E
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>ROW EXCLUSIVE MODE</term>
ROW EXCLUSIVE MODE
</term>
<listitem> <listitem>
<note> <note>
<para> <para>
@ -105,9 +97,7 @@ LOCK [ TABLE ] <replaceable class="PARAMETER">table</replaceable> IN SHARE ROW E
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>SHARE MODE</term>
SHARE MODE
</term>
<listitem> <listitem>
<note> <note>
<para> <para>
@ -124,9 +114,7 @@ LOCK [ TABLE ] <replaceable class="PARAMETER">table</replaceable> IN SHARE ROW E
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>SHARE ROW EXCLUSIVE MODE</term>
SHARE ROW EXCLUSIVE MODE
</term>
<listitem> <listitem>
<para> <para>
@ -139,9 +127,7 @@ LOCK [ TABLE ] <replaceable class="PARAMETER">table</replaceable> IN SHARE ROW E
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>EXCLUSIVE MODE</term>
EXCLUSIVE MODE
</term>
<listitem> <listitem>
<para> <para>
@ -154,9 +140,7 @@ LOCK [ TABLE ] <replaceable class="PARAMETER">table</replaceable> IN SHARE ROW E
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>ACCESS EXCLUSIVE MODE</term>
ACCESS EXCLUSIVE MODE
</term>
<listitem> <listitem>
<note> <note>
<para> <para>
@ -179,7 +163,6 @@ LOCK [ TABLE ] <replaceable class="PARAMETER">table</replaceable> IN SHARE ROW E
</note> </note>
</listitem> </listitem>
</varlistentry> </varlistentry>
</variablelist> </variablelist>
</para> </para>
</refsect2> </refsect2>
@ -195,9 +178,20 @@ LOCK [ TABLE ] <replaceable class="PARAMETER">table</replaceable> IN SHARE ROW E
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term><computeroutput>
LOCK TABLE
</computeroutput></term>
<listitem>
<para>
The lock was successfully applied.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><computeroutput>
ERROR <replaceable class="PARAMETER">table</replaceable>: Table does not exist. ERROR <replaceable class="PARAMETER">table</replaceable>: Table does not exist.
</term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
Message returned if <replaceable class="PARAMETER">table</replaceable> Message returned if <replaceable class="PARAMETER">table</replaceable>
@ -328,18 +322,15 @@ LOCK [ TABLE ] <replaceable class="PARAMETER">table</replaceable> IN SHARE ROW E
</title> </title>
<para> <para>
Illustrate a SHARE lock on a primary key table when going to perform
inserts into a foreign key table:
<programlisting> <programlisting>
--
-- SHARE lock primary key table when going to perform
-- insert into foreign key table.
--
BEGIN WORK; BEGIN WORK;
LOCK TABLE films IN SHARE MODE; LOCK TABLE films IN SHARE MODE;
SELECT id FROM films SELECT id FROM films
WHERE name = 'Star Wars: Episode I - The Phantom Menace'; WHERE name = 'Star Wars: Episode I - The Phantom Menace';
--
-- Do ROLLBACK if record was not returned -- Do ROLLBACK if record was not returned
--
INSERT INTO films_user_comments VALUES INSERT INTO films_user_comments VALUES
(_id_, 'GREAT! I was waiting for it for so long!'); (_id_, 'GREAT! I was waiting for it for so long!');
COMMIT WORK; COMMIT WORK;
@ -347,11 +338,10 @@ LOCK [ TABLE ] <replaceable class="PARAMETER">table</replaceable> IN SHARE ROW E
</para> </para>
<para> <para>
Take a SHARE ROW EXCLUSIVE lock on a primary key table when going to perform
a delete operation:
<programlisting> <programlisting>
--
-- SHARE ROW EXCLUSIVE lock primary key table when going to perform
-- delete operation.
--
BEGIN WORK; BEGIN WORK;
LOCK TABLE films IN SHARE ROW EXCLUSIVE MODE; LOCK TABLE films IN SHARE ROW EXCLUSIVE MODE;
DELETE FROM films_user_comments WHERE id IN DELETE FROM films_user_comments WHERE id IN
@ -360,13 +350,14 @@ LOCK [ TABLE ] <replaceable class="PARAMETER">table</replaceable> IN SHARE ROW E
COMMIT WORK; COMMIT WORK;
</programlisting> </programlisting>
</para> </para>
</refsect1> </refsect1>
<refsect1 id="R1-SQL-LOCK-3"> <refsect1 id="R1-SQL-LOCK-3">
<title> <title>
Compatibility Compatibility
</title> </title>
<para>
</para>
<refsect2 id="R2-SQL-LOCK-4"> <refsect2 id="R2-SQL-LOCK-4">
<refsect2info> <refsect2info>
@ -397,7 +388,7 @@ sgml-indent-data:t
sgml-parent-document:nil sgml-parent-document:nil
sgml-default-dtd-file:"../reference.ced" sgml-default-dtd-file:"../reference.ced"
sgml-exposed-tags:nil sgml-exposed-tags:nil
sgml-local-catalogs:"/usr/lib/sgml/CATALOG" sgml-local-catalogs:"/usr/lib/sgml/catalog"
sgml-local-ecat-files:nil sgml-local-ecat-files:nil
End: End:
--> -->

View File

@ -1,37 +1,37 @@
<REFENTRY ID="SQL-MOVE"> <refentry id="SQL-MOVE">
<REFMETA> <refmeta>
<REFENTRYTITLE> <refentrytitle>
MOVE MOVE
</REFENTRYTITLE> </refentrytitle>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO> <refmiscinfo>SQL - Language Statements</refmiscinfo>
</REFMETA> </refmeta>
<REFNAMEDIV> <refnamediv>
<REFNAME> <refname>
MOVE MOVE
</REFNAME> </refname>
<REFPURPOSE> <refpurpose>
Moves cursor position Moves cursor position
</REFPURPOSE> </refpurpose>
</refnamediv> </refnamediv>
<REFSYNOPSISDIV> <refsynopsisdiv>
<REFSYNOPSISDIVINFO> <refsynopsisdivinfo>
<DATE>1998-09-24</DATE> <date>1998-09-24</date>
</REFSYNOPSISDIVINFO> </refsynopsisdivinfo>
<SYNOPSIS> <synopsis>
MOVE [ <REPLACEABLE CLASS="PARAMETER">selector</REPLACEABLE> ] [ <REPLACEABLE CLASS="PARAMETER">count</REPLACEABLE> ] MOVE [ <replaceable class="PARAMETER">selector</replaceable> ] [ <replaceable class="PARAMETER">count</replaceable> ]
{ IN | FROM } <REPLACEABLE CLASS="PARAMETER">cursor</REPLACEABLE> { IN | FROM } <replaceable class="PARAMETER">cursor</replaceable>
FETCH [ RELATIVE ] [ { [ <REPLACEABLE CLASS="PARAMETER">#</REPLACEABLE> | ALL | NEXT | PRIOR ] } ] FROM ] <REPLACEABLE CLASS="PARAMETER">cursor</REPLACEABLE> FETCH [ RELATIVE ] [ { [ <replaceable class="PARAMETER">#</replaceable> | ALL | NEXT | PRIOR ] } ] FROM ] <replaceable class="PARAMETER">cursor</replaceable>
</SYNOPSIS> </synopsis>
</refsynopsisdiv> </refsynopsisdiv>
<REFSECT1 ID="R1-SQL-MOVE-1"> <refsect1 id="R1-SQL-MOVE-1">
<REFSECT1INFO> <refsect1info>
<DATE>1998-09-24</DATE> <date>1998-09-24</date>
</REFSECT1INFO> </refsect1info>
<TITLE> <title>
Description Description
</TITLE> </title>
<PARA> <para>
<command>MOVE</command> allows a user to move cursor position a specified <command>MOVE</command> allows a user to move cursor position a specified
number of rows. number of rows.
<command>MOVE</command> works like the <command>FETCH</command> command, <command>MOVE</command> works like the <command>FETCH</command> command,
@ -42,14 +42,14 @@ FETCH [ RELATIVE ] [ { [ <REPLACEABLE CLASS="PARAMETER">#</REPLACEABLE> | ALL |
Refer to the <command>FETCH</command> command for details on syntax and usage. Refer to the <command>FETCH</command> command for details on syntax and usage.
</para> </para>
<REFSECT2 ID="R2-SQL-MOVE-3"> <refsect2 id="R2-SQL-MOVE-3">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-24</DATE> <date>1998-09-24</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Notes Notes
</TITLE> </title>
<PARA> <para>
<command>MOVE</command> is a <productname>Postgres</productname> <command>MOVE</command> is a <productname>Postgres</productname>
language extension. language extension.
</para> </para>
@ -61,59 +61,56 @@ FETCH [ RELATIVE ] [ { [ <REPLACEABLE CLASS="PARAMETER">#</REPLACEABLE> | ALL |
<command>ROLLBACK WORK</command> statements <command>ROLLBACK WORK</command> statements
for further information about transactions. for further information about transactions.
</para> </para>
</REFSECT2> </refsect2>
</refsect1> </refsect1>
<REFSECT1 ID="R1-SQL-MOVE-2"> <refsect1 id="R1-SQL-MOVE-2">
<TITLE> <title>
Usage Usage
</TITLE> </title>
<PARA> <para>
<ProgramListing> Set up and use a cursor:
--set up and use a cursor:
-- <programlisting>
BEGIN WORK; BEGIN WORK;
DECLARE liahona CURSOR FOR SELECT * FROM films; DECLARE liahona CURSOR FOR SELECT * FROM films;
--Skip first 5 rows: --Skip first 5 rows:
--
MOVE FORWARD 5 IN liahona; MOVE FORWARD 5 IN liahona;
<computeroutput> <computeroutput>
MOVE MOVE
</computeroutput> </computeroutput>
--Fetch 6th row in the cursor liahona: --Fetch 6th row in the cursor liahona:
--
FETCH 1 IN liahona; FETCH 1 IN liahona;
<computeroutput> <computeroutput>
FETCH FETCH
code |title |did| date_prod|kind |len code |title |did| date_prod|kind |len
-----+------+---+----------+----------+------ -----+------+---+----------+----------+------
P_303|48 Hrs|103|1982-10-22|Action | 01:37 P_303|48 Hrs|103|1982-10-22|Action | 01:37
(1 row) (1 row)
</computeroutput> </computeroutput>
-- close the cursor liahona and commit work: -- close the cursor liahona and commit work:
--
CLOSE liahona; CLOSE liahona;
COMMIT WORK; COMMIT WORK;
</ProgramListing> </programlisting>
</para> </para>
</REFSECT1> </refsect1>
<REFSECT1 ID="R1-SQL-MOVE-3"> <refsect1 id="R1-SQL-MOVE-3">
<TITLE> <title>
Compatibility Compatibility
</TITLE> </title>
<PARA> <para>
</PARA> </para>
<REFSECT2 ID="R2-SQL-MOVE-4"> <refsect2 id="R2-SQL-MOVE-4">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-01</DATE> <date>1998-09-01</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
SQL92 SQL92
</TITLE> </title>
<PARA> <para>
There is no SQL92 <command>MOVE</command> statement. There is no SQL92 <command>MOVE</command> statement.
Instead, <acronym>SQL92</acronym> allows Instead, <acronym>SQL92</acronym> allows
one to <command>FETCH</command> rows from an absolute cursor position, one to <command>FETCH</command> rows from an absolute cursor position,
@ -121,4 +118,21 @@ FETCH [ RELATIVE ] [ { [ <REPLACEABLE CLASS="PARAMETER">#</REPLACEABLE> | ALL |
</para> </para>
</refsect2> </refsect2>
</refsect1> </refsect1>
</REFENTRY> </refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:nil
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../reference.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:"/usr/lib/sgml/catalog"
sgml-local-ecat-files:nil
End:
-->

View File

@ -1,96 +1,90 @@
<REFENTRY ID="SQL-NOTIFY"> <refentry id="SQL-NOTIFY">
<REFMETA> <refmeta>
<REFENTRYTITLE id="sql-notify-ref"> <refentrytitle id="sql-notify-ref">
NOTIFY NOTIFY
</REFENTRYTITLE> </refentrytitle>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO> <refmiscinfo>SQL - Language Statements</refmiscinfo>
</REFMETA> </refmeta>
<REFNAMEDIV> <refnamediv>
<REFNAME> <refname>
NOTIFY NOTIFY
</REFNAME> </refname>
<REFPURPOSE> <refpurpose>
Signals all frontends and backends listening on a notify condition Signals all frontends and backends listening on a notify condition
</REFPURPOSE> </refpurpose>
</refnamediv> </refnamediv>
<REFSYNOPSISDIV> <refsynopsisdiv>
<REFSYNOPSISDIVINFO> <refsynopsisdivinfo>
<DATE>1998-10-07</DATE> <date>1998-10-07</date>
</REFSYNOPSISDIVINFO> </refsynopsisdivinfo>
<SYNOPSIS> <synopsis>
<REPLACEABLE CLASS="PARAMETER"> NOTIFY <replaceable class="PARAMETER">name</replaceable>
</REPLACEABLE> </synopsis>
NOTIFY <REPLACEABLE CLASS="PARAMETER">notifyname</REPLACEABLE>
</SYNOPSIS>
<REFSECT2 ID="R2-SQL-NOTIFY-1"> <refsect2 id="R2-SQL-NOTIFY-1">
<REFSECT2INFO> <refsect2info>
<DATE>1998-10-07</DATE> <date>1998-10-07</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Inputs Inputs
</TITLE> </title>
<PARA> <para>
<VARIABLELIST> <variablelist>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="PARAMETER">notifyname</replaceable></term>
<REPLACEABLE CLASS="PARAMETER">notifyname</REPLACEABLE> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
Notify condition to be signaled. Notify condition to be signaled.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</VARIABLELIST> </variablelist>
</para> </para>
</REFSECT2> </refsect2>
<REFSECT2 ID="R2-SQL-NOTIFY-2"> <refsect2 id="R2-SQL-NOTIFY-2">
<REFSECT2INFO> <refsect2info>
<DATE>1998-10-07</DATE> <date>1998-10-07</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Outputs Outputs
</TITLE> </title>
<PARA> <para>
<VARIABLELIST> <variablelist>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
NOTIFY NOTIFY
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
Acknowledgement that notify command has executed. Acknowledgement that notify command has executed.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable>Notify events</replaceable></term>
Notify events <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
Events are delivered to listening frontends; whether and how each frontend Events are delivered to listening frontends; whether and how each frontend
application reacts depends on its programming. application reacts depends on its programming.
</PARA>
</LISTITEM>
</VARLISTENTRY>
</VARIABLELIST>
</para> </para>
</REFSECT2> </listitem>
</REFSYNOPSISDIV> </varlistentry>
</variablelist>
</para>
</refsect2>
</refsynopsisdiv>
<REFSECT1 ID="R1-SQL-NOTIFY-1"> <refsect1 id="R1-SQL-NOTIFY-1">
<REFSECT1INFO> <refsect1info>
<DATE>1998-10-07</DATE> <date>1998-10-07</date>
</REFSECT1INFO> </refsect1info>
<TITLE> <title>
Description Description
</TITLE> </title>
<PARA> <para>
The <command>NOTIFY</command> command sends a notify event to each The <command>NOTIFY</command> command sends a notify event to each
frontend application that has previously executed frontend application that has previously executed
<command>LISTEN <replaceable class="parameter">notifyname</replaceable></command> <command>LISTEN <replaceable class="parameter">notifyname</replaceable></command>
@ -130,8 +124,8 @@ NOTIFY <REPLACEABLE CLASS="PARAMETER">notifyname</REPLACEABLE>
ways. Firstly, if a <command>NOTIFY</command> is executed inside a ways. Firstly, if a <command>NOTIFY</command> is executed inside a
transaction, the notify events are not delivered until and unless the transaction, the notify events are not delivered until and unless the
transaction is committed. This is appropriate, since if the transaction transaction is committed. This is appropriate, since if the transaction
is aborted we would like all the commands within it to have had no effect is aborted we would like all the commands within it to have had no
--- including <command>NOTIFY</command>. But it can be disconcerting if one effect, including <command>NOTIFY</command>. But it can be disconcerting if one
is expecting the notify events to be delivered immediately. Secondly, if is expecting the notify events to be delivered immediately. Secondly, if
a listening backend receives a notify signal while it is within a transaction, a listening backend receives a notify signal while it is within a transaction,
the notify event will not be delivered to its connected frontend until just the notify event will not be delivered to its connected frontend until just
@ -170,25 +164,25 @@ NOTIFY <REPLACEABLE CLASS="PARAMETER">notifyname</REPLACEABLE>
your own notifies.) your own notifies.)
</para> </para>
<REFSECT2 ID="R2-SQL-NOTIFY-3"> <refsect2 id="R2-SQL-NOTIFY-3">
<REFSECT2INFO> <refsect2info>
<DATE>1998-10-07</DATE> <date>1998-10-07</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Notes Notes
</TITLE> </title>
<para> <para>
<REPLACEABLE CLASS="PARAMETER">notifyname</REPLACEABLE> <replaceable class="PARAMETER">name</replaceable>
can be any string valid as a name; can be any string valid as a name;
it need not correspond to the name of any actual table. If it need not correspond to the name of any actual table. If
<REPLACEABLE CLASS="PARAMETER">notifyname</REPLACEABLE> <replaceable class="PARAMETER">name</replaceable>
is enclosed in double-quotes, it need not even be a syntactically is enclosed in double-quotes, it need not even be a syntactically
valid name, but can be any string up to 31 characters long. valid name, but can be any string up to 31 characters long.
</para> </para>
<para> <para>
In some previous releases of In some previous releases of
<productname>Postgres</productname>, <productname>Postgres</productname>,
<REPLACEABLE CLASS="PARAMETER">notifyname</REPLACEABLE> <replaceable class="PARAMETER">name</replaceable>
had to be enclosed in double-quotes when it did not correspond to any existing had to be enclosed in double-quotes when it did not correspond to any existing
table name, even if syntactically valid as a name. That is no longer required. table name, even if syntactically valid as a name. That is no longer required.
</para> </para>
@ -198,40 +192,60 @@ NOTIFY <REPLACEABLE CLASS="PARAMETER">notifyname</REPLACEABLE>
backend. So it was not possible to distinguish one's own notifies from other backend. So it was not possible to distinguish one's own notifies from other
clients' notifies in those earlier releases. clients' notifies in those earlier releases.
</para> </para>
</REFSECT2> </refsect2>
</refsect1> </refsect1>
<REFSECT1 ID="R1-SQL-NOTIFY-2"> <refsect1 id="R1-SQL-NOTIFY-2">
<TITLE> <title>
Usage Usage
</TITLE> </title>
<PARA> <para>
<ProgramListing> Configure and execute a listen/notify sequence from
-- Configure and execute a listen/notify sequence from psql <application>psql</application>:
postgres=> listen virtual;
LISTEN <programlisting>
postgres=> notify virtual; LISTEN virtual;
NOTIFY NOTIFY virtual;
ASYNC NOTIFY of 'virtual' from backend pid '11239' received ASYNC NOTIFY of 'virtual' from backend pid '11239' received
</ProgramListing> </programlisting>
</para> </para>
</REFSECT1> </refsect1>
<REFSECT1 ID="R1-SQL-NOTIFY-3"> <refsect1 id="R1-SQL-NOTIFY-3">
<TITLE> <title>
Compatibility Compatibility
</TITLE> </title>
<para>
</para>
<REFSECT2 ID="R2-SQL-NOTIFY-4"> <refsect2 id="R2-SQL-NOTIFY-4">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-24</DATE> <date>1998-09-24</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
SQL92 SQL92
</TITLE> </title>
<PARA> <para>
There is no <command>NOTIFY</command> statement in <acronym>SQL92</acronym>. There is no <command>NOTIFY</command> statement in
<acronym>SQL92</acronym>.
</para> </para>
</refsect2> </refsect2>
</refsect1> </refsect1>
</REFENTRY> </refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:nil
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../reference.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:"/usr/lib/sgml/catalog"
sgml-local-ecat-files:nil
End:
-->

View File

@ -1,47 +1,45 @@
<REFENTRY ID="APP-PG-DUMP"> <refentry id="APP-PG-DUMP">
<REFMETA> <refmeta>
<REFENTRYTITLE id="pg-dump"> <refentrytitle id="pg-dump">
<application>pg_dump</application> <application>pg_dump</application>
</REFENTRYTITLE> </refentrytitle>
<REFMISCINFO>Application</REFMISCINFO> <refmiscinfo>Application</refmiscinfo>
</REFMETA> </refmeta>
<REFNAMEDIV> <refnamediv>
<REFNAME> <refname>
<application>pg_dump</application> <application>pg_dump</application>
</REFNAME> </refname>
<REFPURPOSE> <refpurpose>
Extract a <productname>Postgres</productname> database into a script file Extract a <productname>Postgres</productname> database into a script file
</REFPURPOSE> </refpurpose>
</refnamediv> </refnamediv>
<REFSYNOPSISDIV> <refsynopsisdiv>
<REFSYNOPSISDIVINFO> <refsynopsisdivinfo>
<DATE>1998-11-05</DATE> <date>1998-11-05</date>
</REFSYNOPSISDIVINFO> </refsynopsisdivinfo>
<SYNOPSIS> <synopsis>
pg_dump [ <replaceable class="parameter">dbname</replaceable> ] pg_dump [ <replaceable class="parameter">dbname</replaceable> ]
pg_dump [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replaceable class="parameter">port</replaceable> ] pg_dump [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replaceable class="parameter">port</replaceable> ]
[ -t <replaceable class="parameter">table</replaceable> ] [ -t <replaceable class="parameter">table</replaceable> ] [ -f <replaceable class="parameter">outputfile</replaceable> ]
[ -f <replaceable class="parameter">outputfile</replaceable> ]
[ -a ] [ -c ] [ -d ] [ -D ] [ -n ] [ -N ] [ -a ] [ -c ] [ -d ] [ -D ] [ -n ] [ -N ]
[ -o ] [ -s ] [ -u ] [ -v ] [ -x ] [ -o ] [ -s ] [ -u ] [ -v ] [ -x ]
[ <replaceable class="parameter">dbname</replaceable> ] [ <replaceable class="parameter">dbname</replaceable> ]
</SYNOPSIS> </synopsis>
<REFSECT2 ID="R2-APP-PG-DUMP-1"> <refsect2 id="R2-APP-PG-DUMP-1">
<REFSECT2INFO> <refsect2info>
<DATE>1998-11-05</DATE> <date>1998-11-05</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Inputs Inputs
</TITLE> </title>
<PARA> <para>
<application>pg_dump</application> accepts the following command line arguments: <application>pg_dump</application> accepts the following command
line arguments:
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term><replaceable class="parameter">dbname</replaceable></term>
<replaceable class="parameter">dbname</replaceable>
</term>
<listitem> <listitem>
<para> <para>
Specifies the name of the database to be extracted. Specifies the name of the database to be extracted.
@ -54,9 +52,7 @@ pg_dump [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replaceab
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-a</term>
-a
</term>
<listitem> <listitem>
<para> <para>
Dump out only the data, no schema (definitions). Dump out only the data, no schema (definitions).
@ -65,9 +61,7 @@ pg_dump [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replaceab
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-c</term>
-c
</term>
<listitem> <listitem>
<para> <para>
Clean(drop) schema prior to create. Clean(drop) schema prior to create.
@ -76,9 +70,7 @@ pg_dump [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replaceab
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-d</term>
-d
</term>
<listitem> <listitem>
<para> <para>
Dump data as proper insert strings. Dump data as proper insert strings.
@ -87,9 +79,7 @@ pg_dump [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replaceab
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-D</term>
-D
</term>
<listitem> <listitem>
<para> <para>
Dump data as inserts with attribute names Dump data as inserts with attribute names
@ -98,9 +88,7 @@ pg_dump [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replaceab
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-f <replaceable class="parameter">filename</replaceable></term>
-f <replaceable class="parameter">filename</replaceable>
</term>
<listitem> <listitem>
<para> <para>
Specifies the output file. Defaults to <filename>stdout</filename>. Specifies the output file. Defaults to <filename>stdout</filename>.
@ -109,9 +97,7 @@ pg_dump [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replaceab
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-n</term>
-n
</term>
<listitem> <listitem>
<para> <para>
Suppress double quotes around identifiers unless absolutely necessary. Suppress double quotes around identifiers unless absolutely necessary.
@ -123,9 +109,7 @@ pg_dump [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replaceab
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-N</term>
-N
</term>
<listitem> <listitem>
<para> <para>
Include double quotes around identifiers. Include double quotes around identifiers.
@ -135,9 +119,7 @@ pg_dump [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replaceab
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-o</term>
-o
</term>
<listitem> <listitem>
<para> <para>
Dump object identifiers (<acronym>OID</acronym>s) for every table. Dump object identifiers (<acronym>OID</acronym>s) for every table.
@ -146,9 +128,7 @@ pg_dump [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replaceab
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-s</term>
-s
</term>
<listitem> <listitem>
<para> <para>
Dump out only the schema (definitions), no data. Dump out only the schema (definitions), no data.
@ -157,9 +137,7 @@ pg_dump [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replaceab
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-t <replaceable class="parameter">table</replaceable></term>
-t <replaceable class="parameter">table</replaceable>
</term>
<listitem> <listitem>
<para> <para>
Dump data for <replaceable class="parameter">table</replaceable> only. Dump data for <replaceable class="parameter">table</replaceable> only.
@ -168,9 +146,7 @@ pg_dump [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replaceab
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-u</term>
-u
</term>
<listitem> <listitem>
<para> <para>
Use password authentication. Prompts for username and password. Use password authentication. Prompts for username and password.
@ -179,9 +155,7 @@ pg_dump [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replaceab
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-v</term>
-v
</term>
<listitem> <listitem>
<para> <para>
Specifies verbose mode Specifies verbose mode
@ -190,9 +164,7 @@ pg_dump [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replaceab
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-x</term>
-x
</term>
<listitem> <listitem>
<para> <para>
Prevent dumping of ACLs (grant/revoke commands) and table ownership information. Prevent dumping of ACLs (grant/revoke commands) and table ownership information.
@ -208,9 +180,7 @@ pg_dump [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replaceab
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term>-h <replaceable class="parameter">host</replaceable></term>
-h <replaceable class="parameter">host</replaceable>
</term>
<listitem> <listitem>
<para> <para>
Specifies the hostname of the machine on which the Specifies the hostname of the machine on which the
@ -222,9 +192,7 @@ pg_dump [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replaceab
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-p <replaceable class="parameter">port</replaceable></term>
-p <replaceable class="parameter">port</replaceable>
</term>
<listitem> <listitem>
<para> <para>
Specifies the Internet TCP/IP port or local Unix domain socket file Specifies the Internet TCP/IP port or local Unix domain socket file
@ -237,9 +205,7 @@ pg_dump [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replaceab
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-u</term>
-u
</term>
<listitem> <listitem>
<para> <para>
Use password authentication. Use password authentication.
@ -249,29 +215,28 @@ pg_dump [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replaceab
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</variablelist> </variablelist>
</para> </para>
</refsect2> </refsect2>
<REFSECT2 ID="R2-APP-PG-DUMP-2"> <refsect2 id="R2-APP-PG-DUMP-2">
<REFSECT2INFO> <refsect2info>
<DATE>1998-11-05</DATE> <date>1998-11-05</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Outputs Outputs
</TITLE> </title>
<PARA> <para>
<application>pg_dump</application> will create a file or <application>pg_dump</application> will create a file or
write to <filename>stdout</filename>. write to <filename>stdout</filename>.
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term><computeroutput>
Connection to database 'template1' failed. Connection to database 'template1' failed.
connectDB() failed: Is the postmaster running and accepting connections connectDB() failed: Is the postmaster running and accepting connections
at 'UNIX Socket' on port '<replaceable class="parameter">port</replaceable>'? at 'UNIX Socket' on port '<replaceable class="parameter">port</replaceable>'?
</term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
<application>pg_dump</application> could not attach to the <application>pg_dump</application> could not attach to the
@ -286,10 +251,10 @@ pg_dump [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replaceab
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><computeroutput>
Connection to database '<replaceable class="parameter">dbname</replaceable>' failed. Connection to database '<replaceable class="parameter">dbname</replaceable>' failed.
FATAL 1: SetUserId: user '<replaceable class="parameter">username</replaceable>' is not in 'pg_shadow' FATAL 1: SetUserId: user '<replaceable class="parameter">username</replaceable>' is not in 'pg_shadow'
</term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
You do not have a valid entry in the relation <literal>pg_shadow</literal> You do not have a valid entry in the relation <literal>pg_shadow</literal>
@ -300,9 +265,9 @@ pg_dump [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replaceab
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><computeroutput>
dumpSequence(<replaceable class="parameter">table</replaceable>): SELECT failed dumpSequence(<replaceable class="parameter">table</replaceable>): SELECT failed
</term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
You do not have permission to read the database. You do not have permission to read the database.
@ -310,9 +275,9 @@ pg_dump [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replaceab
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</variablelist> </variablelist>
</para> </para>
<note> <note>
<para> <para>
<application>pg_dump</application> internally executes <application>pg_dump</application> internally executes
@ -325,14 +290,14 @@ pg_dump [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replaceab
</refsect2> </refsect2>
</refsynopsisdiv> </refsynopsisdiv>
<REFSECT1 ID="R1-APP-PG-DUMP-1"> <refsect1 id="R1-APP-PG-DUMP-1">
<REFSECT1INFO> <refsect1info>
<DATE>1998-11-05</DATE> <date>1998-11-05</date>
</REFSECT1INFO> </refsect1info>
<TITLE> <title>
Description Description
</TITLE> </title>
<PARA> <para>
<application>pg_dump</application> is a utility for dumping out a <application>pg_dump</application> is a utility for dumping out a
<productname>Postgres</productname> database into a script file <productname>Postgres</productname> database into a script file
containing query commands. The script containing query commands. The script
@ -345,6 +310,7 @@ pg_dump [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replaceab
that it can be readily copied in again, as well as imported into tools that it can be readily copied in again, as well as imported into tools
for editing. for editing.
</para> </para>
<para> <para>
<application>pg_dump</application> <application>pg_dump</application>
is useful for dumping out the contents of a database to move from one is useful for dumping out the contents of a database to move from one
@ -355,24 +321,20 @@ pg_dump [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replaceab
</para> </para>
</refsect1> </refsect1>
<REFSECT1 ID="R1-APP-PG-DUMP-2"> <refsect1 id="R1-APP-PG-DUMP-2">
<REFSECT1INFO> <refsect1info>
<DATE>1998-11-05</DATE> <date>1998-11-05</date>
</REFSECT1INFO> </refsect1info>
<TITLE> <title>
Notes Notes
</TITLE> </title>
<PARA> <para>
<application>pg_dump</application> has a few limitations. <application>pg_dump</application> has a few limitations.
The limitations mostly stem from The limitations mostly stem from
difficulty in extracting certain meta-information from the system difficulty in extracting certain meta-information from the system
catalogs. catalogs.
<variablelist> <itemizedlist>
<varlistentry>
<term>
partial indices
</term>
<listitem> <listitem>
<para> <para>
<application>pg_dump</application> <application>pg_dump</application>
@ -380,44 +342,55 @@ pg_dump [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replaceab
the same as above; partial index predicates are stored as plans. the same as above; partial index predicates are stored as plans.
</para> </para>
</listitem> </listitem>
</varlistentry>
<varlistentry>
<term>
large objects
</term>
<listitem> <listitem>
<para> <para>
<application>pg_dump</application> does not handle large objects. <application>pg_dump</application> does not handle large objects.
Large objects are ignored and must be dealt with manually. Large objects are ignored and must be dealt with manually.
</para> </para>
</listitem> </listitem>
</varlistentry> </itemizedlist>
</variablelist>
</para> </para>
</refsect1> </refsect1>
<REFSECT1 ID="R1-APP-PG-DUMP-3"> <refsect1 id="R1-APP-PG-DUMP-3">
<REFSECT1INFO> <refsect1info>
<DATE>1998-11-05</DATE> <date>1998-11-05</date>
</REFSECT1INFO> </refsect1info>
<TITLE> <title>
Usage Usage
</TITLE> </title>
<PARA> <para>
To dump a database of the same name as the user: To dump a database of the same name as the user:
<programlisting> <programlisting>
% pg_dump > db.out % pg_dump > db.out
</programlisting> </programlisting>
</para> </para>
<para> <para>
To reload this database: To reload this database:
<programlisting> <programlisting>
psql -e database < db.out % psql -e database < db.out
</programlisting> </programlisting>
</para> </para>
</refsect1> </refsect1>
</REFENTRY> </refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:nil
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../reference.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:"/usr/lib/sgml/catalog"
sgml-local-ecat-files:nil
End:
-->

View File

@ -1,53 +1,49 @@
<REFENTRY ID="APP-PG-DUMPALL"> <refentry id="APP-PG-DUMPALL">
<REFMETA> <refmeta>
<REFENTRYTITLE> <refentrytitle>
<application>pg_dumpall</application> <application>pg_dumpall</application>
</REFENTRYTITLE> </refentrytitle>
<REFMISCINFO>Application</REFMISCINFO> <refmiscinfo>Application</refmiscinfo>
</REFMETA> </refmeta>
<REFNAMEDIV> <refnamediv>
<REFNAME> <refname>
<application>pg_dumpall</application> <application>pg_dumpall</application>
</REFNAME> </refname>
<REFPURPOSE> <refpurpose>
Extract all <productname>Postgres</productname> databases into a script file Extract all <productname>Postgres</productname> databases into a script file
</REFPURPOSE> </refpurpose>
</refnamediv> </refnamediv>
<REFSYNOPSISDIV> <refsynopsisdiv>
<REFSYNOPSISDIVINFO> <refsynopsisdivinfo>
<DATE>1998-10-04</DATE> <date>1998-10-04</date>
</REFSYNOPSISDIVINFO> </refsynopsisdivinfo>
<SYNOPSIS> <synopsis>
pg_dumpall pg_dumpall
pg_dumpall [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replaceable class="parameter">port</replaceable> ] pg_dumpall [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replaceable class="parameter">port</replaceable> ] [ -a ] [ -d ] [ -D ] [ -o ] [ -s ] [ -u ] [ -v ] [ -x ]
[ -a ] [ -d ] [ -D ] [ -o ] [ -s ] [ -u ] [ -v ] [ -x ] </synopsis>
</SYNOPSIS>
<REFSECT2 ID="R2-APP-PG-DUMPALL-1"> <refsect2 id="R2-APP-PG-DUMPALL-1">
<REFSECT2INFO> <refsect2info>
<DATE>1998-10-04</DATE> <date>1998-10-04</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Inputs Inputs
</TITLE> </title>
<PARA> <para>
<application>pg_dumpall</application> accepts the following command line arguments: <application>pg_dumpall</application> accepts the following command line arguments:
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term>-a</term>
-a
</term>
<listitem> <listitem>
<para> <para>
Dump out only the data, no schema (definitions). Dump out only the data, no schema (definitions).
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-d</term>
-d
</term>
<listitem> <listitem>
<para> <para>
Dump data as proper insert strings. Dump data as proper insert strings.
@ -56,9 +52,7 @@ pg_dumpall [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replac
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-D</term>
-D
</term>
<listitem> <listitem>
<para> <para>
Dump data as inserts with attribute names Dump data as inserts with attribute names
@ -67,9 +61,7 @@ pg_dumpall [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replac
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-n</term>
-n
</term>
<listitem> <listitem>
<para> <para>
Suppress double quotes around identifiers unless absolutely necessary. Suppress double quotes around identifiers unless absolutely necessary.
@ -80,9 +72,7 @@ pg_dumpall [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replac
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-o</term>
-o
</term>
<listitem> <listitem>
<para> <para>
Dump object identifiers (<acronym>OID</acronym>s) for every table. Dump object identifiers (<acronym>OID</acronym>s) for every table.
@ -91,9 +81,7 @@ pg_dumpall [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replac
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-s</term>
-s
</term>
<listitem> <listitem>
<para> <para>
Dump out only the schema (definitions), no data. Dump out only the schema (definitions), no data.
@ -102,9 +90,7 @@ pg_dumpall [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replac
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-u</term>
-u
</term>
<listitem> <listitem>
<para> <para>
Use password authentication. Prompts for username and password. Use password authentication. Prompts for username and password.
@ -113,9 +99,7 @@ pg_dumpall [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replac
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-v</term>
-v
</term>
<listitem> <listitem>
<para> <para>
Specifies verbose mode Specifies verbose mode
@ -124,9 +108,7 @@ pg_dumpall [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replac
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-x</term>
-x
</term>
<listitem> <listitem>
<para> <para>
Prevent dumping ACLs (grant/revoke commands) and table ownership information. Prevent dumping ACLs (grant/revoke commands) and table ownership information.
@ -136,15 +118,14 @@ pg_dumpall [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replac
</variablelist> </variablelist>
</para> </para>
<para> <para>
<application>pg_dumpall</application> also accepts <application>pg_dumpall</application> also accepts
the following command line arguments for connection parameters: the following command line arguments for connection parameters:
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term>-h <replaceable class="parameter">host</replaceable></term>
-h <replaceable class="parameter">host</replaceable>
</term>
<listitem> <listitem>
<para> <para>
Specifies the hostname of the machine on which the Specifies the hostname of the machine on which the
@ -156,9 +137,7 @@ pg_dumpall [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replac
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-p <replaceable class="parameter">port</replaceable></term>
-p <replaceable class="parameter">port</replaceable>
</term>
<listitem> <listitem>
<para> <para>
Specifies the Internet TCP/IP port or local Unix domain socket file Specifies the Internet TCP/IP port or local Unix domain socket file
@ -171,9 +150,7 @@ pg_dumpall [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replac
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-u</term>
-u
</term>
<listitem> <listitem>
<para> <para>
Use password authentication. Use password authentication.
@ -187,24 +164,23 @@ pg_dumpall [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replac
</para> </para>
</refsect2> </refsect2>
<REFSECT2 ID="R2-APP-PG-DUMPALL-2"> <refsect2 id="R2-APP-PG-DUMPALL-2">
<REFSECT2INFO> <refsect2info>
<DATE>1998-10-04</DATE> <date>1998-10-04</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Outputs Outputs
</TITLE> </title>
<PARA> <para>
<application>pg_dumpall</application> will create a file or <application>pg_dumpall</application> will create a file or
write to <filename>stdout</filename>. write to <filename>stdout</filename>.
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term><computeroutput>
Connection to database 'template1' failed. Connection to database 'template1' failed.
connectDB() failed: Is the postmaster running and accepting connections connectDB() failed: Is the postmaster running and accepting connections at 'UNIX Socket' on port '<replaceable class="parameter">port</replaceable>'?
at 'UNIX Socket' on port '<replaceable class="parameter">port</replaceable>'? </computeroutput></term>
</term>
<listitem> <listitem>
<para> <para>
<application>pg_dumpall</application> could not attach to the <application>pg_dumpall</application> could not attach to the
@ -219,10 +195,10 @@ pg_dumpall [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replac
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><computeroutput>
Connection to database '<replaceable class="parameter">dbname</replaceable>' failed. Connection to database '<replaceable class="parameter">dbname</replaceable>' failed.
FATAL 1: SetUserId: user '<replaceable class="parameter">username</replaceable>' is not in 'pg_shadow' FATAL 1: SetUserId: user '<replaceable class="parameter">username</replaceable>' is not in 'pg_shadow'
</term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
You do not have a valid entry in the relation <literal>pg_shadow</literal> You do not have a valid entry in the relation <literal>pg_shadow</literal>
@ -233,9 +209,9 @@ pg_dumpall [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replac
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><computeroutput>
dumpSequence(<replaceable class="parameter">table</replaceable>): SELECT failed dumpSequence(<replaceable class="parameter">table</replaceable>): SELECT failed
</term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
You do not have permission to read the database. You do not have permission to read the database.
@ -258,14 +234,14 @@ pg_dumpall [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replac
</refsect2> </refsect2>
</refsynopsisdiv> </refsynopsisdiv>
<REFSECT1 ID="R1-APP-PG-DUMPALL-1"> <refsect1 id="R1-APP-PG-DUMPALL-1">
<REFSECT1INFO> <refsect1info>
<DATE>1998-10-04</DATE> <date>1998-10-04</date>
</REFSECT1INFO> </refsect1info>
<TITLE> <title>
Description Description
</TITLE> </title>
<PARA> <para>
<application>pg_dumpall</application> <application>pg_dumpall</application>
is a utility for dumping out all Postgres databases into one file. is a utility for dumping out all Postgres databases into one file.
It also dumps the pg_shadow table, which is global to all databases. It also dumps the pg_shadow table, which is global to all databases.
@ -280,19 +256,19 @@ pg_dumpall [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replac
</para> </para>
<para> <para>
Refer to Refer to
<xref linkend="app-pg-dump" endterm="pg-dump"> <xref endterm="pg-dump" linkend="app-pg-dump">
for more information on this capability. for more information on this capability.
</para </para>
</refsect1> </refsect1>
<REFSECT1 ID="R1-APP-PG-DUMPALL-2"> <refsect1 id="R1-APP-PG-DUMPALL-2">
<REFSECT1INFO> <refsect1info>
<DATE>1998-10-04</DATE> <date>1998-10-04</date>
</REFSECT1INFO> </refsect1info>
<TITLE> <title>
Usage Usage
</TITLE> </title>
<PARA> <para>
To dump all databases: To dump all databases:
<programlisting> <programlisting>
@ -310,7 +286,7 @@ pg_dumpall [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replac
To reload this database: To reload this database:
<programlisting> <programlisting>
psql -e template1 < db.out % psql -e template1 < db.out
</programlisting> </programlisting>
</para> </para>
<tip> <tip>
@ -320,4 +296,21 @@ pg_dumpall [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replac
</para> </para>
</tip> </tip>
</refsect1> </refsect1>
</REFENTRY> </refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:nil
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../reference.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:"/usr/lib/sgml/catalog"
sgml-local-ecat-files:nil
End:
-->

View File

@ -1,59 +1,128 @@
<REFENTRY ID="APP-PG-UPGRADE"> <refentry id="APP-PG-UPGRADE">
<REFMETA> <refmeta>
<REFENTRYTITLE> <refentrytitle>
<application>pg_upgrade</application> <application>pg_upgrade</application>
</REFENTRYTITLE> </refentrytitle>
<REFMISCINFO>Application</REFMISCINFO> <refmiscinfo>Application</refmiscinfo>
</REFMETA> </refmeta>
<REFNAMEDIV> <refnamediv>
<REFNAME> <refname>
<application>pg_upgrade</application> <application>pg_upgrade</application>
</REFNAME> </refname>
<REFPURPOSE> <refpurpose>
Allows upgrade from a previous release without reloading data Allows upgrade from a previous release without reloading data
</REFPURPOSE> </refpurpose>
<REFSYNOPSISDIV> <refsynopsisdiv>
<REFSYNOPSISDIVINFO> <refsynopsisdivinfo>
<DATE>1998-10-04</DATE> <date>1998-10-04</date>
</REFSYNOPSISDIVINFO> </refsynopsisdivinfo>
<SYNOPSIS> <synopsis>
pg_upgrade pg_upgrade
pg_upgrade [-f <replaceable class="parameter">input_file</replaceable>] <replaceable class="parameter">old_data_dir</replaceable> pg_upgrade [ -f <replaceable class="parameter">filename</replaceable> ] <replaceable class="parameter">old_data_dir</replaceable>
</SYNOPSIS> </synopsis>
</refsynopsisdiv>
<REFSECT1 ID="R1-APP-PG-UPGRADE-1"> <refsect1 id="R1-APP-PG-UPGRADE-1">
<REFSECT1INFO> <refsect1info>
<DATE>1998-10-04</DATE> <date>1998-10-04</date>
</REFSECT1INFO> </refsect1info>
<TITLE> <title>
Description Description
</TITLE> </title>
<PARA> <para>
<application>pg_upgrade</application> <application>pg_upgrade</application>
is a utility for upgrading from a previous is a utility for upgrading from a previous
PostgreSQL release without reloading all the data. First, PostgreSQL release without reloading all the data.
to be safe, back up your data directory. Then, use:
<procedure>
<title>Upgrading <productname>Postgres</productname></title>
<step performance="required">
<para>
Back up your data directory.
</para>
</step>
<step performance="required">
<para>
Use:
<programlisting> <programlisting>
% pg_dumpall -s >db.out % pg_dumpall -s >db.out
</programlisting> </programlisting>
to dump out your old database definitions without any to dump out your old database definitions without any
data. Stop the postmaster and all backends. data. Stop the postmaster and all backends.
</para> </para>
</step>
<step performance="required">
<para> <para>
Then rename (using mv) your old pgsql /data directory to Rename (using mv) your old pgsql <filename>data/</filename> directory to
/data.old and do a make install to install the new binaries. <filename>data.old/</filename>.
Run initdb to create a new template1 database containing the system </para>
tables for the new release. Start the new postmaster, cd to the </step>
<step performance="required">
<para>
Do a
<command>make install</command> to install the new binaries.
</para>
</step>
<step performance="required">
<para>
Run <application>initdb</application> to create a new template1 database containing the system
tables for the new release.
</para>
</step>
<step performance="required">
<para>
Start the new postmaster.
</para>
</step>
<step performance="required">
<para>
Change your working directory to the
pgsql main directory, and type: pgsql main directory, and type:
<programlisting> <programlisting>
% pg_upgrade -f db.out data.old % pg_upgrade -f db.out data.old
</programlisting> </programlisting>
The system will do some checking to make sure everything The system will do some checking to make sure everything
is properly configured, and run your db.out script to create is properly configured, and will run your db.out script to create
all the databases and tables you had, but with no all the databases and tables you had, but with no
data. It will then move the data files from /data.old data. It will then move the data files from <filename>data.old/</filename>
into the proper /data directory. You can then check out into the proper <filename>data/</filename> directory.
the data. You can delete the /data.old directory when you </para>
</step>
<step performance="required">
<para>
<emphasis>Carefully</emphasis> examine the contents of the upgraded database.
</para>
</step>
<step performance="required">
<para>
You can delete the <filename>data.old/</filename> directory when you
are finished. are finished.
</REFENTRY> </para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:nil
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../reference.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:"/usr/lib/sgml/catalog"
sgml-local-ecat-files:nil
End:
-->

View File

@ -1,57 +1,74 @@
<REFENTRY ID="APP-PGACCESS"> <refentry id="APP-PGACCESS">
<REFMETA> <refmeta>
<REFENTRYTITLE id="pgaccess-ref"> <refentrytitle id="pgaccess-ref">
<application>pgaccess</application> <application>pgaccess</application>
</REFENTRYTITLE> </refentrytitle>
<REFMISCINFO>Application</REFMISCINFO> <refmiscinfo>Application</refmiscinfo>
</REFMETA> </refmeta>
<REFNAMEDIV> <refnamediv>
<REFNAME> <refname>
<application>pgaccess</application> <application>pgaccess</application>
</REFNAME> </refname>
<REFPURPOSE> <refpurpose>
<productname>Postgres</productname> graphical interactive client <productname>Postgres</productname> graphical interactive client
</REFPURPOSE> </refpurpose>
</refnamediv> </refnamediv>
<REFSYNOPSISDIV> <refsynopsisdiv>
<REFSYNOPSISDIVINFO> <refsynopsisdivinfo>
<DATE>1999-05-19</DATE> <date>1999-05-19</date>
</REFSYNOPSISDIVINFO> </refsynopsisdivinfo>
<SYNOPSIS> <synopsis>
pgaccess [ <replaceable class="parameter">dbname</replaceable> ] pgaccess [ <replaceable class="parameter">dbname</replaceable> ]
</SYNOPSIS> </synopsis>
<REFSECT2 ID="R2-APP-PGACCESS-1"> <refsect2 id="R2-APP-PGACCESS-1">
<REFSECT2INFO> <refsect2info>
<DATE>1999-05-19</DATE> <date>1999-05-19</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Inputs Inputs
</TITLE> </title>
<PARA> <para>
<variablelist>
<varlistentry>
<term><replaceable class="PARAMETER">dbname</replaceable></term>
<listitem>
<para>
The name of an existing database to access.
</para>
</listitem>
</varlistentry>
</variablelist>
</para> </para>
</refsect2> </refsect2>
<REFSECT2 ID="R2-APP-PGACCESS-2"> <refsect2 id="R2-APP-PGACCESS-2">
<REFSECT2INFO> <refsect2info>
<DATE>1999-05-19</DATE> <date>1999-05-19</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Outputs Outputs
</TITLE> </title>
<PARA> <para>
</para> </para>
</refsect2> </refsect2>
</refsynopsisdiv> </refsynopsisdiv>
<REFSECT1 ID="R1-APP-PGACCESS-1"> <refsect1 id="R1-APP-PGACCESS-1">
<REFSECT1INFO> <refsect1info>
<DATE>1999-05-19</DATE> <date>1999-05-19</date>
</REFSECT1INFO> </refsect1info>
<TITLE> <title>
Description Description
</TITLE> </title>
<PARA> <para>
<note>
<title>Editor's Note</title>
<para>
This should be transcribed from other pgaccess info. Volunteers?
</para>
</note>
</para> </para>
</refsect1> </refsect1>
</refentry> </refentry>
@ -68,7 +85,7 @@ sgml-indent-data:t
sgml-parent-document:nil sgml-parent-document:nil
sgml-default-dtd-file:"../reference.ced" sgml-default-dtd-file:"../reference.ced"
sgml-exposed-tags:nil sgml-exposed-tags:nil
sgml-local-catalogs:"/usr/lib/sgml/CATALOG" sgml-local-catalogs:"/usr/lib/sgml/catalog"
sgml-local-ecat-files:nil sgml-local-ecat-files:nil
End: End:
--> -->

View File

@ -1,57 +1,74 @@
<REFENTRY ID="APP-PGADMIN"> <refentry id="APP-PGADMIN">
<REFMETA> <refmeta>
<REFENTRYTITLE id="pgadmin-ref"> <refentrytitle id="pgadmin-ref">
<application>pgadmin</application> <application>pgadmin</application>
</REFENTRYTITLE> </refentrytitle>
<REFMISCINFO>Application</REFMISCINFO> <refmiscinfo>Application</refmiscinfo>
</REFMETA> </refmeta>
<REFNAMEDIV> <refnamediv>
<REFNAME> <refname>
<application>pgadmin</application> <application>pgadmin</application>
</REFNAME> </refname>
<REFPURPOSE> <refpurpose>
<productname>Postgres</productname> graphical interactive client <productname>Postgres</productname> graphical interactive client
</REFPURPOSE> </refpurpose>
</refnamediv> </refnamediv>
<REFSYNOPSISDIV> <refsynopsisdiv>
<REFSYNOPSISDIVINFO> <refsynopsisdivinfo>
<DATE>1999-05-19</DATE> <date>1999-05-19</date>
</REFSYNOPSISDIVINFO> </refsynopsisdivinfo>
<SYNOPSIS> <synopsis>
pgadmin [ <replaceable class="parameter">dbname</replaceable> ] pgadmin [ <replaceable class="parameter">dbname</replaceable> ]
</SYNOPSIS> </synopsis>
<REFSECT2 ID="R2-APP-PGADMIN-1"> <refsect2 id="R2-APP-PGADMIN-1">
<REFSECT2INFO> <refsect2info>
<DATE>1999-05-19</DATE> <date>1999-05-19</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Inputs Inputs
</TITLE> </title>
<PARA> <para>
<variablelist>
<varlistentry>
<term><replaceable class="PARAMETER">dbname</replaceable></term>
<listitem>
<para>
The name of an existing database to access.
</para>
</listitem>
</varlistentry>
</variablelist>
</para> </para>
</refsect2> </refsect2>
<REFSECT2 ID="R2-APP-PGADMIN-2"> <refsect2 id="R2-APP-PGADMIN-2">
<REFSECT2INFO> <refsect2info>
<DATE>1999-05-19</DATE> <date>1999-05-19</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Outputs Outputs
</TITLE> </title>
<PARA> <para>
</para> </para>
</refsect2> </refsect2>
</refsynopsisdiv> </refsynopsisdiv>
<REFSECT1 ID="R1-APP-PGADMIN-1"> <refsect1 id="R1-APP-PGADMIN-1">
<REFSECT1INFO> <refsect1info>
<DATE>1999-05-19</DATE> <date>1999-05-19</date>
</REFSECT1INFO> </refsect1info>
<TITLE> <title>
Description Description
</TITLE> </title>
<PARA> <para>
<note>
<title>Editor's Note</title>
<para>
This should be transcribed from other pgadmin info. Volunteers?
</para>
</note>
</para> </para>
</refsect1> </refsect1>
</refentry> </refentry>
@ -68,7 +85,7 @@ sgml-indent-data:t
sgml-parent-document:nil sgml-parent-document:nil
sgml-default-dtd-file:"../reference.ced" sgml-default-dtd-file:"../reference.ced"
sgml-exposed-tags:nil sgml-exposed-tags:nil
sgml-local-catalogs:"/usr/lib/sgml/CATALOG" sgml-local-catalogs:"/usr/lib/sgml/catalog"
sgml-local-ecat-files:nil sgml-local-ecat-files:nil
End: End:
--> -->

View File

@ -36,9 +36,7 @@ postgres [ -B <replaceable class="parameter">nBuffers</replaceable> ] [ -C ] [ -
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term><replaceable class="parameter">dbname</replaceable></term>
<replaceable class="parameter">dbname</replaceable>
</term>
<listitem> <listitem>
<para> <para>
The optional argument The optional argument
@ -53,9 +51,7 @@ postgres [ -B <replaceable class="parameter">nBuffers</replaceable> ] [ -C ] [ -
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-B <replaceable class="parameter">nBuffers</replaceable></term>
-B <replaceable class="parameter">nBuffers</replaceable>
</term>
<listitem> <listitem>
<para> <para>
If the backend is running under the If the backend is running under the
@ -72,9 +68,7 @@ postgres [ -B <replaceable class="parameter">nBuffers</replaceable> ] [ -C ] [ -
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-C</term>
-C
</term>
<listitem> <listitem>
<para> <para>
Do not show the server version number. Do not show the server version number.
@ -83,9 +77,7 @@ postgres [ -B <replaceable class="parameter">nBuffers</replaceable> ] [ -C ] [ -
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-D <replaceable class="parameter">DataDir</replaceable></term>
-D <replaceable class="parameter">DataDir</replaceable>
</term>
<listitem> <listitem>
<para> <para>
Specifies the directory to use as the root of the tree of database Specifies the directory to use as the root of the tree of database
@ -102,9 +94,7 @@ postgres [ -B <replaceable class="parameter">nBuffers</replaceable> ] [ -C ] [ -
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-E</term>
-E
</term>
<listitem> <listitem>
<para> <para>
Echo all queries. Echo all queries.
@ -113,9 +103,7 @@ postgres [ -B <replaceable class="parameter">nBuffers</replaceable> ] [ -C ] [ -
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-F</term>
-F
</term>
<listitem> <listitem>
<para> <para>
Disable an automatic <function>fsync()</function> call after each transaction. Disable an automatic <function>fsync()</function> call after each transaction.
@ -128,9 +116,7 @@ postgres [ -B <replaceable class="parameter">nBuffers</replaceable> ] [ -C ] [ -
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-O</term>
-O
</term>
<listitem> <listitem>
<para> <para>
Override restrictions, so system table structures can be modified. Override restrictions, so system table structures can be modified.
@ -140,9 +126,7 @@ postgres [ -B <replaceable class="parameter">nBuffers</replaceable> ] [ -C ] [ -
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-Q</term>
-Q
</term>
<listitem> <listitem>
<para> <para>
Specifies "quiet" mode. Specifies "quiet" mode.
@ -151,9 +135,7 @@ postgres [ -B <replaceable class="parameter">nBuffers</replaceable> ] [ -C ] [ -
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-S <replaceable class="parameter">SortSize</replaceable></term>
-S <replaceable class="parameter">SortSize</replaceable>
</term>
<listitem> <listitem>
<para> <para>
Specifies the amount of memory to be used by internal sorts and hashes Specifies the amount of memory to be used by internal sorts and hashes
@ -168,9 +150,7 @@ postgres [ -B <replaceable class="parameter">nBuffers</replaceable> ] [ -C ] [ -
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-d [ <replaceable class="parameter">DebugLevel</replaceable> ]</term>
-d [ <replaceable class="parameter">DebugLevel</replaceable> ]
</term>
<listitem> <listitem>
<para> <para>
The optional argument <replaceable class="parameter">DebugLevel</replaceable> The optional argument <replaceable class="parameter">DebugLevel</replaceable>
@ -191,9 +171,7 @@ postgres [ -B <replaceable class="parameter">nBuffers</replaceable> ] [ -C ] [ -
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-e</term>
-e
</term>
<listitem> <listitem>
<para> <para>
This option controls how dates are interpreted upon This option controls how dates are interpreted upon
@ -214,9 +192,7 @@ postgres [ -B <replaceable class="parameter">nBuffers</replaceable> ] [ -C ] [ -
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-o <replaceable class="parameter">OutputFile</replaceable></term>
-o <replaceable class="parameter">OutputFile</replaceable>
</term>
<listitem> <listitem>
<para> <para>
Sends all debugging and error output to Sends all debugging and error output to
@ -232,9 +208,7 @@ postgres [ -B <replaceable class="parameter">nBuffers</replaceable> ] [ -C ] [ -
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-s</term>
-s
</term>
<listitem> <listitem>
<para> <para>
Print time information and other statistics at the end of each query. Print time information and other statistics at the end of each query.
@ -245,9 +219,7 @@ postgres [ -B <replaceable class="parameter">nBuffers</replaceable> ] [ -C ] [ -
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-v <replaceable class="parameter">protocol</replaceable></term>
-v <replaceable class="parameter">protocol</replaceable>
</term>
<listitem> <listitem>
<para> <para>
Specifies the number of the frontend/backend protocol to be used for this Specifies the number of the frontend/backend protocol to be used for this
@ -271,9 +243,7 @@ postgres [ -B <replaceable class="parameter">nBuffers</replaceable> ] [ -C ] [ -
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term>-A n|r|b|Q\fIn\fP|X\fIn\fP</term>
-A n|r|b|Q\fIn\fP|X\fIn\fP
</term>
<listitem> <listitem>
<para> <para>
This option generates a tremendous amount of output. This option generates a tremendous amount of output.
@ -282,9 +252,7 @@ postgres [ -B <replaceable class="parameter">nBuffers</replaceable> ] [ -C ] [ -
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-L</term>
-L
</term>
<listitem> <listitem>
<para> <para>
Turns off the locking system. Turns off the locking system.
@ -293,9 +261,7 @@ postgres [ -B <replaceable class="parameter">nBuffers</replaceable> ] [ -C ] [ -
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-N</term>
-N
</term>
<listitem> <listitem>
<para> <para>
Disables use of newline as a query delimiter. Disables use of newline as a query delimiter.
@ -304,9 +270,7 @@ postgres [ -B <replaceable class="parameter">nBuffers</replaceable> ] [ -C ] [ -
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-f [ s | i | m | n | h ]</term>
-f [ s | i | m | n | h ]
</term>
<listitem> <listitem>
<para> <para>
Forbids the use of particular scan and join methods: Forbids the use of particular scan and join methods:
@ -328,9 +292,7 @@ postgres [ -B <replaceable class="parameter">nBuffers</replaceable> ] [ -C ] [ -
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-i</term>
-i
</term>
<listitem> <listitem>
<para> <para>
Prevents query execution, but shows the plan tree. Prevents query execution, but shows the plan tree.
@ -339,9 +301,7 @@ postgres [ -B <replaceable class="parameter">nBuffers</replaceable> ] [ -C ] [ -
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-p <replaceable class="parameter">dbname</replaceable></term>
-p <replaceable class="parameter">dbname</replaceable>
</term>
<listitem> <listitem>
<para> <para>
Indicates to the backend server that it has been started by a Indicates to the backend server that it has been started by a
@ -354,9 +314,7 @@ postgres [ -B <replaceable class="parameter">nBuffers</replaceable> ] [ -C ] [ -
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-t pa[rser] | pl[anner] | e[xecutor]</term>
-t pa[rser] | pl[anner] | e[xecutor]
</term>
<listitem> <listitem>
<para> <para>
Print timing statistics for each query relating to each of the major Print timing statistics for each query relating to each of the major
@ -381,9 +339,9 @@ postgres [ -B <replaceable class="parameter">nBuffers</replaceable> ] [ -C ] [ -
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term><computeroutput>
semget: No space left on device semget: No space left on device
</term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
If you see this message, you should run the If you see this message, you should run the

View File

@ -36,9 +36,7 @@ postmaster [ -n | -s ] ...
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term>-B <replaceable class="parameter">nBuffers</replaceable></term>
-B <replaceable class="parameter">nBuffers</replaceable>
</term>
<listitem> <listitem>
<para> <para>
The number of shared-memory buffers for the The number of shared-memory buffers for the
@ -51,9 +49,7 @@ postmaster [ -n | -s ] ...
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-D <replaceable class="parameter">DataDir</replaceable></term>
-D <replaceable class="parameter">DataDir</replaceable>
</term>
<listitem> <listitem>
<para> <para>
Specifies the directory to use as the root of the tree of database Specifies the directory to use as the root of the tree of database
@ -70,9 +66,7 @@ postmaster [ -n | -s ] ...
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-N <replaceable class="parameter">nBackends</replaceable></term>
-N <replaceable class="parameter">nBackends</replaceable>
</term>
<listitem> <listitem>
<para> <para>
The maximum number of backend server processes that this postmaster The maximum number of backend server processes that this postmaster
@ -86,9 +80,7 @@ postmaster [ -n | -s ] ...
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-S</term>
-S
</term>
<listitem> <listitem>
<para> <para>
Specifies that the <application>postmaster</application> Specifies that the <application>postmaster</application>
@ -102,9 +94,7 @@ postmaster [ -n | -s ] ...
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-d [ <replaceable class="parameter">DebugLevel</replaceable> ]</term>
-d [ <replaceable class="parameter">DebugLevel</replaceable> ]
</term>
<listitem> <listitem>
<para> <para>
The optional argument <replaceable class="parameter">DebugLevel</replaceable> The optional argument <replaceable class="parameter">DebugLevel</replaceable>
@ -125,9 +115,7 @@ postmaster [ -n | -s ] ...
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-i</term>
-i
</term>
<listitem> <listitem>
<para> <para>
This enables TCP/IP or Internet domain socket communication. This enables TCP/IP or Internet domain socket communication.
@ -138,9 +126,7 @@ postmaster [ -n | -s ] ...
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-o <replaceable class="parameter">BackendOptions</replaceable></term>
-o <replaceable class="parameter">BackendOptions</replaceable>
</term>
<listitem> <listitem>
<para> <para>
The The
@ -156,9 +142,7 @@ postmaster [ -n | -s ] ...
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-p <replaceable class="parameter">port</replaceable></term>
-p <replaceable class="parameter">port</replaceable>
</term>
<listitem> <listitem>
<para> <para>
Specifies the TCP/IP port or local Unix domain socket file extension Specifies the TCP/IP port or local Unix domain socket file extension
@ -200,9 +184,7 @@ postmaster [ -n | -s ] ...
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term>-n</term>
-n
</term>
<listitem> <listitem>
<para> <para>
<application>postmaster</application> <application>postmaster</application>
@ -215,9 +197,7 @@ postmaster [ -n | -s ] ...
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-s</term>
-s
</term>
<listitem> <listitem>
<para> <para>
<application>postmaster</application> <application>postmaster</application>
@ -259,9 +239,9 @@ postmaster [ -n | -s ] ...
</varlistentry> </varlistentry>
--> -->
<varlistentry> <varlistentry>
<term> <term><computeroutput>
semget: No space left on device semget: No space left on device
</term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
If you see this message, you should run the If you see this message, you should run the
@ -290,9 +270,9 @@ postmaster [ -n | -s ] ...
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><computeroutput>
StreamServerPort: cannot bind to port StreamServerPort: cannot bind to port
</term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
If you see this message, you should be certain that there is no other If you see this message, you should be certain that there is no other
@ -330,9 +310,9 @@ on BSD-based systems, or
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><computeroutput>
IpcMemoryAttach: shmat() failed: Permission denied IpcMemoryAttach: shmat() failed: Permission denied
</term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
A likely explanation is that another user attempted to start a A likely explanation is that another user attempted to start a

View File

@ -20,11 +20,9 @@
<synopsis> <synopsis>
psql [ <replaceable class="parameter">dbname</replaceable> ] psql [ <replaceable class="parameter">dbname</replaceable> ]
psql -A [ -c <replaceable class="parameter">query</replaceable> ] [ -d <replaceable class="parameter">dbname</replaceable> ] psql -A [ -c <replaceable class="parameter">query</replaceable> ] [ -d <replaceable class="parameter">dbname</replaceable> ]
-e -E [ -f <replaceable class="parameter">filename</replaceable> ] -e -E [ -f <replaceable class="parameter">filename</replaceable> ] [ -F <replaceable class="parameter">separator</replaceable> ]
[ -F <replaceable class="parameter">separator</replaceable> ] [ -h <replaceable class="parameter">hostname</replaceable> ] [ -h <replaceable class="parameter">hostname</replaceable> ] -Hln [ -o <replaceable class="parameter">filename</replaceable> ]
-Hln [ -o <replaceable class="parameter">filename</replaceable> ] [ -p [ -p <replaceable class="parameter">port</replaceable> ] -qsSt [ -T <replaceable class="parameter">table_o</replaceable> ] -ux
<replaceable class="parameter">port</replaceable> ]
-qsSt [ -T <replaceable class="parameter">table_o</replaceable> ] -ux
[ <replaceable class="parameter">dbname</replaceable> ] [ <replaceable class="parameter">dbname</replaceable> ]
</synopsis> </synopsis>
@ -43,9 +41,7 @@ psql -A [ -c <replaceable class="parameter">query</replaceable> ] [ -d <replacea
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term><replaceable class="PARAMETER">dbname</replaceable></term>
<replaceable class="PARAMETER">dbname</replaceable>
</term>
<listitem> <listitem>
<para> <para>
The name of an existing database to access. The name of an existing database to access.
@ -59,22 +55,21 @@ psql -A [ -c <replaceable class="parameter">query</replaceable> ] [ -d <replacea
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-c <replaceable class="parameter">query</replaceable></term>
-c <replaceable class="parameter">query</replaceable>
</term>
<listitem> <listitem>
<para> <para>
A single query to run. <application>psql</application> will exit on completion. A single query to run. <application>psql</application> will exit on completion.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</variablelist> </variablelist>
</para> </para>
<para> <para>
The full set of command-line arguments and meta-commands are described in a subsequent The full set of command-line arguments and meta-commands are described in a subsequent
section. section.
</para> </para>
<para> <para>
There are some environment variables which can be used in liu of There are some environment variables which can be used in liu of
command line arguments. command line arguments.
@ -91,9 +86,7 @@ psql -A [ -c <replaceable class="parameter">query</replaceable> ] [ -d <replacea
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term><envar>PGHOST</envar></term>
<envar>PGHOST</envar>
</term>
<listitem> <listitem>
<para> <para>
The <acronym>DNS</acronym> host name of the database server. The <acronym>DNS</acronym> host name of the database server.
@ -105,9 +98,7 @@ psql -A [ -c <replaceable class="parameter">query</replaceable> ] [ -d <replacea
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><envar>PGPORT</envar></term>
<envar>PGPORT</envar>
</term>
<listitem> <listitem>
<para> <para>
The port number on which a <productname>Postgres</productname> server is listening. The port number on which a <productname>Postgres</productname> server is listening.
@ -117,9 +108,7 @@ psql -A [ -c <replaceable class="parameter">query</replaceable> ] [ -d <replacea
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><envar>PGTTY</envar></term>
<envar>PGTTY</envar>
</term>
<listitem> <listitem>
<para> <para>
The target for display of messages from the client support library. The target for display of messages from the client support library.
@ -129,9 +118,7 @@ psql -A [ -c <replaceable class="parameter">query</replaceable> ] [ -d <replacea
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><envar>PGOPTION</envar></term>
<envar>PGOPTION</envar>
</term>
<listitem> <listitem>
<para> <para>
If <envar>PGOPTION</envar> If <envar>PGOPTION</envar>
@ -143,9 +130,7 @@ psql -A [ -c <replaceable class="parameter">query</replaceable> ] [ -d <replacea
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><envar>PGREALM</envar></term>
<envar>PGREALM</envar>
</term>
<listitem> <listitem>
<para> <para>
<envar>PGREALM</envar> <envar>PGREALM</envar>
@ -176,11 +161,13 @@ psql -A [ -c <replaceable class="parameter">query</replaceable> ] [ -d <replacea
<application>psql</application> <application>psql</application>
returns 0 to the shell on successful completion of all queries, returns 0 to the shell on successful completion of all queries,
1 for errors, 2 for abrupt disconnection from the backend. 1 for errors, 2 for abrupt disconnection from the backend.
The default TAB delimiter is used.
<application>psql</application> <application>psql</application>
will also return 1 if the connection to a database could not be made for will also return 1 if the connection to a database could not be made for
any reason. any reason.
</para> </para>
<para>
The default TAB delimiter is used.
</para>
</refsect2> </refsect2>
</refsynopsisdiv> </refsynopsisdiv>
@ -337,9 +324,7 @@ testdb=>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term>-A</term>
-A
</term>
<listitem> <listitem>
<para> <para>
Turn off fill justification when printing out table elements. Turn off fill justification when printing out table elements.
@ -348,9 +333,7 @@ testdb=>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-c <replaceable class="parameter">query</replaceable></term>
-c <replaceable class="parameter">query</replaceable>
</term>
<listitem> <listitem>
<para> <para>
Specifies that Specifies that
@ -364,9 +347,7 @@ testdb=>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-d <replaceable class="parameter">dbname</replaceable></term>
-d <replaceable class="parameter">dbname</replaceable>
</term>
<listitem> <listitem>
<para> <para>
Specifies the name of the database to connect to. This is equivalent to specifying Specifies the name of the database to connect to. This is equivalent to specifying
@ -377,9 +358,7 @@ testdb=>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-e</term>
-e
</term>
<listitem> <listitem>
<para> <para>
Echo the query sent to the backend Echo the query sent to the backend
@ -388,9 +367,7 @@ testdb=>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-E</term>
-E
</term>
<listitem> <listitem>
<para> <para>
Echo the actual query generated by \d and other backslash commands Echo the actual query generated by \d and other backslash commands
@ -399,9 +376,7 @@ testdb=>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-f <replaceable class="parameter">filename</replaceable></term>
-f <replaceable class="parameter">filename</replaceable>
</term>
<listitem> <listitem>
<para> <para>
Use the file <replaceable class="parameter">filename</replaceable> Use the file <replaceable class="parameter">filename</replaceable>
@ -412,9 +387,7 @@ testdb=>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-F <replaceable class="parameter">separator</replaceable></term>
-F <replaceable class="parameter">separator</replaceable>
</term>
<listitem> <listitem>
<para> <para>
Use <replaceable class="parameter">separator</replaceable> Use <replaceable class="parameter">separator</replaceable>
@ -425,9 +398,7 @@ testdb=>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-h <replaceable class="parameter">hostname</replaceable></term>
-h <replaceable class="parameter">hostname</replaceable>
</term>
<listitem> <listitem>
<para> <para>
Specifies the host name of the machine on which the Specifies the host name of the machine on which the
@ -440,9 +411,7 @@ testdb=>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-H</term>
-H
</term>
<listitem> <listitem>
<para> <para>
Turns on Turns on
@ -453,9 +422,7 @@ testdb=>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-l</term>
-l
</term>
<listitem> <listitem>
<para> <para>
Lists all available databases, then exit. Other non-connection options are ignored. Lists all available databases, then exit. Other non-connection options are ignored.
@ -464,9 +431,7 @@ testdb=>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-n</term>
-n
</term>
<listitem> <listitem>
<para> <para>
Do not use the readline library for input line editing and command history. Do not use the readline library for input line editing and command history.
@ -475,9 +440,7 @@ testdb=>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-o <replaceable class="parameter">filename</replaceable></term>
-o <replaceable class="parameter">filename</replaceable>
</term>
<listitem> <listitem>
<para> <para>
Put all output into file <replaceable class="parameter">filename</replaceable>. Put all output into file <replaceable class="parameter">filename</replaceable>.
@ -487,9 +450,7 @@ testdb=>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-p <replaceable class="parameter">port</replaceable></term>
-p <replaceable class="parameter">port</replaceable>
</term>
<listitem> <listitem>
<para> <para>
Specifies the TCP/IP port or, by omission, the local Unix domain socket file Specifies the TCP/IP port or, by omission, the local Unix domain socket file
@ -503,9 +464,7 @@ testdb=>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-q</term>
-q
</term>
<listitem> <listitem>
<para> <para>
Specifies that Specifies that
@ -520,9 +479,7 @@ testdb=>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-s</term>
-s
</term>
<listitem> <listitem>
<para> <para>
Run in single-step mode where the user is prompted for each query before Run in single-step mode where the user is prompted for each query before
@ -532,9 +489,7 @@ testdb=>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-S</term>
-S
</term>
<listitem> <listitem>
<para> <para>
Runs in single-line mode where each query is terminated by a newline, Runs in single-line mode where each query is terminated by a newline,
@ -544,9 +499,7 @@ testdb=>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-t</term>
-t
</term>
<listitem> <listitem>
<para> <para>
Turn off printing of column names. Turn off printing of column names.
@ -558,9 +511,7 @@ testdb=>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-T <replaceable class="parameter">table_options</replaceable></term>
-T <replaceable class="parameter">table_options</replaceable>
</term>
<listitem> <listitem>
<para> <para>
Allows you to specify options to be placed within the Allows you to specify options to be placed within the
@ -573,9 +524,7 @@ testdb=>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-u</term>
-u
</term>
<listitem> <listitem>
<para> <para>
Asks the user for the user name and password before connecting to the database. Asks the user for the user name and password before connecting to the database.
@ -588,9 +537,7 @@ testdb=>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>-x</term>
-x
</term>
<listitem> <listitem>
<para> <para>
Turns on extended row format mode. When enabled each row will have its column Turns on extended row format mode. When enabled each row will have its column
@ -640,9 +587,7 @@ testdb=>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term><literal>\a</literal></term>
<literal>\a</literal>
</term>
<listitem> <listitem>
<para> <para>
Toggle field alignment when printing out table elements. Toggle field alignment when printing out table elements.
@ -651,9 +596,7 @@ testdb=>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><literal>\C</literal> <replaceable class="parameter">caption</replaceable></term>
<literal>\C</literal> <replaceable class="parameter">caption</replaceable>
</term>
<listitem> <listitem>
<para> <para>
Set the HTML3.0 table caption to Set the HTML3.0 table caption to
@ -663,10 +606,7 @@ testdb=>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><literal>\connect</literal> <replaceable class="parameter">meter"</replaceable>ceable> [ <replaceable class="parameter">username</replaceable> ]</term>
<literal>\connect</literal> <replaceable class="parameter">meter"</replaceable>ceable> [ <replaceable
class="parameter">username</replaceable> ]
</term>
<listitem> <listitem>
<para> <para>
Establish a connection to a new database, using the default Establish a connection to a new database, using the default
@ -677,9 +617,7 @@ testdb=>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><literal>\copy</literal> <replaceable class="parameter">meter"</replaceable>ceable> { FROM | TO } <replaceable class="parameter">filename</replaceable>
<literal>\copy</literal> <replaceable class="parameter">meter"</replaceable>ceable> { FROM | TO }
<replaceable class="parameter">filename</replaceable>
</term> </term>
<listitem> <listitem>
<para> <para>
@ -703,9 +641,7 @@ testdb=>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><literal>\d</literal> [ <replaceable class="parameter">table</replaceable> ]</term>
<literal>\d</literal> [ <replaceable class="parameter">table</replaceable> ]
</term>
<listitem> <listitem>
<para> <para>
List tables in the database, or if <replaceable List tables in the database, or if <replaceable
@ -718,9 +654,7 @@ testdb=>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><literal>\da</literal></term>
<literal>\da</literal>
</term>
<listitem> <listitem>
<para> <para>
List all available aggregates. List all available aggregates.
@ -729,9 +663,7 @@ testdb=>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><literal>\dd</literal> <replaceable class="parameter">object</replaceable></term>
<literal>\dd</literal> <replaceable class="parameter">object</replaceable>
</term>
<listitem> <listitem>
<para> <para>
List the description from <literal>pg_description</literal> List the description from <literal>pg_description</literal>
@ -749,9 +681,7 @@ testdb=>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><literal>\df</literal></term>
<literal>\df</literal>
</term>
<listitem> <listitem>
<para> <para>
List functions. List functions.
@ -760,9 +690,7 @@ testdb=>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><literal>\di</literal></term>
<literal>\di</literal>
</term>
<listitem> <listitem>
<para> <para>
List only indexes. List only indexes.
@ -771,9 +699,7 @@ testdb=>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><literal>\do</literal></term>
<literal>\do</literal>
</term>
<listitem> <listitem>
<para> <para>
List only operators. List only operators.
@ -782,9 +708,7 @@ testdb=>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><literal>\ds</literal></term>
<literal>\ds</literal>
</term>
<listitem> <listitem>
<para> <para>
List only sequences. List only sequences.
@ -793,9 +717,7 @@ testdb=>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><literal>\dS</literal></term>
<literal>\dS</literal>
</term>
<listitem> <listitem>
<para> <para>
List system tables and indexes. List system tables and indexes.
@ -804,9 +726,7 @@ testdb=>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><literal>\dt</literal></term>
<literal>\dt</literal>
</term>
<listitem> <listitem>
<para> <para>
List only non-system tables. List only non-system tables.
@ -815,9 +735,7 @@ testdb=>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><literal>\dT</literal></term>
<literal>\dT</literal>
</term>
<listitem> <listitem>
<para> <para>
List types. List types.
@ -825,10 +743,8 @@ testdb=>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry><term>
<term> <literal>\e</literal> [ <replaceable class="parameter">filename</replaceable> ]</term>
<literal>\e</literal> [ <replaceable class="parameter">filename</replaceable> ]
</term>
<listitem> <listitem>
<para> <para>
Edit the current query buffer or the contents of the file Edit the current query buffer or the contents of the file
@ -838,9 +754,7 @@ testdb=>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><literal>\E</literal> [ <replaceable class="parameter">filename</replaceable> ]</term>
<literal>\E</literal> [ <replaceable class="parameter">filename</replaceable> ]
</term>
<listitem> <listitem>
<para> <para>
Edit the current query buffer or the contents of the file Edit the current query buffer or the contents of the file
@ -851,9 +765,7 @@ testdb=>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><literal>\f</literal> [ <replaceable class="parameter">separator</replaceable> ]</term>
<literal>\f</literal> [ <replaceable class="parameter">separator</replaceable> ]
</term>
<listitem> <listitem>
<para> <para>
Set the field separator. Default is a single blank space. Set the field separator. Default is a single blank space.
@ -862,9 +774,7 @@ testdb=>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><literal>\g</literal> [ { <replaceable class="parameter">filename</replaceable> | <literal>|</literal><replaceable class="parameter">command</replaceable> } ]</term>
<literal>\g</literal> [ { <replaceable class="parameter">filename</replaceable> | <literal>|</literal><replaceable class="parameter">command</replaceable> } ]
</term>
<listitem> <listitem>
<para> <para>
Send the current query input buffer to the backend and optionally Send the current query input buffer to the backend and optionally
@ -876,9 +786,7 @@ testdb=>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><literal>\h</literal> [ <replaceable class="parameter">command</replaceable> ]</term>
<literal>\h</literal> [ <replaceable class="parameter">command</replaceable> ]
</term>
<listitem> <listitem>
<para> <para>
Give syntax help on the specified SQL command. Give syntax help on the specified SQL command.
@ -895,9 +803,7 @@ testdb=>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><literal>\H</literal></term>
<literal>\H</literal>
</term>
<listitem> <listitem>
<para> <para>
Toggle <acronym>HTML3</acronym> output. This is equivalent to Toggle <acronym>HTML3</acronym> output. This is equivalent to
@ -908,9 +814,7 @@ testdb=>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><literal>\i</literal> <replaceable class="parameter">filename</replaceable></term>
<literal>\i</literal> <replaceable class="parameter">filename</replaceable>
</term>
<listitem> <listitem>
<para> <para>
Read queries from the file <replaceable class="parameter">filename</replaceable> Read queries from the file <replaceable class="parameter">filename</replaceable>
@ -920,9 +824,7 @@ testdb=>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><literal>\l</literal></term>
<literal>\l</literal>
</term>
<listitem> <listitem>
<para> <para>
List all the databases in the server. List all the databases in the server.
@ -931,9 +833,7 @@ testdb=>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><literal>\m</literal></term>
<literal>\m</literal>
</term>
<listitem> <listitem>
<para> <para>
Toggle the old monitor-like table display, which includes border characters Toggle the old monitor-like table display, which includes border characters
@ -946,9 +846,7 @@ testdb=>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><literal>\o</literal> [ { <replaceable class="parameter">filename</replaceable> | <literal>|</literal><replaceable class="parameter">command</replaceable> } ]</term>
<literal>\o</literal> [ { <replaceable class="parameter">filename</replaceable> | <literal>|</literal><replaceable class="parameter">command</replaceable> } ]
</term>
<listitem> <listitem>
<para> <para>
Save future query results to the file Save future query results to the file
@ -962,9 +860,7 @@ testdb=>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><literal>\p</literal></term>
<literal>\p</literal>
</term>
<listitem> <listitem>
<para> <para>
Print the current query buffer. Print the current query buffer.
@ -973,9 +869,7 @@ testdb=>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><literal>\q</literal></term>
<literal>\q</literal>
</term>
<listitem> <listitem>
<para> <para>
Quit the <application>psql</application> program. Quit the <application>psql</application> program.
@ -984,9 +878,7 @@ testdb=>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><literal>\r</literal></term>
<literal>\r</literal>
</term>
<listitem> <listitem>
<para> <para>
Reset(clear) the query buffer. Reset(clear) the query buffer.
@ -995,9 +887,7 @@ testdb=>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><literal>\s</literal> [ <replaceable class="parameter">filename</replaceable> ]</term>
<literal>\s</literal> [ <replaceable class="parameter">filename</replaceable> ]
</term>
<listitem> <listitem>
<para> <para>
Print or save the command line history to Print or save the command line history to
@ -1011,9 +901,7 @@ testdb=>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><literal>\t</literal></term>
<literal>\t</literal>
</term>
<listitem> <listitem>
<para> <para>
Toggle display of output column name headings and row count footer (defaults to on). Toggle display of output column name headings and row count footer (defaults to on).
@ -1022,9 +910,7 @@ testdb=>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><literal>\T</literal> <replaceable class="parameter">table_options</replaceable></term>
<literal>\T</literal> <replaceable class="parameter">table_options</replaceable>
</term>
<listitem> <listitem>
<para> <para>
Allows you to specify options to be placed within the Allows you to specify options to be placed within the
@ -1038,9 +924,7 @@ testdb=>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><literal>\x</literal></term>
<literal>\x</literal>
</term>
<listitem> <listitem>
<para> <para>
Toggles extended row format mode. When enabled each row will have its column Toggles extended row format mode. When enabled each row will have its column
@ -1052,9 +936,7 @@ testdb=>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><literal>\w</literal> <replaceable class="parameter">filename</replaceable></term>
<literal>\w</literal> <replaceable class="parameter">filename</replaceable>
</term>
<listitem> <listitem>
<para> <para>
Outputs the current query buffer to the file Outputs the current query buffer to the file
@ -1064,9 +946,7 @@ testdb=>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><literal>\z</literal></term>
<literal>\z</literal>
</term>
<listitem> <listitem>
<para> <para>
Produces a list of all tables in the database with their appropriate ACLs Produces a list of all tables in the database with their appropriate ACLs
@ -1076,9 +956,7 @@ testdb=>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><literal>\!</literal> [ <replaceable class="parameter">command</replaceable> ]</term>
<literal>\!</literal> [ <replaceable class="parameter">command</replaceable> ]
</term>
<listitem> <listitem>
<para> <para>
Escape to a separate Unix shell or execute the Unix command Escape to a separate Unix shell or execute the Unix command
@ -1088,9 +966,7 @@ testdb=>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><literal>\?</literal></term>
<literal>\?</literal>
</term>
<listitem> <listitem>
<para> <para>
Get help information about the slash (<quote>\</quote>) commands. Get help information about the slash (<quote>\</quote>) commands.
@ -1114,7 +990,7 @@ sgml-indent-data:t
sgml-parent-document:nil sgml-parent-document:nil
sgml-default-dtd-file:"../reference.ced" sgml-default-dtd-file:"../reference.ced"
sgml-exposed-tags:nil sgml-exposed-tags:nil
sgml-local-catalogs:"/usr/lib/sgml/CATALOG" sgml-local-catalogs:"/usr/lib/sgml/catalog"
sgml-local-ecat-files:nil sgml-local-ecat-files:nil
End: End:
--> -->

View File

@ -31,9 +31,7 @@ RESET <replaceable class="PARAMETER">variable</replaceable>
<para> <para>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term><replaceable class="PARAMETER">variable</replaceable></term>
<replaceable class="PARAMETER">variable</replaceable>
</term>
<listitem> <listitem>
<para> <para>
Refer to the SET statement for more information on available Refer to the SET statement for more information on available
@ -56,9 +54,9 @@ RESET <replaceable class="PARAMETER">variable</replaceable>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term><computeroutput>
RESET VARIABLE RESET VARIABLE
</term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
Message returned if Message returned if
@ -110,12 +108,17 @@ RESET <replaceable class="PARAMETER">variable</replaceable>
Usage Usage
</title> </title>
<para> <para>
Set DateStyle to its default value:
<programlisting> <programlisting>
-- reset DateStyle to its default;
RESET DateStyle; RESET DateStyle;
</programlisting> </programlisting>
</para>
<para>
Set Geqo to its default value:
<programlisting> <programlisting>
-- reset Geqo to its default;
RESET GEQO; RESET GEQO;
</programlisting> </programlisting>
</para> </para>

View File

@ -34,20 +34,14 @@ REVOKE <replaceable class="PARAMETER">privilege</replaceable> [, ...]
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term><replaceable class="PARAMETER">privilege</replaceable></term>
<replaceable class="PARAMETER">privilege</replaceable>
</term>
<listitem> <listitem>
<para> <para>
The possible privileges are: The possible privileges are:
</para>
</listitem>
</varlistentry>
<variablelist>
<varlistentry> <varlistentry>
<term> <term>SELECT</term>
SELECT
</term>
<listitem> <listitem>
<para> <para>
Privilege to access all of the columns of a specific Privilege to access all of the columns of a specific
@ -57,9 +51,7 @@ REVOKE <replaceable class="PARAMETER">privilege</replaceable> [, ...]
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>INSERT</term>
INSERT
</term>
<listitem> <listitem>
<para> <para>
Privilege to insert data into all columns of a Privilege to insert data into all columns of a
@ -69,9 +61,7 @@ REVOKE <replaceable class="PARAMETER">privilege</replaceable> [, ...]
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>UPDATE</term>
UPDATE
</term>
<listitem> <listitem>
<para> <para>
Privilege to update all columns of a specific Privilege to update all columns of a specific
@ -81,9 +71,7 @@ REVOKE <replaceable class="PARAMETER">privilege</replaceable> [, ...]
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>DELETE</term>
DELETE
</term>
<listitem> <listitem>
<para> <para>
Privilege to delete rows from a specific table. Privilege to delete rows from a specific table.
@ -92,9 +80,7 @@ REVOKE <replaceable class="PARAMETER">privilege</replaceable> [, ...]
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>RULE</term>
RULE
</term>
<listitem> <listitem>
<para> <para>
Privilege to define rules on table/view. Privilege to define rules on table/view.
@ -104,23 +90,24 @@ REVOKE <replaceable class="PARAMETER">privilege</replaceable> [, ...]
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>ALL</term>
ALL
</term>
<listitem> <listitem>
<para> <para>
Rescind all privileges. Rescind all privileges.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</variablelist>
</para>
</listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term> <term><replaceable class="PARAMETER">object</replaceable></term>
<replaceable class="PARAMETER">object</replaceable>
</term>
<listitem> <listitem>
<para> <para>
The name of an object from which to revoke access. The name of an object from which to revoke access.
The possible objects are: The possible objects are:
<itemizedlist spacing="compact" mark="bullet"> <itemizedlist spacing="compact" mark="bullet">
<listitem> <listitem>
@ -152,9 +139,7 @@ REVOKE <replaceable class="PARAMETER">privilege</replaceable> [, ...]
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><replaceable class="PARAMETER">group</replaceable></term>
<replaceable class="PARAMETER">group</replaceable>
</term>
<listitem> <listitem>
<para> <para>
The name of a group from whom to revoke privileges. The name of a group from whom to revoke privileges.
@ -163,9 +148,7 @@ REVOKE <replaceable class="PARAMETER">privilege</replaceable> [, ...]
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><replaceable class="PARAMETER">username</replaceable></term>
<replaceable class="PARAMETER">username</replaceable>
</term>
<listitem> <listitem>
<para> <para>
The name of a user from whom revoke privileges. Use the PUBLIC keyword The name of a user from whom revoke privileges. Use the PUBLIC keyword
@ -175,9 +158,7 @@ REVOKE <replaceable class="PARAMETER">privilege</replaceable> [, ...]
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>PUBLIC</term>
PUBLIC
</term>
<listitem> <listitem>
<para> <para>
Rescind the specified privilege(s) for all users. Rescind the specified privilege(s) for all users.
@ -199,9 +180,9 @@ REVOKE <replaceable class="PARAMETER">privilege</replaceable> [, ...]
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term><computeroutput>
CHANGE CHANGE
</term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
Message returned if successfully. Message returned if successfully.
@ -210,9 +191,9 @@ REVOKE <replaceable class="PARAMETER">privilege</replaceable> [, ...]
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><computeroutput>
ERROR ERROR
</term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
Message returned if object is not available or impossible Message returned if object is not available or impossible
@ -233,7 +214,7 @@ REVOKE <replaceable class="PARAMETER">privilege</replaceable> [, ...]
Description Description
</title> </title>
<para> <para>
REVOKE allows creator of an object to revoke permissions granted <command>REVOKE</command> allows creator of an object to revoke permissions granted
before, from all users (via PUBLIC) or a certain user or group. before, from all users (via PUBLIC) or a certain user or group.
</para> </para>
@ -271,6 +252,7 @@ Legend:
<para> <para>
Currently, to create a GROUP you have to insert Currently, to create a GROUP you have to insert
data manually into table pg_group as: data manually into table pg_group as:
<programlisting> <programlisting>
INSERT INTO pg_group VALUES ('todos'); INSERT INTO pg_group VALUES ('todos');
CREATE USER miriam IN GROUP todos; CREATE USER miriam IN GROUP todos;
@ -286,15 +268,18 @@ CREATE USER miriam IN GROUP todos;
Usage Usage
</title> </title>
<para> <para>
<programlisting> Revoke insert privilege from all users on table
-- revoke insert privilege from all users on table films: <literal>films</literal>:
--
REVOKE INSERT ON films FROM PUBLIC; <programlisting>
</programlisting> REVOKE INSERT ON films FROM PUBLIC;
</programlisting>
</para>
<para>
Revoke all privileges from user <literal>manuel</literal> on view <literal>kinds</literal>:
<programlisting> <programlisting>
-- revoke all privileges from user manuel on view kinds:
--
REVOKE ALL ON kinds FROM manuel; REVOKE ALL ON kinds FROM manuel;
</programlisting> </programlisting>
</para> </para>
@ -355,6 +340,7 @@ REVOKE GRANT OPTION FOR <replaceable class="parameter">privilege</replaceable> [
</varlistentry> </varlistentry>
</variablelist> </variablelist>
</para> </para>
<para> <para>
The possible objects are: The possible objects are:
<simplelist> <simplelist>
@ -381,6 +367,7 @@ REVOKE GRANT OPTION FOR <replaceable class="parameter">privilege</replaceable> [
and user2 gives it to user3 then user1 can revoke and user2 gives it to user3 then user1 can revoke
this privilege in cascade using the CASCADE keyword. this privilege in cascade using the CASCADE keyword.
</para> </para>
<para> <para>
If user1 gives a privilege WITH GRANT OPTION to user2, If user1 gives a privilege WITH GRANT OPTION to user2,
and user2 gives it to user3 then if user1 try revoke and user2 gives it to user3 then if user1 try revoke

View File

@ -44,9 +44,9 @@ ROLLBACK [ WORK | TRANSACTION ]
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term><computeroutput>
ABORT ABORT
</term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
Message returned if successful. Message returned if successful.
@ -55,10 +55,10 @@ ROLLBACK [ WORK | TRANSACTION ]
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><computeroutput>
NOTICE: UserAbortTransactionBlock and not in in-progress state NOTICE: UserAbortTransactionBlock and not in in-progress state
ABORT ABORT
</term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
If there is not any transaction currently in progress. If there is not any transaction currently in progress.
@ -106,9 +106,9 @@ ROLLBACK [ WORK | TRANSACTION ]
Usage Usage
</title> </title>
<para> <para>
To abort all changes:
<programlisting> <programlisting>
--To abort all changes:
--
ROLLBACK WORK; ROLLBACK WORK;
</programlisting> </programlisting>
</para> </para>
@ -129,7 +129,7 @@ ROLLBACK [ WORK | TRANSACTION ]
SQL92 SQL92
</title> </title>
<para> <para>
Full compatibility. TRANSACTION is a Full compatibility. The TRANSACTION keyword is a
<productname>Postgres</productname> extension. <productname>Postgres</productname> extension.
</para> </para>
</refsect2> </refsect2>