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">
<REFMETA>
<REFENTRYTITLE>
ABORT
</REFENTRYTITLE>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO>
</REFMETA>
<REFNAMEDIV>
<REFNAME>
ABORT
</REFNAME>
<REFPURPOSE>
Aborts the current transaction
</REFPURPOSE>
</REFNAMEDIV>
<REFSYNOPSISDIV>
<REFSYNOPSISDIVINFO>
<DATE>1998-09-27</DATE>
</REFSYNOPSISDIVINFO>
<SYNOPSIS>
ABORT
</SYNOPSIS>
<REFSECT2 ID="R2-SQL-ABORT-1">
<REFSECT2INFO>
<DATE>1998-09-27</DATE>
</REFSECT2INFO>
<TITLE>
Inputs
</TITLE>
<PARA>
None.
</para>
</REFSECT2>
<REFSECT2 ID="R2-SQL-ABORT-2">
<REFSECT2INFO>
<DATE>1998-09-27</DATE>
</REFSECT2INFO>
<TITLE>
Outputs
</TITLE>
<PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
<refentry id="SQL-ABORT">
<refmeta>
<refentrytitle>
ABORT
</TERM>
<LISTITEM>
<PARA>
Message returned if successful.
</para>
</listitem>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta>
<refnamediv>
<refname>
ABORT
</refname>
<refpurpose>
Aborts the current transaction
</refpurpose>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
<date>1998-09-27</date>
</refsynopsisdivinfo>
<synopsis>
ABORT [ TRANSACTION | WORK ]
</synopsis>
<refsect2 id="R2-SQL-ABORT-1">
<refsect2info>
<date>1998-09-27</date>
</refsect2info>
<title>
Inputs
</title>
<para>
None.
</para>
</refsect2>
<refsect2 id="R2-SQL-ABORT-2">
<refsect2info>
<date>1998-09-27</date>
</refsect2info>
<title>
Outputs
</title>
<para>
<variablelist>
<varlistentry>
<term><computeroutput>
ABORT
</computeroutput></term>
<listitem>
<para>
Message returned if successful.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><computeroutput>
NOTICE: UserAbortTransactionBlock and not in in-progress state
ABORT
</TERM>
<LISTITEM>
<PARA>
If there is not any transaction currently in progress.
</para>
</listitem>
</VARLISTENTRY>
</VARIABLELIST>
</para>
</REFSECT2>
</REFSYNOPSISDIV>
</computeroutput></term>
<listitem>
<para>
If there is not any transaction currently in progress.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
</refsynopsisdiv>
<REFSECT1 ID="R1-SQL-ABORT-1">
<REFSECT1INFO>
<DATE>1998-09-27</DATE>
</REFSECT1INFO>
<TITLE>
Description
</TITLE>
<PARA>
<refsect1 id="R1-SQL-ABORT-1">
<refsect1info>
<date>1998-09-27</date>
</refsect1info>
<title>
Description
</title>
<para>
<command>ABORT</command> rolls back the current transaction and causes
all the updates made by the transaction to be discarded.
This command is identical
in behavior to the <acronym>SQL92</acronym> command <command>ROLLBACK</command>,
and is present only for historical reasons.
</para>
<REFSECT2 ID="R2-SQL-ABORT-3">
<REFSECT2INFO>
<DATE>1998-09-27</DATE>
</REFSECT2INFO>
<TITLE>
Notes
</TITLE>
<para>
Use the <command>COMMIT</command> statement to successfully
terminate a transaction.
</para>
</refsect2>
</REFSECT1>
This command is identical
in behavior to the <acronym>SQL92</acronym> command <command>ROLLBACK</command>,
and is present only for historical reasons.
</para>
<refsect2 id="R2-SQL-ABORT-3">
<refsect2info>
<date>1998-09-27</date>
</refsect2info>
<title>
Notes
</title>
<para>
Use <command>COMMIT</command> to successfully
terminate a transaction.
</para>
</refsect2>
</refsect1>
<REFSECT1 ID="R1-SQL-ABORT-2">
<TITLE>
Usage
</TITLE>
<PARA>
<ProgramListing>
--To abort all changes
--
<refsect1 id="R1-SQL-ABORT-2">
<title>
Usage
</title>
<para>
To abort all changes:
<programlisting>
ABORT WORK;
</ProgramListing>
</para>
</programlisting>
</para>
</REFSECT1>
</refsect1>
<REFSECT1 ID="R1-SQL-ABORT-3">
<TITLE>
Compatibility
</TITLE>
<refsect1 id="R1-SQL-ABORT-3">
<title>
Compatibility
</title>
<REFSECT2 ID="R2-SQL-ABORT-4">
<REFSECT2INFO>
<DATE>1998-09-27</DATE>
</REFSECT2INFO>
<TITLE>
SQL92
</TITLE>
<para>
This command is a <productname>Postgres</productname> extension present
for historical reasons. <command>ROLLBACK</command> is the <acronym>SQL92</acronym>
equivalent command.
</PARA>
</refsect2>
</refsect1>
<refsect2 id="R2-SQL-ABORT-4">
<refsect2info>
<date>1998-09-27</date>
</refsect2info>
<title>
SQL92
</title>
<para>
This command is a <productname>Postgres</productname> extension present
for historical reasons. <command>ROLLBACK</command> is the <acronym>SQL92</acronym>
equivalent command.
</para>
</refsect2>
</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">
<REFMETA>
<REFENTRYTITLE>
ALTER TABLE
</REFENTRYTITLE>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO>
</REFMETA>
<REFNAMEDIV>
<REFNAME>
ALTER TABLE
</REFNAME>
<REFPURPOSE>
Modifies table properties
</REFPURPOSE>
</refnamediv>
<REFSYNOPSISDIV>
<REFSYNOPSISDIVINFO>
<DATE>1998-04-15</DATE>
</REFSYNOPSISDIVINFO>
<SYNOPSIS>
ALTER TABLE <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE>
[ * ] ADD [ COLUMN ] <REPLACEABLE CLASS="PARAMETER">column</REPLACEABLE> <REPLACEABLE CLASS="PARAMETER">type</REPLACEABLE>
ALTER TABLE <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE>
[ * ] RENAME [ COLUMN ] <REPLACEABLE CLASS="PARAMETER">column</REPLACEABLE> TO <REPLACEABLE CLASS="PARAMETER">newcolumn</REPLACEABLE>
ALTER TABLE <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE>
RENAME TO <REPLACEABLE CLASS="PARAMETER">newtable</REPLACEABLE>
</SYNOPSIS>
<refentry id="SQL-ALTERTABLE">
<refmeta>
<refentrytitle>
ALTER TABLE
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta>
<refnamediv>
<refname>
ALTER TABLE
</refname>
<refpurpose>
Modifies table properties
</refpurpose>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
<date>1998-04-15</date>
</refsynopsisdivinfo>
<synopsis>
ALTER TABLE <replaceable class="PARAMETER">table</replaceable>
[ * ] ADD [ COLUMN ] <replaceable class="PARAMETER">ER">co</replaceable>BLE> <replaceable
class="PARAMETER">type</replaceable>
ALTER TABLE <replaceable class="PARAMETER">table</replaceable>
[ * ] RENAME [ COLUMN ] <replaceable class="PARAMETER">ER">co</replaceable>BLE> TO <replaceable
class="PARAMETER">newcolumn</replaceable>
ALTER TABLE <replaceable class="PARAMETER">table</replaceable>
RENAME TO <replaceable class="PARAMETER">newtable</replaceable>
</synopsis>
<REFSECT2 ID="R2-SQL-ALTERTABLE-1">
<REFSECT2INFO>
<DATE>1998-04-15</DATE>
</REFSECT2INFO>
<TITLE>
Inputs
</TITLE>
<PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
<REPLACEABLE CLASS="PARAMETER"> table </REPLACEABLE>
</TERM>
<LISTITEM>
<PARA>
The name of an existing table to alter.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<refsect2 id="R2-SQL-ALTERTABLE-1">
<refsect2info>
<date>1998-04-15</date>
</refsect2info>
<title>
Inputs
</title>
<para>
<variablelist>
<varlistentry>
<term><replaceable class="PARAMETER"> table </replaceable></term>
<listitem>
<para>
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"> 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"> 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"> 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>
<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
</TITLE>
<PARA>
<refsect2 id="R2-SQL-ALTERTABLE-2">
<refsect2info>
<date>1998-04-15</date>
</refsect2info>
<title>
Outputs
</title>
<para>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
<returnvalue>ALTER</returnvalue>
</TERM>
<LISTITEM>
<PARA>
Message returned from column or table renaming.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<variablelist>
<varlistentry>
<term><computeroutput>
ALTER
</computeroutput></term>
<listitem>
<para>
Message returned from column or table renaming.
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
<returnvalue>NEW</returnvalue>
</TERM>
<LISTITEM>
<PARA>
Message returned from column addition.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<varlistentry>
<term><computeroutput>
NEW
</computeroutput></term>
<listitem>
<para>
Message returned from column addition.
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
<ReturnValue>ERROR</ReturnValue>
</TERM>
<LISTITEM>
<PARA>
Message returned if table or column is not available.
</para>
</listitem>
</VARLISTENTRY>
</VARIABLELIST>
</para>
</REFSECT2>
</REFSYNOPSISDIV>
<varlistentry>
<term><computeroutput>
ERROR
</computeroutput></term>
<listitem>
<para>
Message returned if table or column is not available.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
</refsynopsisdiv>
<REFSECT1 ID="R1-SQL-ALTERTABLE-1">
<REFSECT1INFO>
<DATE>1998-04-15</DATE>
</REFSECT1INFO>
<TITLE>
Description
</TITLE>
<PARA>
<refsect1 id="R1-SQL-ALTERTABLE-1">
<refsect1info>
<date>1998-04-15</date>
</refsect1info>
<title>
Description
</title>
<para>
<command>ALTER TABLE</command> changes the definition of an existing table.
The new columns and their types are specified in the same style
and with the the same restrictions as in <command>CREATE TABLE</command>.
@ -156,114 +148,117 @@ Description
the affected table. Thus, the table or column will
remain of the same type and size after this command is
executed.
</para>
<PARA>
</para>
<para>
You must own the table in order to change its schema.
</PARA>
</para>
<REFSECT2 ID="R2-SQL-ALTERTABLE-3">
<REFSECT2INFO>
<DATE>1998-04-15</DATE>
</REFSECT2INFO>
<TITLE>
Notes
</TITLE>
<PARA>
The keyword COLUMN 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
inheritance hierarchy.
<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
inheritance hierarchy.
The <citetitle>PostgreSQL User's Guide</citetitle> has further
information on inheritance.
</para>
information on inheritance.
</para>
<PARA>
Refer to CREATE TABLE for a further description
of valid arguments.
</para>
</REFSECT2>
</REFSECT1>
<para>
Refer to <command>CREATE TABLE</command> for a further description
of valid arguments.
</para>
</refsect2>
</refsect1>
<REFSECT1 ID="R1-SQL-ALTERTABLE-2">
<TITLE>
Usage
</TITLE>
<PARA>
<refsect1 id="R1-SQL-ALTERTABLE-2">
<title>
Usage
</title>
<para>
To add a column of type VARCHAR to a table:
<ProgramListing>
ALTER TABLE distributors ADD COLUMN address VARCHAR(30);
</ProgramListing>
</para>
<programlisting>
ALTER TABLE distributors ADD COLUMN address VARCHAR(30);
</programlisting>
</para>
<PARA>
<para>
To rename an existing column:
<ProgramListing>
ALTER TABLE distributors RENAME COLUMN address TO city;
</ProgramListing>
</para>
<programlisting>
ALTER TABLE distributors RENAME COLUMN address TO city;
</programlisting>
</para>
<PARA>
<para>
To rename an existing table:
<ProgramListing>
ALTER TABLE distributors RENAME TO suppliers;
</ProgramListing>
</para>
<programlisting>
ALTER TABLE distributors RENAME TO suppliers;
</programlisting>
</para>
</refsect1>
</REFSECT1>
<refsect1 id="R1-SQL-ALTERTABLE-3">
<title>
Compatibility
</title>
<REFSECT1 ID="R1-SQL-ALTERTABLE-3">
<TITLE>
Compatibility
</TITLE>
<refsect2 id="R2-SQL-ALTERTABLE-4">
<refsect2info>
<date>1998-04-15</date>
</refsect2info>
<title>
SQL92
</title>
<para>
<command>ALTER TABLE/RENAME</command>
is a <productname>Postgres</productname> language extension.
</para>
<REFSECT2 ID="R2-SQL-ALTERTABLE-4">
<REFSECT2INFO>
<DATE>1998-04-15</DATE>
</REFSECT2INFO>
<TITLE>
SQL92
</TITLE>
<PARA>
<command>ALTER TABLE/RENAME</command>
is a <productname>Postgres</productname> language extension.
</para>
<para>
SQL92 specifies some additional capabilities for <command>ALTER TABLE</command>
statement which are not yet directly supported by
<productname>Postgres</productname>:
</para>
<PARA>
SQL92 specifies some additional capabilities for <command>ALTER TABLE</command>
statement which are not yet directly supported by
<ProductName>Postgres</ProductName>:
</para>
<variablelist>
<varlistentry>
<term>
<synopsis>
ALTER TABLE <replaceable class="PARAMETER">table</replaceable> ALTER [
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>
ADD [ CONSTRAINT <replaceable class="PARAMETER">>constrain</replaceable>> ] <replaceable
class="PARAMETER">table-constraint</replaceable>
</synopsis>
</term>
<listitem>
<para>
Puts the default value or constraint specified into the
definition of column in the table.
See <command>CREATE TABLE</command> for the
syntax of the default and table-constraint clauses.
If a default clause already exists, it will be replaced by
the new definition. If any constraints on this column already
exist, they will be retained using a boolean AND with the new
constraint.
</para>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
<Synopsis>
ALTER TABLE <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE> ALTER [ COLUMN ] <REPLACEABLE CLASS="PARAMETER">column</REPLACEABLE>
SET DEFAULT <REPLACEABLE CLASS="PARAMETER">default</REPLACEABLE>
<para>
Currently, to set new default constraints on an existing column
the table must be recreated and reloaded:
ALTER TABLE <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE> ALTER [ COLUMN ] <REPLACEABLE CLASS="PARAMETER">column</REPLACEABLE>
ADD [ CONSTRAINT <REPLACEABLE CLASS="PARAMETER">constraint</REPLACEABLE> ] <REPLACEABLE CLASS="PARAMETER">table-constraint</REPLACEABLE>
</Synopsis>
</TERM>
<LISTITEM>
<PARA>
Puts the default value or constraint specified into the
definition of column in the table.
See <command>CREATE TABLE</command> for the
syntax of the default and table-constraint clauses.
If a default clause already exists, it will be replaced by
the new definition. If any constraints on this column already
exist, they will be retained using a boolean AND with the new
constraint.
</para>
<PARA>
Currently, to set new default constraints on an existing column
the table must be recreated and reloaded:
<ProgramListing>
<programlisting>
CREATE TABLE temp AS SELECT * FROM distributors;
DROP TABLE distributors;
CREATE TABLE distributors (
@ -273,65 +268,65 @@ CREATE TABLE distributors (
);
INSERT INTO distributors SELECT * FROM temp;
DROP TABLE temp;
</ProgramListing>
</PARA>
</LISTITEM>
</VARLISTENTRY>
</programlisting>
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
<Synopsis>
ALTER TABLE <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE>
DROP DEFAULT <REPLACEABLE CLASS="PARAMETER">default</REPLACEABLE>
ALTER TABLE <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE>
DROP CONSTRAINT <REPLACEABLE CLASS="PARAMETER">constraint</REPLACEABLE> { RESTRICT | CASCADE }
</Synopsis>
</TERM>
<LISTITEM>
<PARA>
Removes the default value specified by default or the rule
specified by constraint from the definition of a table.
If RESTRICT is specified only a constraint with no dependent
constraints can be destroyed.
If CASCADE is specified, Any constraints that are dependent on
this constraint are also dropped.
</para>
<varlistentry>
<term>
<synopsis>
ALTER TABLE <replaceable class="PARAMETER">table</replaceable>
DROP DEFAULT <replaceable class="PARAMETER">default</replaceable>
ALTER TABLE <replaceable class="PARAMETER">table</replaceable>
DROP CONSTRAINT <replaceable class="PARAMETER">constraint</replaceable> { RESTRICT | CASCADE }
</synopsis>
</term>
<listitem>
<para>
Removes the default value specified by default or the rule
specified by constraint from the definition of a table.
If RESTRICT is specified only a constraint with no dependent
constraints can be destroyed.
If CASCADE is specified, Any constraints that are dependent on
this constraint are also dropped.
</para>
<PARA>
Currently, to remove a default value or constraints on an
existing column the table must be recreated and reloaded:
<para>
Currently, to remove a default value or constraints on an
existing column the table must be recreated and reloaded:
<ProgramListing>
<programlisting>
CREATE TABLE temp AS SELECT * FROM distributors;
DROP TABLE distributors;
CREATE TABLE distributors AS SELECT * FROM temp;
DROP TABLE temp;
</ProgramListing>
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
<Synopsis>
ALTER TABLE <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE>
DROP [ COLUMN ] <REPLACEABLE CLASS="PARAMETER">column</REPLACEABLE> { RESTRICT | CASCADE }
</Synopsis>
</TERM>
<LISTITEM>
<PARA>
Removes a column from a table.
If RESTRICT is specified only a column with no dependent
objects can be destroyed.
If CASCADE is specified, all objects that are dependent on
this column are also dropped.
</para>
</programlisting>
</para>
</listitem>
</varlistentry>
<PARA>
Currently, to remove an existing column the table must be
recreated and reloaded:
<varlistentry>
<term>
<synopsis>
ALTER TABLE <replaceable class="PARAMETER">table</replaceable>
DROP [ COLUMN ] <replaceable class="PARAMETER">column</replaceable> { RESTRICT | CASCADE }
</synopsis>
</term>
<listitem>
<para>
Removes a column from a table.
If RESTRICT is specified only a column with no dependent
objects can be destroyed.
If CASCADE is specified, all objects that are dependent on
this column are also dropped.
</para>
<ProgramListing>
<para>
Currently, to remove an existing column the table must be
recreated and reloaded:
<programlisting>
CREATE TABLE temp AS SELECT did, city FROM distributors;
DROP TABLE distributors;
CREATE TABLE distributors (
@ -340,11 +335,28 @@ CREATE TABLE distributors (
);
INSERT INTO distributors SELECT * FROM temp;
DROP TABLE temp;
</ProgramListing>
</PARA>
</listitem>
</varlistentry>
</VARIABLELIST>
</refsect2>
</refsect1>
</REFENTRY>
</programlisting>
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect2>
</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,103 +1,97 @@
<refentry id="SQL-ALTERUSER">
<refmeta>
<refentrytitle>
ALTER USER
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta>
<refnamediv>
<refname>
ALTER USER
</refname>
<refpurpose>
Modifies user account information
</refpurpose>
<refentry id="SQL-ALTERUSER">
<refmeta>
<refentrytitle>
ALTER USER
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta>
<refnamediv>
<refname>
ALTER USER
</refname>
<refpurpose>
Modifies user account information
</refpurpose>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
<date>1998-09-08</date>
</refsynopsisdivinfo>
<synopsis>
ALTER USER <replaceable class="PARAMETER">username</replaceable>
[ WITH PASSWORD <replaceable class="PARAMETER">password</replaceable> ]
[ CREATEDB | NOCREATEDB ]
[ CREATEUSER | NOCREATEUSER ]
<refsynopsisdiv>
<refsynopsisdivinfo>
<date>1998-09-08</date>
</refsynopsisdivinfo>
<synopsis>
ALTER USER <replaceable class="PARAMETER">username</replaceable> [ WITH PASSWORD <replaceable class="PARAMETER">password</replaceable> ]
[ CREATEDB | NOCREATEDB ] [ CREATEUSER | NOCREATEUSER ]
[ IN GROUP <replaceable class="PARAMETER">groupname</replaceable> [, ...] ]
[ VALID UNTIL '<replaceable class="PARAMETER">abstime</replaceable>' ]
</synopsis>
<refsect2 id="R2-SQL-ALTERUSER-1">
<refsect2info>
<date>1998-09-08</date>
</refsect2info>
<title>
Inputs
</title>
<para>
Refer to <command>CREATE USER</command> for a detailed description of each
clause.
</para>
<variablelist>
<varlistentry>
<term>
<replaceable class="PARAMETER"> username </replaceable>
</term>
<listitem>
<para>
The Postgres account name of the user whose details are to be altered.
</para>
</listitem>
</varlistentry>
</synopsis>
<varlistentry>
<term>
<replaceable class="PARAMETER"> password </replaceable>
</term>
<listitem>
<para>
The new password to be used for this account.
</para>
</listitem>
</varlistentry>
<refsect2 id="R2-SQL-ALTERUSER-1">
<refsect2info>
<date>1998-09-08</date>
</refsect2info>
<title>
Inputs
</title>
<varlistentry>
<term>
<replaceable class="PARAMETER"> groupname </replaceable>
</term>
<listitem>
<para>
The name of an access group into which this account is to be put.
</para>
</listitem>
</varlistentry>
<para>
Refer to <command>CREATE USER</command> for a detailed description of each
clause.
</para>
<varlistentry>
<term>
<replaceable class="PARAMETER"> abstime </replaceable>
</term>
<listitem>
<para>
The date (and, optionally, the time)
at which this user's access is to be terminated.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect2>
<refsect2 id="R2-SQL-ALTERUSER-2">
<refsect2info>
<date>1998-09-08</date>
</refsect2info>
<title>
Outputs
</title>
<para>
<variablelist>
<varlistentry>
<term>
<returnvalue>ALTER USER</returnvalue>
</term>
<term><replaceable class="PARAMETER"> username </replaceable></term>
<listitem>
<para>
The Postgres account name of the user whose details are to be altered.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="PARAMETER"> password </replaceable></term>
<listitem>
<para>
The new password to be used for this account.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="PARAMETER"> groupname </replaceable></term>
<listitem>
<para>
The name of an access group into which this account is to be put.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="PARAMETER"> abstime </replaceable></term>
<listitem>
<para>
The date (and, optionally, the time)
at which this user's access is to be terminated.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
<refsect2 id="R2-SQL-ALTERUSER-2">
<refsect2info>
<date>1998-09-08</date>
</refsect2info>
<title>
Outputs
</title>
<para>
<variablelist>
<varlistentry>
<term><computeroutput>
ALTER USER
</computeroutput></term>
<listitem>
<para>
Message returned if the alteration was successful.
@ -106,13 +100,13 @@ ALTER USER <replaceable class="PARAMETER">username</replaceable>
</varlistentry>
<varlistentry>
<term>
<returnvalue>ERROR: alterUser: user "username" does not exist</returnvalue>
</term>
<term><computeroutput>
ERROR: alterUser: user "username" does not exist
</computeroutput></term>
<listitem>
<para>
Error message returned if the user specified doesn't
exist.
Error message returned if the specified user is not known to
the database.
</para>
</listitem>
</varlistentry>
@ -120,116 +114,116 @@ ALTER USER <replaceable class="PARAMETER">username</replaceable>
</para>
</refsect2>
</refsynopsisdiv>
<refsect1 id="R1-SQL-ALTERUSER-1">
<refsect1info>
<date>1998-09-08</date>
</refsect1info>
<title>
Description
</title>
<para>
<command>ALTER USER</command> is used to change the attributes of a user's
<productname>Postgres</productname> account.
Please note that it is not possible
to alter a user's "usesysid" via the alter user
statement. Also, it is only possible for the
<productname>Postgres</productname>
user or any user with read and modify permissions on
"pg_shadow" to alter user passwords.
</para>
<para>
If any of the clauses of the alter user statement are
omitted, the corresponding value in the "pg_shadow" table
is left unchanged.
</para>
<refsect1 id="R1-SQL-ALTERUSER-1">
<refsect1info>
<date>1998-09-08</date>
</refsect1info>
<title>
Description
</title>
<para>
<command>ALTER USER</command> is used to change the attributes of a user's
<productname>Postgres</productname> account.
Please note that it is not possible
to alter a user's "usesysid" via the alter user
statement. Also, it is only possible for the
<productname>Postgres</productname>
user or any user with read and modify permissions on
<literal>pg_shadow</literal> to alter user passwords.
</para>
<para>
If any of the clauses of the alter user statement are
omitted, the corresponding value in the "pg_shadow" table
is left unchanged.
</para>
<refsect2 id="R2-SQL-ALTERUSER-3">
<refsect2info>
<date>1998-09-08</date>
</refsect2info>
<title>
Notes
</title>
<para>
<command>ALTER USER</command> statement
is a <productname>Postgres</productname>
language extension.
</para>
<para>
Refer to <command>CREATE/DROP USER</command>
to create or remove a user
account.
</para>
<para>
In the current release (v6.5), the IN GROUP clause is parsed
but has no affect. When it is fully implemented, it is
intended to modify the pg_group relation.
</para>
</refsect2>
</refsect1>
<refsect1 id="R1-SQL-ALTERUSER-2">
<title>
Usage
</title>
<para>
Change a user password
</para>
<programlisting>
<refsect2 id="R2-SQL-ALTERUSER-3">
<refsect2info>
<date>1998-09-08</date>
</refsect2info>
<title>
Notes
</title>
<para>
<command>ALTER USER</command>
is a <productname>Postgres</productname>
language extension.
</para>
<para>
Refer to <command>CREATE/DROP USER</command>
to create or remove a user account.
</para>
<para>
In the current release (v6.5), the IN GROUP clause is parsed
but has no affect. When it is fully implemented, it is
intended to modify the pg_group relation.
</para>
</refsect2>
</refsect1>
<refsect1 id="R1-SQL-ALTERUSER-2">
<title>
Usage
</title>
<para>
Change a user password:
<programlisting>
ALTER USER davide WITH PASSWORD hu8jmn3;
</programlisting>
<para>
Change a user's valid until date
</para>
<programlisting>
</programlisting>
Change a user's valid until date
<programlisting>
ALTER USER manuel VALID UNTIL 'Jan 31 2030';
</programlisting>
<para>
Change a user's valid until date, specifying that his
authorisation should expire at midday on 4th May 1998 using
the time zone which is one hour ahead of UTC
</para>
<programlisting>
</programlisting>
Change a user's valid until date, specifying that his
authorisation should expire at midday on 4th May 1998 using
the time zone which is one hour ahead of UTC
<programlisting>
ALTER USER chris VALID UNTIL 'May 4 12:00:00 1998 +1';
</programlisting>
<para>
Give a user the ability to create other users and new databases.
</para>
<programlisting>
</programlisting>
Give a user the ability to create other users and new databases.
<programlisting>
ALTER USER miriam CREATEUSER CREATEDB;
</programlisting>
<para>
Place a user in two groups
</para>
<programlisting>
</programlisting>
Place a user in two groups
<programlisting>
ALTER USER miriam IN GROUP sales, payroll;
</programlisting>
</refsect1>
<refsect1 id="R1-SQL-ALTERUSER-3">
<title>
Compatibility
</title>
<para>
</para>
</programlisting>
</para>
</refsect1>
<refsect1 id="R1-SQL-ALTERUSER-3">
<title>
Compatibility
</title>
<para>
</para>
<refsect2 id="R2-SQL-ALTERUSER-4">
<refsect2info>
<date>1998-09-08</date>
</refsect2info>
<title>
SQL92
</title>
<para>
There is no <command>ALTER USER</command> statement in
<acronym>SQL92</acronym>.
The standard leaves
the definition of users to the implementation.
</para>
</refsect2>
</refsect1>
</refentry>
<refsect2 id="R2-SQL-ALTERUSER-4">
<refsect2info>
<date>1998-09-08</date>
</refsect2info>
<title>
SQL92
</title>
<para>
There is no <command>ALTER USER</command> statement in
<acronym>SQL92</acronym>.
The standard leaves
the definition of users to the implementation.
</para>
</refsect2>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View File

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

View File

@ -1,153 +1,152 @@
<REFENTRY ID="SQL-CLOSE">
<REFMETA>
<REFENTRYTITLE>
<refentry id="SQL-CLOSE">
<refmeta>
<refentrytitle>
CLOSE
</REFENTRYTITLE>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO>
</REFMETA>
<REFNAMEDIV>
<REFNAME>
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta>
<refnamediv>
<refname>
CLOSE
</REFNAME>
<REFPURPOSE>
</refname>
<refpurpose>
Close a cursor
</REFPURPOSE>
</refpurpose>
</refnamediv>
<REFSYNOPSISDIV>
<REFSYNOPSISDIVINFO>
<DATE>1998-09-08</DATE>
</REFSYNOPSISDIVINFO>
<SYNOPSIS>
CLOSE <REPLACEABLE CLASS="PARAMETER">cursor</REPLACEABLE>
</SYNOPSIS>
<refsynopsisdiv>
<refsynopsisdivinfo>
<date>1998-09-08</date>
</refsynopsisdivinfo>
<synopsis>
CLOSE <replaceable class="PARAMETER">cursor</replaceable>
</synopsis>
<REFSECT2 ID="R2-SQL-CLOSE-1">
<REFSECT2INFO>
<DATE>1998-09-08</DATE>
</REFSECT2INFO>
<TITLE>
<refsect2 id="R2-SQL-CLOSE-1">
<refsect2info>
<date>1998-09-08</date>
</refsect2info>
<title>
Inputs
</TITLE>
<PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
<REPLACEABLE CLASS="PARAMETER">cursor</REPLACEABLE>
</TERM>
<LISTITEM>
<PARA>
The name of an open cursor to close.
</PARA>
</LISTITEM>
</VARLISTENTRY>
</variablelist>
</para>
</REFSECT2>
<REFSECT2 ID="R2-SQL-CLOSE-2">
<REFSECT2INFO>
<DATE>1998-09-08</DATE>
</REFSECT2INFO>
<TITLE>
Outputs
</TITLE>
<PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
<ReturnValue>CLOSE</ReturnValue>
</TERM>
<LISTITEM>
<PARA>
Message returned if the cursor is successfully closed.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
<ReturnValue>NOTICE PerformPortalClose: portal "<REPLACEABLE CLASS="PARAMETER">cursor</REPLACEABLE>" not found</ReturnValue>
</TERM>
<LISTITEM>
<PARA>
This warning is given if
<REPLACEABLE CLASS="PARAMETER">cursor</REPLACEABLE> is not
declared or has already been closed.
</title>
<para>
<variablelist>
<varlistentry>
<term><replaceable class="PARAMETER">cursor</replaceable></term>
<listitem>
<para>
The name of an open cursor to close.
</para>
</listitem>
</varlistentry>
</VARIABLELIST>
</variablelist>
</para>
</REFSECT2>
</REFSYNOPSISDIV>
<REFSECT1 ID="R1-SQL-CLOSE-1">
<REFSECT1INFO>
<DATE>1998-09-08</DATE>
</REFSECT1INFO>
<TITLE>
</refsect2>
<refsect2 id="R2-SQL-CLOSE-2">
<refsect2info>
<date>1998-09-08</date>
</refsect2info>
<title>
Outputs
</title>
<para>
<variablelist>
<varlistentry>
<term><computeroutput>
CLOSE
</computeroutput></term>
<listitem>
<para>
Message returned if the cursor is successfully closed.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><computeroutput>
NOTICE PerformPortalClose: portal "<replaceable class="PARAMETER">cursor</replaceable>" not found
</computeroutput></term>
<listitem>
<para>
This warning is given if
<replaceable class="PARAMETER">cursor</replaceable> is not
declared or has already been closed.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
</refsynopsisdiv>
<refsect1 id="R1-SQL-CLOSE-1">
<refsect1info>
<date>1998-09-08</date>
</refsect1info>
<title>
Description
</TITLE>
<PARA>
</title>
<para>
<command>CLOSE</command> frees the resources associated with an open cursor.
After the cursor is closed, no subsequent operations
are allowed on it. A cursor should be closed when it is
no longer needed.
</PARA>
<PARA>
</para>
<para>
An implicit close is executed for every open cursor when a
transaction is terminated by <command>COMMIT</command>
or <command>ROLLBACK</command>.
</PARA>
</para>
<REFSECT2 ID="R2-SQL-CLOSE-3">
<REFSECT2INFO>
<DATE>1998-09-08</DATE>
</REFSECT2INFO>
<TITLE>
<refsect2 id="R2-SQL-CLOSE-3">
<refsect2info>
<date>1998-09-08</date>
</refsect2info>
<title>
Notes
</TITLE>
<PARA>
<productname>Postgres</productname> does not have
an explicit <command>OPEN</command> cursor statement;
</title>
<para>
<productname>Postgres</productname> does not have
an explicit <command>OPEN</command> cursor statement;
a cursor is considered open when it is declared.
Use the <command>DECLARE</command> statement to declare a cursor.
</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>
</para>
</refsect2>
</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
Local variables:

View File

@ -1,238 +1,231 @@
<REFENTRY ID="SQL-CLUSTER">
<REFMETA>
<REFENTRYTITLE>
CLUSTER
</REFENTRYTITLE>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO>
</REFMETA>
<REFNAMEDIV>
<REFNAME>
CLUSTER
</REFNAME>
<REFPURPOSE>
Gives storage clustering advice to the backend
</REFPURPOSE>
<refentry id="SQL-CLUSTER">
<refmeta>
<refentrytitle>
CLUSTER
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta>
<refnamediv>
<refname>
CLUSTER
</refname>
<refpurpose>
Gives storage clustering advice to the backend
</refpurpose>
</refnamediv>
<REFSYNOPSISDIV>
<REFSYNOPSISDIVINFO>
<DATE>1998-09-08</DATE>
</REFSYNOPSISDIVINFO>
<SYNOPSIS>
CLUSTER <REPLACEABLE CLASS="PARAMETER">indexname</REPLACEABLE> ON <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE>
</SYNOPSIS>
<REFSECT2 ID="R2-SQL-CLUSTER-1">
<REFSECT2INFO>
<DATE>1998-09-08</DATE>
</REFSECT2INFO>
<TITLE>
Inputs
</TITLE>
<PARA>
</PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
<REPLACEABLE CLASS="PARAMETER">indexname</REPLACEABLE>
</TERM>
<LISTITEM>
<PARA>
The name of an index.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
<REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE>
</TERM>
<LISTITEM>
<PARA>
The name of a table.
</PARA>
</LISTITEM>
</VARLISTENTRY>
</VARIABLELIST>
</REFSECT2>
<REFSECT2 ID="R2-SQL-CLUSTER-2">
<REFSECT2INFO>
<DATE>1998-09-08</DATE>
</REFSECT2INFO>
<TITLE>
Outputs
</TITLE>
<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>
<refsynopsisdiv>
<refsynopsisdivinfo>
<date>1998-09-08</date>
</refsynopsisdivinfo>
<synopsis>
CLUSTER <replaceable class="PARAMETER">indexname</replaceable> ON <replaceable class="PARAMETER">table</replaceable>
</synopsis>
<comment>
This is not documented anywhere. It seems not to be possible to
cluster a table that is inherited.
</comment>
</PARA>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
<returnvalue>ERROR: Relation x does not exist!</returnvalue>
</TERM>
<LISTITEM>
<PARA>
<comment>
The relation complained of was not shown in the error message,
which contained a random string instead of the relation name.
</comment>
</PARA>
</LISTITEM>
</VARLISTENTRY>
</VARIABLELIST>
<refsect2 id="R2-SQL-CLUSTER-1">
<refsect2info>
<date>1998-09-08</date>
</refsect2info>
<title>
Inputs
</title>
<para>
</para>
</REFSECT2>
</REFSYNOPSISDIV>
<REFSECT1 ID="R1-SQL-CLUSTER-1">
<REFSECT1INFO>
<DATE>1998-09-08</DATE>
</REFSECT1INFO>
<TITLE>
Description
</TITLE>
<PARA>
<command>CLUSTER</command> instructs <productname>Postgres</productname>
to cluster the class specified
by <replaceable class="parameter">classname</replaceable> approximately
based on the index specified by
<replaceable class="parameter">indexname</replaceable>. The index must
already have been defined on
<replaceable class="parameter">classname</replaceable>.
</PARA>
<para>
When a class is clustered, it is physically reordered
based on the index information. The clustering is static.
In other words, as the class is updated, the changes are
not clustered. No attempt is made to keep new instances or
updated tuples clustered. If one wishes, one can
recluster manually by issuing the command again.
</para>
<REFSECT2 ID="R2-SQL-CLUSTER-3">
<REFSECT2INFO>
<DATE>1998-09-08</DATE>
</REFSECT2INFO>
<TITLE>
Notes
</TITLE>
<para>
The table is actually copied to a temporary table in index
order, then renamed back to the original name. For this
reason, all grant permissions and other indexes are lost
when clustering is performed.
</para>
<para>
In cases where you are accessing single rows randomly
within a table, the actual order of the data in the heap
table is unimportant. However, if you tend to access some
data more than others, and there is an index that groups
them together, you will benefit from using <command>CLUSTER</command>.
</para>
<para>
Another place <command>CLUSTER</command> is helpful is in cases where you use an
index to pull out several rows from a table. If you are
requesting a range of indexed values from a table, or a
single indexed value that has multiple rows that match,
<command>CLUSTER</command> will help because once the index identifies the
heap page for the first row that matches, all other rows
that match are probably already on the same heap page,
saving disk accesses and speeding up the query.
</para>
<para>
There are two ways to cluster data. The first is with the
<command>CLUSTER</command> command, which reorders the original table with
the ordering of the index you specify. This can be slow
on large tables because the rows are fetched from the heap
in index order, and if the heap table is unordered, the
entries are on random pages, so there is one disk page
retrieved for every row moved. <productname>Postgres</productname> has a cache,
but the majority of a big table will not fit in the cache.
</para>
<para>
Another way to cluster data is to use
<programlisting>
<variablelist>
<varlistentry>
<term><replaceable class="PARAMETER">indexname</replaceable></term>
<listitem>
<para>
The name of an index.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="PARAMETER">table</replaceable></term>
<listitem>
<para>
The name of a table.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect2>
<refsect2 id="R2-SQL-CLUSTER-2">
<refsect2info>
<date>1998-09-08</date>
</refsect2info>
<title>
Outputs
</title>
<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>
This is not documented anywhere. It seems not to be possible to
cluster a table that is inherited.
</comment>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><computeroutput>
ERROR: Relation x does not exist!
</computeroutput></term>
<listitem>
<para>
<comment>
The relation complained of was not shown in the error message,
which contained a random string instead of the relation name.
</comment>
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
</refsynopsisdiv>
<refsect1 id="R1-SQL-CLUSTER-1">
<refsect1info>
<date>1998-09-08</date>
</refsect1info>
<title>
Description
</title>
<para>
<command>CLUSTER</command> instructs <productname>Postgres</productname>
to cluster the class specified
by <replaceable class="parameter">classname</replaceable> approximately
based on the index specified by
<replaceable class="parameter">indexname</replaceable>. The index must
already have been defined on
<replaceable class="parameter">classname</replaceable>.
</para>
<para>
When a class is clustered, it is physically reordered
based on the index information. The clustering is static.
In other words, as the class is updated, the changes are
not clustered. No attempt is made to keep new instances or
updated tuples clustered. If one wishes, one can
recluster manually by issuing the command again.
</para>
<refsect2 id="R2-SQL-CLUSTER-3">
<refsect2info>
<date>1998-09-08</date>
</refsect2info>
<title>
Notes
</title>
<para>
The table is actually copied to a temporary table in index
order, then renamed back to the original name. For this
reason, all grant permissions and other indexes are lost
when clustering is performed.
</para>
<para>
In cases where you are accessing single rows randomly
within a table, the actual order of the data in the heap
table is unimportant. However, if you tend to access some
data more than others, and there is an index that groups
them together, you will benefit from using <command>CLUSTER</command>.
</para>
<para>
Another place <command>CLUSTER</command> is helpful is in cases where you use an
index to pull out several rows from a table. If you are
requesting a range of indexed values from a table, or a
single indexed value that has multiple rows that match,
<command>CLUSTER</command> will help because once the index identifies the
heap page for the first row that matches, all other rows
that match are probably already on the same heap page,
saving disk accesses and speeding up the query.
</para>
<para>
There are two ways to cluster data. The first is with the
<command>CLUSTER</command> command, which reorders the original table with
the ordering of the index you specify. This can be slow
on large tables because the rows are fetched from the heap
in index order, and if the heap table is unordered, the
entries are on random pages, so there is one disk page
retrieved for every row moved. <productname>Postgres</productname> has a cache,
but the majority of a big table will not fit in the cache.
</para>
<para>
Another way to cluster data is to use
<programlisting>
SELECT ... INTO TABLE <replaceable class="parameter">temp</replaceable> FROM ... ORDER BY ...
</programlisting>
This uses the <productname>Postgres</productname> sorting code in
ORDER BY to match the index, and is much faster for
unordered data. You then drop the old table, use
<command>ALTER TABLE/RENAME</command>
to rename <replaceable class="parameter">temp</replaceable> to the old name, and
recreate any indexes. The only problem is that <acronym>OID</acronym>s
will not be preserved. From then on, <command>CLUSTER</command> should be
fast because most of the heap data has already been
ordered, and the existing index is used.
</programlisting>
This uses the <productname>Postgres</productname> sorting code in
ORDER BY to match the index, and is much faster for
unordered data. You then drop the old table, use
<command>ALTER TABLE/RENAME</command>
to rename <replaceable class="parameter">temp</replaceable> to the old name, and
recreate any indexes. The only problem is that <acronym>OID</acronym>s
will not be preserved. From then on, <command>CLUSTER</command> should be
fast because most of the heap data has already been
ordered, and the existing index is used.
</para>
</refsect2>
</refsect1>
<REFSECT1 ID="R1-SQL-CLUSTER-2">
<TITLE>
<refsect1 id="R1-SQL-CLUSTER-2">
<title>
Usage
</TITLE>
<PARA>
</title>
<para>
Cluster the employees relation on the basis of its salary attribute
</PARA>
<ProgramListing>
CLUSTER emp_ind ON emp
</ProgramListing>
</REFSECT1>
<REFSECT1 ID="R1-SQL-CLUSTER-3">
<TITLE>
</para>
<programlisting>
CLUSTER emp_ind ON emp;
</programlisting>
</refsect1>
<refsect1 id="R1-SQL-CLUSTER-3">
<title>
Compatibility
</TITLE>
<PARA>
</PARA>
<REFSECT2 ID="R2-SQL-CLUSTER-4">
<REFSECT2INFO>
<DATE>1998-09-08</DATE>
</REFSECT2INFO>
<TITLE>
</title>
<para>
</para>
<refsect2 id="R2-SQL-CLUSTER-4">
<refsect2info>
<date>1998-09-08</date>
</refsect2info>
<title>
SQL92
</TITLE>
<PARA>
</title>
<para>
There is no <command>CLUSTER</command> statement in SQL92.
</PARA>
</para>
</refsect2>
</refsect1>
</REFENTRY>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-omittag:nil
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t

View File

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

View File

@ -1,176 +1,166 @@
<REFENTRY ID="SQL-COPY">
<REFMETA>
<REFENTRYTITLE>
<refentry id="SQL-COPY">
<refmeta>
<refentrytitle>
COPY
</REFENTRYTITLE>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO>
</REFMETA>
<REFNAMEDIV>
<REFNAME>
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta>
<refnamediv>
<refname>
COPY
</REFNAME>
<REFPURPOSE>
</refname>
<refpurpose>
Copies data between files and tables
</REFPURPOSE>
</refpurpose>
</refnamediv>
<REFSYNOPSISDIV>
<REFSYNOPSISDIVINFO>
<DATE>1998-09-08</DATE>
</REFSYNOPSISDIVINFO>
<SYNOPSIS>
<refsynopsisdiv>
<refsynopsisdivinfo>
<date>1998-09-08</date>
</refsynopsisdivinfo>
<synopsis>
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>' ]
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>' ]
</SYNOPSIS>
</synopsis>
<REFSECT2 ID="R2-SQL-COPY-1">
<REFSECT2INFO>
<DATE>1998-09-08</DATE>
</REFSECT2INFO>
<TITLE>
<refsect2 id="R2-SQL-COPY-1">
<refsect2info>
<date>1998-09-08</date>
</refsect2info>
<title>
Inputs
</TITLE>
<PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
BINARY
</TERM>
<LISTITEM>
<PARA>
Changes the behavior of field formatting, forcing all data to be
stored or read as binary objects rather than as text.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
<replaceable class="parameter">table</replaceable>
</TERM>
<LISTITEM>
<PARA>
The name of an existing table.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
WITH OIDS
</TERM>
<LISTITEM>
<PARA>
Copies the internal unique object id (OID) for each row.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
<replaceable class="parameter">filename</replaceable>
</TERM>
<LISTITEM>
<PARA>
The absolute Unix pathname of the input or output file.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
<filename>stdin</filename>
</TERM>
<LISTITEM>
<PARA>
Specifies that input comes from a pipe or terminal.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
<filename>stdout</filename>
</TERM>
<LISTITEM>
<PARA>
Specifies that output goes to a pipe or terminal.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
<replaceable class="parameter">delimiter</replaceable>
</TERM>
<LISTITEM>
<PARA>
</title>
<para>
<variablelist>
<varlistentry>
<term>BINARY</term>
<listitem>
<para>
Changes the behavior of field formatting, forcing all data to be
stored or read as binary objects rather than as text.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">table</replaceable></term>
<listitem>
<para>
The name of an existing table.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>WITH OIDS</term>
<listitem>
<para>
Copies the internal unique object id (OID) for each row.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">filename</replaceable></term>
<listitem>
<para>
The absolute Unix pathname of the input or output file.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><filename>stdin</filename></term>
<listitem>
<para>
Specifies that input comes from a pipe or terminal.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><filename>stdout</filename></term>
<listitem>
<para>
Specifies that output goes to a pipe or terminal.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">delimiter</replaceable></term>
<listitem>
<para>
A character that delimits the input or output fields.
</PARA>
</LISTITEM>
</VARLISTENTRY>
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</REFSECT2>
</refsect2>
<REFSECT2 ID="R2-SQL-COPY-2">
<REFSECT2INFO>
<DATE>1998-09-08</DATE>
</REFSECT2INFO>
<TITLE>
<refsect2 id="R2-SQL-COPY-2">
<refsect2info>
<date>1998-09-08</date>
</refsect2info>
<title>
Outputs
</TITLE>
<PARA>
</title>
<para>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
<ReturnValue>COPY</ReturnValue>
</TERM>
<LISTITEM>
<PARA>
The copy completed successfully.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
<ReturnValue>ERROR: <replaceable>error message</replaceable></ReturnValue>
</TERM>
<LISTITEM>
<PARA>
<variablelist>
<varlistentry>
<term><computeroutput>
COPY
</computeroutput></term>
<listitem>
<para>
The copy completed successfully.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><computeroutput>
ERROR: <replaceable>error message</replaceable>
</computeroutput></term>
<listitem>
<para>
The copy failed for the reason stated in the error message.
</para>
</listitem>
</varlistentry>
</VARIABLELIST>
</variablelist>
</para>
</REFSECT2>
</REFSYNOPSISDIV>
</refsect2>
</refsynopsisdiv>
<REFSECT1 ID="R1-SQL-COPY-1">
<REFSECT1INFO>
<DATE>1998-09-08</DATE>
</REFSECT1INFO>
<TITLE>
<refsect1 id="R1-SQL-COPY-1">
<refsect1info>
<date>1998-09-08</date>
</refsect1info>
<title>
Description
</TITLE>
</title>
<para>
<command>COPY</command> moves data between
<productname>Postgres</productname> tables and
<productname>Postgres</productname> tables and
standard Unix files.
<command>COPY</command> instructs
the <productname>Postgres</productname> backend
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.
If <filename>stdin</filename> or <filename>stdout</filename> are specified, data flows through the client frontend to
the backend.
</para>
<REFSECT2 ID="R2-SQL-COPY-3">
<REFSECT2INFO>
<DATE>1998-09-08</DATE>
</REFSECT2INFO>
<TITLE>
If <filename>stdin</filename> or <filename>stdout</filename> are
specified, data flows through the client frontend to the backend.
</para>
<refsect2 id="R2-SQL-COPY-3">
<refsect2info>
<date>1998-09-08</date>
</refsect2info>
<title>
Notes
</TITLE>
</title>
<para>
The BINARY keyword will force all data to be
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
or written by <command>COPY</command>.
</para>
<para>
The keyword phrase USING DELIMITERS specifies a single character
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>
</tip>
</para>
</REFSECT2>
</refsect2>
</refsect1>
<refsect1 ID="R1-SQL-COPY-2">
<refsect1 id="R1-SQL-COPY-2">
<refsect1info>
<date>1998-05-04</date>
</refsect1info>
@ -231,9 +222,9 @@ Specifies that output goes to a pipe or terminal.
The actual format for each instance is
<programlisting>
&lt;attr1&gt;&lt;<replaceable class=parameter>separator</replaceable>&gt;&lt;attr2&gt;&lt;<replaceable class=parameter>separator</replaceable>&gt;...&lt;<replaceable class=parameter>separator</replaceable>&gt;&lt;attr<replaceable class="parameter">n</replaceable>&gt;&lt;newline&gt;
</programlisting>
</programlisting>
The oid is placed on the beginning of the line
if WITH OIDS is specified.
if WITH OIDS is specified.
</para>
<para>
If <command>COPY</command> is sending its output to standard
@ -253,7 +244,7 @@ Specifies that output goes to a pipe or terminal.
as a backslash and a tab. A literal newline character is
represented as a backslash and a newline. When loading text data
not generated by <acronym>Postgres</acronym>,
you will need to convert backslash
you will need to convert backslash
characters ("\") to double-backslashes ("\\") to ensure that they are loaded
properly.
</para>
@ -279,20 +270,20 @@ Specifies that output goes to a pipe or terminal.
</para>
<table frame="all">
<title>Contents of a binary copy file</title>
<tgroup cols="2"colsep="1" rowsep="1" align="center">
<COLSPEC COLNAME="col1">
<COLSPEC COLNAME="col2">
<tgroup cols="2" colsep="1" rowsep="1" align="center">
<colspec colname="col1">
<colspec colname="col2">
<spanspec namest="col1" nameend="col2" spanname="subhead">
<tbody>
<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>
<entry>uint32</entry>
<entry>number of tuples</entry>
</row>
<row>
<entry align="center" spanname="subhead">For each tuple</entry>
<entry spanname="subhead" align="center">For each tuple</entry>
</row>
<row>
<entry>uint32</entry>
@ -337,30 +328,30 @@ Specifies that output goes to a pipe or terminal.
</refsect1>
<REFSECT1 ID="R1-SQL-COPY-3">
<TITLE>
<refsect1 id="R1-SQL-COPY-3">
<title>
Usage
</TITLE>
<PARA>
</title>
<para>
The following example copies a table to standard output,
using a vertical bar ("|") as the field
delimiter:
</PARA>
<ProgramListing>
</para>
<programlisting>
COPY country TO <filename>stdout</filename> USING DELIMITERS '|';
</ProgramListing>
<PARA>
</programlisting>
<para>
To copy data from a Unix file into a table "country":
</PARA>
<ProgramListing>
</para>
<programlisting>
COPY country FROM '/usr1/proj/bray/sql/country_data';
</ProgramListing>
<PARA>
</programlisting>
<para>
Here is a sample of data suitable for copying into a table
from <filename>stdin</filename> (so it
has the termination sequence on the last line):
</PARA>
<ProgramListing>
</para>
<programlisting>
AF AFGHANISTAN
AL ALBANIA
DZ ALGERIA
@ -368,8 +359,8 @@ has the termination sequence on the last line):
ZM ZAMBIA
ZW ZIMBABWE
\.
</ProgramListing>
<PARA>
</programlisting>
<para>
The same data, output in binary format on a Linux/i586 machine.
The data is shown after filtering through
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>
field is padded with nulls to four bytes and the text field is
preceded by its length:
</PARA>
<ProgramListing>
</para>
<programlisting>
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
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
\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
</ProgramListing>
</programlisting>
</refsect1>
<refsect1 ID="R1-SQL-COPY-5">
<refsect1 id="R1-SQL-COPY-5">
<title>Bugs and features</title>
<para>
<command>COPY</command> neither invokes rules nor acts on column defaults.
@ -435,31 +426,31 @@ must reside on or be
</para>
</refsect1>
<REFSECT1 ID="R1-SQL-COPY-6">
<TITLE>
<refsect1 id="R1-SQL-COPY-6">
<title>
Compatibility
</TITLE>
<PARA>
</PARA>
</title>
<para>
</para>
<REFSECT2 ID="R2-SQL-COPY-4">
<REFSECT2INFO>
<DATE>1998-09-08</DATE>
</REFSECT2INFO>
<TITLE>
<refsect2 id="R2-SQL-COPY-4">
<refsect2info>
<date>1998-09-08</date>
</refsect2info>
<title>
SQL92
</TITLE>
<PARA>
</title>
<para>
There is no <command>COPY</command> statement in SQL92.
</PARA>
</para>
</refsect2>
</refsect1>
</REFENTRY>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-omittag:nil
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t

View File

@ -1,193 +1,175 @@
<REFENTRY ID="SQL-CREATEAGGREGATE">
<REFMETA>
<REFENTRYTITLE>
<refentry id="SQL-CREATEAGGREGATE">
<refmeta>
<refentrytitle>
CREATE AGGREGATE
</REFENTRYTITLE>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO>
</REFMETA>
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta>
<REFNAMEDIV>
<REFNAME>
<refnamediv>
<refname>
CREATE AGGREGATE
</REFNAME>
<REFPURPOSE>
</refname>
<refpurpose>
Defines a new aggregate function
</REFPURPOSE>
</refpurpose>
</refnamediv>
<REFSYNOPSISDIV>
<REFSYNOPSISDIVINFO>
<DATE>1998-09-09</DATE>
</REFSYNOPSISDIVINFO>
<SYNOPSIS>
CREATE AGGREGATE <REPLACEABLE CLASS="PARAMETER">name</REPLACEABLE> [ AS ]
( BASETYPE = <REPLACEABLE CLASS="PARAMETER">data_type</REPLACEABLE>
[ , SFUNC1 = <REPLACEABLE CLASS="PARAMETER">sfunc1</REPLACEABLE>
, STYPE1 = <REPLACEABLE CLASS="PARAMETER">sfunc1_return_type</REPLACEABLE> ]
[ , SFUNC2 = <REPLACEABLE CLASS="PARAMETER">sfunc2</REPLACEABLE>
, STYPE2 = <REPLACEABLE CLASS="PARAMETER">sfunc2_return_type</REPLACEABLE> ]
[ , FINALFUNC = <REPLACEABLE CLASS="PARAMETER">ffunc</REPLACEABLE> ]
[ , INITCOND1 = <REPLACEABLE CLASS="PARAMETER">initial_condition1</REPLACEABLE> ]
[ , INITCOND2 = <REPLACEABLE CLASS="PARAMETER">initial_condition2</REPLACEABLE> ]
<refsynopsisdiv>
<refsynopsisdivinfo>
<date>1998-09-09</date>
</refsynopsisdivinfo>
<synopsis>
CREATE AGGREGATE <replaceable class="PARAMETER">name</replaceable> [ AS ]
( BASETYPE = <replaceable class="PARAMETER">data_type</replaceable>
[ , SFUNC1 = <replaceable class="PARAMETER">sfunc1</replaceable>
, STYPE1 = <replaceable class="PARAMETER">sfunc1_return_type</replaceable> ]
[ , SFUNC2 = <replaceable class="PARAMETER">sfunc2</replaceable>
, STYPE2 = <replaceable class="PARAMETER">sfunc2_return_type</replaceable> ]
[ , FINALFUNC = <replaceable class="PARAMETER">ffunc</replaceable> ]
[ , INITCOND1 = <replaceable class="PARAMETER">initial_condition1</replaceable> ]
[ , INITCOND2 = <replaceable class="PARAMETER">initial_condition2</replaceable> ]
)
</SYNOPSIS>
</synopsis>
<REFSECT2 ID="R2-SQL-CREATEAGGREGATE-1">
<REFSECT2INFO>
<DATE>1998-09-09</DATE>
</REFSECT2INFO>
<TITLE>
<refsect2 id="R2-SQL-CREATEAGGREGATE-1">
<refsect2info>
<date>1998-09-09</date>
</refsect2info>
<title>
Inputs
</TITLE>
<PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
<REPLACEABLE CLASS="PARAMETER">name</REPLACEABLE>
</TERM>
<LISTITEM>
<para>
The name of an aggregate function to create.
</para>
</LISTITEM>
</varlistentry>
</title>
<para>
<variablelist>
<varlistentry>
<term><replaceable class="PARAMETER">name</replaceable></term>
<listitem>
<para>
The name of an aggregate function to create.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<REPLACEABLE CLASS="PARAMETER">data_type</REPLACEABLE>
</term>
<listitem>
<para>
The fundamental data type on which this aggregate function operates.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="PARAMETER">data_type</replaceable></term>
<listitem>
<para>
The fundamental data type on which this aggregate function operates.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<REPLACEABLE CLASS="PARAMETER">sfunc1</REPLACEABLE>
</term>
<listitem>
<para>
The state transition function
to be called for every non-NULL field from the source column.
It takes a variable of
type <REPLACEABLE CLASS="PARAMETER">sfunc1_return_type</REPLACEABLE> as
the first argument and that field as the
second argument.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="PARAMETER">sfunc1</replaceable></term>
<listitem>
<para>
The state transition function
to be called for every non-NULL field from the source column.
It takes a variable of
type <replaceable class="PARAMETER">sfunc1_return_type</replaceable> as
the first argument and that field as the
second argument.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<REPLACEABLE CLASS="PARAMETER">sfunc1_return_type</REPLACEABLE>
</term>
<listitem>
<para>
The return type of the first transition function.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="PARAMETER">sfunc1_return_type</replaceable></term>
<listitem>
<para>
The return type of the first transition function.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<REPLACEABLE CLASS="PARAMETER">sfunc2</REPLACEABLE>
</term>
<listitem>
<para>
The state transition function
to be called for every non-NULL field from the source column.
It takes a variable
of type <REPLACEABLE CLASS="PARAMETER">sfunc2_return_type</REPLACEABLE>
as the only argument and returns a variable of the same type.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="PARAMETER">sfunc2</replaceable></term>
<listitem>
<para>
The state transition function
to be called for every non-NULL field from the source column.
It takes a variable
of type <replaceable class="PARAMETER">sfunc2_return_type</replaceable>
as the only argument and returns a variable of the same type.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<REPLACEABLE CLASS="PARAMETER">sfunc2_return_type</REPLACEABLE>
</term>
<listitem>
<para>
The return type of the second transition function.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="PARAMETER">sfunc2_return_type</replaceable></term>
<listitem>
<para>
The return type of the second transition function.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<REPLACEABLE CLASS="PARAMETER">ffunc</REPLACEABLE>
</term>
<listitem>
<para>
The final function
called after traversing all input fields. This function must
take two arguments of types
<REPLACEABLE CLASS="PARAMETER">sfunc1_return_type</REPLACEABLE>
and
<REPLACEABLE CLASS="PARAMETER">sfunc2_return_type</REPLACEABLE>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="PARAMETER">ffunc</replaceable></term>
<listitem>
<para>
The final function
called after traversing all input fields. This function must
take two arguments of types
<replaceable class="PARAMETER">sfunc1_return_type</replaceable>
and
<replaceable class="PARAMETER">sfunc2_return_type</replaceable>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<REPLACEABLE CLASS="PARAMETER">initial_condition1</REPLACEABLE>
</term>
<listitem>
<para>
The initial value for the first transition function argument.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="PARAMETER">initial_condition1</replaceable></term>
<listitem>
<para>
The initial value for the first transition function argument.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<REPLACEABLE CLASS="PARAMETER">initial_condition2</REPLACEABLE>
</term>
<listitem>
<para>
The initial value for the second transition function argument.
</para>
</listitem>
<varlistentry>
<term><replaceable class="PARAMETER">initial_condition2</replaceable></term>
<listitem>
<para>
The initial value for the second transition function argument.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</REFSECT2>
<REFSECT2 ID="R2-SQL-CREATEAGGREGATE-2">
<REFSECT2INFO>
<DATE>1998-09-09</DATE>
</REFSECT2INFO>
<TITLE>
</refsect2>
<refsect2 id="R2-SQL-CREATEAGGREGATE-2">
<refsect2info>
<date>1998-09-09</date>
</refsect2info>
<title>
Outputs
</TITLE>
<PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
<ReturnValue>CREATE</ReturnValue>
</TERM>
<LISTITEM>
<PARA>
</title>
<para>
<variablelist>
<varlistentry>
<term><computeroutput>
CREATE
</computeroutput></term>
<listitem>
<para>
Message returned if the command completes successfully.
</para>
</listitem>
</varlistentry>
</VARIABLELIST>
</variablelist>
</para>
</REFSECT2>
</REFSYNOPSISDIV>
<REFSECT1 ID="R1-SQL-CREATEAGGREGATE-1">
<REFSECT1INFO>
<DATE>1998-09-09</DATE>
</REFSECT1INFO>
<TITLE>
</refsect2>
</refsynopsisdiv>
<refsect1 id="R1-SQL-CREATEAGGREGATE-1">
<refsect1info>
<date>1998-09-09</date>
</refsect1info>
<title>
Description
</TITLE>
</title>
<para>
<command>CREATE AGGREGATE</command>
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>
can be used to provide the desired features.
</para>
<PARA>
<para>
An aggregate function can require up to three functions, two
state transition functions,
<REPLACEABLE CLASS="PARAMETER">sfunc1</REPLACEABLE>
and <REPLACEABLE CLASS="PARAMETER">sfunc2</REPLACEABLE>:
<replaceable class="PARAMETER">sfunc1</replaceable>
and <replaceable class="PARAMETER">sfunc2</replaceable>:
<programlisting>
<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">sfunc1</replaceable>( internal-state1, next-data_item ) ---> next-internal-state1 <replaceable class="PARAMETER">sfunc2</replaceable>( internal-state2 ) ---> next-internal-state2
</programlisting>
and a final calculation function,
<REPLACEABLE CLASS="PARAMETER">ffunc</REPLACEABLE>:
<replaceable class="PARAMETER">ffunc</replaceable>:
<programlisting>
<REPLACEABLE CLASS="PARAMETER">ffunc</REPLACEABLE>(internal-state1, internal-state2) ---> aggregate-value
<replaceable class="PARAMETER">ffunc</replaceable>(internal-state1, internal-state2) ---> aggregate-value
</programlisting>
</para>
<para>
<productname>Postgres</productname> creates up to two temporary variables
(referred to here as <REPLACEABLE CLASS="PARAMETER">temp1</REPLACEABLE>
and <REPLACEABLE CLASS="PARAMETER">temp2</REPLACEABLE>)
(referred to here as <replaceable class="PARAMETER">temp1</replaceable>
and <replaceable class="PARAMETER">temp2</replaceable>)
to hold intermediate results used as arguments to the transition functions.
</para>
<para>
@ -225,42 +206,42 @@ The initial value for the second transition function argument.
<listitem>
<para>
The arguments to
<REPLACEABLE CLASS="PARAMETER">sfunc1</REPLACEABLE>
<replaceable class="PARAMETER">sfunc1</replaceable>
must be
<REPLACEABLE CLASS="PARAMETER">temp1</REPLACEABLE>
<replaceable class="PARAMETER">temp1</replaceable>
of type
<REPLACEABLE CLASS="PARAMETER">sfunc1_return_type</REPLACEABLE>
<replaceable class="PARAMETER">sfunc1_return_type</replaceable>
and
<REPLACEABLE CLASS="PARAMETER">column_value</REPLACEABLE>
of type <REPLACEABLE CLASS="PARAMETER">data_type</REPLACEABLE>.
<replaceable class="PARAMETER">column_value</replaceable>
of type <replaceable class="PARAMETER">data_type</replaceable>.
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
<REPLACEABLE CLASS="PARAMETER">sfunc1</REPLACEABLE>.
<replaceable class="PARAMETER">sfunc1</replaceable>.
</para>
</listitem>
<listitem>
<para>
The argument and return value of
<REPLACEABLE CLASS="PARAMETER">sfunc2</REPLACEABLE>
<replaceable class="PARAMETER">sfunc2</replaceable>
must be
<REPLACEABLE CLASS="PARAMETER">temp2</REPLACEABLE>
<replaceable class="PARAMETER">temp2</replaceable>
of type
<REPLACEABLE CLASS="PARAMETER">sfunc2_return_type</REPLACEABLE>.
<replaceable class="PARAMETER">sfunc2_return_type</replaceable>.
</para>
</listitem>
<listitem>
<para>
The arguments to the final-calculation-function
must be
<REPLACEABLE CLASS="PARAMETER">temp1</REPLACEABLE>
<replaceable class="PARAMETER">temp1</replaceable>
and
<REPLACEABLE CLASS="PARAMETER">temp2</REPLACEABLE>
<replaceable class="PARAMETER">temp2</replaceable>
and its return value must
be a <productname>Postgres</productname>
base type (not necessarily
<REPLACEABLE CLASS="PARAMETER">data_type</REPLACEABLE>
<replaceable class="PARAMETER">data_type</replaceable>
which had been specified for BASETYPE).
</para>
</listitem>
@ -269,10 +250,9 @@ The initial value for the second transition function argument.
FINALFUNC should be specified
if and only if both state-transition functions are
specified.
</para
</listitem>
</para></listitem>
</itemizedlist>
</PARA>
</para>
<para>
An aggregate function may also require one or two initial conditions,
@ -281,72 +261,72 @@ The initial value for the second transition function argument.
in the database as fields of type <type>text</type>.
</para>
<REFSECT2 ID="R2-SQL-CREATEAGGREGATE-3">
<REFSECT2INFO>
<DATE>1998-09-09</DATE>
</REFSECT2INFO>
<TITLE>
<refsect2 id="R2-SQL-CREATEAGGREGATE-3">
<refsect2info>
<date>1998-09-09</date>
</refsect2info>
<title>
Notes
</TITLE>
</title>
<para>
Use <command>DROP AGGREGATE</command>
to drop aggregate functions.
to drop aggregate functions.
</para>
<para>
It is possible to specify aggregate functions
that have varying combinations of state and final functions.
For example, the <function>count</function> aggregate requires SFUNC2
(an incrementing function) but not SFUNC1 or FINALFUNC,
whereas the <function>sum</function> aggregate requires SFUNC1 (an addition
function) but not SFUNC2 or FINALFUNC and the <function>avg</function>
aggregate requires
both of the above state functions as
well as a FINALFUNC (a division function) to produce its
answer. In any case, at least one state function must be
defined, and any SFUNC2 must have a corresponding INITCOND2.
<para>
It is possible to specify aggregate functions
that have varying combinations of state and final functions.
For example, the <function>count</function> aggregate requires SFUNC2
(an incrementing function) but not SFUNC1 or FINALFUNC,
whereas the <function>sum</function> aggregate requires SFUNC1 (an addition
function) but not SFUNC2 or FINALFUNC and the <function>avg</function>
aggregate requires
both of the above state functions as
well as a FINALFUNC (a division function) to produce its
answer. In any case, at least one state function must be
defined, and any SFUNC2 must have a corresponding INITCOND2.
</para>
</REFSECT2>
</refsect2>
</refsect1>
<REFSECT1 ID="R1-SQL-CREATEAGGREGATE-2">
<TITLE>
<refsect1 id="R1-SQL-CREATEAGGREGATE-2">
<title>
Usage
</TITLE>
<PARA>
</title>
<para>
Refer to the chapter on aggregate functions
in the <citetitle>PostgreSQL Programmer's Guide</citetitle>
on aggregate functions for
complete examples of usage.
</para>
</REFSECT1>
<REFSECT1 ID="R1-SQL-CREATEAGGREGATE-3">
<TITLE>
</refsect1>
<refsect1 id="R1-SQL-CREATEAGGREGATE-3">
<title>
Compatibility
</TITLE>
<REFSECT2 ID="R2-SQL-CREATEAGGREGATE-4">
<REFSECT2INFO>
<DATE>1998-09-09</DATE>
</REFSECT2INFO>
<TITLE>
</title>
<refsect2 id="R2-SQL-CREATEAGGREGATE-4">
<refsect2info>
<date>1998-09-09</date>
</refsect2info>
<title>
SQL92
</TITLE>
<PARA>
</title>
<para>
<command>CREATE AGGREGATE</command>
is a <productname>Postgres</productname> language extension.
There is no <command>CREATE AGGREGATE</command> in SQL92.
</PARA>
</para>
</refsect2>
</refsect1>
</REFENTRY>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-omittag:nil
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t

View File

@ -1,157 +1,155 @@
<REFENTRY ID="SQL-CREATEDATABASE">
<REFMETA>
<REFENTRYTITLE>
<refentry id="SQL-CREATEDATABASE">
<refmeta>
<refentrytitle>
CREATE DATABASE
</REFENTRYTITLE>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO>
</REFMETA>
<REFNAMEDIV>
<REFNAME>
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta>
<refnamediv>
<refname>
CREATE DATABASE
</REFNAME>
<REFPURPOSE>
</refname>
<refpurpose>
Creates a new database
</REFPURPOSE>
</refpurpose>
</refnamediv>
<REFSYNOPSISDIV>
<REFSYNOPSISDIVINFO>
<DATE>1998-04-15</DATE>
</REFSYNOPSISDIVINFO>
<SYNOPSIS>
CREATE DATABASE <REPLACEABLE CLASS="PARAMETER">name</REPLACEABLE> [ WITH LOCATION = '<replaceable class="parameter">dbpath</replaceable>' ]
</SYNOPSIS>
<REFSECT2 ID="R2-SQL-CREATEDATABASE-1">
<REFSECT2INFO>
<DATE>1998-04-15</DATE>
</REFSECT2INFO>
<TITLE>
Inputs
</TITLE>
<PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
<replaceable class="parameter">name</replaceable>
</TERM>
<LISTITEM>
<PARA>
The name of a database to create.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
<replaceable class="parameter">dbpath</replaceable>
</TERM>
<LISTITEM>
<PARA>
An alternate location can be specified as either an
environment variable known to the backend server
(e.g. '<envar>PGDATA2</envar>') or as an absolute path name
(e.g. '<filename>/usr/local/pgsql/data</filename>').
In either case, the location must be pre-configured
by <command>initlocation</command>.
</PARA>
</LISTITEM>
</VARLISTENTRY>
</VARIABLELIST>
</para>
</REFSECT2>
<REFSECT2 ID="R2-SQL-CREATEDATABASE-2">
<REFSECT2INFO>
<DATE>1998-04-15</DATE>
</REFSECT2INFO>
<TITLE>
Outputs
</TITLE>
<PARA>
<refsynopsisdiv>
<refsynopsisdivinfo>
<date>1998-04-15</date>
</refsynopsisdivinfo>
<synopsis>
CREATE DATABASE <replaceable class="PARAMETER">name</replaceable> [ WITH LOCATION = '<replaceable class="parameter">dbpath</replaceable>' ]
</synopsis>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
<ReturnValue>CREATEDB</ReturnValue>
</TERM>
<LISTITEM>
<PARA>
Message returned if the command completes successfully.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
<ReturnValue>WARN: createdb: database "<replaceable class="parameter">name</replaceable>" already exists.</ReturnValue>
</TERM>
<LISTITEM>
<PARA>
This occurs if <replaceable class="parameter">database</replaceable> specified already exists.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
<ReturnValue>ERROR: Unable to create database directory <replaceable class="parameter">directory</replaceable>
</ReturnValue>
</TERM>
<LISTITEM>
<PARA>
<refsect2 id="R2-SQL-CREATEDATABASE-1">
<refsect2info>
<date>1998-04-15</date>
</refsect2info>
<title>
Inputs
</title>
<para>
<variablelist>
<varlistentry>
<term><replaceable class="parameter">name</replaceable></term>
<listitem>
<para>
The name of a database to create.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">dbpath</replaceable></term>
<listitem>
<para>
An alternate location can be specified as either an
environment variable known to the backend server
(e.g. '<envar>PGDATA2</envar>') or as an absolute path name
(e.g. '<filename>/usr/local/pgsql/data</filename>').
In either case, the location must be pre-configured
by <command>initlocation</command>.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
<refsect2 id="R2-SQL-CREATEDATABASE-2">
<refsect2info>
<date>1998-04-15</date>
</refsect2info>
<title>
Outputs
</title>
<para>
<variablelist>
<varlistentry>
<term><computeroutput>
CREATEDB
</computeroutput></term>
<listitem>
<para>
Message returned if the command completes successfully.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><computeroutput>
WARN: createdb: database "<replaceable class="parameter">name</replaceable>" already exists.
</computeroutput></term>
<listitem>
<para>
This occurs if <replaceable class="parameter">database</replaceable> specified already exists.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><computeroutput>
ERROR: Unable to create database directory <replaceable class="parameter">directory</replaceable>
</computeroutput></term>
<listitem>
<para>
There was a problem with creating the required directory; this operation will
need permissions for the <literal>postgres</literal> user on the specified location.
</para>
</listitem>
</varlistentry>
</VARIABLELIST>
</variablelist>
</para>
</REFSECT2>
</REFSYNOPSISDIV>
<REFSECT1 ID="R1-SQL-CREATEDATABASE-1">
<REFSECT1INFO>
<DATE>1998-04-15</DATE>
</REFSECT1INFO>
<TITLE>
</refsect2>
</refsynopsisdiv>
<refsect1 id="R1-SQL-CREATEDATABASE-1">
<refsect1info>
<date>1998-04-15</date>
</refsect1info>
<title>
Description
</TITLE>
<PARA>
</title>
<para>
<command>CREATE DATABASE</command> creates a new Postgres database.
The creator becomes the administrator of the new database.
</PARA>
<REFSECT2 ID="R2-SQL-CREATEDATABASE-3">
<REFSECT2INFO>
<DATE>1998-04-15</DATE>
</REFSECT2INFO>
<TITLE>
</para>
<refsect2 id="R2-SQL-CREATEDATABASE-3">
<refsect2info>
<date>1998-04-15</date>
</refsect2info>
<title>
Notes
</TITLE>
<PARA>
</title>
<para>
<command>CREATE DATABASE</command> is a <productname>Postgres</productname>
language extension.
</PARA>
language extension.
</para>
<para>
Use <command>DROP DATABASE</command> to remove a database.
</para>
</REFSECT2>
</refsect2>
</refsect1>
<REFSECT1 ID="R1-SQL-CREATEDATABASE-2">
<TITLE>
<refsect1 id="R1-SQL-CREATEDATABASE-2">
<title>
Usage
</TITLE>
<PARA>
</title>
<para>
To create a new database:
</PARA>
<ProgramListing>
<prompt>olly=></prompt> <userinput>create database lusiadas;</userinput>
</ProgramListing>
<PARA>
<programlisting>
<prompt>olly=></prompt> <userinput>create database lusiadas;</userinput>
</programlisting>
</para>
<para>
To create a new database in an alternate area <filename>~/private_db</filename>:
</PARA>
<ProgramListing>
<prompt>$</prompt> <userinput>mkdir private_db</userinput>
<prompt>$</prompt> <userinput>initlocation ~/private_db</userinput>
<computeroutput>Creating Postgres database system directory /home/olly/private_db/base</computeroutput>
<programlisting>
<prompt>$</prompt> <userinput>mkdir private_db</userinput>
<prompt>$</prompt> <userinput>initlocation ~/private_db</userinput>
<computeroutput>Creating Postgres database system directory /home/olly/private_db/base</computeroutput>
<prompt>$</prompt> <userinput>psql olly</userinput>
<computeroutput>Welcome to the POSTGRESQL interactive sql monitor:
@ -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>
<computeroutput>CREATEDB</computeroutput>
</ProgramListing>
</REFSECT1>
<REFSECT1 ID="R1-SQL-CREATEDATABASE-3">
<TITLE>
</programlisting>
</para>
</refsect1>
<refsect1 id="R1-SQL-CREATEDATABASE-3">
<title>
Bugs
</TITLE>
<PARA>
</title>
<para>
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
only an environment variable known to the backend may be
specified for an alternate location.
See the Administrator's Guide for more information.
</PARA>
only an environment variable known to the backend may be
specified for an alternate location.
See the Administrator's Guide for more information.
</para>
</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...
-->
<REFSECT1 ID="R1-SQL-CREATEDATABASE-4">
<TITLE>
<refsect1 id="R1-SQL-CREATEDATABASE-4">
<title>
Compatibility
</TITLE>
<REFSECT2 ID="R2-SQL-CREATEDATABASE-4">
<REFSECT2INFO>
<DATE>1998-04-15</DATE>
</REFSECT2INFO>
<TITLE>
</title>
<refsect2 id="R2-SQL-CREATEDATABASE-4">
<refsect2info>
<date>1998-04-15</date>
</refsect2info>
<title>
SQL92
</TITLE>
<PARA>
</title>
<para>
There is no <command>CREATE DATABASE</command> statement in SQL92.
</PARA>
</para>
<para>
The equivalent command in standard SQL is <command>CREATE SCHEMA</command>.
</para>
</refsect2>
</refsect1>
</REFENTRY>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-omittag:nil
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t

View File

@ -32,41 +32,34 @@ CREATE FUNCTION <replaceable class="parameter">name</replaceable> ( [ <replaceab
Inputs
</title>
<para>
<variablelist>
<varlistentry>
<term>
<replaceable class="parameter">name</replaceable>
</term>
<listitem>
<para>
The name of a function to create.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<replaceable class="parameter">ftype</replaceable>
</term>
<listitem>
<para>
The data type of function arguments.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<replaceable class="parameter">rtype</replaceable>
</term>
<listitem>
<para>
The return data type.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<replaceable class="parameter">definition</replaceable>
</term>
<variablelist>
<varlistentry>
<term><replaceable class="parameter">name</replaceable></term>
<listitem>
<para>
The name of a function to create.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">ftype</replaceable></term>
<listitem>
<para>
The data type of function arguments.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">rtype</replaceable></term>
<listitem>
<para>
The return data type.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">definition</replaceable></term>
<listitem>
<para>
A string defining the function; the meaning depends on the language.
@ -76,9 +69,7 @@ CREATE FUNCTION <replaceable class="parameter">name</replaceable> ( [ <replaceab
</listitem>
</varlistentry>
<varlistentry>
<term>
<replaceable class="parameter">langname</replaceable>
</term>
<term><replaceable class="parameter">langname</replaceable></term>
<listitem>
<para>
may be '<literal>C</literal>', '<literal>sql</literal>',
@ -93,7 +84,7 @@ CREATE FUNCTION <replaceable class="parameter">name</replaceable> ( [ <replaceab
</variablelist>
</para>
</refsect2>
<refsect2 id="R2-SQL-CREATEFUNCTION-2">
<refsect2info>
<date>1998-09-09</date>
@ -102,12 +93,12 @@ CREATE FUNCTION <replaceable class="parameter">name</replaceable> ( [ <replaceab
Outputs
</title>
<para>
<variablelist>
<varlistentry>
<term>
<returnvalue>CREATE</returnvalue>
</term>
<term><computeroutput>
CREATE
</computeroutput></term>
<listitem>
<para>
This is returned if the command completes successfully.
@ -118,7 +109,7 @@ CREATE FUNCTION <replaceable class="parameter">name</replaceable> ( [ <replaceab
</para>
</refsect2>
</refsynopsisdiv>
<refsect1 id="R1-SQL-CREATEFUNCTION-1">
<refsect1info>
<date>1998-09-09</date>
@ -188,20 +179,21 @@ in the <citetitle>PostgreSQL Programmer's Guide</citetitle>
</title>
<para>
To create a simple SQL function:
</para>
<programlisting>
CREATE FUNCTION one() RETURNS int4
AS 'SELECT 1 AS RESULT'
LANGUAGE 'sql';
SELECT one() AS answer;
CREATE FUNCTION one() RETURNS int4
AS 'SELECT 1 AS RESULT'
LANGUAGE 'sql';
SELECT one() AS answer;
<computeroutput>
answer
------
1
</computeroutput>
</programlisting>
</para>
<para>
To create a C function, calling a routine from a user-created
shared library. This particular routine calculates a check
@ -210,16 +202,16 @@ in the <citetitle>PostgreSQL Programmer's Guide</citetitle>
</para>
<programlisting>
<userinput>
CREATE FUNCTION ean_checkdigit(bpchar, bpchar) RETURNS bool
AS '/usr1/proj/bray/sql/funcs.so' LANGUAGE 'c';
CREATE FUNCTION ean_checkdigit(bpchar, bpchar) RETURNS bool
AS '/usr1/proj/bray/sql/funcs.so' LANGUAGE 'c';
CREATE TABLE product (
CREATE TABLE product (
id char(8) PRIMARY KEY,
eanprefix char(8) CHECK (eanprefix ~ '[0-9]{2}-[0-9]{5}')
REFERENCES brandname(ean_prefix),
eancode char(6) CHECK (eancode ~ '[0-9]{6}'),
CONSTRAINT ean CHECK (ean_checkdigit(eanprefix, eancode))
);
);
</userinput>
</programlisting>
</refsect1>
@ -232,16 +224,16 @@ in the <citetitle>PostgreSQL Programmer's Guide</citetitle>
A C function cannot return a set of values.
</para>
</refsect1>
<refsect1 id="R1-SQL-CREATEFUNCTION-4">
<title>
Compatibility
</title>
<para>
<command>CREATE FUNCTION</command> is
a <productname>Postgres</productname> language extension.
<para>
<command>CREATE FUNCTION</command> is
a <productname>Postgres</productname> language extension.
</para>
<refsect2 id="R2-SQL-CREATEFUNCTION-4">
<refsect2info>
<date>1998-09-09</date>
@ -251,27 +243,26 @@ in the <citetitle>PostgreSQL Programmer's Guide</citetitle>
</title>
<para>
<note>
<note>
<para>
PSM stands for Persistent Stored Modules. It is a procedural
language and it was originally hoped that PSM would be ratified
as an official standard by late 1996. As of mid-1998, this
has not yet happened, but it is hoped that PSM will
has not yet happened, but it is hoped that PSM will
eventually become a standard.
</para>
</note>
</note>
SQL/PSM <command>CREATE FUNCTION</command> has the following syntax:
<synopsis>
SQL/PSM <command>CREATE FUNCTION</command> has the following syntax:
<synopsis>
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> [, ...] ] )
RETURNS <replaceable class="parameter">rtype</replaceable>
LANGUAGE '<replaceable class="parameter">langname</replaceable>'
ESPECIFIC <replaceable class="parameter">routine</replaceable>
<replaceable class="parameter">SQL-statement</replaceable>
</synopsis>
</synopsis>
</para>
</refsect2>
</refsect1>

View File

@ -1,133 +1,124 @@
<REFENTRY ID="SQL-CREATEINDEX">
<REFMETA>
<REFENTRYTITLE>
<refentry id="SQL-CREATEINDEX">
<refmeta>
<refentrytitle>
CREATE INDEX
</REFENTRYTITLE>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO>
</REFMETA>
<REFNAMEDIV>
<REFNAME>
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta>
<refnamediv>
<refname>
CREATE INDEX
</REFNAME>
<REFPURPOSE>
</refname>
<refpurpose>
Constructs a secondary index
</REFPURPOSE>
</refpurpose>
</refnamediv>
<REFSYNOPSISDIV>
<REFSYNOPSISDIVINFO>
<DATE>1998-09-09</DATE>
</REFSYNOPSISDIVINFO>
<SYNOPSIS>
<refsynopsisdiv>
<refsynopsisdivinfo>
<date>1998-09-09</date>
</refsynopsisdivinfo>
<synopsis>
CREATE [ UNIQUE ] INDEX <replaceable class="parameter">index_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>] [, ...] )
CREATE [ UNIQUE ] INDEX <replaceable class="parameter">index_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> )
</SYNOPSIS>
<REFSECT2 ID="R2-SQL-CREATEINDEX-1">
<REFSECT2INFO>
<DATE>1998-09-09</DATE>
</REFSECT2INFO>
<TITLE>
( <replaceable class="parameter">func_name</replaceable>( <replaceable class="parameter">r">col</replaceable>le> [, ... ]) <replaceable class="parameter">ops_name</replaceable> )
</synopsis>
<refsect2 id="R2-SQL-CREATEINDEX-1">
<refsect2info>
<date>1998-09-09</date>
</refsect2info>
<title>
Inputs
</TITLE>
<PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
UNIQUE
</TERM>
<LISTITEM>
<PARA>
Causes the system to check for
duplicate values in the table when the index is created (if data
already exist) and each time data is added. Attempts to
insert or update non-duplicate data will generate an
error.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
<replaceable class="parameter">index_name</replaceable>
</TERM>
<LISTITEM>
<PARA>
The name of the index to be created.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
<replaceable class="parameter">table</replaceable>
</TERM>
<LISTITEM>
<PARA>
The name of the table to be indexed.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
<replaceable class="parameter">acc_name</replaceable>
</TERM>
<LISTITEM>
<PARA>
the name of the access method which is to be used for
the index. The default access method is BTREE.
Postgres provides three access methods for secondary indexes:
<variablelist>
<varlistentry>
<term>BTREE</term>
<listitem>
<para>
an implementation of the Lehman-Yao
high-concurrency btrees.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>RTREE</term>
<listitem>
<para>implements standard rtrees using Guttman's
quadratic split algorithm.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>HASH</term>
<listitem>
<para>
an implementation of Litwin's linear hashing.
</para>
</listitem>
</varlistentry>
</variablelist>
</PARA>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
<replaceable class="parameter">column</replaceable>
</TERM>
<LISTITEM>
<PARA>
The name of a column of the table.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
<replaceable class="parameter">ops_name</replaceable>
</TERM>
<LISTITEM>
<PARA>
An associated operator class.
The following select list returns all ops_names:
<programlisting>
</title>
<para>
<variablelist>
<varlistentry>
<term>UNIQUE</term>
<listitem>
<para>
Causes the system to check for
duplicate values in the table when the index is created (if data
already exist) and each time data is added. Attempts to
insert or update non-duplicate data will generate an
error.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">index_name</replaceable></term>
<listitem>
<para>
The name of the index to be created.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">table</replaceable></term>
<listitem>
<para>
The name of the table to be indexed.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">acc_name</replaceable></term>
<listitem>
<para>
the name of the access method which is to be used for
the index. The default access method is BTREE.
Postgres provides three access methods for secondary indexes:
<variablelist>
<varlistentry>
<term>BTREE</term>
<listitem>
<para>
an implementation of the Lehman-Yao
high-concurrency btrees.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>RTREE</term>
<listitem>
<para>implements standard rtrees using Guttman's
quadratic split algorithm.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>HASH</term>
<listitem>
<para>
an implementation of Litwin's linear hashing.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">column</replaceable></term>
<listitem>
<para>
The name of a column of the table.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">ops_name</replaceable></term>
<listitem>
<para>
An associated operator class.
The following select list returns all ops_names:
<programlisting>
SELECT am.amname AS acc_name,
opc.opcname AS ops_name,
opr.oprname AS ops_comp
@ -137,75 +128,72 @@ SELECT am.amname AS acc_name,
amop.amopclaid = opc.oid AND
amop.amopopr = opr.oid
ORDER BY acc_name, ops_name, ops_comp
</programlisting>
</PARA>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
<replaceable class="parameter">func_name</replaceable>
</TERM>
<LISTITEM>
<PARA>
</programlisting>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">func_name</replaceable></term>
<listitem>
<para>
A user-defined function, which returns a value that can
be indexed.
</PARA>
</LISTITEM>
</VARLISTENTRY>
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</REFSECT2>
<REFSECT2 ID="R2-SQL-CREATEINDEX-2">
<REFSECT2INFO>
<DATE>1998-09-09</DATE>
</REFSECT2INFO>
<TITLE>
</refsect2>
<refsect2 id="R2-SQL-CREATEINDEX-2">
<refsect2info>
<date>1998-09-09</date>
</refsect2info>
<title>
Outputs
</TITLE>
<PARA>
</title>
<para>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
<ReturnValue>CREATE</ReturnValue>
</TERM>
<LISTITEM>
<PARA>
The message returned if the index is successfully created.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<variablelist>
<varlistentry>
<term><computeroutput>
CREATE
</computeroutput></term>
<listitem>
<para>
The message returned if the index is successfully created.
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
<ReturnValue>ERROR: Cannot create index: 'index_name' already exists.</ReturnValue>
</TERM>
<LISTITEM>
<PARA>
<varlistentry>
<term><computeroutput>
ERROR: Cannot create index: 'index_name' already exists.
</computeroutput></term>
<listitem>
<para>
This error occurs if it is impossible to create the index.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</REFSECT2>
</REFSYNOPSISDIV>
<REFSECT1 ID="R1-SQL-CREATEINDEX-1">
<REFSECT1INFO>
<DATE>1998-09-09</DATE>
</REFSECT1INFO>
<TITLE>
</refsect2>
</refsynopsisdiv>
<refsect1 id="R1-SQL-CREATEINDEX-1">
<refsect1info>
<date>1998-09-09</date>
</refsect1info>
<title>
Description
</TITLE>
<PARA>
</title>
<para>
<command>CREATE INDEX</command> constructs an index
<replaceable class="parameter">index_name</replaceable>.
on the specified
<replaceable class="parameter">table</replaceable>.
<tip>
<para>
Indexes are primarily used to enhance database performance.
@ -225,45 +213,45 @@ SELECT am.amname AS acc_name,
operator class is the appropriate operator class for that
field type.
</para>
<para>
In the second syntax, an index is defined
on the result of a user-defined function
<replaceable class="parameter">func_name</replaceable> applied
to one or more attributes of a single class. These functional
indexes can be used to obtain fast access to data
based on operators that would normally require some
transformation to apply them to the base data.
</para>
<REFSECT2 ID="R2-SQL-CREATEINDEX-3">
<REFSECT2INFO>
<DATE>1998-09-09</DATE>
</REFSECT2INFO>
<TITLE>
<para>
In the second syntax, an index is defined
on the result of a user-defined function
<replaceable class="parameter">func_name</replaceable> applied
to one or more attributes of a single class. These functional
indexes can be used to obtain fast access to data
based on operators that would normally require some
transformation to apply them to the base data.
</para>
<refsect2 id="R2-SQL-CREATEINDEX-3">
<refsect2info>
<date>1998-09-09</date>
</refsect2info>
<title>
Notes
</TITLE>
<PARA>
</title>
<para>
Currently, only the BTREE access method supports multi-column
indexes. Up to 7 keys may be specified.
</PARA>
</para>
<para>
Use <command>DROP INDEX</command>
to remove an index.
</para>
</REFSECT2>
</refsect2>
</refsect1>
<REFSECT1 ID="R1-SQL-CREATEINDEX-2">
<TITLE>
<refsect1 id="R1-SQL-CREATEINDEX-2">
<title>
Usage
</TITLE>
<PARA>To create a btree index on the field <literal>title</literal>
</title>
<para>To create a btree index on the field <literal>title</literal>
in the table <literal>films</literal>:
</PARA>
<ProgramListing>
</para>
<programlisting>
CREATE UNIQUE INDEX title_idx
ON films (title);
</ProgramListing>
</programlisting>
<!--
<comment>
@ -282,37 +270,36 @@ SELECT * FROM points
</programlisting>
-->
</REFSECT1>
</refsect1>
<REFSECT1 ID="R1-SQL-CREATEINDEX-3">
<TITLE>
<refsect1 id="R1-SQL-CREATEINDEX-3">
<title>
Compatibility
</TITLE>
<PARA>
</PARA>
</title>
<para>
</para>
<REFSECT2 ID="R2-SQL-CREATEINDEX-4">
<REFSECT2INFO>
<DATE>1998-09-09</DATE>
</REFSECT2INFO>
<TITLE>
<refsect2 id="R2-SQL-CREATEINDEX-4">
<refsect2info>
<date>1998-09-09</date>
</refsect2info>
<title>
SQL92
</TITLE>
<PARA>
</title>
<para>
CREATE INDEX is a <productname>Postgres</productname> language extension.
</PARA>
</para>
<para>
There is no <command>CREATE INDEX</command> command in SQL92.
</para>
</refsect2>
</refsect1>
</REFENTRY>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-omittag:nil
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t

View File

@ -1,87 +1,80 @@
<REFENTRY ID="SQL-CREATELANGUAGE">
<REFMETA>
<REFENTRYTITLE>
<refentry id="SQL-CREATELANGUAGE">
<refmeta>
<refentrytitle>
CREATE LANGUAGE
</REFENTRYTITLE>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO>
</REFMETA>
<REFNAMEDIV>
<REFNAME>
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta>
<refnamediv>
<refname>
CREATE LANGUAGE
</REFNAME>
<REFPURPOSE>
</refname>
<refpurpose>
Defines a new language for functions
</REFPURPOSE>
</refpurpose>
</refnamediv>
<REFSYNOPSISDIV>
<REFSYNOPSISDIVINFO>
<DATE>1998-09-09</DATE>
</REFSYNOPSISDIVINFO>
<SYNOPSIS>
<refsynopsisdiv>
<refsynopsisdivinfo>
<date>1998-09-09</date>
</refsynopsisdivinfo>
<synopsis>
CREATE [ TRUSTED ] PROCEDURAL LANGUAGE '<replaceable class="parameter">langname</replaceable>'
HANDLER <replaceable class="parameter">call_handler</replaceable>
LANCOMPILER '<replaceable class="parameter">comment</replaceable>'
</SYNOPSIS>
</synopsis>
<REFSECT2 ID="R2-SQL-CREATELANGUAGE-1">
<REFSECT2INFO>
<DATE>1998-09-09</DATE>
</REFSECT2INFO>
<TITLE>
<refsect2 id="R2-SQL-CREATELANGUAGE-1">
<refsect2info>
<date>1998-09-09</date>
</refsect2info>
<title>
Inputs
</TITLE>
<PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
<function>TRUSTED</function>
</TERM>
<LISTITEM>
<PARA>
<function> TRUSTED</function> specifies that the call handler for
the language is safe; that is, it offers an unprivileged user
no functionality to bypass access restrictions. If
this keyword is omitted when registering the language,
only users with the <productname>Postgres</productname>
superuser privilege can use
this language to create new functions
(like the 'C' language).
</PARA>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
<replaceable class="parameter">langname</replaceable>
</TERM>
<LISTITEM>
<PARA>
The name of the new procedural language.
The language name is case insensitive. A procedural
language cannot override one of the built-in languages of
<productname>Postgres</productname>.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
HANDLER <replaceable class="parameter">call_handler</replaceable>
</TERM>
<LISTITEM>
<PARA>
<replaceable class="parameter">call_handler</replaceable> is the name
of a previously
registered function that will be called to execute the PL
procedures.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
<replaceable class="parameter">comment</replaceable>
</TERM>
<LISTITEM>
<PARA>
</title>
<para>
<variablelist>
<varlistentry>
<term>TRUSTED</term>
<listitem>
<para>
<function> TRUSTED</function> specifies that the call handler for
the language is safe; that is, it offers an unprivileged user
no functionality to bypass access restrictions. If
this keyword is omitted when registering the language,
only users with the <productname>Postgres</productname>
superuser privilege can use
this language to create new functions
(like the 'C' language).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">langname</replaceable></term>
<listitem>
<para>
The name of the new procedural language.
The language name is case insensitive. A procedural
language cannot override one of the built-in languages of
<productname>Postgres</productname>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>HANDLER <replaceable class="parameter">call_handler</replaceable></term>
<listitem>
<para>
<replaceable class="parameter">call_handler</replaceable> is the name
of a previously
registered function that will be called to execute the PL
procedures.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">comment</replaceable></term>
<listitem>
<para>
The <function>LANCOMPILER</function> argument is the
string that will be
inserted in the <literal>LANCOMPILER</literal> attribute
@ -89,81 +82,82 @@ superuser privilege can use
<filename>pg_language</filename> entry. At present,
<productname>Postgres</productname> does not use
this attribute in any way.
</PARA>
</LISTITEM>
</VARLISTENTRY>
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</REFSECT2>
</refsect2>
<REFSECT2 ID="R2-SQL-CREATELANGUAGE-2">
<REFSECT2INFO>
<DATE>1998-09-09</DATE>
</REFSECT2INFO>
<TITLE>
<refsect2 id="R2-SQL-CREATELANGUAGE-2">
<refsect2info>
<date>1998-09-09</date>
</refsect2info>
<title>
Outputs
</TITLE>
<PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
<ReturnValue>CREATE</ReturnValue>
</TERM>
<LISTITEM>
<PARA>
This message is returned if the language is successfully
created.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
<ReturnValue>ERROR: PL handler function <replaceable class="parameter">funcname</replaceable>() doesn't exist</ReturnValue>
</TERM>
<LISTITEM>
<PARA>
</title>
<para>
<variablelist>
<varlistentry>
<term><computeroutput>
CREATE
</computeroutput></term>
<listitem>
<para>
This message is returned if the language is successfully
created.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><computeroutput>
ERROR: PL handler function <replaceable class="parameter">funcname</replaceable>() doesn't exist
</computeroutput></term>
<listitem>
<para>
This error is returned if the function
<replaceable class="parameter">funcname</replaceable>()
is not found.
</para>
</listitem>
</varlistentry>
</VARIABLELIST>
</variablelist>
</para>
</REFSECT2>
</REFSYNOPSISDIV>
<REFSECT1 ID="R1-SQL-CREATELANGUAGE-1">
<REFSECT1INFO>
<DATE>1998-09-09</DATE>
</REFSECT1INFO>
<TITLE>
</refsect2>
</refsynopsisdiv>
<refsect1 id="R1-SQL-CREATELANGUAGE-1">
<refsect1info>
<date>1998-09-09</date>
</refsect1info>
<title>
Description
</TITLE>
<PARA>
</title>
<para>
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>.
Subsequently, functions and
Subsequently, functions and
trigger procedures can be defined in this new language.
The user must have the <productname>Postgres</productname>
superuser privilege to
superuser privilege to
register a new language.
</PARA>
<REFSECT2 ID="R2-SQL-CREATELANGUAGE-3">
<REFSECT2INFO>
<DATE>1998-09-09</DATE>
</REFSECT2INFO>
<TITLE>
</para>
<refsect2 id="R2-SQL-CREATELANGUAGE-3">
<refsect2info>
<date>1998-09-09</date>
</refsect2info>
<title>
Writing PL handlers
</TITLE>
<PARA>
</title>
<para>
The call handler for a procedural language must be written
in a compiler language such as 'C' and registered with
<productname>Postgres</productname> as a function taking
no arguments and returning the
no arguments and returning the
<type>opaque</type> type, a placeholder for unspecified or undefined types..
This prevents the call handler from being
called directly as a function from queries.
@ -196,7 +190,7 @@ Subsequently, functions and
</para>
</listitem>
</itemizedlist>
</PARA>
</para>
<para>
It's up to the call handler to fetch the
<filename>pg_proc</filename> entry and
@ -213,14 +207,14 @@ Subsequently, functions and
</para>
</refsect2>
<REFSECT2 ID="R2-SQL-CREATELANGUAGE-4">
<REFSECT2INFO>
<DATE>1998-09-09</DATE>
</REFSECT2INFO>
<TITLE>
<refsect2 id="R2-SQL-CREATELANGUAGE-4">
<refsect2info>
<date>1998-09-09</date>
</refsect2info>
<title>
Notes
</TITLE>
<PARA>
</title>
<para>
Use <command>CREATE FUNCTION</command>
to create a function.
</para>
@ -230,8 +224,8 @@ Subsequently, functions and
<para>
Refer to the table <filename>pg_language</filename>
for further information:
<programlisting>
<computeroutput>
<programlisting>
<computeroutput>
Table = pg_language
+--------------------------+--------------------------+-------+
| Field | Type | Length|
@ -246,130 +240,129 @@ internal|n/a
lisp |/usr/ucb/liszt
C |/bin/cc
sql |postgres
</computeroutput>
</programlisting>
</computeroutput>
</programlisting>
</para>
</refsect2>
</refsect1>
<REFSECT1 ID="R1-SQL-CREATELANGUAGE-4">
<TITLE>
<refsect1 id="R1-SQL-CREATELANGUAGE-4">
<title>
Restrictions
</TITLE>
<PARA>
</title>
<para>
Since the call handler for a procedural language must be
registered with <productname>Postgres</productname> in the 'C' language,
it inherits
it inherits
all the capabilities and restrictions of 'C' functions.
</para>
</refsect1>
<REFSECT1 ID="R1-SQL-CREATELANGUAGE-5">
<TITLE>
<refsect1 id="R1-SQL-CREATELANGUAGE-5">
<title>
Bugs
</TITLE>
<PARA>
</title>
<para>
At present, the definitions for a procedural language cannot be
changed once they have been created.
</para>
</refsect1>
<REFSECT1 ID="R1-SQL-CREATELANGUAGE-6">
<TITLE>
<refsect1 id="R1-SQL-CREATELANGUAGE-6">
<title>
Usage
</TITLE>
<PARA>
</title>
<para>
This is a template for a PL handler written in 'C':
</PARA>
<ProgramListing>
#include "executor/spi.h"
#include "commands/trigger.h"
#include "utils/elog.h"
#include "fmgr.h" /* for FmgrValues struct */
#include "access/heapam.h"
#include "utils/syscache.h"
#include "catalog/pg_proc.h"
#include "catalog/pg_type.h"
Datum
plsample_call_handler(
Oid prooid,
int pronargs,
FmgrValues *proargs,
bool *isNull)
{
Datum retval;
TriggerData *trigdata;
<programlisting>
#include "executor/spi.h"
#include "commands/trigger.h"
#include "utils/elog.h"
#include "fmgr.h" /* for FmgrValues struct */
#include "access/heapam.h"
#include "utils/syscache.h"
#include "catalog/pg_proc.h"
#include "catalog/pg_type.h"
if (CurrentTriggerData == NULL) {
/*
* Called as a function
*/
Datum
plsample_call_handler(
Oid prooid,
int pronargs,
FmgrValues *proargs,
bool *isNull)
{
Datum retval;
TriggerData *trigdata;
retval = ...
} else {
/*
* Called as a trigger procedure
*/
trigdata = CurrentTriggerData;
CurrentTriggerData = NULL;
if (CurrentTriggerData == NULL) {
/*
* Called as a function
*/
retval = ...
}
retval = ...
} else {
/*
* Called as a trigger procedure
*/
trigdata = CurrentTriggerData;
CurrentTriggerData = NULL;
retval = ...
}
*isNull = false;
return retval;
}
</programlisting>
</para>
*isNull = false;
return retval;
}
</ProgramListing>
<para>
Only a few thousand lines of code have to be added instead
of the dots to complete the PL call handler.
See <command>CREATE FUNCTION</command> for information on how to compile
it into a loadable module
.</para>
See <command>CREATE FUNCTION</command> for information on how to compile
it into a loadable module.
</para>
<para>
The following commands then register the sample procedural
language:
<programlisting>
CREATE FUNCTION plsample_call_handler () RETURNS opaque
CREATE FUNCTION plsample_call_handler () RETURNS opaque
AS '/usr/local/pgsql/lib/plsample.so'
LANGUAGE 'C';
CREATE PROCEDURAL LANGUAGE 'plsample'
CREATE PROCEDURAL LANGUAGE 'plsample'
HANDLER plsample_call_handler
LANCOMPILER 'PL/Sample';
</programlisting>
</para>
</REFSECT1>
<REFSECT1 ID="R1-SQL-CREATELANGUAGE-7">
<TITLE>
</refsect1>
<refsect1 id="R1-SQL-CREATELANGUAGE-7">
<title>
Compatibility
</TITLE>
<PARA>
</title>
<para>
CREATE LANGUAGE is a <productname>Postgres</productname> extension.
</PARA>
<REFSECT2 ID="R2-SQL-CREATELANGUAGE-5">
<REFSECT2INFO>
<DATE>1998-09-09</DATE>
</REFSECT2INFO>
<TITLE>
</para>
<refsect2 id="R2-SQL-CREATELANGUAGE-5">
<refsect2info>
<date>1998-09-09</date>
</refsect2info>
<title>
SQL92
</TITLE>
<PARA>
</title>
<para>
There is no <command>CREATE LANGUAGE</command> statement in
<acronym>SQL92</acronym>.
</PARA>
<acronym>SQL92</acronym>.
</para>
</refsect2>
</refsect1>
</REFENTRY>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-omittag:nil
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t

View File

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

View File

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

View File

@ -1,23 +1,23 @@
<REFENTRY ID="SQL-CREATESEQUENCE">
<REFMETA>
<REFENTRYTITLE>
<refentry id="SQL-CREATESEQUENCE">
<refmeta>
<refentrytitle>
CREATE SEQUENCE
</REFENTRYTITLE>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO>
</REFMETA>
<REFNAMEDIV>
<REFNAME>
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta>
<refnamediv>
<refname>
CREATE SEQUENCE
</REFNAME>
<REFPURPOSE>
</refname>
<refpurpose>
Creates a new sequence number generator
</REFPURPOSE>
</refpurpose>
</refnamediv>
<REFSYNOPSISDIV>
<REFSYNOPSISDIVINFO>
<DATE>1998-04-15</DATE>
</REFSYNOPSISDIVINFO>
<SYNOPSIS>
<refsynopsisdiv>
<refsynopsisdivinfo>
<date>1998-04-15</date>
</refsynopsisdivinfo>
<synopsis>
CREATE SEQUENCE <replaceable class="parameter">seqname</replaceable>
[ INCREMENT <replaceable class="parameter">increment</replaceable> ]
[ MINVALUE <replaceable class="parameter">minvalue</replaceable> ]
@ -25,218 +25,207 @@ CREATE SEQUENCE <replaceable class="parameter">seqname</replaceable>
[ START <replaceable class="parameter">start</replaceable> ]
[ CACHE <replaceable class="parameter">cache</replaceable> ]
[ CYCLE ]
</SYNOPSIS>
</synopsis>
<REFSECT2 ID="R2-SQL-CREATESEQUENCE-1">
<REFSECT2INFO>
<DATE>1998-09-11</DATE>
</REFSECT2INFO>
<TITLE>
<refsect2 id="R2-SQL-CREATESEQUENCE-1">
<refsect2info>
<date>1998-09-11</date>
</refsect2info>
<title>
Inputs
</TITLE>
<PARA>
</PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
<replaceable class="parameter">seqname</replaceable>
</TERM>
<LISTITEM>
<PARA>
The name of a sequence to be created.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
<replaceable class="parameter">increment</replaceable>
</TERM>
<LISTITEM>
<PARA>
The <option>INCREMENT <replaceable class="parameter">increment</replaceable></option> clause is optional. A positive value will make an
ascending sequence, a negative one a descending sequence.
The default value is one (1).
</PARA>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
<replaceable class="parameter">minvalue</replaceable>
</TERM>
<LISTITEM>
<PARA>
The optional clause <option>MINVALUE
<replaceable class="parameter">minvalue</replaceable></option>
determines the minimum value
a sequence can generate. The defaults are 1 and -2147483647 for
ascending and descending sequences, respectively.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
<replaceable class="parameter">maxvalue</replaceable>
</TERM>
<LISTITEM>
<PARA>
Use the optional clause <option>MAXVALUE
<replaceable class="parameter">maxvalue</replaceable></option> to
determine the maximum
value for the sequence. The defaults are 2147483647 and -1 for
ascending and descending sequences, respectively.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
<replaceable class="parameter">start</replaceable>
</TERM>
<LISTITEM>
<PARA>
The optional <option>START
<replaceable class="parameter">start</replaceable>
clause</option> enables the sequence to begin anywhere.
The default starting value is
<replaceable class="parameter">minvalue</replaceable>
for ascending sequences and
<replaceable class="parameter">maxvalue</replaceable>
for descending ones.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
<replaceable class="parameter">cache</replaceable>
</TERM>
<LISTITEM>
<PARA>
The <option>CACHE <replaceable class="parameter">cache</replaceable></option> option
enables sequence numbers to be preallocated
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)
and this is also the default.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
CYCLE
</TERM>
<LISTITEM>
<PARA>
The optional CYCLE keyword may be used to enable the sequence
to continue when the
<replaceable class="parameter">maxvalue</replaceable> or
<replaceable class="parameter">minvalue</replaceable> has been
reached by
an ascending or descending sequence respectively. If the limit is
reached, the next number generated will be whatever the
<replaceable class="parameter">minvalue</replaceable> or
<replaceable class="parameter">maxvalue</replaceable> is,
as appropriate.
</PARA>
</LISTITEM>
</VARLISTENTRY>
</variablelist>
</REFSECT2>
<REFSECT2 ID="R2-SQL-CREATESEQUENCE-2">
<REFSECT2INFO>
<DATE>1998-09-11</DATE>
</REFSECT2INFO>
<TITLE>
Outputs
</TITLE>
<PARA>
</title>
<para>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
<ReturnValue>CREATE</ReturnValue>
</TERM>
<LISTITEM>
<PARA>
Message returned if the command is successful.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
<ReturnValue>ERROR: amcreate: '<replaceable class="parameter">seqname</replaceable>' relation already exists</ReturnValue>
</TERM>
<LISTITEM>
<PARA>
If the sequence specified already exists.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
<ReturnValue>ERROR: DefineSequence: START value (<replaceable class="parameter">start</replaceable>) can't be > MAXVALUE (<replaceable class="parameter">maxvalue</replaceable>)</ReturnValue>
</TERM>
<LISTITEM>
<PARA>
If the specified starting value is out of range.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
<ReturnValue>ERROR: DefineSequence: START value (<replaceable class="parameter">start</replaceable>) can't be < MINVALUE (<replaceable class="parameter">minvalue</replaceable>)</ReturnValue>
</TERM>
<LISTITEM>
<PARA>
If the specified starting value is out of range.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
<ReturnValue>ERROR: DefineSequence: MINVALUE (<replaceable class="parameter">minvalue</replaceable>) can't be >= MAXVALUE (<replaceable class="parameter">maxvalue</replaceable>)</ReturnValue>
</TERM>
<LISTITEM>
<PARA>
If the minimum and maximum values are inconsistant.
<variablelist>
<varlistentry>
<term><replaceable class="parameter">seqname</replaceable></term>
<listitem>
<para>
The name of a sequence to be created.
</para>
</listitem>
</varlistentry>
</VARIABLELIST>
<varlistentry>
<term><replaceable class="parameter">increment</replaceable></term>
<listitem>
<para>
The
<option>INCREMENT <replaceable class="parameter">increment</replaceable></option>
clause is optional. A positive value will make an
ascending sequence, a negative one a descending sequence.
The default value is one (1).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">minvalue</replaceable></term>
<listitem>
<para>
The optional clause <option>MINVALUE
<replaceable class="parameter">minvalue</replaceable></option>
determines the minimum value
a sequence can generate. The defaults are 1 and -2147483647 for
ascending and descending sequences, respectively.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">maxvalue</replaceable></term>
<listitem>
<para>
Use the optional clause <option>MAXVALUE
<replaceable class="parameter">maxvalue</replaceable></option> to
determine the maximum
value for the sequence. The defaults are 2147483647 and -1 for
ascending and descending sequences, respectively.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">start</replaceable></term>
<listitem>
<para>
The optional <option>START
<replaceable class="parameter">start</replaceable>
clause</option> enables the sequence to begin anywhere.
The default starting value is
<replaceable class="parameter">minvalue</replaceable>
for ascending sequences and
<replaceable class="parameter">maxvalue</replaceable>
for descending ones.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">cache</replaceable></term>
<listitem>
<para>
The <option>CACHE <replaceable class="parameter">cache</replaceable></option> option
enables sequence numbers to be preallocated
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)
and this is also the default.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>CYCLE</term>
<listitem>
<para>
The optional CYCLE keyword may be used to enable the sequence
to continue when the
<replaceable class="parameter">maxvalue</replaceable> or
<replaceable class="parameter">minvalue</replaceable> has been
reached by
an ascending or descending sequence respectively. If the limit is
reached, the next number generated will be whatever the
<replaceable class="parameter">minvalue</replaceable> or
<replaceable class="parameter">maxvalue</replaceable> is,
as appropriate.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</REFSECT2>
</REFSYNOPSISDIV>
<REFSECT1 ID="R1-SQL-CREATESEQUENCE-1">
<REFSECT1INFO>
<DATE>1998-09-11</DATE>
</REFSECT1INFO>
<TITLE>
</refsect2>
<refsect2 id="R2-SQL-CREATESEQUENCE-2">
<refsect2info>
<date>1998-09-11</date>
</refsect2info>
<title>
Outputs
</title>
<para>
<variablelist>
<varlistentry>
<term><computeroutput>
CREATE
</computeroutput></term>
<listitem>
<para>
Message returned if the command is successful.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><computeroutput>
ERROR: Relation '<replaceable class="parameter">seqname</replaceable>' already exists
</computeroutput></term>
<listitem>
<para>
If the sequence specified already exists.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><computeroutput>
ERROR: DefineSequence: MINVALUE (<replaceable class="parameter">start</replaceable>) can't be >= MAXVALUE (<replaceable class="parameter">max</replaceable>)
</computeroutput></term>
<listitem>
<para>
If the specified starting value is out of range.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><computeroutput>
ERROR: DefineSequence: START value (<replaceable class="parameter">start</replaceable>) can't be < MINVALUE (<replaceable class="parameter">min</replaceable>)
</computeroutput></term>
<listitem>
<para>
If the specified starting value is out of range.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><computeroutput>
ERROR: DefineSequence: MINVALUE (<replaceable class="parameter">min</replaceable>) can't be >= MAXVALUE (<replaceable class="parameter">max</replaceable>)
</computeroutput></term>
<listitem>
<para>
If the minimum and maximum values are inconsistant.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
</refsynopsisdiv>
<refsect1 id="R1-SQL-CREATESEQUENCE-1">
<refsect1info>
<date>1998-09-11</date>
</refsect1info>
<title>
Description
</TITLE>
<PARA>
CREATE SEQUENCE will enter a new sequence number generator
</title>
<para>
<command>CREATE SEQUENCE</command> will enter a new sequence number generator
into the current data base. This involves creating and initialising a
new single-row
table with the name <replaceable class="parameter">seqname</replaceable>.
The generator will be "owned" by the user issuing the command.
</PARA>
</para>
<para>
After a sequence is created, you may use the function
<function>nextval(<replaceable class="parameter">seqname</replaceable>)</function>
to get a new number from the sequence.
The function
<function>currval('<replaceable class="parameter">seqname</replaceable>')</function>
may be used to determine the number returned by the last call to
<function>nextval(<replaceable class="parameter">seqname</replaceable>)</function>
for the specified sequence in the current session.
The function
<function>setval('<replaceable class="parameter">seqname</replaceable>',
<replaceable class="parameter">newvalue</replaceable>)</function>
may be used to set the current value of the specified sequence.
The next call to
<function>nextval(<replaceable class="parameter">seqname</replaceable>)</function>
will return the given value plus the sequence increment.
<function>nextval(<replaceable class="parameter">seqname</replaceable>)</function>
to get a new number from the sequence.
The function
<function>currval('<replaceable class="parameter">seqname</replaceable>')</function>
may be used to determine the number returned by the last call to
<function>nextval(<replaceable class="parameter">seqname</replaceable>)</function>
for the specified sequence in the current session.
The function
<function>setval('<replaceable class="parameter">seqname</replaceable>',
<replaceable class="parameter">newvalue</replaceable>)</function>
may be used to set the current value of the specified sequence.
The next call to
<function>nextval(<replaceable class="parameter">seqname</replaceable>)</function>
will return the given value plus the sequence increment.
</para>
<para>
Use a query like
<programlisting>
@ -256,7 +245,7 @@ SELECT last_value FROM sequence_name;
calls to a generator.
</para>
<caution>
<caution>
<para>
Unexpected results may be obtained if a cache setting greater than one
is used for a sequence object that will be used concurrently by multiple
@ -279,35 +268,35 @@ SELECT last_value FROM sequence_name;
whether or not it has yet been returned by nextval.
</para>
</caution>
<REFSECT2 ID="R2-SQL-CREATESEQUENCE-3">
<REFSECT2INFO>
<DATE>1998-09-11</DATE>
</REFSECT2INFO>
<TITLE>
<refsect2 id="R2-SQL-CREATESEQUENCE-3">
<refsect2info>
<date>1998-09-11</date>
</refsect2info>
<title>
Notes
</TITLE>
<PARA>
Refer to the DROP SEQUENCE statement to remove a sequence.
</PARA>
</title>
<para>
Refer to the <command>DROP SEQUENCE</command> statement to remove a sequence.
</para>
<para>
Each backend uses its own cache to store allocated numbers.
Numbers that are cached but not used in the current session will be
lost, resulting in "holes" in the sequence.
</para>
</REFSECT2>
</refsect2>
</refsect1>
<REFSECT1 ID="R1-SQL-CREATESEQUENCE-2">
<TITLE>
<refsect1 id="R1-SQL-CREATESEQUENCE-2">
<title>
Usage
</TITLE>
<PARA>
</title>
<para>
Create an ascending sequence called <literal>serial</literal>, starting at 101:
</PARA>
<ProgramListing>
</para>
<programlisting>
CREATE SEQUENCE serial START 101;
</ProgramListing>
</programlisting>
<para>
Select the next number from this sequence
<programlisting>
@ -328,47 +317,45 @@ INSERT INTO distributors VALUES (NEXTVAL('serial'),'nothing');
<para>
Set the sequence value after a COPY FROM:
<programlisting>
CREATE FUNCTION distributors_id_max() RETURNS INT4
CREATE FUNCTION distributors_id_max() RETURNS INT4
AS 'SELECT max(id) FROM distributors'
LANGUAGE 'sql';
BEGIN;
BEGIN;
COPY distributors FROM 'input_file';
SELECT setval('serial', distributors_id_max());
END;
END;
</programlisting>
</para>
</REFSECT1>
<REFSECT1 ID="R1-SQL-CREATESEQUENCE-3">
<TITLE>
</refsect1>
<refsect1 id="R1-SQL-CREATESEQUENCE-3">
<title>
Compatibility
</TITLE>
<PARA>
</title>
<para>
<command>CREATE SEQUENCE</command> is a <productname>Postgres</productname>
language extension.
</PARA>
<REFSECT2 ID="R2-SQL-CREATESEQUENCE-4">
<REFSECT2INFO>
<DATE>1998-09-11</DATE>
</REFSECT2INFO>
<TITLE>
</para>
<refsect2 id="R2-SQL-CREATESEQUENCE-4">
<refsect2info>
<date>1998-09-11</date>
</refsect2info>
<title>
SQL92
</TITLE>
<PARA>
</title>
<para>
There is no <command>CREATE SEQUENCE</command> statement
in <acronym>SQL92</acronym>.
</PARA>
in <acronym>SQL92</acronym>.
</para>
</refsect2>
</refsect1>
</REFENTRY>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-omittag:nil
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

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

View File

@ -36,9 +36,7 @@ CREATE USER<replaceable class="PARAMETER"> username</replaceable>
<para>
<variablelist>
<varlistentry>
<term>
<returnvalue><replaceable class="parameter">username</replaceable></returnvalue>
</term>
<term><replaceable class="parameter">username</replaceable></term>
<listitem>
<para>
The name of the user.
@ -47,9 +45,7 @@ CREATE USER<replaceable class="PARAMETER"> username</replaceable>
</varlistentry>
<varlistentry>
<term>
<returnvalue><replaceable class="parameter">password</replaceable></returnvalue>
</term>
<term><replaceable class="parameter">password</replaceable></term>
<listitem>
<para>
The WITH PASSWORD clause sets the user's password within
@ -81,9 +77,8 @@ CREATE USER<replaceable class="PARAMETER"> username</replaceable>
</varlistentry>
<varlistentry>
<term>
<returnvalue> CREATEDB/NOCREATEDB</returnvalue>
</term>
<term>CREATEDB</term>
<term>NOCREATEDB</term>
<listitem>
<para>
These clauses define a user's ability to create databases.
@ -96,9 +91,8 @@ CREATE USER<replaceable class="PARAMETER"> username</replaceable>
</varlistentry>
<varlistentry>
<term>
<returnvalue>CREATEUSER/NOCREATEUSER</returnvalue>
</term>
<term>CREATEUSER</term>
<term>NOCREATEUSER</term>
<listitem>
<para>
These clauses determine whether a user will be permitted to
@ -111,9 +105,7 @@ CREATE USER<replaceable class="PARAMETER"> username</replaceable>
</varlistentry>
<varlistentry>
<term>
<returnvalue><replaceable class="parameter">groupname</replaceable></returnvalue>
</term>
<term><replaceable class="parameter">groupname</replaceable></term>
<listitem>
<para>
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>
<term>
<returnvalue><replaceable class="parameter">abstime</replaceable></returnvalue>
</term>
<term><replaceable class="parameter">abstime</replaceable></term>
<listitem>
<para>
The VALID UNTIL clause sets an absolute time after which the
@ -155,34 +145,20 @@ CREATE USER<replaceable class="PARAMETER"> username</replaceable>
<para>
<variablelist>
<varlistentry>
<term>
<returnvalue>CREATE USER</returnvalue>
</term>
<term><computeroutput>
CREATE USER
</computeroutput></term>
<listitem>
<para>
Message returned if the command completes successfully.
</para>
</listitem>
</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>
</para>
</refsect2>
</refsynopsisdiv>
<refsect1 id="R1-SQL-CREATEUSER-1">
<refsect1info>
<date>1998-09-21</date>
@ -192,23 +168,27 @@ CREATE USER<replaceable class="PARAMETER"> username</replaceable>
</title>
<para>
CREATE USER will add a new user to an instance of
<productname>Postgres</productname>.
<productname>Postgres</productname>.
</para>
<para>
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
<productname>Postgres</productname> users' <filename>usesysid</filename>s will not
correspond to their operating
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
<filename>usesysid</filename> during the initdb process.
If you still want the
OS user id and the <filename>usesysid</filename> to match
for any given user,
use the "createuser" script provided with the <productname>Postgres</productname>
distribution.
use the <application>createuser</application> script provided with
the <productname>Postgres</productname> distribution.
</para>
<refsect2 id="R2-SQL-CREATEUSER-3">
@ -219,11 +199,13 @@ CREATE USER<replaceable class="PARAMETER"> username</replaceable>
Notes
</title>
<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>
Use DROP USER or ALTER USER statements to remove or modify a user
account.</para>
Use <command>DROP USER</command> or <command>ALTER USER</command>
statements to remove or modify a user account.
</para>
<para>
Refer to the <filename>pg_shadow</filename> table for further information.
</para>
@ -251,31 +233,37 @@ CREATE USER<replaceable class="PARAMETER"> username</replaceable>
</title>
<para>
Create a user with no password:
<programlisting>
CREATE USER jonathan
</programlisting>
</para>
<programlisting>
CREATE USER jonathan
</programlisting>
<para>
Create a user with a password:
<programlisting>
CREATE USER davide WITH PASSWORD jw8s0F4
</programlisting>
</para>
<programlisting>
CREATE USER davide WITH PASSWORD jw8s0F4
</programlisting>
<para>
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
valid:
<programlisting>
CREATE USER miriam WITH PASSWORD jw8s0F4 VALID UNTIL 'Jan 1 2002'
</programlisting>
</para>
<programlisting>
CREATE USER miriam WITH PASSWORD jw8s0F4 VALID UNTIL 'Jan 1 2002'
</programlisting>
<para>
Create an account where the user can create databases:
<programlisting>
CREATE USER manuel WITH PASSWORD jw8s0F4 CREATEDB
</programlisting>
</para>
<programlisting>
CREATE USER manuel WITH PASSWORD jw8s0F4 CREATEDB
</programlisting>
</refsect1>
<refsect1 id="R1-SQL-CREATEUSER-3">
@ -293,7 +281,7 @@ CREATE USER<replaceable class="PARAMETER"> username</replaceable>
SQL92
</title>
<para>
There is no CREATE USER statement in SQL92.
There is no <command>CREATE USER</command> statement in SQL92.
</para>
</refsect2>
</refsect1>

View File

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

View File

@ -1,266 +1,274 @@
<REFENTRY ID="APP-CREATEDB">
<REFMETA>
<REFENTRYTITLE>
<application>createdb</application>
</REFENTRYTITLE>
<REFMISCINFO>Application</REFMISCINFO>
</REFMETA>
<REFNAMEDIV>
<REFNAME>
<application>createdb</application>
</REFNAME>
<REFPURPOSE>
Create a new <productname>Postgres</productname> database
</REFPURPOSE>
</refnamediv>
<REFSYNOPSISDIV>
<REFSYNOPSISDIVINFO>
<DATE>1998-10-02</DATE>
</REFSYNOPSISDIVINFO>
<SYNOPSIS>
createdb [ <replaceable class="parameter">dbname</replaceable> ]
createdb [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replaceable class="parameter">port</replaceable> ]
[ -D <replaceable class="parameter">datadir</replaceable> ]
[ -u ] [ <replaceable class="parameter">dbname</replaceable> ]
</SYNOPSIS>
<REFSECT2 ID="R2-APP-CREATEDB-1">
<REFSECT2INFO>
<DATE>1998-10-02</DATE>
</REFSECT2INFO>
<TITLE>
Inputs
</TITLE>
<PARA>
<variablelist>
<varlistentry>
<term>
-h <replaceable class="parameter">host</replaceable>
</term>
<listitem>
<para>
Specifies the hostname of the machine on which the
<application>postmaster</application>
is running. Defaults to using a local Unix domain socket
rather than an IP connection..
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
-p <replaceable class="parameter">port</replaceable>
</term>
<listitem>
<para>
Specifies the Internet TCP/IP port or local Unix domain socket file
extension on which the <application>postmaster</application>
is listening for connections. The port number defaults to 5432,
or the value of the <envar>PGPORT</envar>
environment variable (if set).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
-u
</term>
<listitem>
<para>
Use password authentication.
Prompts for
<replaceable class="parameter">username</replaceable>
and <replaceable class="parameter">password</replaceable>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
-D <replaceable class="parameter">datadir</replaceable>
</term>
<listitem>
<para>
Specifies the alternate database location for this database installation.
This is the location of the installation system tables, not the location
of this specific database, which may be different.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<replaceable class="parameter">dbname</replaceable>
</term>
<listitem>
<para>
Specifies the name of the database to be created. The name must be
unique among all <productname>Postgres</productname> databases in this installation.
<replaceable class="parameter">dbname</replaceable>
defaults to the value of the
<envar>USER</envar>
environment variable.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
<refentry id="APP-CREATEDB">
<refmeta>
<refentrytitle>
<application>createdb</application>
</refentrytitle>
<refmiscinfo>Application</refmiscinfo>
</refmeta>
<refnamediv>
<refname>
<application>createdb</application>
</refname>
<refpurpose>
Create a new <productname>Postgres</productname> database
</refpurpose>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
<date>1998-10-02</date>
</refsynopsisdivinfo>
<synopsis>
createdb [ <replaceable class="parameter">dbname</replaceable> ]
createdb [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replaceable class="parameter">port</replaceable> ]
[ -D <replaceable class="parameter">datadir</replaceable> ] [ -u ] [ <replaceable class="parameter">dbname</replaceable> ]
</synopsis>
<REFSECT2 ID="R2-APP-CREATEDB-2">
<REFSECT2INFO>
<DATE>1998-10-02</DATE>
</REFSECT2INFO>
<TITLE>
Outputs
</TITLE>
<PARA>
<application>createdb</application> will create files in the
<filename><envar>PGDATA</envar>/<replaceable class="parameter">dbname</replaceable>/</filename>
data area for the new database.
<variablelist>
<varlistentry>
<term>
Connection to database 'template1' failed.
connectDB() failed: Is the postmaster running and accepting connections
at 'UNIX Socket' on port '<replaceable class="parameter">port</replaceable>'?
createdb: database creation failed on <replaceable class="parameter">dbname</replaceable>.
</term>
<listitem>
<para>
<application>createdb</application> could not attach to the
<application>postmaster</application>
process on the specified host and port. If you see this message,
ensure that the <application>postmaster</application>
is running on the proper host and that you have specified the proper
port. If your site uses an authentication system, ensure that you
have obtained the required authentication credentials.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
Connection to database 'template1' failed.
FATAL 1: SetUserId: user '<replaceable class="parameter">username</replaceable>' is not in 'pg_shadow'
createdb: database creation failed on <replaceable class="parameter">dbname</replaceable>.
</term>
<listitem>
<para>
You do not have a valid entry in the relation <literal>pg_shadow</literal>
and and will not be allowed to access <productname>Postgres</productname>.
Contact your <productname>Postgres</productname> administrator.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
ERROR: user '<replaceable class="parameter">username</replaceable>' is not allowed to create/destroy databases
createdb: database creation failed on <replaceable class="parameter">dbname</replaceable>.
</term>
<listitem>
<para>
You do not have permission to create new databases.
Contact your <productname>Postgres</productname> site administrator.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
ERROR: createdb: database '<replaceable class="parameter">dbname</replaceable>' already exists.
createdb: database creation failed on <replaceable class="parameter">dbname</replaceable>.
</term>
<listitem>
<para>
The database already exists.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
createdb: database creation failed on <replaceable class="parameter">dbname</replaceable>.
</term>
<listitem>
<para>
An internal error occurred in <application>psql</application>
or in the backend server. Ensure that your site administrator has
properly installed <productname>Postgres</productname>and initialized the site with
<application>initdb</application>.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
<note>
<para>
<application>createdb</application> internally runs
CREATE DATABASE from <application>psql</application>
while connected to the <literal>template1</literal> database.
</para>
</note>
</refsect2>
</refsynopsisdiv>
<REFSECT1 ID="R1-APP-CREATEDB-1">
<REFSECT1INFO>
<DATE>1998-10-02</DATE>
</REFSECT1INFO>
<TITLE>
Description
</TITLE>
<PARA>
<application>createdb</application> creates a new
<productname>Postgres</productname> database.
The person who executes this command becomes
the database administrator, or <acronym>DBA</acronym>,
for this database and is the only
person, other than the <productname>Postgres</productname> super-user,
who can destroy it.
</para>
<refsect2 id="R2-APP-CREATEDB-1">
<refsect2info>
<date>1998-10-02</date>
</refsect2info>
<title>
Inputs
</title>
<para>
<variablelist>
<varlistentry>
<term>-h <replaceable class="parameter">host</replaceable></term>
<listitem>
<para>
Specifies the hostname of the machine on which the
<application>postmaster</application>
is running. Defaults to using a local Unix domain socket
rather than an IP connection.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-p <replaceable class="parameter">port</replaceable></term>
<listitem>
<para>
Specifies the Internet TCP/IP port or local Unix domain socket file
extension on which the <application>postmaster</application>
is listening for connections. The port number defaults to 5432,
or the value of the <envar>PGPORT</envar>
environment variable (if set).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-u</term>
<listitem>
<para>
Use password authentication.
Prompts for
<replaceable class="parameter">username</replaceable>
and <replaceable class="parameter">password</replaceable>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-D <replaceable class="parameter">datadir</replaceable></term>
<listitem>
<para>
Specifies the alternate database location for this database installation.
This is the location of the installation system tables, not the location
of this specific database, which may be different.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">dbname</replaceable></term>
<listitem>
<para>
Specifies the name of the database to be created. The name must be
unique among all <productname>Postgres</productname> databases in this installation.
<replaceable class="parameter">dbname</replaceable>
defaults to the value of the
<envar>USER</envar>
environment variable.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
<refsect2 id="R2-APP-CREATEDB-2">
<refsect2info>
<date>1998-10-02</date>
</refsect2info>
<title>
Outputs
</title>
<para>
<application>createdb</application> will create files in the
<filename><envar>PGDATA</envar>/<replaceable class="parameter">dbname</replaceable>/</filename>
data area for the new database.
<variablelist>
<varlistentry>
<term><computeroutput>
Connection to database 'template1' failed.
connectDB() failed: Is the postmaster running and accepting connections at 'UNIX Socket' on port '<replaceable class="parameter">port</replaceable>'?
createdb: database creation failed on <replaceable class="parameter">dbname</replaceable>.
</computeroutput></term>
<listitem>
<para>
<application>createdb</application> could not attach to the
<application>postmaster</application>
process on the specified host and port. If you see this message,
ensure that the <application>postmaster</application>
is running on the proper host and that you have specified the proper
port. If your site uses an authentication system, ensure that you
have obtained the required authentication credentials.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><computeroutput>
Connection to database 'template1' failed.
FATAL 1: SetUserId: user '<replaceable class="parameter">username</replaceable>' is not in 'pg_shadow'
createdb: database creation failed on <replaceable class="parameter">dbname</replaceable>.
</computeroutput></term>
<listitem>
<para>
You do not have a valid entry in the relation <literal>pg_shadow</literal>
and and will not be allowed to access <productname>Postgres</productname>.
Contact your <productname>Postgres</productname> administrator.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><computeroutput>
ERROR: user '<replaceable class="parameter">username</replaceable>' is not allowed to create/destroy databases
createdb: database creation failed on <replaceable class="parameter">dbname</replaceable>.
</computeroutput></term>
<listitem>
<para>
You do not have permission to create new databases.
Contact your <productname>Postgres</productname> site administrator.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><computeroutput>
ERROR: createdb: database '<replaceable class="parameter">dbname</replaceable>' already exists.
createdb: database creation failed on <replaceable class="parameter">dbname</replaceable>.
</computeroutput></term>
<listitem>
<para>
The database already exists.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><computeroutput>
createdb: database creation failed on <replaceable class="parameter">dbname</replaceable>.
</computeroutput></term>
<listitem>
<para>
An internal error occurred in <application>psql</application>
or in the backend server. Ensure that your site administrator has
properly installed <productname>Postgres</productname>and initialized the site with
<application>initdb</application>.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
<note>
<para>
<application>createdb</application> is a shell script that invokes
<application>psql</application>.
Hence, a <application>postmaster</application>
process must be running on the database server host before
<application>createdb</application>
is executed. The
<envar>PGOPTION</envar>
and
<envar>PGREALM</envar>
environment variables will be passed on to
<application>psql</application>
and processed as described in <xref linkend="app-psql" endterm="psql-ref">.
<application>createdb</application> internally runs
<command>CREATE DATABASE</command> from <application>psql</application>
while connected to the <literal>template1</literal> database.
</para>
</refsect1>
<REFSECT1 ID="R1-APP-CREATEDB-2">
<REFSECT1INFO>
<DATE>1998-10-02</DATE>
</REFSECT1INFO>
<TITLE>
Usage
</TITLE>
<PARA>
To create the database <literal>demo</literal>
using the postmaster on the local host, port 5432:
<programlisting>
createdb demo
</programlisting>
To create the database <literal>demo</literal>
using the postmaster on host eden, port 5000:
<programlisting>
createdb -p 5000 -h eden demo
</programlisting>
</para>
</refsect1>
</REFENTRY>
</note>
</refsect2>
</refsynopsisdiv>
<refsect1 id="R1-APP-CREATEDB-1">
<refsect1info>
<date>1998-10-02</date>
</refsect1info>
<title>
Description
</title>
<para>
<application>createdb</application> creates a new
<productname>Postgres</productname> database.
The person who executes this command becomes
the database administrator, or <acronym>DBA</acronym>,
for this database and is the only
person, other than the <productname>Postgres</productname> super-user,
who can destroy it.
</para>
<para>
<application>createdb</application> is a shell script that invokes
<application>psql</application>.
Hence, a <application>postmaster</application>
process must be running on the database server host before
<application>createdb</application>
is executed. The
<envar>PGOPTION</envar>
and
<envar>PGREALM</envar>
environment variables will be passed on to
<application>psql</application>
and processed as described in <xref endterm="psql-ref"
linkend="app-psql">.
</para>
</refsect1>
<refsect1 id="R1-APP-CREATEDB-2">
<refsect1info>
<date>1998-10-02</date>
</refsect1info>
<title>
Usage
</title>
<para>
To create the database <literal>demo</literal>
using the postmaster on the local host, port 5432:
<programlisting>
$ createdb demo
</programlisting>
</para>
<para>
To create the database <literal>demo</literal>
using the postmaster on host eden, port 5000:
<programlisting>
$ createdb -p 5000 -h eden demo
</programlisting>
</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,290 +1,292 @@
<REFENTRY ID="APP-CREATEUSER">
<REFMETA>
<REFENTRYTITLE>
<application>createuser</application>
</REFENTRYTITLE>
<REFMISCINFO>Application</REFMISCINFO>
</REFMETA>
<REFNAMEDIV>
<REFNAME>
<application>createuser</application>
</REFNAME>
<REFPURPOSE>
Create a new <productname>Postgres</productname> user
</REFPURPOSE>
</refnamediv>
<REFSYNOPSISDIV>
<REFSYNOPSISDIVINFO>
<DATE>1998-10-02</DATE>
</REFSYNOPSISDIVINFO>
<SYNOPSIS>
<refentry id="APP-CREATEUSER">
<refmeta>
<refentrytitle>
<application>createuser</application>
</refentrytitle>
<refmiscinfo>Application</refmiscinfo>
</refmeta>
<refnamediv>
<refname>
<application>createuser</application>
</refname>
<refpurpose>
Create a new <productname>Postgres</productname> user
</refpurpose>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
<date>1998-10-02</date>
</refsynopsisdivinfo>
<synopsis>
createuser [ <replaceable class="parameter">username</replaceable> ]
createuser [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replaceable class="parameter">port</replaceable> ]
[ -i <replaceable class="parameter">userid</replaceable> ]
[ -d | -D ] [ -u | -U ] [ <replaceable class="parameter">username</replaceable> ]
</SYNOPSIS>
[ -i <replaceable class="parameter">userid</replaceable> ] [ -d | -D ] [ -u | -U ]
[ <replaceable class="parameter">username</replaceable> ]
</synopsis>
<REFSECT2 ID="R2-APP-CREATEUSER-1">
<REFSECT2INFO>
<DATE>1998-10-02</DATE>
</REFSECT2INFO>
<TITLE>
Inputs
</TITLE>
<PARA>
<variablelist>
<varlistentry>
<term>
-h <replaceable class="parameter">host</replaceable>
</term>
<listitem>
<para>
Specifies the hostname of the machine on which the
<application>postmaster</application>
is running. Defaults to using a local Unix domain socket
rather than an IP connection..
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
-p <replaceable class="parameter">port</replaceable>
</term>
<listitem>
<para>
Specifies the Internet TCP/IP port or local Unix domain socket file
extension on which the <application>postmaster</application>
is listening for connections. The port number defaults to 5432,
or the value of the <envar>PGPORT</envar>
environment variable (if set).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
-d
</term>
<listitem>
<para>
Allows the user to create databases.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
-D
</term>
<listitem>
<para>
Forbids the user to create databases.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
-i <replaceable class="parameter">userid</replaceable>
</term>
<listitem>
<para>
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
to match the operating system UID.
You will be prompted for an identifier if none is specified on the command line,
and it will suggest an identifier matching the UID.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
-u
</term>
<listitem>
<para>
Allows the user to create other users.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
-U
</term>
<listitem>
<para>
Forbids the user to create other users.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<replaceable class="parameter">username</replaceable>
</term>
<listitem>
<para>
Specifies the name of the <productname>Postgres</productname> user to be created.
This name must be unique among all <productname>Postgres</productname> users.
You will be prompted for a name if none is specified on the command line.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
<refsect2 id="R2-APP-CREATEUSER-1">
<refsect2info>
<date>1998-10-02</date>
</refsect2info>
<title>
Inputs
</title>
<para>
<REFSECT2 ID="R2-APP-CREATEUSER-2">
<REFSECT2INFO>
<DATE>1998-10-02</DATE>
</REFSECT2INFO>
<TITLE>
Outputs
</TITLE>
<PARA>
<application>createuser</application> will add an entry in the
<literal>pg_user</literal> or <literal>pg_shadow</literal> system table.
<variablelist>
<varlistentry>
<term>
Connection to database 'template1' failed.
connectDB() failed: Is the postmaster running and accepting connections
at 'UNIX Socket' on port '<replaceable class="parameter">port</replaceable>'?
createuser: database access failed.
</term>
<listitem>
<para>
<application>createuser</application> could not attach to the
<application>postmaster</application>
process on the specified host and port. If you see this message,
ensure that the <application>postmaster</application>
is running on the proper host and that you have specified the proper
port. If your site uses an authentication system, ensure that you
have obtained the required authentication credentials.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
Connection to database 'template1' failed.
FATAL 1: SetUserId: user '<replaceable class="parameter">username</replaceable>' is not in 'pg_shadow'
createuser: database access failed.
</term>
<listitem>
<para>
You do not have a valid entry in the relation <literal>pg_shadow</literal>
and and will not be allowed to access <productname>Postgres</productname>. Contact your
<productname>Postgres</productname> administrator.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
createuser: <replaceable class="parameter">username</replaceable> cannot create users.
</term>
<listitem>
<para>
You do not have permission to create new users; contact your
<productname>Postgres</productname> site administrator.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
createuser: user "<replaceable class="parameter">username</replaceable>" already exists
</term>
<listitem>
<para>
The user to be added already has an entry in the <literal>pg_shadow</literal>
class.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
database access failed
</term>
<listitem>
<para>
An internal error occurred in <application>psql</application>
or in the backend server. Ensure that your site administrator has
properly installed <productname>Postgres</productname>and initialized the site with
<application>initdb</application>.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
<note>
<para>
<application>createuser</application> internally runs
CREATE USER from <application>psql</application>
while connected to the <literal>template1</literal> database.
</para>
</note>
</refsect2>
</refsynopsisdiv>
<variablelist>
<varlistentry>
<term>-h <replaceable class="parameter">host</replaceable></term>
<listitem>
<para>
Specifies the hostname of the machine on which the
<application>postmaster</application>
is running. Defaults to using a local Unix domain socket
rather than an IP connection.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-p <replaceable class="parameter">port</replaceable></term>
<listitem>
<para>
Specifies the Internet TCP/IP port or local Unix domain socket file
extension on which the <application>postmaster</application>
is listening for connections. The port number defaults to 5432,
or the value of the <envar>PGPORT</envar>
environment variable (if set).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-d</term>
<listitem>
<para>
Allows the user to create databases.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-D</term>
<listitem>
<para>
Forbids the user to create databases.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-i <replaceable class="parameter">userid</replaceable></term>
<listitem>
<para>
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
to match the operating system UID.
You will be prompted for an identifier if none is specified on the command line,
and it will suggest an identifier matching the UID.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-u</term>
<listitem>
<para>
Allows the user to create other users.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-U</term>
<listitem>
<para>
Forbids the user to create other users.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">username</replaceable></term>
<listitem>
<para>
Specifies the name of the <productname>Postgres</productname> user to be created.
This name must be unique among all <productname>Postgres</productname> users.
You will be prompted for a name if none is specified on the command line.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
<refsect2 id="R2-APP-CREATEUSER-2">
<refsect2info>
<date>1998-10-02</date>
</refsect2info>
<title>
Outputs
</title>
<para>
<application>createuser</application> will add an entry in the
<literal>pg_user</literal> or <literal>pg_shadow</literal> system table.
<variablelist>
<varlistentry>
<term><computeroutput>
Connection to database 'template1' failed.
connectDB() failed: Is the postmaster running and accepting connections at 'UNIX Socket' on port '<replaceable class="parameter">port</replaceable>'?
createuser: database access failed.
</computeroutput></term>
<listitem>
<para>
<application>createuser</application> could not attach to the
<application>postmaster</application>
process on the specified host and port. If you see this message,
ensure that the <application>postmaster</application>
is running on the proper host and that you have specified the proper
port. If your site uses an authentication system, ensure that you
have obtained the required authentication credentials.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><computeroutput>
Connection to database 'template1' failed.
FATAL 1: SetUserId: user '<replaceable class="parameter">username</replaceable>' is not in 'pg_shadow'
createuser: database access failed.
</computeroutput></term>
<listitem>
<para>
You do not have a valid entry in the relation <literal>pg_shadow</literal>
and and will not be allowed to access <productname>Postgres</productname>. Contact your
<productname>Postgres</productname> administrator.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><computeroutput>
createuser: <replaceable class="parameter">username</replaceable> cannot create users.
</computeroutput></term>
<listitem>
<para>
You do not have permission to create new users; contact your
<productname>Postgres</productname> site administrator.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><computeroutput>
createuser: user "<replaceable class="parameter">username</replaceable>" already exists
</computeroutput></term>
<listitem>
<para>
The user to be added already has an entry in the
<literal>pg_shadow</literal> class.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><computeroutput>
database access failed
</computeroutput></term>
<listitem>
<para>
An internal error occurred in <application>psql</application>
or in the backend server. Ensure that your site administrator has
properly installed <productname>Postgres</productname>and initialized the site with
<application>initdb</application>.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
<note>
<para>
<application>createuser</application> internally runs
<command>CREATE USER</command> from <application>psql</application>
while connected to the <literal>template1</literal> database.
</para>
</note>
</refsect2>
</refsynopsisdiv>
<REFSECT1 ID="R1-APP-CREATEUSER-1">
<REFSECT1INFO>
<DATE>1998-10-02</DATE>
</REFSECT1INFO>
<TITLE>
Description
</TITLE>
<PARA>
<application>createuser</application> creates a
new <productname>Postgres</productname> user.
Only users with <literal>usesuper</literal> set in
the <literal>pg_shadow</literal> class can create
new <productname>Postgres</productname> users. As shipped,
the user <literal>postgres</literal> can create users.
</para>
<refsect1 id="R1-APP-CREATEUSER-1">
<refsect1info>
<date>1998-10-02</date>
</refsect1info>
<title>
Description
</title>
<para>
<application>createuser</application> creates a
new <productname>Postgres</productname> user.
Only users with <literal>usesuper</literal> set in
the <literal>pg_shadow</literal> class can create
new <productname>Postgres</productname> users. As shipped,
the user <literal>postgres</literal> can create users.
</para>
<para>
<application>createuser</application> is a shell script that invokes
<application>psql</application>.
Hence, a <application>postmaster</application>
process must be running on the database server host before
<application>createuser</application> is executed.
The
<envar>PGOPTION</envar>
and
<envar>PGREALM</envar>
environment variables will be passed on to
<application>psql</application>
and processed as described in <xref endterm="psql-ref" linkend="app-psql">.
</para>
<para>
Once invoked, <application>createuser</application>
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
user identifier must be specified.
<note>
<para>
<application>createuser</application> is a shell script that invokes
<application>psql</application>.
Hence, a <application>postmaster</application>
process must be running on the database server host before
<application>createuser</application> is executed.
The
<envar>PGOPTION</envar>
and
<envar>PGREALM</envar>
environment variables will be passed on to
<application>psql</application>
and processed as described in <xref linkend="app-psql" endterm="psql-ref">.
Once invoked, <application>createuser</application>
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
user identifier must be specified.
The <productname>Postgres</productname> user identifier
does not need to be the same as the user's Unix UID. However, typically
they are assigned to be the same.
</para>
<note>
<para>
The <productname>Postgres</productname> user identifier
does not need to be the same as the user's Unix UID. However, typically
they are assigned to be the same.
</para>
</note>
<para>
You must also describe the privileges of the new user for security purposes.
Specifically, you will be asked whether the new user should be able to
act as <productname>Postgres</productname> super-user,
whether the new user may create new databases and whether the new user
is allowed to create other new users.
</para>
</refsect1>
</REFENTRY>
</note>
</para>
<para>
You must also describe the privileges of the new user for security purposes.
Specifically, you will be asked whether the new user should be able to
act as <productname>Postgres</productname> super-user,
whether the new user may create new databases and whether the new user
is allowed to create other new users.
</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,227 +1,215 @@
<REFENTRY ID="SQL-DECLARE">
<REFMETA>
<REFENTRYTITLE>
<refentry id="SQL-DECLARE">
<refmeta>
<refentrytitle>
DECLARE
</REFENTRYTITLE>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO>
</REFMETA>
<REFNAMEDIV>
<REFNAME>
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta>
<refnamediv>
<refname>
DECLARE
</REFNAME>
<REFPURPOSE>
</refname>
<refpurpose>
Defines a cursor for table access
</REFPURPOSE>
</refpurpose>
</refnamediv>
<REFSYNOPSISDIV>
<REFSYNOPSISDIVINFO>
<DATE>1998-09-04</DATE>
</REFSYNOPSISDIVINFO>
<SYNOPSIS>
<refsynopsisdiv>
<refsynopsisdivinfo>
<date>1998-09-04</date>
</refsynopsisdivinfo>
<synopsis>
DECLARE <replaceable class="parameter">cursor</replaceable> [ BINARY ] [ INSENSITIVE ] [ SCROLL ]
CURSOR FOR <replaceable class="parameter">query</replaceable>
[ FOR { READ ONLY | UPDATE [ OF <replaceable class="parameter">column</replaceable> [, ...] ] ]
</SYNOPSIS>
<REFSECT2 ID="R2-SQL-DECLARE-1">
<REFSECT2INFO>
<DATE>1998-04-15</DATE>
</REFSECT2INFO>
<TITLE>
</synopsis>
<refsect2 id="R2-SQL-DECLARE-1">
<refsect2info>
<date>1998-04-15</date>
</refsect2info>
<title>
Inputs
</TITLE>
<PARA>
</PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
<replaceable class="parameter">cursor</replaceable>
</TERM>
<LISTITEM>
<PARA>
The name of the cursor to be used in subsequent FETCH operations..
</PARA>
</LISTITEM>
</VARLISTENTRY>
</title>
<para>
<variablelist>
<varlistentry>
<term><replaceable class="parameter">cursor</replaceable></term>
<listitem>
<para>
The name of the cursor to be used in subsequent FETCH operations..
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
BINARY
</TERM>
<LISTITEM>
<PARA>
Causes the cursor to fetch data in binary
rather than in text format.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<varlistentry>
<term>BINARY</term>
<listitem>
<para>
Causes the cursor to fetch data in binary
rather than in text format.
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
INSENSITIVE
</TERM>
<LISTITEM>
<PARA>
<acronym>SQL92</acronym> keyword indicating that data retrieved
from the cursor should be unaffected by updates from other processes or cursors.
Since cursor operations occur within transactions
in <productname>Postgres</productname> this is always the case.
This keyword has no effect.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<varlistentry>
<term>INSENSITIVE</term>
<listitem>
<para>
<acronym>SQL92</acronym> keyword indicating that data retrieved
from the cursor should be unaffected by updates from other processes or cursors.
Since cursor operations occur within transactions
in <productname>Postgres</productname> this is always the case.
This keyword has no effect.
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
SCROLL
</TERM>
<LISTITEM>
<PARA>
<acronym>SQL92</acronym> keyword indicating that data may be retrieved
in multiple rows per FETCH operation. Since this is allowed at all times
by <productname>Postgres</productname> this keyword has no effect.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<varlistentry>
<term>SCROLL</term>
<listitem>
<para>
<acronym>SQL92</acronym> keyword indicating that data may be retrieved
in multiple rows per FETCH operation. Since this is allowed at all times
by <productname>Postgres</productname> this keyword has no effect.
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
<replaceable class="parameter">query</replaceable>
</TERM>
<LISTITEM>
<PARA>
An SQL query which will provide the rows to be governed by the
cursor.
Refer to the SELECT statement for further information about
valid arguments.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<varlistentry>
<term><replaceable class="parameter">query</replaceable></term>
<listitem>
<para>
An SQL query which will provide the rows to be governed by the
cursor.
Refer to the SELECT statement for further information about
valid arguments.
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
READ ONLY
</TERM>
<LISTITEM>
<PARA>
<acronym>SQL92</acronym> keyword indicating that the cursor will be used
in a readonly mode. Since this is the only cursor access mode
available in <productname>Postgres</productname> this keyword has no effect.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<varlistentry>
<term>READ ONLY</term>
<listitem>
<para>
<acronym>SQL92</acronym> keyword indicating that the cursor will be used
in a readonly mode. Since this is the only cursor access mode
available in <productname>Postgres</productname> this keyword has no effect.
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
UPDATE
</TERM>
<LISTITEM>
<PARA>
<acronym>SQL92</acronym> keyword indicating that the cursor will be used
to update tables. Since cursor updates are not currently
supported in <productname>Postgres</productname> this keyword
provokes an informational error message.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<varlistentry>
<term>UPDATE</term>
<listitem>
<para>
<acronym>SQL92</acronym> keyword indicating that the cursor will be used
to update tables. Since cursor updates are not currently
supported in <productname>Postgres</productname> this keyword
provokes an informational error message.
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
<replaceable class="parameter">column</replaceable>
</TERM>
<LISTITEM>
<PARA>
Column(s) to be updated.
Since cursor updates are not currently
supported in <productname>Postgres</productname> the UPDATE clause
provokes an informational error message.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<varlistentry>
<term><replaceable class="parameter">column</replaceable></term>
<listitem>
<para>
Column(s) to be updated.
Since cursor updates are not currently
supported in <productname>Postgres</productname> the UPDATE clause
provokes an informational error message.
</para>
</listitem>
</varlistentry>
</VARIABLELIST>
</REFSECT2>
<REFSECT2 ID="R2-SQL-DECLARE-2">
<REFSECT2INFO>
<DATE>1998-04-15</DATE>
</REFSECT2INFO>
<TITLE>
Outputs
</TITLE>
<PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
SELECT
</TERM>
<LISTITEM>
<PARA>
The message returned if the SELECT is run successfully.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
NOTICE
BlankPortalAssignName: portal "<replaceable class="parameter">cursor</replaceable>" already exists
</TERM>
<LISTITEM>
<PARA>
This error occurs if cursor "<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>
</variablelist>
</para>
</REFSECT2>
</REFSYNOPSISDIV>
<REFSECT1 ID="R1-SQL-DECLARE-1">
<REFSECT1INFO>
<DATE>1998-09-04</DATE>
</REFSECT1INFO>
<TITLE>
</refsect2>
<refsect2 id="R2-SQL-DECLARE-2">
<refsect2info>
<date>1998-04-15</date>
</refsect2info>
<title>
Outputs
</title>
<para>
<variablelist>
<varlistentry>
<term><computeroutput>
SELECT
</computeroutput></term>
<listitem>
<para>
The message returned if the SELECT is run successfully.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><computeroutput>
NOTICE
BlankPortalAssignName: portal "<replaceable class="parameter">cursor</replaceable>" already exists
</computeroutput></term>
<listitem>
<para>
This error occurs if <replaceable class="parameter">cursor</replaceable> is already declared.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><computeroutput>
ERROR: Named portals may only be used in begin/end transaction blocks
</computeroutput></term>
<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
</TITLE>
<PARA>
DECLARE allows a user to create cursors, which can be used to retrieve
</title>
<para>
<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
data either in text or in binary foramt.
</PARA>
<PARA>
</para>
<para>
Normal cursors return data in text format, either ASCII or another
encoding scheme depending on how the <productname>Postgres</productname>
backend was built. Since
encoding scheme depending on how the <productname>Postgres</productname>
backend was built. Since
data is stored natively in binary format, the system must
do a conversion to produce the text format. In addition,
text formats are often larger in size than the corresponding binary format.
Once the information comes back in text form, the client
application may have to convert it to a binary format to
manipulate it anyway.
</PARA>
<PARA>
</para>
<para>
BINARY cursors give you back the data in the native binary
representation. So binary cursors will tend to be a
little faster since they suffer less conversion overhead.
</para>
<para>
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
whereas with a binary cursor you would get
a 4-byte value equal to control-A ('^A').
you would get a string of '1' with a default cursor
whereas with a binary cursor you would get
a 4-byte value equal to control-A ('^A').
<caution>
<para>
BINARY cursors should be used carefully. User applications such
@ -230,14 +218,15 @@ whereas with a binary cursor you would get
</para>
</caution>
</para>
<PARA>
<para>
However, string representation is architecture-neutral whereas binary
representation can differ between different machine architectures.
Therefore, if your client machine and server machine use different
representations (e.g. "big-endian" versus "little-endian"),
you will probably not want your data returned in
you will probably not want your data returned in
binary format.
<tip>
<para>
If you intend to display the data in
@ -245,23 +234,23 @@ whereas with a binary cursor you would get
effort on the client side.
</para>
</tip>
</PARA>
<REFSECT2 ID="R2-SQL-DECLARE-3">
<REFSECT2INFO>
<DATE>1998-09-04</DATE>
</REFSECT2INFO>
<TITLE>
</para>
<refsect2 id="R2-SQL-DECLARE-3">
<refsect2info>
<date>1998-09-04</date>
</refsect2info>
<title>
Notes
</TITLE>
<PARA>
</title>
<para>
Cursors are only available in transactions.
</PARA>
<PARA>
</para>
<para>
<productname>Postgres</productname>
does not have an explicit <command>OPEN cursor</command>
statement; a cursor is considered to be open when it is declared.
<note>
<para>
In <acronym>SQL92</acronym> cursors are only available in
@ -271,39 +260,39 @@ whereas with a binary cursor you would get
involving DECLARE and OPEN statements.
</para>
</note>
</PARA>
</REFSECT2>
</para>
</refsect2>
</refsect1>
<REFSECT1 ID="R1-SQL-DECLARESTATEMENT-2">
<TITLE>
<refsect1 id="R1-SQL-DECLARESTATEMENT-2">
<title>
Usage
</TITLE>
<PARA>
</title>
<para>
To declare a cursor:
</PARA>
<ProgramListing>
<programlisting>
DECLARE liahona CURSOR
FOR SELECT * FROM films;
</ProgramListing>
</REFSECT1>
</programlisting>
</para>
</refsect1>
<REFSECT1 ID="R1-SQL-DECLARESTATEMENT-3">
<TITLE>
<refsect1 id="R1-SQL-DECLARESTATEMENT-3">
<title>
Compatibility
</TITLE>
<PARA>
</PARA>
<REFSECT2 ID="R2-SQL-DECLARESTATEMENT-4">
<REFSECT2INFO>
<DATE>1998-04-15</DATE>
</REFSECT2INFO>
<TITLE>
</title>
<para>
</para>
<refsect2 id="R2-SQL-DECLARESTATEMENT-4">
<refsect2info>
<date>1998-04-15</date>
</refsect2info>
<title>
SQL92
</TITLE>
<PARA>
</title>
<para>
<acronym>SQL92</acronym> allows cursors only in embedded <acronym>SQL</acronym>
and in modules. <productname>Postgres</productname> permits cursors to be used
interactively.
@ -314,12 +303,12 @@ DECLARE liahona CURSOR
</para>
</refsect2>
</refsect1>
</REFENTRY>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-omittag:nil
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t

View File

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

View File

@ -1,269 +1,277 @@
<REFENTRY ID="APP-DESTROYDB">
<REFMETA>
<REFENTRYTITLE>
<application>destroydb</application>
</REFENTRYTITLE>
<REFMISCINFO>Application</REFMISCINFO>
</REFMETA>
<REFNAMEDIV>
<REFNAME>
<application>destroydb</application>
</REFNAME>
<REFPURPOSE>
Remove an existing <productname>Postgres</productname> database
</REFPURPOSE>
</refnamediv>
<REFSYNOPSISDIV>
<REFSYNOPSISDIVINFO>
<DATE>1998-10-02</DATE>
</REFSYNOPSISDIVINFO>
<SYNOPSIS>
<refentry id="APP-DESTROYDB">
<refmeta>
<refentrytitle>
<application>destroydb</application>
</refentrytitle>
<refmiscinfo>Application</refmiscinfo>
</refmeta>
<refnamediv>
<refname>
<application>destroydb</application>
</refname>
<refpurpose>
Remove an existing <productname>Postgres</productname> database
</refpurpose>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
<date>1998-10-02</date>
</refsynopsisdivinfo>
<synopsis>
destroydb [ <replaceable class="parameter">dbname</replaceable> ]
destroydb [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replaceable class="parameter">port</replaceable> ]
[ -i ] [ <replaceable class="parameter">dbname</replaceable> ]
</SYNOPSIS>
</synopsis>
<REFSECT2 ID="R2-APP-DESTROYDB-1">
<REFSECT2INFO>
<DATE>1998-10-02</DATE>
</REFSECT2INFO>
<TITLE>
Inputs
</TITLE>
<PARA>
<variablelist>
<varlistentry>
<term>
-h <replaceable class="parameter">host</replaceable>
</term>
<listitem>
<para>
Specifies the hostname of the machine on which the
<application>postmaster</application>
is running. Defaults to using a local Unix domain socket
rather than an IP connection..
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
-p <replaceable class="parameter">port</replaceable>
</term>
<listitem>
<para>
Specifies the Internet TCP/IP port or local Unix domain socket file
extension on which the <application>postmaster</application>
is listening for connections. The port number defaults to 5432,
or the value of the <envar>PGPORT</envar>
environment variable (if set).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
-i
</term>
<listitem>
<para>
Run in interactive mode.
Prompts for confirmation before destroying a database.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<replaceable class="parameter">dbname</replaceable>
</term>
<listitem>
<para>
Specifies the name of the database to be destroyed. The database
must be one of the existing <productname>Postgres</productname> databases
in this installation.
<replaceable class="parameter">dbname</replaceable>
defaults to the value of the
<envar>USER</envar>
environment variable.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
<refsect2 id="R2-APP-DESTROYDB-1">
<refsect2info>
<date>1998-10-02</date>
</refsect2info>
<title>
Inputs
</title>
<para>
<REFSECT2 ID="R2-APP-DESTROYDB-2">
<REFSECT2INFO>
<DATE>1998-10-02</DATE>
</REFSECT2INFO>
<TITLE>
Outputs
</TITLE>
<PARA>
<application>destroydb</application> will remove files from the
<filename><envar>PGDATA</envar>/<replaceable class="parameter">dbname</replaceable>/</filename>
data area for the existing database.
<variablelist>
<varlistentry>
<term>
Connection to database 'template1' failed.
connectDB() failed: Is the postmaster running and accepting connections
at 'UNIX Socket' on port '<replaceable class="parameter">port</replaceable>'?
destroydb: database destroy failed on <replaceable class="parameter">dbname</replaceable>.
</term>
<listitem>
<para>
<application>destroydb</application> could not attach to the
<application>postmaster</application>
process on the specified host and port. If you see this message,
ensure that the <application>postmaster</application>
is running on the proper host and that you have specified the proper
port. If your site uses an authentication system, ensure that you
have obtained the required authentication credentials.
</para>
</listitem>
</varlistentry>
<variablelist>
<varlistentry>
<term>-h <replaceable class="parameter">host</replaceable></term>
<listitem>
<para>
Specifies the hostname of the machine on which the
<application>postmaster</application>
is running. Defaults to using a local Unix domain socket
rather than an IP connection.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
Connection to database 'template1' failed.
FATAL 1: SetUserId: user '<replaceable class="parameter">username</replaceable>' is not in 'pg_shadow'
destroydb: database destroy failed on <replaceable class="parameter">dbname</replaceable>.
</term>
<listitem>
<para>
You do not have a valid entry in the relation <literal>pg_shadow</literal>
and and will not be allowed to access <productname>Postgres</productname>.
Contact your <productname>Postgres</productname> administrator.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-p <replaceable class="parameter">port</replaceable></term>
<listitem>
<para>
Specifies the Internet TCP/IP port or local Unix domain socket file
extension on which the <application>postmaster</application>
is listening for connections. The port number defaults to 5432,
or the value of the <envar>PGPORT</envar>
environment variable (if set).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
ERROR: user '<replaceable class="parameter">username</replaceable>' is not allowed to create/destroy databases
destroydb: database destroy failed on <replaceable class="parameter">dbname</replaceable>.
</term>
<listitem>
<para>
You do not have permission to destroy (or create) databases.
Contact your <productname>Postgres</productname> site administrator.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
ERROR: destroydb: database '<replaceable class="parameter">dbname</replaceable>' does not exist.
destroydb: database destroy failed on <replaceable class="parameter">dbname</replaceable>.
</term>
<listitem>
<para>
The database to be removed does not have an entry in the
<literal>pg_database</literal> class.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
ERROR: destroydb: database '<replaceable class="parameter">dbname</replaceable>' is not owned by you.
destroydb: database destroy failed on <replaceable class="parameter">dbname</replaceable>.
</term>
<listitem>
<para>
You are not the Database Administrator (DBA) for the specified database.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
destroydb: database destroy failed on <replaceable class="parameter">dbname</replaceable>.
</term>
<listitem>
<para>
An internal error occurred in <application>psql</application>
or in the backend server. Ensure that your site administrator has
properly installed <productname>Postgres</productname>and initialized the site with
<application>initdb</application>.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
<note>
<para>
<application>destroydb</application> internally runs
<command>DESTROY DATABASE</command> from <application>psql</application>
while connected to the <literal>template1</literal> database.
</para>
</note>
</refsect2>
</refsynopsisdiv>
<varlistentry>
<term>-i</term>
<listitem>
<para>
Run in interactive mode.
Prompts for confirmation before destroying a database.
</para>
</listitem>
</varlistentry>
<REFSECT1 ID="R1-APP-DESTROYDB-1">
<REFSECT1INFO>
<DATE>1998-10-02</DATE>
</REFSECT1INFO>
<TITLE>
Description
</TITLE>
<PARA>
<application>destroydb</application> destroys an existing
<productname>Postgres</productname> database.
The person who executes this command must be
the database administrator, or <acronym>DBA</acronym>,
or must be the <productname>Postgres</productname> super-user.
The program runs silently; no confirmation message will be displayed.
After the database is destroyed, a Unix shell prompt will reappear.
</para>
<varlistentry>
<term><replaceable class="parameter">dbname</replaceable></term>
<listitem>
<para>
Specifies the name of the database to be destroyed. The database
must be one of the existing <productname>Postgres</productname> databases
in this installation.
<replaceable class="parameter">dbname</replaceable>
defaults to the value of the
<envar>USER</envar>
environment variable.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
<refsect2 id="R2-APP-DESTROYDB-2">
<refsect2info>
<date>1998-10-02</date>
</refsect2info>
<title>
Outputs
</title>
<para>
<application>destroydb</application> will remove files from the
<filename><envar>PGDATA</envar>/<replaceable class="parameter">dbname</replaceable>/</filename>
data area for the existing database.
<variablelist>
<varlistentry>
<term><computeroutput>
Connection to database 'template1' failed.
connectDB() failed: Is the postmaster running and accepting connections
at 'UNIX Socket' on port '<replaceable class="parameter">port</replaceable>'?
destroydb: database destroy failed on <replaceable class="parameter">dbname</replaceable>.
</computeroutput></term>
<listitem>
<para>
<application>destroydb</application> could not attach to the
<application>postmaster</application>
process on the specified host and port. If you see this message,
ensure that the <application>postmaster</application>
is running on the proper host and that you have specified the proper
port. If your site uses an authentication system, ensure that you
have obtained the required authentication credentials.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><computeroutput>
Connection to database 'template1' failed.
FATAL 1: SetUserId: user '<replaceable class="parameter">username</replaceable>' is not in 'pg_shadow'
destroydb: database destroy failed on <replaceable class="parameter">dbname</replaceable>.
</computeroutput></term>
<listitem>
<para>
You do not have a valid entry in the relation <literal>pg_shadow</literal>
and and will not be allowed to access <productname>Postgres</productname>.
Contact your <productname>Postgres</productname> administrator.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><computeroutput>
ERROR: user '<replaceable class="parameter">username</replaceable>' is not allowed to create/destroy databases
destroydb: database destroy failed on <replaceable class="parameter">dbname</replaceable>.
</computeroutput></term>
<listitem>
<para>
You do not have permission to destroy (or create) databases.
Contact your <productname>Postgres</productname> site administrator.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><computeroutput>
ERROR: destroydb: database '<replaceable class="parameter">dbname</replaceable>' does not exist.
destroydb: database destroy failed on <replaceable class="parameter">dbname</replaceable>.
</computeroutput></term>
<listitem>
<para>
The database to be removed does not have an entry in the
<literal>pg_database</literal> class.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><computeroutput>
ERROR: destroydb: database '<replaceable class="parameter">dbname</replaceable>' is not owned by you.
destroydb: database destroy failed on <replaceable class="parameter">dbname</replaceable>.
</computeroutput></term>
<listitem>
<para>
You are not the Database Administrator (DBA) for the specified database.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><computeroutput>
destroydb: database destroy failed on <replaceable class="parameter">dbname</replaceable>.
</computeroutput></term>
<listitem>
<para>
An internal error occurred in <application>psql</application>
or in the backend server. Ensure that your site administrator has
properly installed <productname>Postgres</productname>and initialized the site with
<application>initdb</application>.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
<note>
<para>
All references to
the database are removed, including the directory containing this
database and its associated files.
<application>destroydb</application> internally runs
<command>DESTROY DATABASE</command> from <application>psql</application>
while connected to the <literal>template1</literal> database.
</para>
<para>
<application>destroydb</application> is a shell script that invokes
<application>psql</application>.
Hence, a <application>postmaster</application>
process must be running on the database server host before
<application>destroydb</application>
is executed. The
<envar>PGOPTION</envar>
and
<envar>PGREALM</envar>
environment variables will be passed on to
<application>psql</application>
and processed as described in <xref linkend="app-psql" endterm="psql-ref">.
</para>
</refsect1>
</note>
</refsect2>
</refsynopsisdiv>
<REFSECT1 ID="R1-APP-DESTROYDB-2">
<REFSECT1INFO>
<DATE>1998-10-02</DATE>
</REFSECT1INFO>
<TITLE>
Usage
</TITLE>
<PARA>
To destroy the database <literal>demo</literal>
using the postmaster on the local host, port 5432:
<programlisting>
destroydb demo
</programlisting>
</para>
<para>
To destroy the database <literal>demo</literal>
using the postmaster on host eden, port 5000:
<programlisting>
destroydb -p 5000 -h eden demo
</programlisting>
</para>
</refsect1>
</REFENTRY>
<refsect1 id="R1-APP-DESTROYDB-1">
<refsect1info>
<date>1998-10-02</date>
</refsect1info>
<title>
Description
</title>
<para>
<application>destroydb</application> destroys an existing
<productname>Postgres</productname> database.
The person who executes this command must be
the database administrator, or <acronym>DBA</acronym>,
or must be the <productname>Postgres</productname> super-user.
The program runs silently; no confirmation message will be displayed.
After the database is destroyed, a Unix shell prompt will reappear.
</para>
<para>
All references to
the database are removed, including the directory containing this
database and its associated files.
</para>
<para>
<application>destroydb</application> is a shell script that invokes
<application>psql</application>.
Hence, a <application>postmaster</application>
process must be running on the database server host before
<application>destroydb</application>
is executed. The
<envar>PGOPTION</envar>
and
<envar>PGREALM</envar>
environment variables will be passed on to
<application>psql</application>
and processed as described in <xref endterm="psql-ref"
linkend="app-psql">.
</para>
</refsect1>
<refsect1 id="R1-APP-DESTROYDB-2">
<refsect1info>
<date>1998-10-02</date>
</refsect1info>
<title>
Usage
</title>
<para>
To destroy the database <literal>demo</literal>
using the postmaster on the local host, port 5432:
<programlisting>
destroydb demo
</programlisting>
</para>
<para>
To destroy the database <literal>demo</literal>
using the postmaster on host eden, port 5000:
<programlisting>
destroydb -p 5000 -h eden demo
</programlisting>
</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,244 +1,254 @@
<REFENTRY ID="APP-DESTROYUSER">
<REFMETA>
<REFENTRYTITLE>
<application>destroyuser</application>
</REFENTRYTITLE>
<REFMISCINFO>Application</REFMISCINFO>
</REFMETA>
<REFNAMEDIV>
<REFNAME>
<application>destroyuser</application>
</REFNAME>
<REFPURPOSE>
Destroy a <productname>Postgres</productname> user and associated databases
</REFPURPOSE>
</refnamediv>
<REFSYNOPSISDIV>
<REFSYNOPSISDIVINFO>
<DATE>1998-10-02</DATE>
</REFSYNOPSISDIVINFO>
<SYNOPSIS>
<refentry id="APP-DESTROYUSER">
<refmeta>
<refentrytitle>
<application>destroyuser</application>
</refentrytitle>
<refmiscinfo>Application</refmiscinfo>
</refmeta>
<refnamediv>
<refname>
<application>destroyuser</application>
</refname>
<refpurpose>
Destroy a <productname>Postgres</productname> user and associated databases
</refpurpose>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
<date>1998-10-02</date>
</refsynopsisdivinfo>
<synopsis>
destroyuser [ <replaceable class="parameter">username</replaceable> ]
destroyuser [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replaceable class="parameter">port</replaceable> ]
[ <replaceable class="parameter">username</replaceable> ]
</SYNOPSIS>
</synopsis>
<REFSECT2 ID="R2-APP-DESTROYUSER-1">
<REFSECT2INFO>
<DATE>1998-10-02</DATE>
</REFSECT2INFO>
<TITLE>
Inputs
</TITLE>
<PARA>
<variablelist>
<varlistentry>
<term>
-h <replaceable class="parameter">host</replaceable>
</term>
<listitem>
<para>
Specifies the hostname of the machine on which the
<application>postmaster</application>
is running. Defaults to using a local Unix domain socket
rather than an IP connection..
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
-p <replaceable class="parameter">port</replaceable>
</term>
<listitem>
<para>
Specifies the Internet TCP/IP port or local Unix domain socket file
extension on which the <application>postmaster</application>
is listening for connections. The port number defaults to 5432,
or the value of the <envar>PGPORT</envar>
environment variable (if set).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<replaceable class="parameter">username</replaceable>
</term>
<listitem>
<para>
Specifies the name of the <productname>Postgres</productname> user to be removed.
This name must exist in the <productname>Postgres</productname> installation.
You will be prompted for a name if none is specified on the command line.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
<REFSECT2 ID="R2-APP-DESTROYUSER-2">
<REFSECT2INFO>
<DATE>1998-10-02</DATE>
</REFSECT2INFO>
<TITLE>
Outputs
</TITLE>
<PARA>
<application>destroyuser</application> will remove an entry in the
<literal>pg_user</literal> or <literal>pg_shadow</literal> system table,
and will remove all databases for which that user is the administrator
(<acronym>DBA</acronym>).
<refsect2 id="R2-APP-DESTROYUSER-1">
<refsect2info>
<date>1998-10-02</date>
</refsect2info>
<title>
Inputs
</title>
<para>
<variablelist>
<varlistentry>
<term>
Connection to database 'template1' failed.
connectDB() failed: Is the postmaster running and accepting connections
at 'UNIX Socket' on port '<replaceable class="parameter">port</replaceable>'?
destroyuser: database access failed.
</term>
<listitem>
<para>
<application>destroyuser</application> could not attach to the
<application>postmaster</application>
process on the specified host and port. If you see this message,
ensure that the <application>postmaster</application>
is running on the proper host and that you have specified the proper
port. If your site uses an authentication system, ensure that you
have obtained the required authentication credentials.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
Connection to database 'template1' failed.
FATAL 1: SetUserId: user '<replaceable class="parameter">username</replaceable>' is not in 'pg_shadow'
destroyuser: database access failed.
</term>
<listitem>
<para>
You do not have a valid entry in the relation <literal>pg_shadow</literal>
and and will not be allowed to access <productname>Postgres</productname>. Contact your
<productname>Postgres</productname> administrator.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
destroyuser: <replaceable class="parameter">username</replaceable> cannot delete users.
</term>
<listitem>
<para>
You do not have permission to delete users; contact your
<productname>Postgres</productname> site administrator.
</para>
</listitem>
</varlistentry>
<variablelist>
<varlistentry>
<term>-h <replaceable class="parameter">host</replaceable></term>
<listitem>
<para>
Specifies the hostname of the machine on which the
<application>postmaster</application>
is running. Defaults to using a local Unix domain socket
rather than an IP connection.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
destroyuser: user "<replaceable class="parameter">username</replaceable>" already exists
</term>
<listitem>
<para>
The user to be added already has an entry in the <literal>pg_shadow</literal>
class.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
database access failed
</term>
<listitem>
<para>
An internal error occurred in <application>psql</application>
or in the backend server. Ensure that your site administrator has
properly installed <productname>Postgres</productname>and initialized the site with
<application>initdb</application>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-p <replaceable class="parameter">port</replaceable></term>
<listitem>
<para>
Specifies the Internet TCP/IP port or local Unix domain socket file
extension on which the <application>postmaster</application>
is listening for connections. The port number defaults to 5432,
or the value of the <envar>PGPORT</envar>
environment variable (if set).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
destroydb on <replaceable class="parameter">dbname</replaceable> failed - exiting
</term>
<listitem>
<para>
An internal error occurred in <application>psql</application>
or in the backend server. There was possibly a Unix permissions problem with the
specified database.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">username</replaceable></term>
<listitem>
<para>
Specifies the name of the <productname>Postgres</productname> user to be removed.
This name must exist in the <productname>Postgres</productname> installation.
You will be prompted for a name if none is specified on the command line.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
<varlistentry>
<term>
delete of user <replaceable class="parameter">username</replaceable> was UNSUCCESSFUL
</term>
<listitem>
<para>
An internal error occurred in <application>psql</application>
or in the backend server.
</para>
</listitem>
</varlistentry>
<refsect2 id="R2-APP-DESTROYUSER-2">
<refsect2info>
<date>1998-10-02</date>
</refsect2info>
<title>
Outputs
</title>
<para>
<application>destroyuser</application> will remove an entry in the
<literal>pg_user</literal> or <literal>pg_shadow</literal> system table,
and will remove all databases for which that user is the administrator
(<acronym>DBA</acronym>).
</variablelist>
</para>
<variablelist>
<varlistentry>
<term><computeroutput>
Connection to database 'template1' failed.
connectDB() failed: Is the postmaster running and accepting connections
at 'UNIX Socket' on port '<replaceable class="parameter">port</replaceable>'?
destroyuser: database access failed.
</computeroutput></term>
<listitem>
<para>
<application>destroyuser</application> could not attach to the
<application>postmaster</application>
process on the specified host and port. If you see this message,
ensure that the <application>postmaster</application>
is running on the proper host and that you have specified the proper
port. If your site uses an authentication system, ensure that you
have obtained the required authentication credentials.
</para>
</listitem>
</varlistentry>
<note>
<para>
<application>destroyuser</application> internally runs
DROP USER from <application>psql</application>
while connected to the <literal>template1</literal> database.
</para>
</note>
</refsect2>
</refsynopsisdiv>
<REFSECT1 ID="R1-APP-DESTROYUSER-1">
<REFSECT1INFO>
<DATE>1998-10-02</DATE>
</REFSECT1INFO>
<TITLE>
Description
</TITLE>
<PARA>
<application>destroyuser</application> removes an existing
<productname>Postgres</productname> user
and the databases for which that user
is database administrator.
Only users with <literal>usesuper</literal> set in
the <literal>pg_shadow</literal> class can destroy
<productname>Postgres</productname> users. As shipped,
the user <literal>postgres</literal> can remove users.
</para>
<varlistentry>
<term><computeroutput>
Connection to database 'template1' failed.
FATAL 1: SetUserId: user '<replaceable class="parameter">username</replaceable>' is not in 'pg_shadow'
destroyuser: database access failed.
</computeroutput></term>
<listitem>
<para>
You do not have a valid entry in the relation <literal>pg_shadow</literal>
and and will not be allowed to access <productname>Postgres</productname>. Contact your
<productname>Postgres</productname> administrator.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><computeroutput>
destroyuser: <replaceable class="parameter">username</replaceable> cannot delete users.
</computeroutput></term>
<listitem>
<para>
You do not have permission to delete users; contact your
<productname>Postgres</productname> site administrator.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><computeroutput>
destroyuser: user "<replaceable class="parameter">username</replaceable>" already exists
</computeroutput></term>
<listitem>
<para>
The user to be added already has an entry in the
<literal>pg_shadow</literal> class.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><computeroutput>
database access failed
</computeroutput></term>
<listitem>
<para>
An internal error occurred in <application>psql</application>
or in the backend server. Ensure that your site administrator has
properly installed <productname>Postgres</productname>and initialized the site with
<application>initdb</application>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><computeroutput>
destroydb on <replaceable class="parameter">dbname</replaceable> failed - exiting
</computeroutput></term>
<listitem>
<para>
An internal error occurred in <application>psql</application>
or in the backend server. There was possibly a Unix permissions problem with the
specified database.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><computeroutput>
delete of user <replaceable class="parameter">username</replaceable> was UNSUCCESSFUL
</computeroutput></term>
<listitem>
<para>
An internal error occurred in <application>psql</application>
or in the backend server.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
<note>
<para>
<application>destroyuser</application> is a shell script that invokes
<application>psql</application>.
Hence, a <application>postmaster</application>
process must be running on the database server host before
<application>destroyuser</application> is executed.
The
<envar>PGOPTION</envar>
and
<envar>PGREALM</envar>
environment variables will be passed on to
<application>psql</application>
and processed as described in <xref linkend="app-psql" endterm="psql-ref">.
<application>destroyuser</application> internally runs
<command>DROP USER</command> from <application>psql</application>
while connected to the <literal>template1</literal> database.
</para>
<para>
Once invoked, <application>destroyuser</application>
will warn you about the databases that will be destroyed in the
process and permit you to abort the removal of the user if desired.
</para>
</refsect1>
</REFENTRY>
</note>
</refsect2>
</refsynopsisdiv>
<refsect1 id="R1-APP-DESTROYUSER-1">
<refsect1info>
<date>1998-10-02</date>
</refsect1info>
<title>
Description
</title>
<para>
<application>destroyuser</application> removes an existing
<productname>Postgres</productname> user
and the databases for which that user
is database administrator.
Only users with <literal>usesuper</literal> set in
the <literal>pg_shadow</literal> class can destroy
<productname>Postgres</productname> users. As shipped,
the user <literal>postgres</literal> can remove users.
</para>
<para>
<application>destroyuser</application> is a shell script that invokes
<application>psql</application>.
Hence, a <application>postmaster</application>
process must be running on the database server host before
<application>destroyuser</application> is executed.
The
<envar>PGOPTION</envar>
and
<envar>PGREALM</envar>
environment variables will be passed on to
<application>psql</application>
and processed as described in <xref endterm="psql-ref"
linkend="app-psql">.
</para>
<para>
Once invoked, <application>destroyuser</application>
will warn you about the databases that will be destroyed in the
process and permit you to abort the removal of the user if desired.
</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,168 +1,164 @@
<REFENTRY ID="SQL-DROPAGGREGATE">
<REFMETA>
<REFENTRYTITLE>
<refentry id="SQL-DROPAGGREGATE">
<refmeta>
<refentrytitle>
DROP AGGREGATE
</REFENTRYTITLE>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO>
</REFMETA>
<REFNAMEDIV>
<REFNAME>
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta>
<refnamediv>
<refname>
DROP AGGREGATE
</REFNAME>
<REFPURPOSE>
</refname>
<refpurpose>
Removes the definition of an aggregate function
</REFPURPOSE>
</refpurpose>
</refnamediv>
<REFSYNOPSISDIV>
<REFSYNOPSISDIVINFO>
<DATE>1998-04-15</DATE>
</REFSYNOPSISDIVINFO>
<SYNOPSIS>
DROP AGGREGATE <REPLACEABLE CLASS="PARAMETER">name</REPLACEABLE> <REPLACEABLE CLASS="PARAMETER">type</REPLACEABLE>
</SYNOPSIS>
<REFSECT2 ID="R2-SQL-DROPAGGREGATE-1">
<REFSECT2INFO>
<DATE>1998-04-15</DATE>
</REFSECT2INFO>
<TITLE>
<refsynopsisdiv>
<refsynopsisdivinfo>
<date>1998-04-15</date>
</refsynopsisdivinfo>
<synopsis>
DROP AGGREGATE <replaceable class="PARAMETER">name</replaceable> <replaceable class="PARAMETER">type</replaceable>
</synopsis>
<refsect2 id="R2-SQL-DROPAGGREGATE-1">
<refsect2info>
<date>1998-04-15</date>
</refsect2info>
<title>
Inputs
</TITLE>
<PARA>
</PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
<replaceable class="parameter">name</replaceable>
</TERM>
<LISTITEM>
<PARA>
The name of an existing aggregate function.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
<replaceable class="parameter">type</replaceable>
</TERM>
<LISTITEM>
<PARA>
The type of an existing aggregate function.
(Refer to the <citetitle>PostgreSQL User's Guide</citetitle> for
further information about data types).
<comment>This should become a cross-reference rather than a
hard-coded chapter number</comment>
</PARA>
</LISTITEM>
</VARLISTENTRY>
</variablelist>
</REFSECT2>
<REFSECT2 ID="R2-SQL-DROPAGGREGATE-2">
<REFSECT2INFO>
<DATE>1998-04-15</DATE>
</REFSECT2INFO>
<TITLE>
Outputs
</TITLE>
<PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
<ReturnValue>DROP</ReturnValue>
</TERM>
<LISTITEM>
<PARA>
Message returned if the command is successful.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
<ReturnValue>WARN RemoveAggregate: aggregate '<replaceable class="parameter">name</replaceable>' for '<replaceable class="parameter">type</replaceable>' does not exist</ReturnValue>
</TERM>
<LISTITEM>
<PARA>
This message occurs if the aggregate function specified does not
exist in the database.
</title>
<para>
<variablelist>
<varlistentry>
<term><replaceable class="parameter">name</replaceable></term>
<listitem>
<para>
The name of an existing aggregate function.
</para>
</listitem>
</varlistentry>
</VARIABLELIST>
<varlistentry>
<term><replaceable class="parameter">type</replaceable></term>
<listitem>
<para>
The type of an existing aggregate function.
(Refer to the <citetitle>PostgreSQL User's Guide</citetitle> for
further information about data types).
<comment>This should become a cross-reference rather than a
hard-coded chapter number</comment>
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</REFSECT2>
</REFSYNOPSISDIV>
<REFSECT1 ID="R1-SQL-DROPAGGREGATE-1">
<REFSECT1INFO>
<DATE>1998-04-15</DATE>
</REFSECT1INFO>
<TITLE>
</refsect2>
<refsect2 id="R2-SQL-DROPAGGREGATE-2">
<refsect2info>
<date>1998-04-15</date>
</refsect2info>
<title>
Outputs
</title>
<para>
<variablelist>
<varlistentry>
<term><computeroutput>
DROP
</computeroutput></term>
<listitem>
<para>
Message returned if the command is successful.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><computeroutput>
WARN RemoveAggregate: aggregate '<replaceable class="parameter">agg</replaceable>' for '<replaceable class="parameter">type</replaceable>' does not exist
</computeroutput></term>
<listitem>
<para>
This message occurs if the aggregate function specified does not
exist in the database.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
</refsynopsisdiv>
<refsect1 id="R1-SQL-DROPAGGREGATE-1">
<refsect1info>
<date>1998-04-15</date>
</refsect1info>
<title>
Description
</TITLE>
<PARA>
</title>
<para>
<command>DROP AGGREGATE</command> will remove all references to an existing
aggregate definition. To execute this command the current
user must be the owner of the aggregate.
</PARA>
<REFSECT2 ID="R2-SQL-DROPAGGREGATE-3">
<REFSECT2INFO>
<DATE>1998-04-15</DATE>
</REFSECT2INFO>
<TITLE>
</para>
<refsect2 id="R2-SQL-DROPAGGREGATE-3">
<refsect2info>
<date>1998-04-15</date>
</refsect2info>
<title>
Notes
</TITLE>
<PARA>
</title>
<para>
The <command>DROP AGGREGATE</command> statement is a
<productname>Postgres</productname>
<productname>Postgres</productname>
language extension.
</PARA>
<PARA>
</para>
<para>
Refer to the <command>CREATE AGGREGATE</command> statement to
create aggregate functions.
</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>
</para>
</refsect2>
</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
Local variables:
mode: sgml
sgml-omittag:t
sgml-omittag:nil
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t

View File

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

View File

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

View File

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

View File

@ -1,172 +1,170 @@
<REFENTRY ID="SQL-DROPLANGUAGE">
<REFMETA>
<REFENTRYTITLE>
<refentry id="SQL-DROPLANGUAGE">
<refmeta>
<refentrytitle>
DROP LANGUAGE
</REFENTRYTITLE>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO>
</REFMETA>
<REFNAMEDIV>
<REFNAME>
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta>
<refnamediv>
<refname>
DROP LANGUAGE
</REFNAME>
<REFPURPOSE>
</refname>
<refpurpose>
Removes a user-defined procedural language
</REFPURPOSE>
</refpurpose>
</refnamediv>
<REFSYNOPSISDIV>
<REFSYNOPSISDIVINFO>
<DATE>1998-04-15</DATE>
</REFSYNOPSISDIVINFO>
<SYNOPSIS>
DROP PROCEDURAL LANGUAGE '<REPLACEABLE CLASS="PARAMETER">langname</REPLACEABLE>'
</SYNOPSIS>
<refsynopsisdiv>
<refsynopsisdivinfo>
<date>1998-04-15</date>
</refsynopsisdivinfo>
<synopsis>
DROP PROCEDURAL LANGUAGE '<replaceable class="PARAMETER">name</replaceable>'
</synopsis>
<REFSECT2 ID="R2-SQL-DROPLANGUAGE-1">
<REFSECT2INFO>
<DATE>1998-04-15</DATE>
</REFSECT2INFO>
<TITLE>
<refsect2 id="R2-SQL-DROPLANGUAGE-1">
<refsect2info>
<date>1998-04-15</date>
</refsect2info>
<title>
Inputs
</TITLE>
<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">
<REFSECT2INFO>
<DATE>1998-04-15</DATE>
</REFSECT2INFO>
<TITLE>
Outputs
</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.
</title>
<para>
<variablelist>
<varlistentry>
<term><replaceable class="PARAMETER">name</replaceable></term>
<listitem>
<para>
The name of an existing procedural language.
</para>
</listitem>
</varlistentry>
</VARIABLELIST>
</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 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 ID="R2-SQL-DROPLANGUAGE-4">
<REFSECT2INFO>
<DATE>1998-04-15</DATE>
</REFSECT2INFO>
<TITLE>
<refsect2 id="R2-SQL-DROPLANGUAGE-2">
<refsect2info>
<date>1998-04-15</date>
</refsect2info>
<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
</TITLE>
<PARA>
</title>
<para>
No checks are made if functions or trigger procedures registered
in this language still exist. To re-enable them without having
to drop and recreate all the functions, the pg_proc's prolang
attribute of the functions must be adjusted to the new object
ID of the recreated pg_language entry for the PL.
</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>
</para>
</refsect2>
</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
Local variables:
mode: sgml
sgml-omittag:t
sgml-omittag:nil
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,91 +1,90 @@
<REFENTRY ID="SQL-DROPUSER">
<REFMETA>
<REFENTRYTITLE>
<refentry id="SQL-DROPUSER">
<refmeta>
<refentrytitle>
DROP USER
</REFENTRYTITLE>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO>
</REFMETA>
<REFNAMEDIV>
<REFNAME>
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta>
<refnamediv>
<refname>
DROP USER
</REFNAME>
<REFPURPOSE>
</refname>
<refpurpose>
Removes an user account information
</REFPURPOSE>
</refpurpose>
</refnamediv>
<REFSYNOPSISDIV>
<REFSYNOPSISDIVINFO>
<DATE>1998-09-22</DATE>
</REFSYNOPSISDIVINFO>
<SYNOPSIS>
DROP USER <REPLACEABLE CLASS="PARAMETER">username</REPLACEABLE>
</SYNOPSIS>
<refsynopsisdiv>
<refsynopsisdivinfo>
<date>1998-09-22</date>
</refsynopsisdivinfo>
<synopsis>
DROP USER <replaceable class="PARAMETER">name</replaceable>
</synopsis>
<REFSECT2 ID="R2-SQL-DROPUSER-1">
<REFSECT2INFO>
<DATE>1998-09-22</DATE>
</REFSECT2INFO>
<TITLE>
<refsect2 id="R2-SQL-DROPUSER-1">
<refsect2info>
<date>1998-09-22</date>
</refsect2info>
<title>
Inputs
</TITLE>
<PARA>
</PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
<REPLACEABLE CLASS="PARAMETER">username</REPLACEABLE>
</TERM>
<LISTITEM>
<PARA>
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>
</title>
<para>
<variablelist>
<varlistentry>
<term><replaceable class="PARAMETER">name</replaceable></term>
<listitem>
<para>
The name of an existing user.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</REFSECT2>
</REFSYNOPSISDIV>
<REFSECT1 ID="R1-SQL-DROPUSER-1">
<REFSECT1INFO>
<DATE>1998-09-22</DATE>
</REFSECT1INFO>
<TITLE>
</refsect2>
<refsect2 id="R2-SQL-DROPUSER-2">
<refsect2info>
<date>1998-09-22</date>
</refsect2info>
<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
</TITLE>
<PARA>
</title>
<para>
<command>DROP USER</command> removes the specified
user from the database,
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
can be used in place of the <application>destroyuser</application>
script, regardless of how the user was created.
</PARA>
<REFSECT2 ID="R2-SQL-DROPUSER-3">
<REFSECT2INFO>
<DATE>1998-09-22</DATE>
</REFSECT2INFO>
<TITLE>
</para>
<refsect2 id="R2-SQL-DROPUSER-3">
<refsect2info>
<date>1998-09-22</date>
</refsect2info>
<title>
Notes
</TITLE>
<PARA>
</title>
<para>
<command>DROP USER</command> is a <productname>Postgres</productname>
language extension.
</PARA>
<PARA>
</para>
<para>
Refer to <command>CREATE USER</command> and
<command>ALTER USER</command> for information on
how to create or modify user accounts.
</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>
</para>
</refsect2>
</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
Local variables:
mode: sgml
sgml-omittag:t
sgml-omittag:nil
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t

View File

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

View File

@ -1,186 +1,180 @@
<REFENTRY ID="SQL-EXPLAIN">
<REFMETA>
<REFENTRYTITLE>
EXPLAIN
</REFENTRYTITLE>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO>
</REFMETA>
<REFNAMEDIV>
<REFNAME>
EXPLAIN
</REFNAME>
<REFPURPOSE>
Shows statement execution details
</REFPURPOSE>
</refnamediv>
<refentry id="SQL-EXPLAIN">
<refmeta>
<refentrytitle>
EXPLAIN
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta>
<refnamediv>
<refname>
EXPLAIN
</refname>
<refpurpose>
Shows statement execution details
</refpurpose>
</refnamediv>
<REFSYNOPSISDIV>
<REFSYNOPSISDIVINFO>
<DATE>1998-09-01</DATE>
</REFSYNOPSISDIVINFO>
<SYNOPSIS>
EXPLAIN [ VERBOSE ] <REPLACEABLE CLASS="PARAMETER">query</REPLACEABLE>
</SYNOPSIS>
<refsynopsisdiv>
<refsynopsisdivinfo>
<date>1998-09-01</date>
</refsynopsisdivinfo>
<synopsis>
EXPLAIN [ VERBOSE ] <replaceable class="PARAMETER">query</replaceable>
</synopsis>
<REFSECT2 ID="R2-SQL-EXPLAIN-1">
<REFSECT2INFO>
<DATE>1998-09-01</DATE>
</REFSECT2INFO>
<TITLE>
Inputs
</TITLE>
<PARA>
<refsect2 id="R2-SQL-EXPLAIN-1">
<refsect2info>
<date>1998-09-01</date>
</refsect2info>
<title>
Inputs
</title>
<para>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
VERBOSE
</TERM>
<LISTITEM>
<PARA>
Flag to show detailed query plan.
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
<REPLACEABLE CLASS="PARAMETER">query</REPLACEABLE>
</TERM>
<LISTITEM>
<PARA>
Any <REPLACEABLE CLASS="PARAMETER">query</REPLACEABLE>.
</para>
</listitem>
</varlistentry>
</VARIABLELIST>
</para>
</REFSECT2>
<variablelist>
<varlistentry>
<term>VERBOSE</term>
<listitem>
<para>
Flag to show detailed query plan.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="PARAMETER">query</replaceable></term>
<listitem>
<para>
Any <replaceable class="PARAMETER">query</replaceable>.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
<REFSECT2 ID="R2-SQL-EXPLAIN-2">
<REFSECT2INFO>
<DATE>1998-04-15</DATE>
</REFSECT2INFO>
<TITLE>
Outputs
</TITLE>
<PARA>
<refsect2 id="R2-SQL-EXPLAIN-2">
<refsect2info>
<date>1998-04-15</date>
</refsect2info>
<title>
Outputs
</title>
<para>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
<variablelist>
<varlistentry>
<term><computeroutput>
NOTICE: QUERY PLAN:
<replaceable>plan</replaceable>
</TERM>
<LISTITEM>
<PARA>
Explicit query plan from the <productname>Postgres</productname> backend.
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
</computeroutput></term>
<listitem>
<para>
Explicit query plan from the <productname>Postgres</productname> backend.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><computeroutput>
EXPLAIN
</TERM>
<LISTITEM>
<PARA>
Flag sent after query plan is shown.
</para>
</listitem>
</varlistentry>
</VARIABLELIST>
</para>
</REFSECT2>
</REFSYNOPSISDIV>
</computeroutput></term>
<listitem>
<para>
Flag sent after query plan is shown.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
</refsynopsisdiv>
<REFSECT1 ID="R1-SQL-EXPLAIN-1">
<REFSECT1INFO>
<DATE>1998-04-15</DATE>
</REFSECT1INFO>
<TITLE>
Description
</TITLE>
<PARA>
<refsect1 id="R1-SQL-EXPLAIN-1">
<refsect1info>
<date>1998-04-15</date>
</refsect1info>
<title>
Description
</title>
<para>
This command outputs details about the supplied query.
The default output is the computed query cost.
The cost value is only meaningful to the optimizer in comparing
various query plans.
VERBOSE displays the full query plan and cost to your screen,
and pretty-prints the plan to the postmaster log file.
</para>
<REFSECT2 ID="R2-SQL-EXPLAIN-3">
<REFSECT2INFO>
<DATE>1998-04-15</DATE>
</REFSECT2INFO>
<TITLE>
Notes
</TITLE>
<PARA>
There is only sparse documentation on the optimizer's use of cost
information in <productname>Postgres</productname>.
General information on cost estimation for query optimization
can be found in database textbooks.
Refer to the <citetitle>Programmer's Guide</citetitle>
in the chapters on indexes and the genetic query optimizer for
more information.
</para>
</REFSECT2>
</refsect1>
</para>
<REFSECT1 ID="R1-SQL-EXPLAIN-2">
<TITLE>
Usage
</TITLE>
<PARA>
To show a query plan for a simple query:
<refsect2 id="R2-SQL-EXPLAIN-3">
<refsect2info>
<date>1998-04-15</date>
</refsect2info>
<title>
Notes
</title>
<para>
There is only sparse documentation on the optimizer's use of cost
information in <productname>Postgres</productname>.
General information on cost estimation for query optimization
can be found in database textbooks.
Refer to the <citetitle>Programmer's Guide</citetitle>
in the chapters on indexes and the genetic query optimizer for
more information.
</para>
</refsect2>
</refsect1>
<ProgramListing>
postgres=> explain select * from foo;
<refsect1 id="R1-SQL-EXPLAIN-2">
<title>
Usage
</title>
<para>
To show a query plan for a simple query:
<programlisting>
EXPLAIN select * from foo;
NOTICE: QUERY PLAN:
Seq Scan on foo (cost=0.00 rows=0 width=4)
EXPLAIN
</ProgramListing>
</para>
</REFSECT1>
</programlisting>
</para>
</refsect1>
<REFSECT1 ID="R1-SQL-EXPLAIN-3">
<TITLE>
Compatibility
</TITLE>
<PARA>
</PARA>
<refsect1 id="R1-SQL-EXPLAIN-3">
<title>
Compatibility
</title>
<para>
</para>
<REFSECT2 ID="R2-SQL-EXPLAIN-4">
<REFSECT2INFO>
<DATE>1998-09-01</DATE>
</REFSECT2INFO>
<TITLE>
SQL92
</TITLE>
<PARA>
There is no EXPLAIN statement defined in SQL92.
</para>
</refsect2>
</refsect1>
</REFENTRY>
<refsect2 id="R2-SQL-EXPLAIN-4">
<refsect2info>
<date>1998-09-01</date>
</refsect2info>
<title>
SQL92
</title>
<para>
There is no <command>EXPLAIN</command> statement defined in SQL92.
</para>
</refsect2>
</refsect1>
</refentry>
<!--
<REPLACEABLE CLASS="PARAMETER">
</REPLACEABLE>
<ReturnValue></ReturnValue>
<PARA>
</PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>&bull;
</TERM>
<LISTITEM>
<PARA>
</PARA>
</LISTITEM>
</VARLISTENTRY>
</VARIABLELIST>
<PARA>
</PARA>
<!-- 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,300 +1,287 @@
<REFENTRY ID="SQL-FETCH">
<REFMETA>
<REFENTRYTITLE>
FETCH
</REFENTRYTITLE>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO>
</REFMETA>
<REFNAMEDIV>
<REFNAME>
FETCH
</REFNAME>
<REFPURPOSE>
Gets rows using a cursor
</REFPURPOSE>
</refnamediv>
<REFSYNOPSISDIV>
<REFSYNOPSISDIVINFO>
<DATE>1998-09-01</DATE>
</REFSYNOPSISDIVINFO>
<SYNOPSIS>
FETCH [ <REPLACEABLE CLASS="PARAMETER">selector</REPLACEABLE> ] [ <REPLACEABLE CLASS="PARAMETER">count</REPLACEABLE> ]
{ IN | FROM } <REPLACEABLE CLASS="PARAMETER">cursor</REPLACEABLE>
FETCH [ RELATIVE ] [ { [ <REPLACEABLE CLASS="PARAMETER">#</REPLACEABLE> | ALL | NEXT | PRIOR ] } ]
FROM ] <REPLACEABLE CLASS="PARAMETER">cursor</REPLACEABLE>
</SYNOPSIS>
<refentry id="SQL-FETCH">
<refmeta>
<refentrytitle>
FETCH
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta>
<refnamediv>
<refname>
FETCH
</refname>
<refpurpose>
Gets rows using a cursor
</refpurpose>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
<date>1998-09-01</date>
</refsynopsisdivinfo>
<synopsis>
FETCH [ <replaceable class="PARAMETER">selector</replaceable> ] [ <replaceable class="PARAMETER">count</replaceable> ] { IN | FROM } <replaceable class="PARAMETER">cursor</replaceable>
FETCH [ RELATIVE ] [ { [ <replaceable class="PARAMETER">#</replaceable> | ALL | NEXT | PRIOR ] } ] FROM ] <replaceable class="PARAMETER">cursor</replaceable>
</synopsis>
<REFSECT2 ID="R2-SQL-FETCH-1">
<REFSECT2INFO>
<DATE>1998-09-01</DATE>
</REFSECT2INFO>
<TITLE>
Inputs
</TITLE>
<PARA>
<refsect2 id="R2-SQL-FETCH-1">
<refsect2info>
<date>1998-09-01</date>
</refsect2info>
<title>
Inputs
</title>
<para>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
<REPLACEABLE CLASS="PARAMETER">selector</REPLACEABLE>
</TERM>
<LISTITEM>
<PARA>
<REPLACEABLE CLASS="PARAMETER">selector</REPLACEABLE>
defines the fetch direction. It can be one
the following:
</para>
</listitem>
</varlistentry>
</variablelist>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
FORWARD
</TERM>
<LISTITEM>
<PARA>
fetch next row(s). This is the default
if <REPLACEABLE CLASS="PARAMETER">selector</REPLACEABLE> is omitted.
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
BACKWARD
</TERM>
<LISTITEM>
<PARA>
fetch previous row(s).
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
RELATIVE
</TERM>
<LISTITEM>
<PARA>
Noise word for SQL92 compatibility.
</para>
</listitem>
</varlistentry>
<variablelist>
<varlistentry>
<term><replaceable class="PARAMETER">selector</replaceable></term>
<listitem>
<para>
<replaceable class="PARAMETER">selector</replaceable>
defines the fetch direction. It can be one
the following:
<variablelist>
<varlistentry>
<term>FORWARD</term>
<listitem>
<para>
fetch next row(s). This is the default
if <replaceable class="PARAMETER">selector</replaceable> is omitted.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>BACKWARD</term>
<listitem>
<para>
fetch previous row(s).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>RELATIVE</term>
<listitem>
<para>
Noise word for SQL92 compatibility.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</listitem>
</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:
</para>
</listitem>
</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:
<variablelist>
<varlistentry>
<term><replaceable class="PARAMETER">#</replaceable></term>
<listitem>
<para>
A signed integer that specify how many rows to fetch.
Note that a negative integer is equivalent to changing the sense of
FORWARD and BACKWARD.
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
<REPLACEABLE CLASS="PARAMETER">#</REPLACEABLE>
</TERM>
<LISTITEM>
<PARA>
A signed integer that specify how many rows to fetch.
Note that a negative integer is equivalent to changing the sense of
FORWARD and BACKWARD.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
ALL
</term>
<listitem>
<para>
Retrieve all remaining rows.
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
ALL
</TERM>
<LISTITEM>
<PARA>
Retrieve all remaining rows.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
NEXT
</term>
<listitem>
<para>
Equivalent to specifying a count of <command>1</command>.
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
NEXT
</TERM>
<LISTITEM>
<PARA>
Equivalent to specifying a count of <command>1</command>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
PRIOR
</term>
<listitem>
<para>
Equivalent to specifying a count of <command>-1</command>.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
PRIOR
</TERM>
<LISTITEM>
<PARA>
Equivalent to specifying a count of <command>-1</command>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="PARAMETER">cursor</replaceable></term>
<listitem>
<para>
An open cursor's name.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
<VARLISTENTRY>
<TERM>
<REPLACEABLE CLASS="PARAMETER">cursor</REPLACEABLE>
</TERM>
<LISTITEM>
<PARA>
An open cursor's name.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</REFSECT2>
<refsect2 id="R2-SQL-FETCH-2">
<refsect2info>
<date>1998-04-15</date>
</refsect2info>
<title>
Outputs
</title>
<para>
<command>FETCH</command> returns the results of the query defined by the specified cursor.
The following messages will be returned if the query fails:
<REFSECT2 ID="R2-SQL-FETCH-2">
<REFSECT2INFO>
<DATE>1998-04-15</DATE>
</REFSECT2INFO>
<TITLE>
Outputs
</TITLE>
<PARA>
FETCH returns the results of the query defined by the specified cursor.
The following messages will be returned if the query fails:
</para>
<variablelist>
<varlistentry>
<term><computeroutput>
NOTICE: PerformPortalFetch: portal "<replaceable class="PARAMETER">cursor</replaceable>" not found
</computeroutput></term>
<listitem>
<para>
If <replaceable class="PARAMETER">cursor</replaceable>
is not previously declared.
The cursor must be declared within a transaction block.
</para>
</listitem>
</varlistentry>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
NOTICE: PerformPortalFetch: portal "<REPLACEABLE CLASS="PARAMETER">cursor</REPLACEABLE>" not found
</TERM>
<LISTITEM>
<PARA>
If <REPLACEABLE CLASS="PARAMETER">cursor</REPLACEABLE>
is not previously declared.
The cursor must be declared within a transaction block.
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
<varlistentry>
<term><computeroutput>
NOTICE: FETCH/ABSOLUTE not supported, using RELATIVE
</TERM>
<LISTITEM>
<PARA>
<productname>Postgres</productname> does not support absolute
positioning of cursors.
</para>
</listitem>
</varlistentry>
</computeroutput></term>
<listitem>
<para>
<productname>Postgres</productname> does not support absolute
positioning of cursors.
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
<varlistentry>
<term><computeroutput>
ERROR: FETCH/RELATIVE at current position is not supported
</TERM>
<LISTITEM>
<PARA>
<acronym>SQL92</acronym> allows one to repetatively retrieve the cursor
at its "current position" using the syntax
<programlisting>
FETCH RELATIVE 0 FROM <REPLACEABLE CLASS="PARAMETER">cursor</REPLACEABLE>
</programlisting>
</computeroutput></term>
<listitem>
<para>
<acronym>SQL92</acronym> allows one to repetatively retrieve the cursor
at its "current position" using the syntax
<synopsis>
FETCH RELATIVE 0 FROM <replaceable class="PARAMETER">cursor</replaceable>
</synopsis>
</para>
<productname>Postgres</productname> does not currently support
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.
If the RELATIVE keyword has been used, the <productname>Postgres</productname>
assumes that the user intended <acronym>SQL92</acronym> behavior
and returns this error message.
</para>
</listitem>
</varlistentry>
<para>
<productname>Postgres</productname> does not currently support
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.
If the RELATIVE keyword has been used, the <productname>Postgres</productname>
assumes that the user intended <acronym>SQL92</acronym> behavior
and returns this error message.
</para>
</listitem>
</varlistentry>
</variablelist>
</variablelist>
</para>
</refsect2>
</refsynopsisdiv>
</REFSECT2>
</REFSYNOPSISDIV>
<REFSECT1 ID="R1-SQL-FETCH-1">
<REFSECT1INFO>
<DATE>1998-04-15</DATE>
</REFSECT1INFO>
<TITLE>
Description
</TITLE>
<PARA>
<refsect1 id="R1-SQL-FETCH-1">
<refsect1info>
<date>1998-04-15</date>
</refsect1info>
<title>
Description
</title>
<para>
FETCH allows a user to retrieve rows using a cursor.
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
than <REPLACEABLE CLASS="PARAMETER">#</REPLACEABLE>,
then only those available are fetched.
than <replaceable class="PARAMETER">#</replaceable>,
then only those available are fetched.
Substituting the keyword ALL in place of a number will
cause all remaining rows in the cursor to be retrieved.
Instances may be fetched in both FORWARD and BACKWARD
directions. The default direction is FORWARD.
<tip>
<para>
Negative numbers are now allowed to be specified for the
row count. A negative number is equivalent to reversing
the sense of the FORWARD and BACKWARD keywords. For example,
<command>FORWARD -1</command> is the same as <command>BACKWARD 1</command>.
</para>
</tip>
</para>
<para>
Note that the FORWARD and BACKWARD keywords are
<productname>Postgres</productname> extensions.
The <acronym>SQL92</acronym> syntax is also supported, specified
in the second form of the command. See below for details
on compatibility issues.
</para>
<para>
<tip>
<para>
Negative numbers are now allowed to be specified for the
row count. A negative number is equivalent to reversing
the sense of the FORWARD and BACKWARD keywords. For example,
<command>FORWARD -1</command> is the same as <command>BACKWARD 1</command>.
</para>
</tip>
</para>
<para>
Note that the FORWARD and BACKWARD keywords are
<productname>Postgres</productname> extensions.
The <acronym>SQL92</acronym> syntax is also supported, specified
in the second form of the command. See below for details
on compatibility issues.
</para>
<para>
Once all rows are fetched, every other fetch access returns
no rows.
</para>
</para>
<para>
<para>
Updating data in a cursor is not supported by
<productname>Postgres</productname>,
<productname>Postgres</productname>,
because mapping cursor updates back to base tables is
not generally possible, as is also the case with VIEW updates.
Consequently,
not generally possible, as is also the case with VIEW updates.
Consequently,
users must issue explicit UPDATE commands to replace data.
</para>
<para>
<para>
Cursors may only be used inside of transactions because
the data that they store spans multiple user queries.
</para>
</para>
<REFSECT2 ID="R2-SQL-FETCH-3">
<REFSECT2INFO>
<DATE>1998-04-15</DATE>
</REFSECT2INFO>
<TITLE>
Notes
</TITLE>
<PARA>
Refer to MOVE statements to change cursor position.
Refer to DECLARE statements to declare a cursor.
Refer to BEGIN WORK, COMMIT WORK, ROLLBACK WORK statements
for further information about transactions.
</para>
</REFSECT2>
</refsect1>
<refsect2 id="R2-SQL-FETCH-3">
<refsect2info>
<date>1998-04-15</date>
</refsect2info>
<title>
Notes
</title>
<para>
Use <command>MOVE</command> to change cursor position.
<command>DECLARE</command> will define a cursor.
Refer to <command>BEGIN</command>, <command>COMMIT</command>, and
<command>ROLLBACK</command>
for further information about transactions.
</para>
</refsect2>
</refsect1>
<REFSECT1 ID="R1-SQL-FETCH-2">
<TITLE>
Usage
</TITLE>
<PARA>
<ProgramListing>
<refsect1 id="R1-SQL-FETCH-2">
<title>
Usage
</title>
<para>
<programlisting>
--set up and use a cursor:
--
BEGIN WORK;
@ -326,82 +313,75 @@ Usage
--
CLOSE liahona;
COMMIT WORK;
</ProgramListing>
</para>
</REFSECT1>
</programlisting>
</para>
</refsect1>
<REFSECT1 ID="R1-SQL-FETCH-3">
<TITLE>
Compatibility
</TITLE>
<PARA>
The non-embedded use of cursors is a <productname>Postgres</productname>
extension. The syntax and usage of cursors is being compared
against the embedded form of cursors defined in <acronym>SQL92</acronym>.
</PARA>
<refsect1 id="R1-SQL-FETCH-3">
<title>
Compatibility
</title>
<para>
The non-embedded use of cursors is a <productname>Postgres</productname>
extension. The syntax and usage of cursors is being compared
against the embedded form of cursors defined in <acronym>SQL92</acronym>.
</para>
<REFSECT2 ID="R2-SQL-FETCH-4">
<REFSECT2INFO>
<DATE>1998-09-01</DATE>
</REFSECT2INFO>
<TITLE>
SQL92
</TITLE>
<PARA>
<acronym>SQL92</acronym> allows absolute positioning of the cursor for
FETCH, and allows placing the results into explicit variables.
<refsect2 id="R2-SQL-FETCH-4">
<refsect2info>
<date>1998-09-01</date>
</refsect2info>
<title>
SQL92
</title>
<para>
<acronym>SQL92</acronym> allows absolute positioning of the cursor for
FETCH, and allows placing the results into explicit variables.
<synopsis>
FETCH ABSOLUTE <REPLACEABLE CLASS="PARAMETER">#</REPLACEABLE>
FROM <REPLACEABLE CLASS="PARAMETER">cursor</REPLACEABLE>
INTO :<REPLACEABLE CLASS="PARAMETER">variable</REPLACEABLE> [, ...]
</synopsis>
<synopsis>
FETCH ABSOLUTE <replaceable class="PARAMETER">#</replaceable>
FROM <replaceable class="PARAMETER">cursor</replaceable>
INTO :<replaceable class="PARAMETER">variable</replaceable> [, ...]
</synopsis>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
ABSOLUTE
</TERM>
<LISTITEM>
<PARA>
The cursor should be positioned to the specified absolute
row number. All row numbers in <productname>Postgres</productname>
are relative numbers so this capability is not supported.
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
:<REPLACEABLE CLASS="PARAMETER">variable</REPLACEABLE>
</TERM>
<LISTITEM>
<PARA>
Target host variable(s).
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
</refsect1>
</REFENTRY>
<variablelist>
<varlistentry>
<term>ABSOLUTE</term>
<listitem>
<para>
The cursor should be positioned to the specified absolute
row number. All row numbers in <productname>Postgres</productname>
are relative numbers so this capability is not supported.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>:<replaceable class="PARAMETER">variable</replaceable></term>
<listitem>
<para>
Target host variable(s).
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
</refsect1>
</refentry>
<!--
<REPLACEABLE CLASS="PARAMETER">
</REPLACEABLE>
<ReturnValue></ReturnValue>
<PARA>
</PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>&bull;
</TERM>
<LISTITEM>
<PARA>
</PARA>
</LISTITEM>
</VARLISTENTRY>
</VARIABLELIST>
<PARA>
</PARA>
<!-- 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,269 +1,257 @@
<REFENTRY ID="SQL-GRANT">
<REFMETA>
<REFENTRYTITLE>
GRANT
</REFENTRYTITLE>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO>
</REFMETA>
<REFNAMEDIV>
<REFNAME>
GRANT
</REFNAME>
<REFPURPOSE>
Grants access privilege to a user, a group or all users
</REFPURPOSE>
</refnamediv>
<REFSYNOPSISDIV>
<REFSYNOPSISDIVINFO>
<DATE>1998-09-23</DATE>
</REFSYNOPSISDIVINFO>
<SYNOPSIS>
GRANT <REPLACEABLE CLASS="PARAMETER">privilege</REPLACEABLE> [, ...]
ON <REPLACEABLE CLASS="PARAMETER">object</REPLACEABLE> [, ...]
TO { PUBLIC | GROUP <REPLACEABLE CLASS="PARAMETER">group</REPLACEABLE> | <REPLACEABLE CLASS="PARAMETER">username</REPLACEABLE> }
</SYNOPSIS>
<refentry id="SQL-GRANT">
<refmeta>
<refentrytitle>
GRANT
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta>
<refnamediv>
<refname>
GRANT
</refname>
<refpurpose>
Grants access privilege to a user, a group or all users
</refpurpose>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
<date>1998-09-23</date>
</refsynopsisdivinfo>
<synopsis>
GRANT <replaceable class="PARAMETER">privilege</replaceable> [, ...] ON <replaceable class="PARAMETER">object</replaceable> [, ...]
TO { PUBLIC | GROUP <replaceable class="PARAMETER">group</replaceable> | <replaceable class="PARAMETER">username</replaceable> }
</synopsis>
<REFSECT2 ID="R2-SQL-GRANT-1">
<REFSECT2INFO>
<DATE>1998-09-23</DATE>
</REFSECT2INFO>
<TITLE>
Inputs
</TITLE>
<PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
<REPLACEABLE CLASS="PARAMETER">privilege</REPLACEABLE>
</TERM>
<LISTITEM>
<PARA>
The possible privileges are:
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
SELECT
</TERM>
<LISTITEM>
<PARA>
Access all of the columns of a specific
table/view.
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
INSERT
</TERM>
<LISTITEM>
<PARA>
Insert data into all columns of a
specific table.
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
UPDATE
</TERM>
<LISTITEM>
<PARA>
Update all columns of a specific
table.
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
DELETE
</TERM>
<LISTITEM>
<PARA>
Delete rows from a specific table.
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
RULE
</TERM>
<LISTITEM>
<PARA>
Define rules on the table/view
(See CREATE RULE statement).
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
ALL
</TERM>
<LISTITEM>
<PARA>
Grant all privileges.
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
<REPLACEABLE CLASS="PARAMETER">object</REPLACEABLE>
</TERM>
<LISTITEM>
<PARA>
The name of an object to which to grant access.
The possible objects are:
</para>
<para>
<itemizedlist mark="bullet" spacing="compact">
<listitem>
<para>
table
</para>
</listitem>
<listitem>
<para>
view
</para>
</listitem>
<listitem>
<para>
sequence
</para>
</listitem>
<listitem>
<para>
index
</para>
</listitem>
</itemizedlist>
</para>
</listitem>
</varlistentry>
<refsect2 id="R2-SQL-GRANT-1">
<refsect2info>
<date>1998-09-23</date>
</refsect2info>
<title>
Inputs
</title>
<para>
<VARLISTENTRY>
<TERM>
PUBLIC
</TERM>
<LISTITEM>
<PARA>
A short form representing all users.
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
GROUP <REPLACEABLE CLASS="PARAMETER">group</REPLACEABLE>
</TERM>
<LISTITEM>
<PARA>
A <REPLACEABLE CLASS="PARAMETER">group</REPLACEABLE> to whom to grant privileges.
In the current release, the group must be created explicitly as described below.
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
<REPLACEABLE CLASS="PARAMETER">username</REPLACEABLE>
</TERM>
<LISTITEM>
<PARA>
The name of a user to whom grant privileges. PUBLIC is a short form
representing all users.
</para>
</listitem>
</varlistentry>
</VARIABLELIST>
</para>
</REFSECT2>
<variablelist>
<varlistentry>
<term><replaceable class="PARAMETER">privilege</replaceable></term>
<listitem>
<para>
The possible privileges are:
<REFSECT2 ID="R2-SQL-GRANT-2">
<REFSECT2INFO>
<DATE>1998-09-23</DATE>
</REFSECT2INFO>
<TITLE>
Outputs
</TITLE>
<PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
CHANGE
</TERM>
<LISTITEM>
<PARA>
Message returned if successful.
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
ERROR: ChangeAcl: class "<REPLACEABLE CLASS="PARAMETER">object</REPLACEABLE>"
not found
</TERM>
<LISTITEM>
<PARA>
Message returned if the specified object is not available or
if it is impossible
to give privileges to the specified group or users.
</para>
</listitem>
</varlistentry>
</VARIABLELIST>
</para>
</REFSECT2>
</REFSYNOPSISDIV>
<variablelist>
<varlistentry>
<term>SELECT</term>
<listitem>
<para>
Access all of the columns of a specific
table/view.
</para>
</listitem>
</varlistentry>
<REFSECT1 ID="R1-SQL-GRANT-1">
<REFSECT1INFO>
<DATE>1998-09-23</DATE>
</REFSECT1INFO>
<TITLE>
Description
</TITLE>
<PARA>
GRANT allows the creator of an object to give specific permissions to
all users (PUBLIC) or to a certain user or group.
Users other than the creator don't have any access permission
unless the creator GRANTs permissions, after the object
is created.
</para>
<para>
Once a user has a privilege on an object, he is enabled to exercise
that privilege.
There is no need to GRANT privileges to the creator of
an object, the creator automatically holds ALL privileges, and can
also drop the object.
</para>
<varlistentry>
<term>INSERT</term>
<listitem>
<para>
Insert data into all columns of a
specific table.
</para>
</listitem>
</varlistentry>
<REFSECT2 ID="R2-SQL-GRANT-3">
<REFSECT2INFO>
<DATE>1998-09-23</DATE>
</REFSECT2INFO>
<TITLE>
Notes
</TITLE>
<PARA>
Use the <command>psql \z</command> command
for further information about permissions
on existing objects:
<programlisting>
<varlistentry>
<term>UPDATE</term>
<listitem>
<para>
Update all columns of a specific
table.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>DELETE</term>
<listitem>
<para>
Delete rows from a specific table.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>RULE</term>
<listitem>
<para>
Define rules on the table/view
(See CREATE RULE statement).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>ALL</term>
<listitem>
<para>
Grant all privileges.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="PARAMETER">object</replaceable></term>
<listitem>
<para>
The name of an object to which to grant access.
The possible objects are:
<itemizedlist spacing="compact" mark="bullet">
<listitem>
<para>
table
</para>
</listitem>
<listitem>
<para>
view
</para>
</listitem>
<listitem>
<para>
sequence
</para>
</listitem>
<listitem>
<para>
index
</para>
</listitem>
</itemizedlist>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>PUBLIC</term>
<listitem>
<para>
A short form representing all users.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>GROUP <replaceable class="PARAMETER">group</replaceable></term>
<listitem>
<para>
A <replaceable class="PARAMETER">group</replaceable> to whom to grant privileges.
In the current release, the group must be created explicitly as described below.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<replaceable class="PARAMETER">username</replaceable>
</term>
<listitem>
<para>
The name of a user to whom grant privileges. PUBLIC is a short form
representing all users.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
<refsect2 id="R2-SQL-GRANT-2">
<refsect2info>
<date>1998-09-23</date>
</refsect2info>
<title>
Outputs
</title>
<para>
<variablelist>
<varlistentry>
<term><computeroutput>
CHANGE
</computeroutput></term>
<listitem>
<para>
Message returned if successful.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><computeroutput>
ERROR: ChangeAcl: class "<replaceable class="PARAMETER">object</replaceable>" not found
</computeroutput></term>
<listitem>
<para>
Message returned if the specified object is not available or
if it is impossible
to give privileges to the specified group or users.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
</refsynopsisdiv>
<refsect1 id="R1-SQL-GRANT-1">
<refsect1info>
<date>1998-09-23</date>
</refsect1info>
<title>
Description
</title>
<para>
<command>GRANT</command> allows the creator of an object to give specific permissions to
all users (PUBLIC) or to a certain user or group.
Users other than the creator don't have any access permission
unless the creator GRANTs permissions, after the object
is created.
</para>
<para>
Once a user has a privilege on an object, he is enabled to exercise
that privilege.
There is no need to GRANT privileges to the creator of
an object, the creator automatically holds ALL privileges, and can
also drop the object.
</para>
<refsect2 id="R2-SQL-GRANT-3">
<refsect2info>
<date>1998-09-23</date>
</refsect2info>
<title>
Notes
</title>
<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
on existing objects:
<programlisting>
Database = lusitania
+------------------+---------------------------------------------+
| Relation | Grant/Revoke Permissions |
@ -280,229 +268,204 @@
a -- INSERT
R -- RULE
arwR -- ALL
</programlisting>
</programlisting>
<tip>
<para>
Currently, to create a GROUP you have to insert
data manually into table pg_group as:
<programlisting>
INSERT INTO pg_group VALUES ('todos');
CREATE USER miriam IN GROUP todos;
</programlisting>
Refer to REVOKE statements to revoke access privileges.
</para>
</tip>
</para>
</REFSECT2>
</refsect1>
<REFSECT1 ID="R1-SQL-GRANT-2">
<TITLE>
Usage
</TITLE>
<PARA>
<ProgramListing>
-- grant insert privilege to all users on table films:
--
GRANT INSERT ON films TO PUBLIC;
</programlisting>
<tip>
<para>
Currently, to create a GROUP you have to insert
data manually into table pg_group as:
<programlisting>
-- grant all privileges to user manuel on view kinds:
--
GRANT ALL ON kinds TO manuel;
</ProgramListing>
</para>
</REFSECT1>
INSERT INTO pg_group VALUES ('todos');
CREATE USER miriam IN GROUP todos;
</programlisting>
</para>
</tip>
</para>
<REFSECT1 ID="R1-SQL-GRANT-3">
<TITLE>
Compatibility
</TITLE>
<PARA>
</PARA>
<para>
Refer to REVOKE statements to revoke access privileges.
</para>
</refsect2>
</refsect1>
<refsect1 id="R1-SQL-GRANT-2">
<title>
Usage
</title>
<para>
Grant insert privilege to all users on table films:
<programlisting>
GRANT INSERT ON films TO PUBLIC;
</programlisting>
</para>
<para>
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
</title>
<para>
</para>
<REFSECT2 ID="R2-SQL-GRANT-4">
<REFSECT2INFO>
<DATE>1998-09-23</DATE>
</REFSECT2INFO>
<TITLE>
SQL92
</TITLE>
<PARA>
The <acronym>SQL92</acronym> syntax for GRANT allows setting privileges
for individual columns
within a table, and allows setting a privilege to grant
the same privileges to others.
<SYNOPSIS>
GRANT <REPLACEABLE CLASS="PARAMETER">privilege</REPLACEABLE> [, ...]
ON <REPLACEABLE CLASS="PARAMETER">object</REPLACEABLE> [ ( <REPLACEABLE CLASS="PARAMETER">column</REPLACEABLE> [, ...] ) ] [, ...]
TO { PUBLIC | <REPLACEABLE CLASS="PARAMETER">username</REPLACEABLE> [, ...] }
[ WITH GRANT OPTION ]
</SYNOPSIS>
Fields are compatible with the those in the <acronym>Postgres</acronym>
implementation, with the following additions:
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
<REPLACEABLE CLASS="PARAMETER">privilege</REPLACEABLE>
SELECT
</TERM>
<LISTITEM>
<PARA>
<acronym>SQL92</acronym> permits additional privileges to be specified:
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
REFERENCES
</TERM>
<LISTITEM>
<PARA>
Allowed to reference some or all of the columns of a specific
table/view in integrity constraints.
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
USAGE
</TERM>
<LISTITEM>
<PARA>
Allowed to use a domain, character set, collation
or translation.
If an object specifies anything other than a table/view,
<REPLACEABLE CLASS="PARAMETER">privilege</REPLACEABLE>
must specify only USAGE.
</para>
</listitem>
</varlistentry>
</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>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
CHARACTER SET
</TERM>
<LISTITEM>
<PARA>
Allowed to use the specified character set.
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
COLLATION
</TERM>
<LISTITEM>
<PARA>
Allowed to use the specified collation sequence.
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
TRANSLATION
</TERM>
<LISTITEM>
<PARA>
Allowed to use the specified character set translation.
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
DOMAIN
</TERM>
<LISTITEM>
<PARA>
Allowed to use the specified domain.
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
WITH GRANT OPTION
</TERM>
<LISTITEM>
<PARA>
Allowed to grant the same privilege to others.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
</refsect1>
</REFENTRY>
<refsect2 id="R2-SQL-GRANT-4">
<refsect2info>
<date>1998-09-23</date>
</refsect2info>
<title>
SQL92
</title>
<para>
The <acronym>SQL92</acronym> syntax for GRANT allows setting privileges
for individual columns
within a table, and allows setting a privilege to grant
the same privileges to others:
<!--
<REPLACEABLE CLASS="PARAMETER">
</REPLACEABLE>
<ReturnValue></ReturnValue>
<PARA>
</PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>&bull;
</TERM>
<LISTITEM>
<PARA>
</PARA>
</LISTITEM>
</VARLISTENTRY>
</VARIABLELIST>
<PARA>
</PARA>
<synopsis>
GRANT <replaceable class="PARAMETER">privilege</replaceable> [, ...]
ON <replaceable class="PARAMETER">object</replaceable> [ ( <replaceable class="PARAMETER">column</replaceable> [, ...] ) ] [, ...]
TO { PUBLIC | <replaceable class="PARAMETER">username</replaceable> [, ...] } [ WITH GRANT OPTION ]
</synopsis>
</para>
<para>
Fields are compatible with the those in the <acronym>Postgres</acronym>
implementation, with the following additions:
<variablelist>
<varlistentry>
<term><replaceable class="PARAMETER">privilege</replaceable></term>
<listitem>
<para>
<acronym>SQL92</acronym> permits additional privileges to be specified:
<variablelist>
<varlistentry>
<term>SELECT</term>
<listitem>
<para>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>REFERENCES</term>
<listitem>
<para>
Allowed to reference some or all of the columns of a specific
table/view in integrity constraints.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>USAGE</term>
<listitem>
<para>
Allowed to use a domain, character set, collation
or translation.
If an object specifies anything other than a table/view,
<replaceable class="PARAMETER">privilege</replaceable>
must specify only USAGE.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="PARAMETER">object</replaceable></term>
<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.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>COLLATION</term>
<listitem>
<para>
Allowed to use the specified collation sequence.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>TRANSLATION</term>
<listitem>
<para>
Allowed to use the specified character set translation.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>DOMAIN</term>
<listitem>
<para>
Allowed to use the specified domain.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>WITH GRANT OPTION</term>
<listitem>
<para>
Allowed to grant the same privilege to others.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
</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,313 +1,315 @@
<REFENTRY ID="APP-INITDB">
<REFMETA>
<REFENTRYTITLE>
<application>initdb</application>
</REFENTRYTITLE>
<REFMISCINFO>Application</REFMISCINFO>
</REFMETA>
<REFNAMEDIV>
<REFNAME>
<application>initdb</application>
</REFNAME>
<REFPURPOSE>
Create a new <productname>Postgres</productname> database installation
</REFPURPOSE>
</refnamediv>
<REFSYNOPSISDIV>
<REFSYNOPSISDIVINFO>
<DATE>1998-10-02</DATE>
</REFSYNOPSISDIVINFO>
<SYNOPSIS>
<refentry id="APP-INITDB">
<refmeta>
<refentrytitle>
<application>initdb</application>
</refentrytitle>
<refmiscinfo>Application</refmiscinfo>
</refmeta>
<refnamediv>
<refname>
<application>initdb</application>
</refname>
<refpurpose>
Create a new <productname>Postgres</productname> database installation
</refpurpose>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
<date>1998-10-02</date>
</refsynopsisdivinfo>
<synopsis>
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> ]
[ --template=<replaceable class="parameter">template</replaceable> | -t <replaceable class="parameter">template</replaceable> ]
[ --username=<replaceable class="parameter">name</replaceable> | -u <replaceable class="parameter">name</replaceable> ]
[ --noclean | -n ] [ --debug | -d ]
</SYNOPSIS>
</synopsis>
<REFSECT2 ID="R2-APP-INITDB-1">
<REFSECT2INFO>
<DATE>1998-10-02</DATE>
</REFSECT2INFO>
<TITLE>
Inputs
</TITLE>
<PARA>
<variablelist>
<varlistentry>
<term>
--pglib=<replaceable class="parameter">libdir</replaceable>
</term>
<term>
-l <replaceable class="parameter">libdir</replaceable>
</term>
<term>
<envar>PGLIB</envar>
</term>
<listitem>
<para>
Where are the files that make up <productname>Postgres</productname>?
Apart from files that
have to go in particular directories because of their function, the
files that make up the <productname>Postgres</productname> software
were installed in a directory
called the <replaceable class="parameter">libdir</replaceable> directory.
An example of a file that will be found
there that <application>initdb</application>
needs is <filename>global1.bki.source</filename>,
which contains all the information that goes
into the shared catalog tables.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
--pgdata=<replaceable class="parameter">dbdir</replaceable>
</term>
<term>
-r <replaceable class="parameter">dbdir</replaceable>
</term>
<term>
<envar>PGDATA</envar>
</term>
<listitem>
<para>
Where in your Unix filesystem do you want the database data to go?
The top level directory is called the <envar>PGDATA</envar> directory.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
--username=<replaceable class="parameter">name</replaceable>
</term>
<term>
-u <replaceable class="parameter">name</replaceable>
</term>
<term>
<envar>PGUSER</envar>
</term>
<listitem>
<para>
Who will be the <productname>Postgres</productname> superuser
for this database system? The
<productname>Postgres</productname> superuser is a Unix user
who owns all files that store the database
system and also owns the postmaster and backend processes that access them.
Or just let it default to you (the Unix user who runs
<application>initdb</application>).
</para>
<note>
<para>
Only the Unix superuser (<literal>root</literal>)
can create a database system with an owner
different from the <productname>Postgres</productname> superuser.
</para>
</note>
</listitem>
</varlistentry>
</variablelist>
</para>
<para>
Other, less commonly used, parameters are also available:
<variablelist>
<varlistentry>
<term>
--template=<replaceable class="parameter">template</replaceable>
</term>
<term>
-t <replaceable class="parameter">template</replaceable>
</term>
<listitem>
<para>
Replace the <literal>template1</literal>
database in an existing database system, and don't touch anything else.
This is useful when you need to upgrade your <literal>template1</literal>
database using <application>initdb</application>
from a newer release of <productname>Postgres</productname>,
or when your <literal>template1</literal>
database has become corrupted by some system problem. Normally the
contents of <literal>template1</literal>
remain constant throughout the life of the database system. You can't
destroy anything by running <application>initdb</application>
with the
<option>--template</option>
option.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
--noclean
</term>
<term>
-n
</term>
<listitem>
<para>
By default, when <application>initdb</application>
determines that error prevent it from completely creating the database
system, it removes any files it may have created before determining
that it can't finish the job. That includes any core files left by
the programs it invokes. This option inhibits any tidying-up and is
thus useful for debugging.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
--debug
</term>
<term>
-d
</term>
<listitem>
<para>
Print debugging output from the bootstrap backend.
The bootstrap backend is the program <application>initdb</application>
uses to create the catalog tables. This option generates a tremendous
amount of output. It also turns off the final vacuuming step.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
<para>
Files are also input to <application>initdb</application>:
<variablelist>
<varlistentry>
<term>
<application>postconfig</application>
</term>
<listitem>
<para>
If appearing somewhere in the Unix command search path
(defined by the PATH environment variable).
This is a program that specifies defaults for some of the
command options. See below.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<filename><envar>PGLIB</envar>/global1.bki.source</filename>
</term>
<listitem>
<para>
Contents for the shared catalog tables in the new database system. This
file is part of the <productname>Postgres</productname> software.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<filename><envar>PGLIB</envar>/local1_template1.bki.source</filename>
</term>
<listitem>
<para>
Contents for the template1 tables in the new database system. This
file is part of the <productname>Postgres</productname> software.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
<refsect2 id="R2-APP-INITDB-1">
<refsect2info>
<date>1998-10-02</date>
</refsect2info>
<title>
Inputs
</title>
<para>
<REFSECT2 ID="R2-APP-INITDB-2">
<REFSECT2INFO>
<DATE>1998-09-26</DATE>
</REFSECT2INFO>
<TITLE>
Outputs
</TITLE>
<PARA>
<application>initdb</application> will create files in the <envar>PGDATA</envar>
data area which are the system tables and framework for a complete
installation.
</para>
</refsect2>
</refsynopsisdiv>
<variablelist>
<varlistentry>
<term>--pglib=<replaceable class="parameter">libdir</replaceable></term>
<term>-l <replaceable class="parameter">libdir</replaceable></term>
<term><envar>PGLIB</envar></term>
<listitem>
<para>
Where are the files that make up <productname>Postgres</productname>?
Apart from files that
have to go in particular directories because of their function, the
files that make up the <productname>Postgres</productname> software
were installed in a directory
called the <replaceable class="parameter">libdir</replaceable> directory.
An example of a file that will be found
there that <application>initdb</application>
needs is <filename>global1.bki.source</filename>,
which contains all the information that goes
into the shared catalog tables.
</para>
</listitem>
</varlistentry>
<REFSECT1 ID="R1-APP-INITDB-1">
<REFSECT1INFO>
<DATE>1998-09-26</DATE>
</REFSECT1INFO>
<TITLE>
Description
</TITLE>
<PARA>
<application>initdb</application> creates a new
<productname>Postgres</productname> database system.
A database system is a
collection of databases that are all administered by the same Unix user
and managed by a single postmaster.
</para>
<para>
Creating a database system consists of creating the directories in which
the database data will live, generating the shared catalog tables
(tables that don't belong to any particular database), and
creating the <literal>template1</literal>
database. What is the <literal>template1</literal>
database? When you create a database, <productname>Postgres</productname>
does it by copying
everything from the <literal>template1</literal>
database. It contains catalog tables filled in for things like the
builtin types.
</para>
<para>
After <application>initdb</application>
creates the database, it completes the initialization by running
<application>vacuum</application>, which resets some optimization parameters.
</para>
<para>
There are three ways to give parameters to <application>initdb</application>.
First, you can use <application>initdb</application> command options.
Second, you can set environment
variables before invoking <application>initdb</application>.
Third, you can have a program called <application>postconfig</application>
in your Unix command search path.
<varlistentry>
<term>--pgdata=<replaceable class="parameter">dbdir</replaceable></term>
<term>-r <replaceable class="parameter">dbdir</replaceable></term>
<term><envar>PGDATA</envar></term>
<listitem>
<para>
Where in your Unix filesystem do you want the database data to go?
The top level directory is called the <envar>PGDATA</envar> directory.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--username=<replaceable class="parameter">name</replaceable></term>
<term>-u <replaceable class="parameter">name</replaceable></term>
<term><envar>PGUSER</envar></term>
<listitem>
<para>
Who will be the <productname>Postgres</productname> superuser
for this database system? The
<productname>Postgres</productname> superuser is a Unix user
who owns all files that store the database
system and also owns the postmaster and backend processes that access them.
Or just let it default to you (the Unix user who runs
<application>initdb</application>).
</para>
<note>
<para>
Only the Unix superuser (<literal>root</literal>)
can create a database system with an owner
different from the <productname>Postgres</productname> superuser.
</para>
</note>
</listitem>
</varlistentry>
</variablelist>
</para>
<para>
Other, less commonly used, parameters are also available:
<variablelist>
<varlistentry>
<term>--template=<replaceable class="parameter">template</replaceable></term>
<term>-t <replaceable class="parameter">template</replaceable></term>
<listitem>
<para>
Replace the <literal>template1</literal>
database in an existing database system, and don't touch anything else.
This is useful when you need to upgrade your <literal>template1</literal>
database using <application>initdb</application>
from a newer release of <productname>Postgres</productname>,
or when your <literal>template1</literal>
database has become corrupted by some system problem. Normally the
contents of <literal>template1</literal>
remain constant throughout the life of the database system. You can't
destroy anything by running <application>initdb</application>
with the
<option>--template</option>
option.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--noclean</term>
<term>-n</term>
<listitem>
<para>
By default, when <application>initdb</application>
determines that error prevent it from completely creating the database
system, it removes any files it may have created before determining
that it can't finish the job. That includes any core files left by
the programs it invokes. This option inhibits any tidying-up and is
thus useful for debugging.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--debug</term>
<term>-d</term>
<listitem>
<para>
Print debugging output from the bootstrap backend.
The bootstrap backend is the program <application>initdb</application>
uses to create the catalog tables. This option generates a tremendous
amount of output. It also turns off the final vacuuming step.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
<para>
Files are also input to <application>initdb</application>:
<variablelist>
<varlistentry>
<term><application>postconfig</application></term>
<listitem>
<para>
If appearing somewhere in the Unix command search path
(defined by the PATH environment variable).
This is a program that specifies defaults for some of the
command options. See below.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><filename><envar>PGLIB</envar>/global1.bki.source</filename></term>
<listitem>
<para>
Contents for the shared catalog tables in the new database system. This
file is part of the <productname>Postgres</productname> software.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><filename><envar>PGLIB</envar>/local1_template1.bki.source</filename></term>
<listitem>
<para>
Contents for the template1 tables in the new database system. This
file is part of the <productname>Postgres</productname> software.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
<refsect2 id="R2-APP-INITDB-2">
<refsect2info>
<date>1998-09-26</date>
</refsect2info>
<title>
Outputs
</title>
<para>
<application>initdb</application> will create files in the
<envar>PGDATA</envar>
data area which are the system tables and framework for a complete
installation.
</para>
</refsect2>
</refsynopsisdiv>
<refsect1 id="R1-APP-INITDB-1">
<refsect1info>
<date>1998-09-26</date>
</refsect1info>
<title>
Description
</title>
<para>
<application>initdb</application> creates a new
<productname>Postgres</productname> database system.
A database system is a
collection of databases that are all administered by the same Unix user
and managed by a single postmaster.
</para>
<para>
Creating a database system consists of creating the directories in which
the database data will live, generating the shared catalog tables
(tables that don't belong to any particular database), and
creating the <literal>template1</literal>
database. What is the <literal>template1</literal>
database? When you create a database, <productname>Postgres</productname>
does it by copying
everything from the <literal>template1</literal>
database. It contains catalog tables filled in for things like the
builtin types.
</para>
<para>
After <application>initdb</application>
creates the database, it completes the initialization by running
<application>vacuum</application>, which resets some optimization parameters.
</para>
<para>
There are three ways to give parameters to <application>initdb</application>.
<itemizedlist>
<listitem>
<para>
You can use <application>initdb</application> command options.
</para>
</listitem>
<listitem>
<para>
You can set environment
variables before invoking <application>initdb</application>.
</para>
</listitem>
<listitem>
<para>
You can have a program called <application>postconfig</application>
in your Unix command search path.
<application>initdb</application> invokes that program and that program then writes
<application>initdb</application> parameters to its standard output stream.
This third option is not a common thing to do, however.
</para>
<para>
Command options always override parameters specified any other way.
The values returned by <application>postconfig</application>
override any environment variables, but your
<application>postconfig</application>
program may base its output on the environment variables if you want
their values to be used.
</para>
<para>
The value that <application>postconfig</application>
outputs must have the format
<programlisting>
<replaceable>var1</replaceable>=<replaceable class="parameter">value1</replaceable> <replaceable>var2</replaceable>=<replaceable class="parameter">value2</replaceable> ...
</programlisting>
It can output nothing if it doesn't want to supply any parameters.
The <replaceable>var</replaceable> values are equal to
the corresponding environment variable
names. For example,
<programlisting>
PGDATA=/tmp/postgres_test
</programlisting>
has the
same effect as invoking <application>initdb</application>
with an environment variable called <envar>PGDATA</envar> whose value is
<filename>/tmp/postgres_test</filename>.
</para>
</refsect1>
</REFENTRY>
</para>
</listitem>
</itemizedlist>
</para>
<para>
Command options always override parameters specified any other way.
The values returned by <application>postconfig</application>
override any environment variables, but your
<application>postconfig</application>
program may base its output on the environment variables if you want
their values to be used.
</para>
<para>
The value that <application>postconfig</application>
outputs must have the format
<synopsis>
<replaceable>var1</replaceable>=<replaceable class="parameter">value1</replaceable> <replaceable class="parameter">var2</replaceable>=<replaceable class="parameter">value2</replaceable> ...
</synopsis>
It can output nothing if it doesn't want to supply any parameters.
The <replaceable>var</replaceable> values are equal to
the corresponding environment variable
names. For example,
<programlisting>
PGDATA=/tmp/postgres_test
</programlisting>
has the
same effect as invoking <application>initdb</application>
with an environment variable called <envar>PGDATA</envar> whose value is
<filename>/tmp/postgres_test</filename>.
</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,228 +1,233 @@
<REFENTRY ID="APP-INITLOCATION">
<REFMETA>
<REFENTRYTITLE>
<application>initlocation</application>
</REFENTRYTITLE>
<REFMISCINFO>Application</REFMISCINFO>
</REFMETA>
<REFNAMEDIV>
<REFNAME>
<application>initlocation</application>
</REFNAME>
<REFPURPOSE>
Create a secondary <productname>Postgres</productname> database storage area
</REFPURPOSE>
</refnamediv>
<REFSYNOPSISDIV>
<REFSYNOPSISDIVINFO>
<DATE>1998-10-02</DATE>
</REFSYNOPSISDIVINFO>
<SYNOPSIS>
initlocation [ --location=<replaceable class="parameter">altdir</replaceable> | -D <replaceable class="parameter">altdir</replaceable> ]
<refentry id="APP-INITLOCATION">
<refmeta>
<refentrytitle>
<application>initlocation</application>
</refentrytitle>
<refmiscinfo>Application</refmiscinfo>
</refmeta>
<refnamediv>
<refname>
<application>initlocation</application>
</refname>
<refpurpose>
Create a secondary <productname>Postgres</productname> database storage area
</refpurpose>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
<date>1998-10-02</date>
</refsynopsisdivinfo>
<synopsis>
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> ]
[ <replaceable class="parameter">altdir</replaceable> ]
</SYNOPSIS>
</synopsis>
<REFSECT2 ID="R2-APP-INITLOCATION-1">
<REFSECT2INFO>
<DATE>1998-10-02</DATE>
</REFSECT2INFO>
<TITLE>
Inputs
</TITLE>
<PARA>
<variablelist>
<varlistentry>
<term>
--location=<replaceable class="parameter">altdir</replaceable>
</term>
<term>
-D <replaceable class="parameter">altdir</replaceable>
</term>
<term>
<replaceable class="parameter">altdir</replaceable>
</term>
<listitem>
<para>
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
might want to point your first alternate location at <envar>PGDATA2</envar>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
--username=<replaceable class="parameter">name</replaceable>
</term>
<term>
-u <replaceable class="parameter">name</replaceable>
</term>
<term>
<envar>PGUSER</envar>
</term>
<listitem>
<para>
Who will be the Unix filesystem owner of this database storage area?
The
<productname>Postgres</productname> superuser is a Unix user
who owns all files that store the database
system and also owns the postmaster and backend processes that access them.
Usually, this is the user who should run <application>initlocation</application>
and who will thus have ownership of the directories and files.
</para>
<note>
<para>
Only the Unix superuser can create a database system with a
different user as the <productname>Postgres</productname> superuser.
Specifying a user other than the <productname>Postgres</productname> superuser
may lead to database security and data integrity problems. Refer to the
<citetitle><productname>PostgreSQL</productname> Administrator's Guide</citetitle>
for more information.
</para>
</note>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
<REFSECT2 ID="R2-APP-INITLOCATION-2">
<REFSECT2INFO>
<DATE>1998-09-26</DATE>
</REFSECT2INFO>
<TITLE>
Outputs
</TITLE>
<PARA>
<application>initlocation</application> will create directories in
the specified place.
<variablelist>
<varlistentry>
<term>
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.
Creating Postgres database system directory <replaceable class="parameter">altdir</replaceable>
Creating Postgres database system directory <replaceable class="parameter">altdir</replaceable>
</term>
<listitem>
<para>
Successful completion.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
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.
Creating Postgres database system directory /usr/local/src/testlocation
mkdir: cannot make directory `<replaceable class="parameter">altdir</replaceable>': Permission denied
</term>
<listitem>
<para>
You do not have filesystem permission to write to the specified directory area.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
Valid username not given. You must specify the username for
the Postgres superuser for the database system you are
initializing, either with the --username option or by default
to the USER environment variable.
</term>
<listitem>
<para>
The username which you have specified is not the
<productname>Postgres</productname> superuser.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
Can't tell what username to use. You don't have the USER
environment variable set to your username and didn't specify the
--username option
</term>
<listitem>
<para>
Specify the <option>--username</option> command line option.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
</refsynopsisdiv>
<refsect2 id="R2-APP-INITLOCATION-1">
<refsect2info>
<date>1998-10-02</date>
</refsect2info>
<title>
Inputs
</title>
<para>
<REFSECT1 ID="R1-APP-INITLOCATION-1">
<REFSECT1INFO>
<DATE>1998-09-26</DATE>
</REFSECT1INFO>
<TITLE>
Description
</TITLE>
<PARA>
<application>initlocation</application>
creates a new <productname>Postgres</productname> secondary database storage area.
A secondary storage area contains a required tree of directories with
the correct file permissions on those directories.
</para>
<para>
Creating a database storage area consists of creating the directories in which
database data might live.
</para>
<para>
There are two kinds of arguments for <application>initlocation</application>.
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
<command>CREATE DATABASE/WITH LOCATION</command>
or
<command>createdb -D <replaceable class="parameter">altdir</replaceable></command>.
However, <emphasis>the backend daemon must have this variable in it's
environment</emphasis> for this to succeed.
Second, you may be able to specify an explicit
absolute path to the top directory of the storage area. However,this second
option is possible only if explicitly enabled during the
<productname>Postgres</productname> installation. It is usually disabled
to alleviate security and data integrity concerns.
</para>
<note>
<para>
<productname>Postgres</productname> will add <filename>/base/</filename>
to the specified path to create the storage area.
</para>
<para>
The backend requires that any argument to <option>WITH LOCATION</option> which is
in all uppercase and which has no path delimiters is an environment variable.
</para>
</note>
</refsect1>
<variablelist>
<varlistentry>
<term>--location=<replaceable class="parameter">altdir</replaceable></term>
<term>-D <replaceable class="parameter">altdir</replaceable></term>
<term><replaceable class="parameter">altdir</replaceable></term>
<listitem>
<para>
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
might want to point your first alternate location at
<envar>PGDATA2</envar>.
</para>
</listitem>
</varlistentry>
<REFSECT1 ID="R1-APP-INITLOCATION-2">
<REFSECT1INFO>
<DATE>1998-09-26</DATE>
</REFSECT1INFO>
<TITLE>
Usage
</TITLE>
<PARA>
To create a database in an alternate location, using an environment variable:
<varlistentry>
<term>--username=<replaceable class="parameter">name</replaceable></term>
<term>-u <replaceable class="parameter">name</replaceable></term>
<term><envar>PGUSER</envar></term>
<listitem>
<para>
Who will be the Unix filesystem owner of this database storage area?
The
<productname>Postgres</productname> superuser is a Unix user
who owns all files that store the database
system and also owns the postmaster and backend processes that access them.
Usually, this is the user who should run <application>initlocation</application>
and who will thus have ownership of the directories and files.
</para>
<note>
<para>
Only the Unix superuser can create a database system with a
different user as the <productname>Postgres</productname> superuser.
Specifying a user other than the <productname>Postgres</productname> superuser
may lead to database security and data integrity problems. Refer to the
<citetitle><productname>PostgreSQL</productname> Administrator's Guide</citetitle>
for more information.
</para>
</note>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
<programlisting>
% setenv PGDATA2 /opt/postgres/data
% initlocation PGDATA2
% createdb -D PGDATA2
</programlisting>
</para>
</refsect1>
</REFENTRY>
<refsect2 id="R2-APP-INITLOCATION-2">
<refsect2info>
<date>1998-09-26</date>
</refsect2info>
<title>
Outputs
</title>
<para>
<application>initlocation</application> will create directories in
the specified place.
<variablelist>
<varlistentry>
<term><computeroutput>
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.
Creating Postgres database system directory <replaceable class="parameter">altdir</replaceable>
Creating Postgres database system directory <replaceable class="parameter">altdir</replaceable>
</computeroutput></term>
<listitem>
<para>
Successful completion.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><computeroutput>
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.
Creating Postgres database system directory /usr/local/src/testlocation
mkdir: cannot make directory `<replaceable class="parameter">altdir</replaceable>': Permission denied
</computeroutput></term>
<listitem>
<para>
You do not have filesystem permission to write to the specified directory area.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><computeroutput>
Valid username not given. You must specify the username for
the Postgres superuser for the database system you are
initializing, either with the --username option or by default
to the USER environment variable.
</computeroutput></term>
<listitem>
<para>
The username which you have specified is not the
<productname>Postgres</productname> superuser.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><computeroutput>
Can't tell what username to use. You don't have the USER
environment variable set to your username and didn't specify the
--username option
</computeroutput></term>
<listitem>
<para>
Specify the <option>--username</option> command line option.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
</refsynopsisdiv>
<refsect1 id="R1-APP-INITLOCATION-1">
<refsect1info>
<date>1998-09-26</date>
</refsect1info>
<title>
Description
</title>
<para>
<application>initlocation</application>
creates a new <productname>Postgres</productname> secondary database storage area.
A secondary storage area contains a required tree of directories with
the correct file permissions on those directories.
</para>
<para>
Creating a database storage area consists of creating the directories in which
database data might live.
</para>
<para>
There are two kinds of arguments for <application>initlocation</application>.
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
<command>CREATE DATABASE/WITH LOCATION</command>
or
<command>createdb -D <replaceable class="parameter">altdir</replaceable></command>.
However, <emphasis>the backend daemon must have this variable in it's
environment</emphasis> for this to succeed.
Second, you may be able to specify an explicit
absolute path to the top directory of the storage area. However,this second
option is possible only if explicitly enabled during the
<productname>Postgres</productname> installation. It is usually disabled
to alleviate security and data integrity concerns.
</para>
<note>
<para>
<productname>Postgres</productname> will add <filename>/base/</filename>
to the specified path to create the storage area.
</para>
<para>
The backend requires that any argument to <option>WITH LOCATION</option> which is
in all uppercase and which has no path delimiters is an environment variable.
</para>
</note>
</refsect1>
<refsect1 id="R1-APP-INITLOCATION-2">
<refsect1info>
<date>1998-09-26</date>
</refsect1info>
<title>
Usage
</title>
<para>
To create a database in an alternate location, using an environment variable:
<programlisting>
% setenv PGDATA2 /opt/postgres/data
% initlocation PGDATA2
% createdb -D PGDATA2
</programlisting>
</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,237 +1,235 @@
<REFENTRY ID="SQL-INSERT">
<REFMETA>
<REFENTRYTITLE>
INSERT
</REFENTRYTITLE>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO>
</REFMETA>
<REFNAMEDIV>
<REFNAME>
INSERT
</REFNAME>
<REFPURPOSE>
Inserts new rows into a table
</REFPURPOSE>
<refentry id="SQL-INSERT">
<refmeta>
<refentrytitle>
INSERT
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta>
<refnamediv>
<refname>
INSERT
</refname>
<refpurpose>
Inserts new rows into a table
</refpurpose>
</refnamediv>
<REFSYNOPSISDIV>
<REFSYNOPSISDIVINFO>
<DATE>1998-09-23</DATE>
</REFSYNOPSISDIVINFO>
<SYNOPSIS>
INSERT INTO <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE> [ ( <REPLACEABLE CLASS="PARAMETER">column</REPLACEABLE> [, ...] ) ]
{ VALUES ( <REPLACEABLE CLASS="PARAMETER">expression</REPLACEABLE> [, ...] ) | SELECT <REPLACEABLE CLASS="PARAMETER">query</REPLACEABLE> }
</SYNOPSIS>
<refsynopsisdiv>
<refsynopsisdivinfo>
<date>1998-09-23</date>
</refsynopsisdivinfo>
<synopsis>
INSERT INTO <replaceable class="PARAMETER">table</replaceable> [ ( <replaceable class="PARAMETER">column</replaceable> [, ...] ) ]
{ VALUES ( <replaceable class="PARAMETER">expression</replaceable> [, ...] ) | SELECT <replaceable class="PARAMETER">query</replaceable> }
</synopsis>
<REFSECT2 ID="R2-SQL-INSERT-1">
<REFSECT2INFO>
<DATE>1998-09-23</DATE>
</REFSECT2INFO>
<TITLE>
<refsect2 id="R2-SQL-INSERT-1">
<refsect2info>
<date>1998-09-23</date>
</refsect2info>
<title>
Inputs
</TITLE>
<PARA>
</PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
<REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE>
</TERM>
<LISTITEM>
<PARA>
The name of an existing table.
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
<REPLACEABLE CLASS="PARAMETER">column</REPLACEABLE>
</TERM>
<LISTITEM>
<PARA>
The name of a column in <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE>.
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
<REPLACEABLE CLASS="PARAMETER">expression</REPLACEABLE>
</TERM>
<LISTITEM>
<PARA>
A valid expression or value to assign to <REPLACEABLE CLASS="PARAMETER">column</REPLACEABLE>.
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
<REPLACEABLE CLASS="PARAMETER">query</REPLACEABLE>
</TERM>
<LISTITEM>
<PARA>
A valid query. Refer to the SELECT statement for a further description
of valid arguments.
</para>
</listitem>
</varlistentry>
</VARIABLELIST>
</REFSECT2>
<REFSECT2 ID="R2-SQL-INSERT-2">
<REFSECT2INFO>
<DATE>1998-09-23</DATE>
</REFSECT2INFO>
<TITLE>
Outputs
</TITLE>
<PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
<ReturnValue>INSERT <replaceable>oid</replaceable></ReturnValue> 1
</TERM>
<LISTITEM>
<PARA>
Message returned if only one row was inserted.
<ReturnValue><replaceable>oid</replaceable></ReturnValue>
is the numeric <acronym>OID</acronym> of the inserted row.
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
<ReturnValue>INSERT 0 <replaceable>#</replaceable></ReturnValue>
</TERM>
<LISTITEM>
<PARA>
Message returned if more than one rows were inserted.
<ReturnValue><replaceable>#</replaceable></ReturnValue>
is the number of rows inserted.
</para>
</listitem>
</varlistentry>
</VARIABLELIST>
</para>
</REFSECT2>
</REFSYNOPSISDIV>
<REFSECT1 ID="R1-SQL-INSERT-1">
<REFSECT1INFO>
<DATE>1998-09-02</DATE>
</REFSECT1INFO>
<TITLE>
Description
</TITLE>
<PARA>
INSERT 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.
The columns in the target list may be listed in any order.
In every column not present in the target list will be inserted
the default value, if column has not a declared default value
it will be assumed as NULL. If the expression for each column
is not of the correct data type, automatic type coercion will be
attempted.
</para>
<para>
You must have insert privilege to a table in order to append
to it, as well as select privilege on any table specified
in a WHERE clause.
</para>
</refsect1>
</title>
<para>
<REFSECT1 ID="R1-SQL-INSERT-2">
<TITLE>
Usage
</TITLE>
<PARA>
<ProgramListing>
--Insert a single row into table films;
--(in the second example the column date_prod is omitted
--therefore will be stored in it a default value of NULL):
--
INSERT INTO films VALUES
('UA502','Bananas',105,'1971-07-13','Comedy',INTERVAL '82 minute');
INSERT INTO films (code, title, did, date_prod, kind)
VALUES ('T_601', 'Yojimbo', 106, DATE '1961-06-16', 'Drama');
</ProgramListing>
<ProgramListing>
--Insert a single row into table distributors, note that
--only column "name" is specified, to the non specified
--column "did" will be assigned its default value:
--
INSERT INTO distributors (name) VALUES ('British Lion');
</ProgramListing>
<ProgramListing>
--Insert several rows into table films from table tmp:
--
INSERT INTO films
SELECT * FROM tmp;
</ProgramListing>
<ProgramListing>
--Insert into arrays:
--Create an empty 3x3 gameboard for noughts-and-crosses
--(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])
VALUES (1,'{{"","",""},{},{"",""}}');
INSERT INTO tictactoe (game, board[3][3])
VALUES (2,'{}');
INSERT INTO tictactoe (game, board)
VALUES (3,'{{,,},{,,},{,,}}');
</ProgramListing>
</para>
</REFSECT1>
<variablelist>
<varlistentry>
<term><replaceable class="PARAMETER">table</replaceable></term>
<listitem>
<para>
The name of an existing table.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="PARAMETER">column</replaceable></term>
<listitem>
<para>
The name of a column in <replaceable class="PARAMETER">table</replaceable>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="PARAMETER">expression</replaceable></term>
<listitem>
<para>
A valid expression or value to assign to <replaceable
class="PARAMETER">column</replaceable>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="PARAMETER">query</replaceable></term>
<listitem>
<para>
A valid query. Refer to the SELECT statement for a further description
of valid arguments.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
<REFSECT1 ID="R1-SQL-INSERT-3">
<TITLE>
Compatibility
</TITLE>
<PARA>
</PARA>
<refsect2 id="R2-SQL-INSERT-2">
<refsect2info>
<date>1998-09-23</date>
</refsect2info>
<title>
Outputs
</title>
<para>
<variablelist>
<varlistentry>
<term><computeroutput>
INSERT <replaceable>oid</replaceable> 1
</computeroutput></term>
<listitem>
<para>
Message returned if only one row was inserted.
<returnvalue><replaceable>oid</replaceable></returnvalue>
is the numeric <acronym>OID</acronym> of the inserted row.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><computeroutput>
INSERT 0 <replaceable>#</replaceable>
</computeroutput></term>
<listitem>
<para>
Message returned if more than one rows were inserted.
<returnvalue><replaceable>#</replaceable></returnvalue>
is the number of rows inserted.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
</refsynopsisdiv>
<refsect1 id="R1-SQL-INSERT-1">
<refsect1info>
<date>1998-09-02</date>
</refsect1info>
<title>
Description
</title>
<para>
<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.
The columns in the target list may be listed in any order.
In every column not present in the target list will be inserted
the default value, if column has not a declared default value
it will be assumed as NULL. If the expression for each column
is not of the correct data type, automatic type coercion will be
attempted.
</para>
<para>
You must have insert privilege to a table in order to append
to it, as well as select privilege on any table specified
in a WHERE clause.
</para>
</refsect1>
<refsect1 id="R1-SQL-INSERT-2">
<title>
Usage
</title>
<para>
Insert a single row into table <literal>films</literal>:
<programlisting>
INSERT INTO films VALUES
('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)
VALUES ('T_601', 'Yojimbo', 106, DATE '1961-06-16', 'Drama');
</programlisting>
</para>
<para>
Insert a single row into table distributors; note that
only column <literal>name</literal> is specified, so the omitted
column <literal>did</literal> will be assigned its default value:
<programlisting>
INSERT INTO distributors (name) VALUES ('British Lion');
</programlisting>
</para>
<para>
Insert several rows into table films from table <literal>tmp</literal>:
<programlisting>
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
-- (all of these queries create the same board attribute)
INSERT INTO tictactoe (game, board[1:3][1:3])
VALUES (1,'{{"","",""},{},{"",""}}');
INSERT INTO tictactoe (game, board[3][3])
VALUES (2,'{}');
INSERT INTO tictactoe (game, board)
VALUES (3,'{{,,},{,,},{,,}}');
</programlisting>
</para>
</refsect1>
<refsect1 id="R1-SQL-INSERT-3">
<title>
Compatibility
</title>
<para>
</para>
<REFSECT2 ID="R2-SQL-INSERT-4">
<REFSECT2INFO>
<DATE>1998-09-23</DATE>
</REFSECT2INFO>
<TITLE>
SQL92
</TITLE>
<PARA>
The INSERT statement is fully compatible with <acronym>SQL92</acronym>.
Possible limitations in features of the
<REPLACEABLE CLASS="PARAMETER">query</REPLACEABLE>
clause are documented for the SELECT statement.
</para>
</refsect2>
</refsect1>
</REFENTRY>
<refsect2 id="R2-SQL-INSERT-4">
<refsect2info>
<date>1998-09-23</date>
</refsect2info>
<title>
SQL92
</title>
<para>
<command>INSERT</command> is fully compatible with <acronym>SQL92</acronym>.
Possible limitations in features of the
<replaceable class="PARAMETER">query</replaceable>
clause are documented for the SELECT statement.
</para>
</refsect2>
</refsect1>
</refentry>
<!--
<REPLACEABLE CLASS="PARAMETER">
</REPLACEABLE>
<ReturnValue></ReturnValue>
<PARA>
</PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>&bull;
</TERM>
<LISTITEM>
<PARA>
</PARA>
</LISTITEM>
</VARLISTENTRY>
</VARIABLELIST>
<PARA>
</PARA>
<!-- 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,185 +1,199 @@
<REFENTRY ID="SQL-LISTEN">
<REFMETA>
<REFENTRYTITLE>
LISTEN
</REFENTRYTITLE>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO>
</REFMETA>
<REFNAMEDIV>
<REFNAME>
LISTEN
</REFNAME>
<REFPURPOSE>
Listen for notification on a notify condition
</REFPURPOSE>
</refnamediv>
<REFSYNOPSISDIV>
<REFSYNOPSISDIVINFO>
<DATE>1998-10-07</DATE>
</REFSYNOPSISDIVINFO>
<SYNOPSIS>
LISTEN <REPLACEABLE CLASS="PARAMETER">notifyname</REPLACEABLE>
</SYNOPSIS>
<refentry id="SQL-LISTEN">
<refmeta>
<refentrytitle>
LISTEN
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta>
<refnamediv>
<refname>
LISTEN
</refname>
<refpurpose>
Listen for a response on a notify condition
</refpurpose>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
<date>1998-10-07</date>
</refsynopsisdivinfo>
<synopsis>
LISTEN <replaceable class="PARAMETER">name</replaceable>
</synopsis>
<REFSECT2 ID="R2-SQL-LISTEN-1">
<REFSECT2INFO>
<DATE>1998-10-07</DATE>
</REFSECT2INFO>
<TITLE>
Inputs
</TITLE>
<PARA>
</PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
<REPLACEABLE CLASS="PARAMETER">notifyname</REPLACEABLE>
</TERM>
<LISTITEM>
<PARA>
Name of notify condition.
</para>
</listitem>
</varlistentry>
</VARIABLELIST>
</REFSECT2>
<REFSECT2 ID="R2-SQL-LISTEN-2">
<REFSECT2INFO>
<DATE>1998-09-24</DATE>
</REFSECT2INFO>
<TITLE>
Outputs
</TITLE>
<PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
<returnvalue>LISTEN</returnvalue>
</TERM>
<LISTITEM>
<PARA>
Message returned upon successful completion of registration.
</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>
</varlistentry>
</VARIABLELIST>
</para>
</REFSECT2>
</REFSYNOPSISDIV>
<REFSECT1 ID="R1-SQL-LISTEN-1">
<REFSECT1INFO>
<DATE>1998-10-07</DATE>
</REFSECT1INFO>
<TITLE>
Description
</TITLE>
<PARA>
LISTEN registers the current <productname>Postgres</productname> backend as a
listener on the notify condition
<REPLACEABLE CLASS="PARAMETER">notifyname</REPLACEABLE>.
</para>
<para>
Whenever the command
<command>NOTIFY <REPLACEABLE CLASS="PARAMETER">notifyname</REPLACEABLE></command>
is invoked, either by this backend or another one connected to
the same database, all the backends currently listening on that notify
condition are notified, and each will in turn notify its connected
frontend application. See the discussion of <command>NOTIFY</command>
for more information.
</para>
<para>
A backend can be deregistered for a given notify condition with the
<command>UNLISTEN</command> command. Also, a backend's listen registrations
are automatically cleared when the backend process exits.
</para>
<para>
The method a frontend application must use to detect notify events depends on
which <productname>Postgres</productname> application programming interface it
uses. With the basic libpq library, the application issues
<command>LISTEN</command> as an ordinary SQL command, and then must
periodically call the routine <function>PQnotifies</function> to find out
whether any notify events have been received. Other interfaces such as
libpgtcl provide higher-level methods for handling notify events; indeed,
with libpgtcl the application programmer should not even issue
<command>LISTEN</command> or <command>UNLISTEN</command> directly. See the
documentation for the library you are using for more details.
</para>
<para>
The reference page for <command>NOTIFY</command> contains a more extensive
discussion of the use of <command>LISTEN</command> and
<command>NOTIFY</command>.
</para>
<REFSECT2 ID="R2-SQL-LISTEN-3">
<REFSECT2INFO>
<DATE>1998-10-07</DATE>
</REFSECT2INFO>
<TITLE>
Notes
</TITLE>
<para>
<REPLACEABLE CLASS="PARAMETER">notifyname</REPLACEABLE>
can be any string valid as a name;
it need not correspond to the name of any actual table. If
<REPLACEABLE CLASS="PARAMETER">notifyname</REPLACEABLE>
is enclosed in double-quotes, it need not even be a syntactically
valid name, but can be any string up to 31 characters long.
</para>
<para>
In some previous releases of
<productname>Postgres</productname>,
<REPLACEABLE CLASS="PARAMETER">notifyname</REPLACEABLE>
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.
</para>
</REFSECT2>
</refsect1>
<REFSECT1 ID="R1-SQL-LISTEN-2">
<TITLE>
Usage
</TITLE>
<PARA>
<ProgramListing>
-- Configure and execute a listen/notify sequence from psql
postgres=> listen virtual;
LISTEN
postgres=> notify virtual;
NOTIFY
ASYNC NOTIFY of 'virtual' from backend pid '11239' received
</ProgramListing>
</para>
</REFSECT1>
<REFSECT1 ID="R1-SQL-LISTEN-3">
<TITLE>
Compatibility
</TITLE>
<REFSECT2 ID="R2-SQL-LISTEN-4">
<REFSECT2INFO>
<DATE>1998-09-01</DATE>
</REFSECT2INFO>
<TITLE>
SQL92
</TITLE>
<PARA>
There is no <command>LISTEN</command> in <acronym>SQL92</acronym>.
</para>
</refsect2>
</refsect1>
</REFENTRY>
<refsect2 id="R2-SQL-LISTEN-1">
<refsect2info>
<date>1998-10-07</date>
</refsect2info>
<title>
Inputs
</title>
<para>
<variablelist>
<varlistentry>
<term><replaceable class="PARAMETER">name</replaceable></term>
<listitem>
<para>
Name of notify condition.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
<refsect2 id="R2-SQL-LISTEN-2">
<refsect2info>
<date>1998-09-24</date>
</refsect2info>
<title>
Outputs
</title>
<para>
<variablelist>
<varlistentry>
<term><computeroutput>
LISTEN
</computeroutput></term>
<listitem>
<para>
Message returned upon successful completion of registration.
</para>
</listitem>
</varlistentry>
<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>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
</refsynopsisdiv>
<refsect1 id="R1-SQL-LISTEN-1">
<refsect1info>
<date>1998-10-07</date>
</refsect1info>
<title>
Description
</title>
<para>
<command>LISTEN</command> registers the current <productname>Postgres</productname> backend as a
listener on the notify condition
<replaceable class="PARAMETER">name</replaceable>.
</para>
<para>
Whenever the command
<command>NOTIFY <replaceable class="PARAMETER">name</replaceable></command>
is invoked, either by this backend or another one connected to
the same database, all the backends currently listening on that notify
condition are notified, and each will in turn notify its connected
frontend application. See the discussion of <command>NOTIFY</command>
for more information.
</para>
<para>
A backend can be unregistered for a given notify condition with the
<command>UNLISTEN</command> command. Also, a backend's listen registrations
are automatically cleared when the backend process exits.
</para>
<para>
The method a frontend application must use to detect notify events depends on
which <productname>Postgres</productname> application programming interface it
uses. With the basic libpq library, the application issues
<command>LISTEN</command> as an ordinary SQL command, and then must
periodically call the routine <function>PQnotifies</function> to find out
whether any notify events have been received. Other interfaces such as
libpgtcl provide higher-level methods for handling notify events; indeed,
with libpgtcl the application programmer should not even issue
<command>LISTEN</command> or <command>UNLISTEN</command> directly. See the
documentation for the library you are using for more details.
</para>
<para>
The reference page for <command>NOTIFY</command> contains a more extensive
discussion of the use of <command>LISTEN</command> and
<command>NOTIFY</command>.
</para>
<refsect2 id="R2-SQL-LISTEN-3">
<refsect2info>
<date>1998-10-07</date>
</refsect2info>
<title>
Notes
</title>
<para>
<replaceable class="PARAMETER">name</replaceable>
can be any string valid as a name;
it need not correspond to the name of any actual table. If
<replaceable class="PARAMETER">notifyname</replaceable>
is enclosed in double-quotes, it need not even be a syntactically
valid name, but can be any string up to 31 characters long.
</para>
<para>
In some previous releases of
<productname>Postgres</productname>,
<replaceable class="PARAMETER">name</replaceable>
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.
</para>
</refsect2>
</refsect1>
<refsect1 id="R1-SQL-LISTEN-2">
<title>
Usage
</title>
<para>
Configure and execute a listen/notify sequence from <application>psql</application>:
<programlisting>
LISTEN virtual;
NOTIFY virtual;
ASYNC NOTIFY of 'virtual' from backend pid '11239' received
</programlisting>
</para>
</refsect1>
<refsect1 id="R1-SQL-LISTEN-3">
<title>
Compatibility
</title>
<refsect2 id="R2-SQL-LISTEN-4">
<refsect2info>
<date>1998-09-01</date>
</refsect2info>
<title>
SQL92
</title>
<para>
There is no <command>LISTEN</command> in <acronym>SQL92</acronym>.
</para>
</refsect2>
</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,179 +1,192 @@
<REFENTRY ID="SQL-LOAD">
<REFMETA>
<REFENTRYTITLE>
LOAD
</REFENTRYTITLE>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO>
</REFMETA>
<REFNAMEDIV>
<REFNAME>
LOAD
</REFNAME>
<REFPURPOSE>
Dynamically loads an object file
</REFPURPOSE>
</refnamediv>
<REFSYNOPSISDIV>
<REFSYNOPSISDIVINFO>
<DATE>1998-09-24</DATE>
</REFSYNOPSISDIVINFO>
<SYNOPSIS>
<REPLACEABLE CLASS="PARAMETER">
</REPLACEABLE>
LOAD '<REPLACEABLE CLASS="PARAMETER">filename</REPLACEABLE>'
</SYNOPSIS>
<refentry id="SQL-LOAD">
<refmeta>
<refentrytitle>
LOAD
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta>
<refnamediv>
<refname>
LOAD
</refname>
<refpurpose>
Dynamically loads an object file
</refpurpose>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
<date>1998-09-24</date>
</refsynopsisdivinfo>
<synopsis>
LOAD '<replaceable class="PARAMETER">filename</replaceable>'
</synopsis>
<REFSECT2 ID="R2-SQL-LOAD-1">
<REFSECT2INFO>
<DATE>1998-09-01</DATE>
</REFSECT2INFO>
<TITLE>
Inputs
</TITLE>
<PARA>
</PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
<REPLACEABLE CLASS="PARAMETER">filename</REPLACEABLE>
</TERM>
<LISTITEM>
<PARA>
Object file for dynamic loading.
</para>
</listitem>
</varlistentry>
</VARIABLELIST>
<refsect2 id="R2-SQL-LOAD-1">
<refsect2info>
<date>1998-09-01</date>
</refsect2info>
<title>
Inputs
</title>
<para>
<variablelist>
<varlistentry>
<term><replaceable class="PARAMETER">filename</replaceable></term>
<listitem>
<para>
Object file for dynamic loading.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
</REFSECT2>
<refsect2 id="R2-SQL-LOAD-2">
<refsect2info>
<date>1998-09-24</date>
</refsect2info>
<title>
Outputs
</title>
<para>
<REFSECT2 ID="R2-SQL-LOAD-2">
<REFSECT2INFO>
<DATE>1998-09-24</DATE>
</REFSECT2INFO>
<TITLE>
Outputs
</TITLE>
<PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
<returnvalue>LOAD</returnvalue>
</TERM>
<LISTITEM>
<PARA>
Message returned on successful completion.
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
<returnvalue>ERROR: LOAD: could not open file '<REPLACEABLE CLASS="PARAMETER">filename</REPLACEABLE>'</returnvalue>
</TERM>
<LISTITEM>
<PARA>
Message returned if the specified file is not found. The file must be visible
<emphasis>to the <productname>Postgres</productname> backend</emphasis>,
with the appropriate full path name specified, to avoid this message.
</para>
</listitem>
</varlistentry>
</VARIABLELIST>
</para>
</REFSECT2>
</REFSYNOPSISDIV>
<REFSECT1 ID="R1-SQL-LOAD-1">
<REFSECT1INFO>
<DATE>1998-09-24</DATE>
</REFSECT1INFO>
<TITLE>
Description
</TITLE>
<PARA>
Loads an object (or ".o") file into the
<productname>Postgres</productname> backend address space. Once a
file is loaded, all functions in that file can be accessed. This
function is used in support of user-defined types and functions.
</para>
<para>
If a file is not loaded using
<command>LOAD</command>,
the file will be loaded automatically the first time the
function is called by <productname>Postgres</productname>.
<command>LOAD</command>
can also be used to reload an object file if it has been edited and
recompiled. Only objects created from C language files are supported
at this time.
</para>
<REFSECT2 ID="R2-SQL-LOAD-3">
<REFSECT2INFO>
<DATE>1998-09-24</DATE>
</REFSECT2INFO>
<TITLE>
Notes
</TITLE>
<PARA>
Functions in loaded object files should not call functions in other
object files loaded through the
<command>LOAD</command>
command. For example, all functions in file <literal>A</literal> should
call each other, functions in the standard or math libraries, or in
Postgres itself. They should not call functions defined in a different
loaded file <literal>B</literal>.
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
the new address space of <literal>B</literal>.
If <literal>B</literal> is not reloaded, however, there will
not be a problem.
</para>
<para>
Object files must be compiled to contain position independent code.
For example,
on DECstations you must use
<application>/bin/cc</application>
with the <literal>-G 0</literal> option when compiling object files to be
loaded.
</para>
<para>
Note that if you are porting <productname>Postgres</productname>
to a new platform, <command>LOAD</command>
will have to work in order to support ADTs.
</para>
</REFSECT2>
</refsect1>
<variablelist>
<varlistentry>
<term><computeroutput>
LOAD
</computeroutput></term>
<listitem>
<para>
Message returned on successful completion.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><computeroutput>
ERROR: LOAD: could not open file '<replaceable class="PARAMETER">filename</replaceable>'
</computeroutput></term>
<listitem>
<para>
Message returned if the specified file is not found. The file must be visible
<emphasis>to the <productname>Postgres</productname> backend</emphasis>,
with the appropriate full path name specified, to avoid this message.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
</refsynopsisdiv>
<REFSECT1 ID="R1-SQL-LOAD-2">
<TITLE>
Usage
</TITLE>
<PARA>
<ProgramListing>
--Load the file /usr/postgres/demo/circle.o
--
LOAD '/usr/postgres/demo/circle.o'
</ProgramListing>
</para>
</REFSECT1>
<REFSECT1 ID="R1-SQL-LOAD-3">
<TITLE>
Compatibility
</TITLE>
<PARA>
</PARA>
<REFSECT2 ID="R2-SQL-LOAD-4">
<REFSECT2INFO>
<DATE>1998-09-24</DATE>
</REFSECT2INFO>
<TITLE>
SQL92
</TITLE>
<PARA>
There is no <command>LOAD</command> in <acronym>SQL92</acronym>.
</para>
</refsect2>
</refsect1>
</REFENTRY>
<refsect1 id="R1-SQL-LOAD-1">
<refsect1info>
<date>1998-09-24</date>
</refsect1info>
<title>
Description
</title>
<para>
Loads an object (or ".o") file into the
<productname>Postgres</productname> backend address space. Once a
file is loaded, all functions in that file can be accessed. This
function is used in support of user-defined types and functions.
</para>
<para>
If a file is not loaded using
<command>LOAD</command>,
the file will be loaded automatically the first time the
function is called by <productname>Postgres</productname>.
<command>LOAD</command>
can also be used to reload an object file if it has been edited and
recompiled. Only objects created from C language files are supported
at this time.
</para>
<refsect2 id="R2-SQL-LOAD-3">
<refsect2info>
<date>1998-09-24</date>
</refsect2info>
<title>
Notes
</title>
<para>
Functions in loaded object files should not call functions in other
object files loaded through the
<command>LOAD</command>
command. For example, all functions in file <literal>A</literal> should
call each other, functions in the standard or math libraries, or in
Postgres itself. They should not call functions defined in a different
loaded file <literal>B</literal>.
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
the new address space of <literal>B</literal>.
If <literal>B</literal> is not reloaded, however, there will
not be a problem.
</para>
<para>
Object files must be compiled to contain position independent code.
For example,
on DECstations you must use
<application>/bin/cc</application>
with the <literal>-G 0</literal> option when compiling object files to be
loaded.
</para>
<para>
Note that if you are porting <productname>Postgres</productname>
to a new platform, <command>LOAD</command>
will have to work in order to support ADTs.
</para>
</refsect2>
</refsect1>
<refsect1 id="R1-SQL-LOAD-2">
<title>
Usage
</title>
<para>
Load the file <filename>/usr/postgres/demo/circle.o</filename>:
<programlisting>
LOAD '/usr/postgres/demo/circle.o'
</programlisting>
</para>
</refsect1>
<refsect1 id="R1-SQL-LOAD-3">
<title>
Compatibility
</title>
<para>
</para>
<refsect2 id="R2-SQL-LOAD-4">
<refsect2info>
<date>1998-09-24</date>
</refsect2info>
<title>
SQL92
</title>
<para>
There is no <command>LOAD</command> in <acronym>SQL92</acronym>.
</para>
</refsect2>
</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

@ -34,9 +34,7 @@ LOCK [ TABLE ] <replaceable class="PARAMETER">table</replaceable> IN SHARE ROW E
<variablelist>
<varlistentry>
<term>
<replaceable class="PARAMETER">table</replaceable>
</term>
<term><replaceable class="PARAMETER">table</replaceable></term>
<listitem>
<para>
The name of an existing table to lock.
@ -45,17 +43,15 @@ LOCK [ TABLE ] <replaceable class="PARAMETER">table</replaceable> IN SHARE ROW E
</varlistentry>
<varlistentry>
<term>
ACCESS SHARE MODE
</term>
<term>ACCESS SHARE MODE</term>
<listitem>
<note>
<para>
This lock mode is acquired automatically over tables being queried.
<productname>Postgres</productname> releases automatically acquired
ACCESS SHARE locks after the statement is done.
</para>
</note>
<para>
This lock mode is acquired automatically over tables being queried.
<productname>Postgres</productname> releases automatically acquired
ACCESS SHARE locks after the statement is done.
</para>
</note>
<para>
This is the least restrictive lock mode which conflicts only with
@ -68,9 +64,7 @@ LOCK [ TABLE ] <replaceable class="PARAMETER">table</replaceable> IN SHARE ROW E
</varlistentry>
<varlistentry>
<term>
ROW SHARE MODE
</term>
<term>ROW SHARE MODE</term>
<listitem>
<note>
<para>
@ -85,12 +79,10 @@ LOCK [ TABLE ] <replaceable class="PARAMETER">table</replaceable> IN SHARE ROW E
</varlistentry>
<varlistentry>
<term>
ROW EXCLUSIVE MODE
</term>
<term>ROW EXCLUSIVE MODE</term>
<listitem>
<note>
<para>
<para>
Automatically acquired by any <command>UPDATE</command>,
<command>DELETE</command>, <command>INSERT</command> statement.
</para>
@ -105,9 +97,7 @@ LOCK [ TABLE ] <replaceable class="PARAMETER">table</replaceable> IN SHARE ROW E
</varlistentry>
<varlistentry>
<term>
SHARE MODE
</term>
<term>SHARE MODE</term>
<listitem>
<note>
<para>
@ -124,9 +114,7 @@ LOCK [ TABLE ] <replaceable class="PARAMETER">table</replaceable> IN SHARE ROW E
</varlistentry>
<varlistentry>
<term>
SHARE ROW EXCLUSIVE MODE
</term>
<term>SHARE ROW EXCLUSIVE MODE</term>
<listitem>
<para>
@ -139,9 +127,7 @@ LOCK [ TABLE ] <replaceable class="PARAMETER">table</replaceable> IN SHARE ROW E
</varlistentry>
<varlistentry>
<term>
EXCLUSIVE MODE
</term>
<term>EXCLUSIVE MODE</term>
<listitem>
<para>
@ -154,9 +140,7 @@ LOCK [ TABLE ] <replaceable class="PARAMETER">table</replaceable> IN SHARE ROW E
</varlistentry>
<varlistentry>
<term>
ACCESS EXCLUSIVE MODE
</term>
<term>ACCESS EXCLUSIVE MODE</term>
<listitem>
<note>
<para>
@ -179,7 +163,6 @@ LOCK [ TABLE ] <replaceable class="PARAMETER">table</replaceable> IN SHARE ROW E
</note>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
@ -195,9 +178,20 @@ LOCK [ TABLE ] <replaceable class="PARAMETER">table</replaceable> IN SHARE ROW E
<variablelist>
<varlistentry>
<term>
ERROR <replaceable class="PARAMETER">table</replaceable>: Table does not exist.
</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.
</computeroutput></term>
<listitem>
<para>
Message returned if <replaceable class="PARAMETER">table</replaceable>
@ -328,45 +322,42 @@ LOCK [ TABLE ] <replaceable class="PARAMETER">table</replaceable> IN SHARE ROW E
</title>
<para>
Illustrate a SHARE lock on a primary key table when going to perform
inserts into a foreign key table:
<programlisting>
--
-- SHARE lock primary key table when going to perform
-- insert into foreign key table.
--
BEGIN WORK;
LOCK TABLE films IN SHARE MODE;
SELECT id FROM films
WHERE name = 'Star Wars: Episode I - The Phantom Menace';
--
-- Do ROLLBACK if record was not returned
--
INSERT INTO films_user_comments VALUES
(_id_, 'GREAT! I was waiting for it for so long!');
COMMIT WORK;
</programlisting>
BEGIN WORK;
LOCK TABLE films IN SHARE MODE;
SELECT id FROM films
WHERE name = 'Star Wars: Episode I - The Phantom Menace';
-- Do ROLLBACK if record was not returned
INSERT INTO films_user_comments VALUES
(_id_, 'GREAT! I was waiting for it for so long!');
COMMIT WORK;
</programlisting>
</para>
<para>
<programlisting>
--
-- SHARE ROW EXCLUSIVE lock primary key table when going to perform
-- delete operation.
--
BEGIN WORK;
LOCK TABLE films IN SHARE ROW EXCLUSIVE MODE;
DELETE FROM films_user_comments WHERE id IN
(SELECT id FROM films WHERE rating < 5);
DELETE FROM films WHERE rating < 5;
COMMIT WORK;
</programlisting>
Take a SHARE ROW EXCLUSIVE lock on a primary key table when going to perform
a delete operation:
<programlisting>
BEGIN WORK;
LOCK TABLE films IN SHARE ROW EXCLUSIVE MODE;
DELETE FROM films_user_comments WHERE id IN
(SELECT id FROM films WHERE rating < 5);
DELETE FROM films WHERE rating < 5;
COMMIT WORK;
</programlisting>
</para>
</refsect1>
<refsect1 id="R1-SQL-LOCK-3">
<title>
Compatibility
</title>
<para>
</para>
<refsect2 id="R2-SQL-LOCK-4">
<refsect2info>
@ -397,7 +388,7 @@ 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-catalogs:"/usr/lib/sgml/catalog"
sgml-local-ecat-files:nil
End:
-->

View File

@ -1,124 +1,138 @@
<REFENTRY ID="SQL-MOVE">
<REFMETA>
<REFENTRYTITLE>
<refentry id="SQL-MOVE">
<refmeta>
<refentrytitle>
MOVE
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta>
<refnamediv>
<refname>
MOVE
</refname>
<refpurpose>
Moves cursor position
</refpurpose>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
<date>1998-09-24</date>
</refsynopsisdivinfo>
<synopsis>
MOVE [ <replaceable class="PARAMETER">selector</replaceable> ] [ <replaceable class="PARAMETER">count</replaceable> ]
{ IN | FROM } <replaceable class="PARAMETER">cursor</replaceable>
FETCH [ RELATIVE ] [ { [ <replaceable class="PARAMETER">#</replaceable> | ALL | NEXT | PRIOR ] } ] FROM ] <replaceable class="PARAMETER">cursor</replaceable>
</synopsis>
</refsynopsisdiv>
<refsect1 id="R1-SQL-MOVE-1">
<refsect1info>
<date>1998-09-24</date>
</refsect1info>
<title>
Description
</title>
<para>
<command>MOVE</command> allows a user to move cursor position a specified
number of rows.
<command>MOVE</command> works like the <command>FETCH</command> command,
but only positions the cursor and does
not return rows.
</para>
<para>
Refer to the <command>FETCH</command> command for details on syntax and usage.
</para>
<refsect2 id="R2-SQL-MOVE-3">
<refsect2info>
<date>1998-09-24</date>
</refsect2info>
<title>
Notes
</title>
<para>
<command>MOVE</command> is a <productname>Postgres</productname>
language extension.
</para>
<para>
Refer to <command>FETCH</command> for a description
of valid arguments.
Refer to <command>DECLARE</command> to declare a cursor.
Refer to <command>BEGIN WORK</command>, <command>COMMIT WORK</command>,
<command>ROLLBACK WORK</command> statements
for further information about transactions.
</para>
</refsect2>
</refsect1>
<refsect1 id="R1-SQL-MOVE-2">
<title>
Usage
</title>
<para>
Set up and use a cursor:
<programlisting>
BEGIN WORK;
DECLARE liahona CURSOR FOR SELECT * FROM films;
--Skip first 5 rows:
MOVE FORWARD 5 IN liahona;
<computeroutput>
MOVE
</REFENTRYTITLE>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO>
</REFMETA>
<REFNAMEDIV>
<REFNAME>
MOVE
</REFNAME>
<REFPURPOSE>
Moves cursor position
</REFPURPOSE>
</refnamediv>
<REFSYNOPSISDIV>
<REFSYNOPSISDIVINFO>
<DATE>1998-09-24</DATE>
</REFSYNOPSISDIVINFO>
<SYNOPSIS>
MOVE [ <REPLACEABLE CLASS="PARAMETER">selector</REPLACEABLE> ] [ <REPLACEABLE CLASS="PARAMETER">count</REPLACEABLE> ]
{ IN | FROM } <REPLACEABLE CLASS="PARAMETER">cursor</REPLACEABLE>
FETCH [ RELATIVE ] [ { [ <REPLACEABLE CLASS="PARAMETER">#</REPLACEABLE> | ALL | NEXT | PRIOR ] } ] FROM ] <REPLACEABLE CLASS="PARAMETER">cursor</REPLACEABLE>
</SYNOPSIS>
</refsynopsisdiv>
</computeroutput>
--Fetch 6th row in the cursor liahona:
FETCH 1 IN liahona;
<computeroutput>
FETCH
<REFSECT1 ID="R1-SQL-MOVE-1">
<REFSECT1INFO>
<DATE>1998-09-24</DATE>
</REFSECT1INFO>
<TITLE>
Description
</TITLE>
<PARA>
<command>MOVE</command> allows a user to move cursor position a specified
number of rows.
<command>MOVE</command> works like the <command>FETCH</command> command,
but only positions the cursor and does
not return rows.
</para>
<para>
Refer to the <command>FETCH</command> command for details on syntax and usage.
</para>
code |title |did| date_prod|kind |len
-----+------+---+----------+----------+------
P_303|48 Hrs|103|1982-10-22|Action | 01:37
(1 row)
</computeroutput>
-- close the cursor liahona and commit work:
CLOSE liahona;
COMMIT WORK;
</programlisting>
</para>
</refsect1>
<REFSECT2 ID="R2-SQL-MOVE-3">
<REFSECT2INFO>
<DATE>1998-09-24</DATE>
</REFSECT2INFO>
<TITLE>
Notes
</TITLE>
<PARA>
<command>MOVE</command> is a <productname>Postgres</productname>
language extension.
</para>
<para>
Refer to <command>FETCH</command> for a description
of valid arguments.
Refer to <command>DECLARE</command> to declare a cursor.
Refer to <command>BEGIN WORK</command>, <command>COMMIT WORK</command>,
<command>ROLLBACK WORK</command> statements
for further information about transactions.
</para>
</REFSECT2>
</refsect1>
<REFSECT1 ID="R1-SQL-MOVE-2">
<TITLE>
Usage
</TITLE>
<PARA>
<ProgramListing>
--set up and use a cursor:
--
BEGIN WORK;
DECLARE liahona CURSOR FOR SELECT * FROM films;
--Skip first 5 rows:
--
MOVE FORWARD 5 IN liahona;
<computeroutput>
MOVE
</computeroutput>
--Fetch 6th row in the cursor liahona:
--
FETCH 1 IN liahona;
<computeroutput>
FETCH
code |title |did| date_prod|kind |len
-----+------+---+----------+----------+------
P_303|48 Hrs|103|1982-10-22|Action | 01:37
(1 row)
</computeroutput>
-- close the cursor liahona and commit work:
--
CLOSE liahona;
COMMIT WORK;
</ProgramListing>
</para>
</REFSECT1>
<REFSECT1 ID="R1-SQL-MOVE-3">
<TITLE>
Compatibility
</TITLE>
<PARA>
</PARA>
<refsect1 id="R1-SQL-MOVE-3">
<title>
Compatibility
</title>
<para>
</para>
<REFSECT2 ID="R2-SQL-MOVE-4">
<REFSECT2INFO>
<DATE>1998-09-01</DATE>
</REFSECT2INFO>
<TITLE>
SQL92
</TITLE>
<PARA>
There is no SQL92 <command>MOVE</command> statement.
Instead, <acronym>SQL92</acronym> allows
one to <command>FETCH</command> rows from an absolute cursor position,
implicitly moving the cursor to the correct place.
</para>
</refsect2>
</refsect1>
</REFENTRY>
<refsect2 id="R2-SQL-MOVE-4">
<refsect2info>
<date>1998-09-01</date>
</refsect2info>
<title>
SQL92
</title>
<para>
There is no SQL92 <command>MOVE</command> statement.
Instead, <acronym>SQL92</acronym> allows
one to <command>FETCH</command> rows from an absolute cursor position,
implicitly moving the cursor to the correct place.
</para>
</refsect2>
</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,237 +1,251 @@
<REFENTRY ID="SQL-NOTIFY">
<REFMETA>
<REFENTRYTITLE id="sql-notify-ref">
<refentry id="SQL-NOTIFY">
<refmeta>
<refentrytitle id="sql-notify-ref">
NOTIFY
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta>
<refnamediv>
<refname>
NOTIFY
</refname>
<refpurpose>
Signals all frontends and backends listening on a notify condition
</refpurpose>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
<date>1998-10-07</date>
</refsynopsisdivinfo>
<synopsis>
NOTIFY <replaceable class="PARAMETER">name</replaceable>
</synopsis>
<refsect2 id="R2-SQL-NOTIFY-1">
<refsect2info>
<date>1998-10-07</date>
</refsect2info>
<title>
Inputs
</title>
<para>
<variablelist>
<varlistentry>
<term><replaceable class="PARAMETER">notifyname</replaceable></term>
<listitem>
<para>
Notify condition to be signaled.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
<refsect2 id="R2-SQL-NOTIFY-2">
<refsect2info>
<date>1998-10-07</date>
</refsect2info>
<title>
Outputs
</title>
<para>
<variablelist>
<varlistentry>
<term><computeroutput>
NOTIFY
</REFENTRYTITLE>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO>
</REFMETA>
<REFNAMEDIV>
<REFNAME>
NOTIFY
</REFNAME>
<REFPURPOSE>
Signals all frontends and backends listening on a notify condition
</REFPURPOSE>
</refnamediv>
<REFSYNOPSISDIV>
<REFSYNOPSISDIVINFO>
<DATE>1998-10-07</DATE>
</REFSYNOPSISDIVINFO>
<SYNOPSIS>
<REPLACEABLE CLASS="PARAMETER">
</REPLACEABLE>
NOTIFY <REPLACEABLE CLASS="PARAMETER">notifyname</REPLACEABLE>
</SYNOPSIS>
</computeroutput></term>
<listitem>
<para>
Acknowledgement that notify command has executed.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable>Notify events</replaceable></term>
<listitem>
<para>
Events are delivered to listening frontends; whether and how each frontend
application reacts depends on its programming.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
</refsynopsisdiv>
<REFSECT2 ID="R2-SQL-NOTIFY-1">
<REFSECT2INFO>
<DATE>1998-10-07</DATE>
</REFSECT2INFO>
<TITLE>
Inputs
</TITLE>
<PARA>
<refsect1 id="R1-SQL-NOTIFY-1">
<refsect1info>
<date>1998-10-07</date>
</refsect1info>
<title>
Description
</title>
<para>
The <command>NOTIFY</command> command sends a notify event to each
frontend application that has previously executed
<command>LISTEN <replaceable class="parameter">notifyname</replaceable></command>
for the specified notify condition in the current database.
</para>
<para>
The information passed to the frontend for a notify event includes the notify
condition name and the notifying backend process's PID. It is up to the
database designer to define the condition names that will be used in a given
database and what each one means.
</para>
<para>
Commonly, the notify condition name is the same as the name of some table in
the database, and the notify event essentially means "I changed this table,
take a look at it to see what's new". But no such association is enforced by
the <command>NOTIFY</command> and <command>LISTEN</command> commands. For
example, a database designer could use several different condition names
to signal different sorts of changes to a single table.
</para>
<para>
<command>NOTIFY</command> provides a simple form of signal or
IPC (interprocess communication) mechanism for a collection of processes
accessing the same <productname>Postgres</productname> database.
Higher-level mechanisms can be built by using tables in the database to
pass additional data (beyond a mere condition name) from notifier to
listener(s).
</para>
<para>
When <command>NOTIFY</command> is used to signal the occurrence of changes
to a particular table, a useful programming technique is to put the
<command>NOTIFY</command> in a rule that is triggered by table updates.
In this way, notification happens automatically when the table is changed,
and the application programmer can't accidentally forget to do it.
</para>
<para>
<command>NOTIFY</command> interacts with SQL transactions in some important
ways. Firstly, if a <command>NOTIFY</command> is executed inside a
transaction, the notify events are not delivered until and unless the
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, including <command>NOTIFY</command>. But it can be disconcerting if one
is expecting the notify events to be delivered immediately. Secondly, if
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
after the transaction is completed (either committed or aborted). Again, the
reasoning is that if a notify were delivered within a transaction that was
later aborted, one would want the notification to be undone somehow --- but
the backend cannot "take back" a notify once it has sent it to the frontend.
So notify events are only delivered between transactions. The upshot of this
is that applications using <command>NOTIFY</command> for real-time signaling
should try to keep their transactions short.
</para>
<para>
<command>NOTIFY</command> behaves like Unix signals in one important
respect: if the same condition name is signaled multiple times in quick
succession, recipients may get only one notify event for several executions
of <command>NOTIFY</command>. So it is a bad idea to depend on the number
of notifies received. Instead, use <command>NOTIFY</command> to wake up
applications that need to pay attention to something, and use a database
object (such as a sequence) to keep track of what happened or how many times
it happened.
</para>
<para>
It is common for a frontend that sends <command>NOTIFY</command> to be
listening on the same notify name itself. In that case it will get back a
notify event, just like all the other listening frontends. Depending on the
application logic, this could result in useless work --- for example,
re-reading a database table to find the same updates that that frontend just
wrote out. In <productname>Postgres</productname> 6.4 and later, it is
possible to avoid such extra work by noticing whether the notifying backend
process's PID (supplied in the notify event message) is the same as one's own
backend's PID (available from libpq). When they are the same, the notify
event is one's own work bouncing back, and can be ignored. (Despite what was
said in the preceding paragraph, this is a safe technique.
<productname>Postgres</productname> keeps self-notifies separate from notifies
arriving from other backends, so you cannot miss an outside notify by ignoring
your own notifies.)
</para>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
<REPLACEABLE CLASS="PARAMETER">notifyname</REPLACEABLE>
</TERM>
<LISTITEM>
<PARA>
Notify condition to be signaled.
</para>
</listitem>
</varlistentry>
</VARIABLELIST>
</para>
</REFSECT2>
<refsect2 id="R2-SQL-NOTIFY-3">
<refsect2info>
<date>1998-10-07</date>
</refsect2info>
<title>
Notes
</title>
<para>
<replaceable class="PARAMETER">name</replaceable>
can be any string valid as a name;
it need not correspond to the name of any actual table. If
<replaceable class="PARAMETER">name</replaceable>
is enclosed in double-quotes, it need not even be a syntactically
valid name, but can be any string up to 31 characters long.
</para>
<para>
In some previous releases of
<productname>Postgres</productname>,
<replaceable class="PARAMETER">name</replaceable>
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.
</para>
<para>
In <productname>Postgres</productname> releases prior to 6.4, the backend
PID delivered in a notify message was always the PID of the frontend's own
backend. So it was not possible to distinguish one's own notifies from other
clients' notifies in those earlier releases.
</para>
</refsect2>
</refsect1>
<REFSECT2 ID="R2-SQL-NOTIFY-2">
<REFSECT2INFO>
<DATE>1998-10-07</DATE>
</REFSECT2INFO>
<TITLE>
Outputs
</TITLE>
<PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
NOTIFY
</TERM>
<LISTITEM>
<PARA>
Acknowledgement that notify command has executed.
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
Notify events
</TERM>
<LISTITEM>
<PARA>
Events are delivered to listening frontends; whether and how each frontend
application reacts depends on its programming.
</PARA>
</LISTITEM>
</VARLISTENTRY>
</VARIABLELIST>
</para>
</REFSECT2>
</REFSYNOPSISDIV>
<REFSECT1 ID="R1-SQL-NOTIFY-1">
<REFSECT1INFO>
<DATE>1998-10-07</DATE>
</REFSECT1INFO>
<TITLE>
Description
</TITLE>
<PARA>
The <command>NOTIFY</command> command sends a notify event to each
frontend application that has previously executed
<command>LISTEN <replaceable class="parameter">notifyname</replaceable></command>
for the specified notify condition in the current database.
</para>
<para>
The information passed to the frontend for a notify event includes the notify
condition name and the notifying backend process's PID. It is up to the
database designer to define the condition names that will be used in a given
database and what each one means.
</para>
<para>
Commonly, the notify condition name is the same as the name of some table in
the database, and the notify event essentially means "I changed this table,
take a look at it to see what's new". But no such association is enforced by
the <command>NOTIFY</command> and <command>LISTEN</command> commands. For
example, a database designer could use several different condition names
to signal different sorts of changes to a single table.
</para>
<para>
<command>NOTIFY</command> provides a simple form of signal or
IPC (interprocess communication) mechanism for a collection of processes
accessing the same <productname>Postgres</productname> database.
Higher-level mechanisms can be built by using tables in the database to
pass additional data (beyond a mere condition name) from notifier to
listener(s).
</para>
<para>
When <command>NOTIFY</command> is used to signal the occurrence of changes
to a particular table, a useful programming technique is to put the
<command>NOTIFY</command> in a rule that is triggered by table updates.
In this way, notification happens automatically when the table is changed,
and the application programmer can't accidentally forget to do it.
</para>
<para>
<command>NOTIFY</command> interacts with SQL transactions in some important
ways. Firstly, if a <command>NOTIFY</command> is executed inside a
transaction, the notify events are not delivered until and unless the
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
--- including <command>NOTIFY</command>. But it can be disconcerting if one
is expecting the notify events to be delivered immediately. Secondly, if
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
after the transaction is completed (either committed or aborted). Again, the
reasoning is that if a notify were delivered within a transaction that was
later aborted, one would want the notification to be undone somehow --- but
the backend cannot "take back" a notify once it has sent it to the frontend.
So notify events are only delivered between transactions. The upshot of this
is that applications using <command>NOTIFY</command> for real-time signaling
should try to keep their transactions short.
</para>
<para>
<command>NOTIFY</command> behaves like Unix signals in one important
respect: if the same condition name is signaled multiple times in quick
succession, recipients may get only one notify event for several executions
of <command>NOTIFY</command>. So it is a bad idea to depend on the number
of notifies received. Instead, use <command>NOTIFY</command> to wake up
applications that need to pay attention to something, and use a database
object (such as a sequence) to keep track of what happened or how many times
it happened.
</para>
<para>
It is common for a frontend that sends <command>NOTIFY</command> to be
listening on the same notify name itself. In that case it will get back a
notify event, just like all the other listening frontends. Depending on the
application logic, this could result in useless work --- for example,
re-reading a database table to find the same updates that that frontend just
wrote out. In <productname>Postgres</productname> 6.4 and later, it is
possible to avoid such extra work by noticing whether the notifying backend
process's PID (supplied in the notify event message) is the same as one's own
backend's PID (available from libpq). When they are the same, the notify
event is one's own work bouncing back, and can be ignored. (Despite what was
said in the preceding paragraph, this is a safe technique.
<productname>Postgres</productname> keeps self-notifies separate from notifies
arriving from other backends, so you cannot miss an outside notify by ignoring
your own notifies.)
</para>
<REFSECT2 ID="R2-SQL-NOTIFY-3">
<REFSECT2INFO>
<DATE>1998-10-07</DATE>
</REFSECT2INFO>
<TITLE>
Notes
</TITLE>
<para>
<REPLACEABLE CLASS="PARAMETER">notifyname</REPLACEABLE>
can be any string valid as a name;
it need not correspond to the name of any actual table. If
<REPLACEABLE CLASS="PARAMETER">notifyname</REPLACEABLE>
is enclosed in double-quotes, it need not even be a syntactically
valid name, but can be any string up to 31 characters long.
</para>
<para>
In some previous releases of
<productname>Postgres</productname>,
<REPLACEABLE CLASS="PARAMETER">notifyname</REPLACEABLE>
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.
</para>
<para>
In <productname>Postgres</productname> releases prior to 6.4, the backend
PID delivered in a notify message was always the PID of the frontend's own
backend. So it was not possible to distinguish one's own notifies from other
clients' notifies in those earlier releases.
</para>
</REFSECT2>
</refsect1>
<refsect1 id="R1-SQL-NOTIFY-2">
<title>
Usage
</title>
<para>
Configure and execute a listen/notify sequence from
<application>psql</application>:
<REFSECT1 ID="R1-SQL-NOTIFY-2">
<TITLE>
Usage
</TITLE>
<PARA>
<ProgramListing>
-- Configure and execute a listen/notify sequence from psql
postgres=> listen virtual;
LISTEN
postgres=> notify virtual;
NOTIFY
ASYNC NOTIFY of 'virtual' from backend pid '11239' received
</ProgramListing>
</para>
</REFSECT1>
<programlisting>
LISTEN virtual;
NOTIFY virtual;
ASYNC NOTIFY of 'virtual' from backend pid '11239' received
</programlisting>
</para>
</refsect1>
<REFSECT1 ID="R1-SQL-NOTIFY-3">
<TITLE>
Compatibility
</TITLE>
<REFSECT2 ID="R2-SQL-NOTIFY-4">
<REFSECT2INFO>
<DATE>1998-09-24</DATE>
</REFSECT2INFO>
<TITLE>
SQL92
</TITLE>
<PARA>
There is no <command>NOTIFY</command> statement in <acronym>SQL92</acronym>.
</para>
</refsect2>
</refsect1>
</REFENTRY>
<refsect1 id="R1-SQL-NOTIFY-3">
<title>
Compatibility
</title>
<para>
</para>
<refsect2 id="R2-SQL-NOTIFY-4">
<refsect2info>
<date>1998-09-24</date>
</refsect2info>
<title>
SQL92
</title>
<para>
There is no <command>NOTIFY</command> statement in
<acronym>SQL92</acronym>.
</para>
</refsect2>
</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,423 +1,396 @@
<REFENTRY ID="APP-PG-DUMP">
<REFMETA>
<REFENTRYTITLE id="pg-dump">
<application>pg_dump</application>
</REFENTRYTITLE>
<REFMISCINFO>Application</REFMISCINFO>
</REFMETA>
<REFNAMEDIV>
<REFNAME>
<application>pg_dump</application>
</REFNAME>
<REFPURPOSE>
Extract a <productname>Postgres</productname> database into a script file
</REFPURPOSE>
</refnamediv>
<REFSYNOPSISDIV>
<REFSYNOPSISDIVINFO>
<DATE>1998-11-05</DATE>
</REFSYNOPSISDIVINFO>
<SYNOPSIS>
<refentry id="APP-PG-DUMP">
<refmeta>
<refentrytitle id="pg-dump">
<application>pg_dump</application>
</refentrytitle>
<refmiscinfo>Application</refmiscinfo>
</refmeta>
<refnamediv>
<refname>
<application>pg_dump</application>
</refname>
<refpurpose>
Extract a <productname>Postgres</productname> database into a script file
</refpurpose>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
<date>1998-11-05</date>
</refsynopsisdivinfo>
<synopsis>
pg_dump [ <replaceable class="parameter">dbname</replaceable> ]
pg_dump [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replaceable class="parameter">port</replaceable> ]
[ -t <replaceable class="parameter">table</replaceable> ]
[ -f <replaceable class="parameter">outputfile</replaceable> ]
[ -t <replaceable class="parameter">table</replaceable> ] [ -f <replaceable class="parameter">outputfile</replaceable> ]
[ -a ] [ -c ] [ -d ] [ -D ] [ -n ] [ -N ]
[ -o ] [ -s ] [ -u ] [ -v ] [ -x ]
[ <replaceable class="parameter">dbname</replaceable> ]
</SYNOPSIS>
</synopsis>
<REFSECT2 ID="R2-APP-PG-DUMP-1">
<REFSECT2INFO>
<DATE>1998-11-05</DATE>
</REFSECT2INFO>
<TITLE>
Inputs
</TITLE>
<PARA>
<application>pg_dump</application> accepts the following command line arguments:
<variablelist>
<varlistentry>
<term>
<replaceable class="parameter">dbname</replaceable>
</term>
<listitem>
<para>
Specifies the name of the database to be extracted.
<replaceable class="parameter">dbname</replaceable>
defaults to the value of the
<envar>USER</envar>
environment variable.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
-a
</term>
<listitem>
<para>
Dump out only the data, no schema (definitions).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
-c
</term>
<listitem>
<para>
Clean(drop) schema prior to create.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
-d
</term>
<listitem>
<para>
Dump data as proper insert strings.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
-D
</term>
<listitem>
<para>
Dump data as inserts with attribute names
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
-f <replaceable class="parameter">filename</replaceable>
</term>
<listitem>
<para>
Specifies the output file. Defaults to <filename>stdout</filename>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
-n
</term>
<listitem>
<para>
Suppress double quotes around identifiers unless absolutely necessary.
This may cause trouble loading this dumped data if there are reserved words
used for identifiers.
This was the default behavior in pre-v6.4 <application>pg_dump</application>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
-N
</term>
<listitem>
<para>
Include double quotes around identifiers.
This is the default.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
-o
</term>
<listitem>
<para>
Dump object identifiers (<acronym>OID</acronym>s) for every table.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
-s
</term>
<listitem>
<para>
Dump out only the schema (definitions), no data.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
-t <replaceable class="parameter">table</replaceable>
</term>
<listitem>
<para>
Dump data for <replaceable class="parameter">table</replaceable> only.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
-u
</term>
<listitem>
<para>
Use password authentication. Prompts for username and password.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
-v
</term>
<listitem>
<para>
Specifies verbose mode
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
-x
</term>
<listitem>
<para>
Prevent dumping of ACLs (grant/revoke commands) and table ownership information.
</para>
</listitem>
</varlistentry>
<refsect2 id="R2-APP-PG-DUMP-1">
<refsect2info>
<date>1998-11-05</date>
</refsect2info>
<title>
Inputs
</title>
<para>
<application>pg_dump</application> accepts the following command
line arguments:
</variablelist>
</para>
<para>
<application>pg_dump</application> also accepts
the following command line arguments for connection parameters:
<variablelist>
<varlistentry>
<term>
-h <replaceable class="parameter">host</replaceable>
</term>
<listitem>
<para>
Specifies the hostname of the machine on which the
<application>postmaster</application>
is running. Defaults to using a local Unix domain socket
rather than an IP connection..
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
-p <replaceable class="parameter">port</replaceable>
</term>
<listitem>
<para>
Specifies the Internet TCP/IP port or local Unix domain socket file
extension on which the <application>postmaster</application>
is listening for connections. The port number defaults to 5432,
or the value of the <envar>PGPORT</envar>
environment variable (if set).
</para>
</listitem>
</varlistentry>
<variablelist>
<varlistentry>
<term><replaceable class="parameter">dbname</replaceable></term>
<listitem>
<para>
Specifies the name of the database to be extracted.
<replaceable class="parameter">dbname</replaceable>
defaults to the value of the
<envar>USER</envar>
environment variable.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
-u
</term>
<listitem>
<para>
Use password authentication.
Prompts for
<replaceable class="parameter">username</replaceable>
and <replaceable class="parameter">password</replaceable>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-a</term>
<listitem>
<para>
Dump out only the data, no schema (definitions).
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
<varlistentry>
<term>-c</term>
<listitem>
<para>
Clean(drop) schema prior to create.
</para>
</listitem>
</varlistentry>
<REFSECT2 ID="R2-APP-PG-DUMP-2">
<REFSECT2INFO>
<DATE>1998-11-05</DATE>
</REFSECT2INFO>
<TITLE>
Outputs
</TITLE>
<PARA>
<application>pg_dump</application> will create a file or
write to <filename>stdout</filename>.
<varlistentry>
<term>-d</term>
<listitem>
<para>
Dump data as proper insert strings.
</para>
</listitem>
</varlistentry>
<variablelist>
<varlistentry>
<term>
Connection to database 'template1' failed.
connectDB() failed: Is the postmaster running and accepting connections
at 'UNIX Socket' on port '<replaceable class="parameter">port</replaceable>'?
</term>
<listitem>
<para>
<application>pg_dump</application> could not attach to the
<application>postmaster</application>
process on the specified host and port. If you see this message,
ensure that the <application>postmaster</application>
is running on the proper host and that you have specified the proper
port. If your site uses an authentication system, ensure that you
have obtained the required authentication credentials.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
Connection to database '<replaceable class="parameter">dbname</replaceable>' failed.
FATAL 1: SetUserId: user '<replaceable class="parameter">username</replaceable>' is not in 'pg_shadow'
</term>
<listitem>
<para>
You do not have a valid entry in the relation <literal>pg_shadow</literal>
and and will not be allowed to access <productname>Postgres</productname>.
Contact your <productname>Postgres</productname> administrator.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
dumpSequence(<replaceable class="parameter">table</replaceable>): SELECT failed
</term>
<listitem>
<para>
You do not have permission to read the database.
Contact your <productname>Postgres</productname> site administrator.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
<note>
<para>
<application>pg_dump</application> internally executes
<command>SELECT</command> statements. If you have problems running
<application>pg_dump</application>,
make sure you are able to select information from the database using, for
example, <application>psql</application>.
</para>
</note>
</refsect2>
</refsynopsisdiv>
<REFSECT1 ID="R1-APP-PG-DUMP-1">
<REFSECT1INFO>
<DATE>1998-11-05</DATE>
</REFSECT1INFO>
<TITLE>
Description
</TITLE>
<PARA>
<application>pg_dump</application> is a utility for dumping out a
<productname>Postgres</productname> database into a script file
containing query commands. The script
files are in text format and can be used to reconstruct the database,
even on other machines and other architectures.
<application>pg_dump</application>
will produce the queries necessary to re-generate all
user-defined types, functions, tables, indices, aggregates, and
operators. In addition, all the data is copied out in text format so
that it can be readily copied in again, as well as imported into tools
for editing.
</para>
<varlistentry>
<term>-D</term>
<listitem>
<para>
Dump data as inserts with attribute names
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-f <replaceable class="parameter">filename</replaceable></term>
<listitem>
<para>
Specifies the output file. Defaults to <filename>stdout</filename>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-n</term>
<listitem>
<para>
Suppress double quotes around identifiers unless absolutely necessary.
This may cause trouble loading this dumped data if there are reserved words
used for identifiers.
This was the default behavior in pre-v6.4 <application>pg_dump</application>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-N</term>
<listitem>
<para>
Include double quotes around identifiers.
This is the default.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-o</term>
<listitem>
<para>
Dump object identifiers (<acronym>OID</acronym>s) for every table.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-s</term>
<listitem>
<para>
Dump out only the schema (definitions), no data.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-t <replaceable class="parameter">table</replaceable></term>
<listitem>
<para>
Dump data for <replaceable class="parameter">table</replaceable> only.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-u</term>
<listitem>
<para>
Use password authentication. Prompts for username and password.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-v</term>
<listitem>
<para>
Specifies verbose mode
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-x</term>
<listitem>
<para>
Prevent dumping of ACLs (grant/revoke commands) and table ownership information.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
<para>
<application>pg_dump</application> also accepts
the following command line arguments for connection parameters:
<variablelist>
<varlistentry>
<term>-h <replaceable class="parameter">host</replaceable></term>
<listitem>
<para>
Specifies the hostname of the machine on which the
<application>postmaster</application>
is running. Defaults to using a local Unix domain socket
rather than an IP connection..
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-p <replaceable class="parameter">port</replaceable></term>
<listitem>
<para>
Specifies the Internet TCP/IP port or local Unix domain socket file
extension on which the <application>postmaster</application>
is listening for connections. The port number defaults to 5432,
or the value of the <envar>PGPORT</envar>
environment variable (if set).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-u</term>
<listitem>
<para>
Use password authentication.
Prompts for
<replaceable class="parameter">username</replaceable>
and <replaceable class="parameter">password</replaceable>.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
<refsect2 id="R2-APP-PG-DUMP-2">
<refsect2info>
<date>1998-11-05</date>
</refsect2info>
<title>
Outputs
</title>
<para>
<application>pg_dump</application> will create a file or
write to <filename>stdout</filename>.
<variablelist>
<varlistentry>
<term><computeroutput>
Connection to database 'template1' failed.
connectDB() failed: Is the postmaster running and accepting connections
at 'UNIX Socket' on port '<replaceable class="parameter">port</replaceable>'?
</computeroutput></term>
<listitem>
<para>
<application>pg_dump</application> could not attach to the
<application>postmaster</application>
process on the specified host and port. If you see this message,
ensure that the <application>postmaster</application>
is running on the proper host and that you have specified the proper
port. If your site uses an authentication system, ensure that you
have obtained the required authentication credentials.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><computeroutput>
Connection to database '<replaceable class="parameter">dbname</replaceable>' failed.
FATAL 1: SetUserId: user '<replaceable class="parameter">username</replaceable>' is not in 'pg_shadow'
</computeroutput></term>
<listitem>
<para>
You do not have a valid entry in the relation <literal>pg_shadow</literal>
and and will not be allowed to access <productname>Postgres</productname>.
Contact your <productname>Postgres</productname> administrator.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><computeroutput>
dumpSequence(<replaceable class="parameter">table</replaceable>): SELECT failed
</computeroutput></term>
<listitem>
<para>
You do not have permission to read the database.
Contact your <productname>Postgres</productname> site administrator.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
<note>
<para>
<application>pg_dump</application> internally executes
<command>SELECT</command> statements. If you have problems running
<application>pg_dump</application>,
make sure you are able to select information from the database using, for
example, <application>psql</application>.
</para>
</note>
</refsect2>
</refsynopsisdiv>
<refsect1 id="R1-APP-PG-DUMP-1">
<refsect1info>
<date>1998-11-05</date>
</refsect1info>
<title>
Description
</title>
<para>
<application>pg_dump</application> is a utility for dumping out a
<productname>Postgres</productname> database into a script file
containing query commands. The script
files are in text format and can be used to reconstruct the database,
even on other machines and other architectures.
<application>pg_dump</application>
will produce the queries necessary to re-generate all
user-defined types, functions, tables, indices, aggregates, and
operators. In addition, all the data is copied out in text format so
that it can be readily copied in again, as well as imported into tools
for editing.
</para>
<para>
<application>pg_dump</application>
is useful for dumping out the contents of a database to move from one
<productname>Postgres</productname> installation to another. After running
<application>pg_dump</application>,
one should examine the output script file for any warnings, especially
in light of the limitations listed below.
</para>
</refsect1>
<refsect1 id="R1-APP-PG-DUMP-2">
<refsect1info>
<date>1998-11-05</date>
</refsect1info>
<title>
Notes
</title>
<para>
<application>pg_dump</application> has a few limitations.
The limitations mostly stem from
difficulty in extracting certain meta-information from the system
catalogs.
<itemizedlist>
<listitem>
<para>
<application>pg_dump</application>
is useful for dumping out the contents of a database to move from one
<productname>Postgres</productname> installation to another. After running
<application>pg_dump</application>,
one should examine the output script file for any warnings, especially
in light of the limitations listed below.
</para>
</refsect1>
does not understand partial indices. The reason is
the same as above; partial index predicates are stored as plans.
</para>
</listitem>
<REFSECT1 ID="R1-APP-PG-DUMP-2">
<REFSECT1INFO>
<DATE>1998-11-05</DATE>
</REFSECT1INFO>
<TITLE>
Notes
</TITLE>
<PARA>
<application>pg_dump</application> has a few limitations.
The limitations mostly stem from
difficulty in extracting certain meta-information from the system
catalogs.
<listitem>
<para>
<application>pg_dump</application> does not handle large objects.
Large objects are ignored and must be dealt with manually.
</para>
</listitem>
</itemizedlist>
</para>
</refsect1>
<variablelist>
<varlistentry>
<term>
partial indices
</term>
<listitem>
<para>
<application>pg_dump</application>
does not understand partial indices. The reason is
the same as above; partial index predicates are stored as plans.
</para>
</listitem>
</varlistentry>
<refsect1 id="R1-APP-PG-DUMP-3">
<refsect1info>
<date>1998-11-05</date>
</refsect1info>
<title>
Usage
</title>
<para>
To dump a database of the same name as the user:
<varlistentry>
<term>
large objects
</term>
<listitem>
<para>
<application>pg_dump</application> does not handle large objects.
Large objects are ignored and must be dealt with manually.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<programlisting>
% pg_dump > db.out
</programlisting>
</para>
<REFSECT1 ID="R1-APP-PG-DUMP-3">
<REFSECT1INFO>
<DATE>1998-11-05</DATE>
</REFSECT1INFO>
<TITLE>
Usage
</TITLE>
<PARA>
To dump a database of the same name as the user:
<para>
To reload this database:
<programlisting>
% pg_dump > db.out
</programlisting>
</para>
<para>
To reload this database:
<programlisting>
psql -e database < db.out
</programlisting>
</para>
</refsect1>
</REFENTRY>
<programlisting>
% psql -e database < db.out
</programlisting>
</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,323 +1,316 @@
<REFENTRY ID="APP-PG-DUMPALL">
<REFMETA>
<REFENTRYTITLE>
<application>pg_dumpall</application>
</REFENTRYTITLE>
<REFMISCINFO>Application</REFMISCINFO>
</REFMETA>
<REFNAMEDIV>
<REFNAME>
<application>pg_dumpall</application>
</REFNAME>
<REFPURPOSE>
Extract all <productname>Postgres</productname> databases into a script file
</REFPURPOSE>
</refnamediv>
<REFSYNOPSISDIV>
<REFSYNOPSISDIVINFO>
<DATE>1998-10-04</DATE>
</REFSYNOPSISDIVINFO>
<SYNOPSIS>
<refentry id="APP-PG-DUMPALL">
<refmeta>
<refentrytitle>
<application>pg_dumpall</application>
</refentrytitle>
<refmiscinfo>Application</refmiscinfo>
</refmeta>
<refnamediv>
<refname>
<application>pg_dumpall</application>
</refname>
<refpurpose>
Extract all <productname>Postgres</productname> databases into a script file
</refpurpose>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
<date>1998-10-04</date>
</refsynopsisdivinfo>
<synopsis>
pg_dumpall
pg_dumpall [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replaceable class="parameter">port</replaceable> ]
[ -a ] [ -d ] [ -D ] [ -o ] [ -s ] [ -u ] [ -v ] [ -x ]
</SYNOPSIS>
pg_dumpall [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replaceable class="parameter">port</replaceable> ] [ -a ] [ -d ] [ -D ] [ -o ] [ -s ] [ -u ] [ -v ] [ -x ]
</synopsis>
<REFSECT2 ID="R2-APP-PG-DUMPALL-1">
<REFSECT2INFO>
<DATE>1998-10-04</DATE>
</REFSECT2INFO>
<TITLE>
Inputs
</TITLE>
<PARA>
<application>pg_dumpall</application> accepts the following command line arguments:
<variablelist>
<varlistentry>
<term>
-a
</term>
<listitem>
<para>
Dump out only the data, no schema (definitions).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
-d
</term>
<listitem>
<para>
Dump data as proper insert strings.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
-D
</term>
<listitem>
<para>
Dump data as inserts with attribute names
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
-n
</term>
<listitem>
<para>
Suppress double quotes around identifiers unless absolutely necessary.
This may cause trouble loading this dumped data if there are reserved words
used for identifiers.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
-o
</term>
<listitem>
<para>
Dump object identifiers (<acronym>OID</acronym>s) for every table.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
-s
</term>
<listitem>
<para>
Dump out only the schema (definitions), no data.
</para>
</listitem>
</varlistentry>
<refsect2 id="R2-APP-PG-DUMPALL-1">
<refsect2info>
<date>1998-10-04</date>
</refsect2info>
<title>
Inputs
</title>
<para>
<application>pg_dumpall</application> accepts the following command line arguments:
<varlistentry>
<term>
-u
</term>
<listitem>
<para>
Use password authentication. Prompts for username and password.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
-v
</term>
<listitem>
<para>
Specifies verbose mode
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
-x
</term>
<listitem>
<para>
Prevent dumping ACLs (grant/revoke commands) and table ownership information.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
<para>
<application>pg_dumpall</application> also accepts
the following command line arguments for connection parameters:
<variablelist>
<varlistentry>
<term>
-h <replaceable class="parameter">host</replaceable>
</term>
<listitem>
<para>
Specifies the hostname of the machine on which the
<application>postmaster</application>
is running. Defaults to using a local Unix domain socket
rather than an IP connection..
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
-p <replaceable class="parameter">port</replaceable>
</term>
<listitem>
<para>
Specifies the Internet TCP/IP port or local Unix domain socket file
extension on which the <application>postmaster</application>
is listening for connections. The port number defaults to 5432,
or the value of the <envar>PGPORT</envar>
environment variable (if set).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
-u
</term>
<listitem>
<para>
Use password authentication.
Prompts for
<replaceable class="parameter">username</replaceable>
and <replaceable class="parameter">password</replaceable>.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
<variablelist>
<varlistentry>
<term>-a</term>
<listitem>
<para>
Dump out only the data, no schema (definitions).
</para>
</listitem>
</varlistentry>
<REFSECT2 ID="R2-APP-PG-DUMPALL-2">
<REFSECT2INFO>
<DATE>1998-10-04</DATE>
</REFSECT2INFO>
<TITLE>
Outputs
</TITLE>
<PARA>
<application>pg_dumpall</application> will create a file or
write to <filename>stdout</filename>.
<variablelist>
<varlistentry>
<term>
Connection to database 'template1' failed.
connectDB() failed: Is the postmaster running and accepting connections
at 'UNIX Socket' on port '<replaceable class="parameter">port</replaceable>'?
</term>
<listitem>
<para>
<application>pg_dumpall</application> could not attach to the
<application>postmaster</application>
process on the specified host and port. If you see this message,
ensure that the <application>postmaster</application>
is running on the proper host and that you have specified the proper
port. If your site uses an authentication system, ensure that you
have obtained the required authentication credentials.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
Connection to database '<replaceable class="parameter">dbname</replaceable>' failed.
FATAL 1: SetUserId: user '<replaceable class="parameter">username</replaceable>' is not in 'pg_shadow'
</term>
<listitem>
<para>
You do not have a valid entry in the relation <literal>pg_shadow</literal>
and and will not be allowed to access <productname>Postgres</productname>.
Contact your <productname>Postgres</productname> administrator.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-d</term>
<listitem>
<para>
Dump data as proper insert strings.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
dumpSequence(<replaceable class="parameter">table</replaceable>): SELECT failed
</term>
<listitem>
<para>
You do not have permission to read the database.
Contact your <productname>Postgres</productname> site administrator.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
<varlistentry>
<term>-D</term>
<listitem>
<para>
Dump data as inserts with attribute names
</para>
</listitem>
</varlistentry>
<note>
<para>
<application>pg_dumpall</application> internally executes
<command>SELECT</command> statements. If you have problems running
<application>pg_dumpall</application>,
make sure you are able to select information from the database using, for
example, <application>psql</application>.
</para>
</note>
</refsect2>
</refsynopsisdiv>
<REFSECT1 ID="R1-APP-PG-DUMPALL-1">
<REFSECT1INFO>
<DATE>1998-10-04</DATE>
</REFSECT1INFO>
<TITLE>
Description
</TITLE>
<PARA>
<application>pg_dumpall</application>
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.
<application>pg_dumpall</application> includes in this file the proper commands
to automatically create each dumped database before loading.
</para>
<varlistentry>
<term>-n</term>
<listitem>
<para>
Suppress double quotes around identifiers unless absolutely necessary.
This may cause trouble loading this dumped data if there are reserved words
used for identifiers.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-o</term>
<listitem>
<para>
Dump object identifiers (<acronym>OID</acronym>s) for every table.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-s</term>
<listitem>
<para>
Dump out only the schema (definitions), no data.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-u</term>
<listitem>
<para>
Use password authentication. Prompts for username and password.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-v</term>
<listitem>
<para>
Specifies verbose mode
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-x</term>
<listitem>
<para>
Prevent dumping ACLs (grant/revoke commands) and table ownership information.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
<para>
<application>pg_dumpall</application> also accepts
the following command line arguments for connection parameters:
<variablelist>
<varlistentry>
<term>-h <replaceable class="parameter">host</replaceable></term>
<listitem>
<para>
Specifies the hostname of the machine on which the
<application>postmaster</application>
is running. Defaults to using a local Unix domain socket
rather than an IP connection..
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-p <replaceable class="parameter">port</replaceable></term>
<listitem>
<para>
Specifies the Internet TCP/IP port or local Unix domain socket file
extension on which the <application>postmaster</application>
is listening for connections. The port number defaults to 5432,
or the value of the <envar>PGPORT</envar>
environment variable (if set).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-u</term>
<listitem>
<para>
Use password authentication.
Prompts for
<replaceable class="parameter">username</replaceable>
and <replaceable class="parameter">password</replaceable>.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
<refsect2 id="R2-APP-PG-DUMPALL-2">
<refsect2info>
<date>1998-10-04</date>
</refsect2info>
<title>
Outputs
</title>
<para>
<application>pg_dumpall</application> will create a file or
write to <filename>stdout</filename>.
<variablelist>
<varlistentry>
<term><computeroutput>
Connection to database 'template1' failed.
connectDB() failed: Is the postmaster running and accepting connections at 'UNIX Socket' on port '<replaceable class="parameter">port</replaceable>'?
</computeroutput></term>
<listitem>
<para>
<application>pg_dumpall</application> could not attach to the
<application>postmaster</application>
process on the specified host and port. If you see this message,
ensure that the <application>postmaster</application>
is running on the proper host and that you have specified the proper
port. If your site uses an authentication system, ensure that you
have obtained the required authentication credentials.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><computeroutput>
Connection to database '<replaceable class="parameter">dbname</replaceable>' failed.
FATAL 1: SetUserId: user '<replaceable class="parameter">username</replaceable>' is not in 'pg_shadow'
</computeroutput></term>
<listitem>
<para>
You do not have a valid entry in the relation <literal>pg_shadow</literal>
and and will not be allowed to access <productname>Postgres</productname>.
Contact your <productname>Postgres</productname> administrator.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><computeroutput>
dumpSequence(<replaceable class="parameter">table</replaceable>): SELECT failed
</computeroutput></term>
<listitem>
<para>
You do not have permission to read the database.
Contact your <productname>Postgres</productname> site administrator.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
<note>
<para>
<application>pg_dumpall</application> takes all <application>pg_dump</application>
options, but <option>-f</option>, <option>-t</option> and
<replaceable class="parameter">dbname</replaceable>
should be omitted.
<application>pg_dumpall</application> internally executes
<command>SELECT</command> statements. If you have problems running
<application>pg_dumpall</application>,
make sure you are able to select information from the database using, for
example, <application>psql</application>.
</para>
</note>
</refsect2>
</refsynopsisdiv>
<refsect1 id="R1-APP-PG-DUMPALL-1">
<refsect1info>
<date>1998-10-04</date>
</refsect1info>
<title>
Description
</title>
<para>
<application>pg_dumpall</application>
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.
<application>pg_dumpall</application> includes in this file the proper commands
to automatically create each dumped database before loading.
</para>
<para>
<application>pg_dumpall</application> takes all <application>pg_dump</application>
options, but <option>-f</option>, <option>-t</option> and
<replaceable class="parameter">dbname</replaceable>
should be omitted.
</para>
<para>
Refer to
<xref endterm="pg-dump" linkend="app-pg-dump">
for more information on this capability.
</para>
</refsect1>
<refsect1 id="R1-APP-PG-DUMPALL-2">
<refsect1info>
<date>1998-10-04</date>
</refsect1info>
<title>
Usage
</title>
<para>
To dump all databases:
<programlisting>
% pg_dumpall -o > db.out
</programlisting>
<tip>
<para>
Refer to
<xref linkend="app-pg-dump" endterm="pg-dump">
for more information on this capability.
</para
</refsect1>
<REFSECT1 ID="R1-APP-PG-DUMPALL-2">
<REFSECT1INFO>
<DATE>1998-10-04</DATE>
</REFSECT1INFO>
<TITLE>
Usage
</TITLE>
<PARA>
To dump all databases:
<programlisting>
% pg_dumpall -o > db.out
</programlisting>
<tip>
<para>
You can use most <application>pg_dump</application> options
for <application>pg_dumpall</application>.
</para>
</tip>
You can use most <application>pg_dump</application> options
for <application>pg_dumpall</application>.
</para>
<para>
To reload this database:
<programlisting>
psql -e template1 < db.out
</programlisting>
</para>
<tip>
<para>
You can use most <application>psql</application> options
when reloading.
</para>
</tip>
</refsect1>
</REFENTRY>
</tip>
</para>
<para>
To reload this database:
<programlisting>
% psql -e template1 < db.out
</programlisting>
</para>
<tip>
<para>
You can use most <application>psql</application> options
when reloading.
</para>
</tip>
</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,59 +1,128 @@
<REFENTRY ID="APP-PG-UPGRADE">
<REFMETA>
<REFENTRYTITLE>
<application>pg_upgrade</application>
</REFENTRYTITLE>
<REFMISCINFO>Application</REFMISCINFO>
</REFMETA>
<REFNAMEDIV>
<REFNAME>
<application>pg_upgrade</application>
</REFNAME>
<REFPURPOSE>
Allows upgrade from a previous release without reloading data
</REFPURPOSE>
<REFSYNOPSISDIV>
<REFSYNOPSISDIVINFO>
<DATE>1998-10-04</DATE>
</REFSYNOPSISDIVINFO>
<SYNOPSIS>
<refentry id="APP-PG-UPGRADE">
<refmeta>
<refentrytitle>
<application>pg_upgrade</application>
</refentrytitle>
<refmiscinfo>Application</refmiscinfo>
</refmeta>
<refnamediv>
<refname>
<application>pg_upgrade</application>
</refname>
<refpurpose>
Allows upgrade from a previous release without reloading data
</refpurpose>
<refsynopsisdiv>
<refsynopsisdivinfo>
<date>1998-10-04</date>
</refsynopsisdivinfo>
<synopsis>
pg_upgrade
pg_upgrade [-f <replaceable class="parameter">input_file</replaceable>] <replaceable class="parameter">old_data_dir</replaceable>
</SYNOPSIS>
pg_upgrade [ -f <replaceable class="parameter">filename</replaceable> ] <replaceable class="parameter">old_data_dir</replaceable>
</synopsis>
</refsynopsisdiv>
<REFSECT1 ID="R1-APP-PG-UPGRADE-1">
<REFSECT1INFO>
<DATE>1998-10-04</DATE>
</REFSECT1INFO>
<TITLE>
Description
</TITLE>
<PARA>
<application>pg_upgrade</application>
is a utility for upgrading from a previous
PostgreSQL release without reloading all the data. First,
to be safe, back up your data directory. Then, use:
<programlisting>
<refsect1 id="R1-APP-PG-UPGRADE-1">
<refsect1info>
<date>1998-10-04</date>
</refsect1info>
<title>
Description
</title>
<para>
<application>pg_upgrade</application>
is a utility for upgrading from a previous
PostgreSQL release without reloading all the data.
<procedure>
<title>Upgrading <productname>Postgres</productname></title>
<step performance="required">
<para>
Back up your data directory.
</para>
</step>
<step performance="required">
<para>
Use:
<programlisting>
% pg_dumpall -s >db.out
</programlisting>
to dump out your old database definitions without any
data. Stop the postmaster and all backends.
</para>
</programlisting>
to dump out your old database definitions without any
data. Stop the postmaster and all backends.
</para>
</step>
<para>
Then rename (using mv) your old pgsql /data directory to
/data.old and do a make install to install the new binaries.
Run initdb to create a new template1 database containing the system
tables for the new release. Start the new postmaster, cd to the
pgsql main directory, and type:
<programlisting>
<step performance="required">
<para>
Rename (using mv) your old pgsql <filename>data/</filename> directory to
<filename>data.old/</filename>.
</para>
</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:
<programlisting>
% pg_upgrade -f db.out data.old
</programlisting>
The system will do some checking to make sure everything
is properly configured, and run your db.out script to create
all the databases and tables you had, but with no
data. It will then move the data files from /data.old
into the proper /data directory. You can then check out
the data. You can delete the /data.old directory when you
are finished.
</REFENTRY>
</programlisting>
The system will do some checking to make sure everything
is properly configured, and will run your db.out script to create
all the databases and tables you had, but with no
data. It will then move the data files from <filename>data.old/</filename>
into the proper <filename>data/</filename> directory.
</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.
</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">
<REFMETA>
<REFENTRYTITLE id="pgaccess-ref">
<refentry id="APP-PGACCESS">
<refmeta>
<refentrytitle id="pgaccess-ref">
<application>pgaccess</application>
</REFENTRYTITLE>
<REFMISCINFO>Application</REFMISCINFO>
</REFMETA>
<REFNAMEDIV>
<REFNAME>
</refentrytitle>
<refmiscinfo>Application</refmiscinfo>
</refmeta>
<refnamediv>
<refname>
<application>pgaccess</application>
</REFNAME>
<REFPURPOSE>
</refname>
<refpurpose>
<productname>Postgres</productname> graphical interactive client
</REFPURPOSE>
</refpurpose>
</refnamediv>
<REFSYNOPSISDIV>
<REFSYNOPSISDIVINFO>
<DATE>1999-05-19</DATE>
</REFSYNOPSISDIVINFO>
<SYNOPSIS>
<refsynopsisdiv>
<refsynopsisdivinfo>
<date>1999-05-19</date>
</refsynopsisdivinfo>
<synopsis>
pgaccess [ <replaceable class="parameter">dbname</replaceable> ]
</SYNOPSIS>
</synopsis>
<REFSECT2 ID="R2-APP-PGACCESS-1">
<REFSECT2INFO>
<DATE>1999-05-19</DATE>
</REFSECT2INFO>
<TITLE>
<refsect2 id="R2-APP-PGACCESS-1">
<refsect2info>
<date>1999-05-19</date>
</refsect2info>
<title>
Inputs
</TITLE>
<PARA>
</title>
<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>
</refsect2>
<REFSECT2 ID="R2-APP-PGACCESS-2">
<REFSECT2INFO>
<DATE>1999-05-19</DATE>
</REFSECT2INFO>
<TITLE>
<refsect2 id="R2-APP-PGACCESS-2">
<refsect2info>
<date>1999-05-19</date>
</refsect2info>
<title>
Outputs
</TITLE>
<PARA>
</title>
<para>
</para>
</refsect2>
</refsynopsisdiv>
<REFSECT1 ID="R1-APP-PGACCESS-1">
<REFSECT1INFO>
<DATE>1999-05-19</DATE>
</REFSECT1INFO>
<TITLE>
<refsect1 id="R1-APP-PGACCESS-1">
<refsect1info>
<date>1999-05-19</date>
</refsect1info>
<title>
Description
</TITLE>
<PARA>
</title>
<para>
<note>
<title>Editor's Note</title>
<para>
This should be transcribed from other pgaccess info. Volunteers?
</para>
</note>
</para>
</refsect1>
</refentry>
@ -68,7 +85,7 @@ 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-catalogs:"/usr/lib/sgml/catalog"
sgml-local-ecat-files:nil
End:
-->

View File

@ -1,57 +1,74 @@
<REFENTRY ID="APP-PGADMIN">
<REFMETA>
<REFENTRYTITLE id="pgadmin-ref">
<refentry id="APP-PGADMIN">
<refmeta>
<refentrytitle id="pgadmin-ref">
<application>pgadmin</application>
</REFENTRYTITLE>
<REFMISCINFO>Application</REFMISCINFO>
</REFMETA>
<REFNAMEDIV>
<REFNAME>
</refentrytitle>
<refmiscinfo>Application</refmiscinfo>
</refmeta>
<refnamediv>
<refname>
<application>pgadmin</application>
</REFNAME>
<REFPURPOSE>
</refname>
<refpurpose>
<productname>Postgres</productname> graphical interactive client
</REFPURPOSE>
</refpurpose>
</refnamediv>
<REFSYNOPSISDIV>
<REFSYNOPSISDIVINFO>
<DATE>1999-05-19</DATE>
</REFSYNOPSISDIVINFO>
<SYNOPSIS>
<refsynopsisdiv>
<refsynopsisdivinfo>
<date>1999-05-19</date>
</refsynopsisdivinfo>
<synopsis>
pgadmin [ <replaceable class="parameter">dbname</replaceable> ]
</SYNOPSIS>
</synopsis>
<REFSECT2 ID="R2-APP-PGADMIN-1">
<REFSECT2INFO>
<DATE>1999-05-19</DATE>
</REFSECT2INFO>
<TITLE>
<refsect2 id="R2-APP-PGADMIN-1">
<refsect2info>
<date>1999-05-19</date>
</refsect2info>
<title>
Inputs
</TITLE>
<PARA>
</title>
<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>
</refsect2>
<REFSECT2 ID="R2-APP-PGADMIN-2">
<REFSECT2INFO>
<DATE>1999-05-19</DATE>
</REFSECT2INFO>
<TITLE>
<refsect2 id="R2-APP-PGADMIN-2">
<refsect2info>
<date>1999-05-19</date>
</refsect2info>
<title>
Outputs
</TITLE>
<PARA>
</title>
<para>
</para>
</refsect2>
</refsynopsisdiv>
<REFSECT1 ID="R1-APP-PGADMIN-1">
<REFSECT1INFO>
<DATE>1999-05-19</DATE>
</REFSECT1INFO>
<TITLE>
<refsect1 id="R1-APP-PGADMIN-1">
<refsect1info>
<date>1999-05-19</date>
</refsect1info>
<title>
Description
</TITLE>
<PARA>
</title>
<para>
<note>
<title>Editor's Note</title>
<para>
This should be transcribed from other pgadmin info. Volunteers?
</para>
</note>
</para>
</refsect1>
</refentry>
@ -68,7 +85,7 @@ 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-catalogs:"/usr/lib/sgml/catalog"
sgml-local-ecat-files:nil
End:
-->

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,13 +1,13 @@
<refentry id="SQL-ROLLBACK">
<refmeta>
<refentrytitle id="SQL-ROLLBACK-TITLE">
ROLLBACK
ROLLBACK
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta>
<refnamediv>
<refname>
ROLLBACK
ROLLBACK
</refname>
<refpurpose>
Aborts the current transaction
@ -44,9 +44,9 @@ ROLLBACK [ WORK | TRANSACTION ]
<variablelist>
<varlistentry>
<term>
ABORT
</term>
<term><computeroutput>
ABORT
</computeroutput></term>
<listitem>
<para>
Message returned if successful.
@ -55,10 +55,10 @@ ROLLBACK [ WORK | TRANSACTION ]
</varlistentry>
<varlistentry>
<term>
NOTICE: UserAbortTransactionBlock and not in in-progress state
ABORT
</term>
<term><computeroutput>
NOTICE: UserAbortTransactionBlock and not in in-progress state
ABORT
</computeroutput></term>
<listitem>
<para>
If there is not any transaction currently in progress.
@ -106,10 +106,10 @@ ROLLBACK [ WORK | TRANSACTION ]
Usage
</title>
<para>
To abort all changes:
<programlisting>
--To abort all changes:
--
ROLLBACK WORK;
ROLLBACK WORK;
</programlisting>
</para>
</refsect1>
@ -129,7 +129,7 @@ ROLLBACK [ WORK | TRANSACTION ]
SQL92
</title>
<para>
Full compatibility. TRANSACTION is a
Full compatibility. The TRANSACTION keyword is a
<productname>Postgres</productname> extension.
</para>
</refsect2>