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

Complete merge of all old man page information.

ecpg reference page still needs formatting.
parent 2aa64f79
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/abort.sgml,v 1.4 1999/07/22 15:09:05 thomas Exp $
Postgres documentation
-->
<refentry id="SQL-ABORT"> <refentry id="SQL-ABORT">
<refmeta> <refmeta>
<refentrytitle> <refentrytitle id="sql-abort-title">
ABORT ABORT
</refentrytitle> </refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo> <refmiscinfo>SQL - Language Statements</refmiscinfo>
...@@ -15,10 +20,10 @@ ...@@ -15,10 +20,10 @@
</refnamediv> </refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
<refsynopsisdivinfo> <refsynopsisdivinfo>
<date>1998-09-27</date> <date>1999-07-20</date>
</refsynopsisdivinfo> </refsynopsisdivinfo>
<synopsis> <synopsis>
ABORT [ TRANSACTION | WORK ] ABORT [ WORK | TRANSACTION ]
</synopsis> </synopsis>
<refsect2 id="R2-SQL-ABORT-1"> <refsect2 id="R2-SQL-ABORT-1">
......
<!-- allfiles.sgml <!--
- $Header: /cvsroot/pgsql/doc/src/sgml/ref/allfiles.sgml,v 1.10 1999/07/22 15:09:06 thomas Exp $
- Complete list of usable sgml source files in this directory. Postgres documentation
- Complete list of usable sgml source files in this directory.
- --> -->
<!entity intro-ref system "intro-ref.sgml"> <!entity intro-ref system "intro-ref.sgml">
<!entity commands system "commands.sgml"> <!entity commands system "commands.sgml">
...@@ -38,22 +38,6 @@ ...@@ -38,22 +38,6 @@
<!entity trim system "trim.sgml"> <!entity trim system "trim.sgml">
<!entity upper system "upper.sgml"> <!entity upper system "upper.sgml">
<!-- these are folded into create_table.sgml
<!entity check system "check.sgml">
<!entity constraints system "constraint.sgml">
<!entity default system "default.sgml">
<!entity notNull system "not_null.sgml">
<!entity primaryKey system "primary_key.sgml">
<!entity unique system "unique.sgml">
-->
<!-- these are folded into select.sgml
<!entity groupBy system "group_by.sgml">
<!entity having system "having.sgml">
<!entity orderBy system "order_by.sgml">
<!entity union system "union.sgml">
-->
<!-- these are in the "commands" reference chapter --> <!-- these are in the "commands" reference chapter -->
<!entity abort system "abort.sgml"> <!entity abort system "abort.sgml">
<!entity alterTable system "alter_table.sgml"> <!entity alterTable system "alter_table.sgml">
...@@ -92,6 +76,7 @@ ...@@ -92,6 +76,7 @@
<!entity dropType system "drop_type.sgml"> <!entity dropType system "drop_type.sgml">
<!entity dropUser system "drop_user.sgml"> <!entity dropUser system "drop_user.sgml">
<!entity dropView system "drop_view.sgml"> <!entity dropView system "drop_view.sgml">
<!entity end system "end.sgml">
<!entity explain system "explain.sgml"> <!entity explain system "explain.sgml">
<!entity fetch system "fetch.sgml"> <!entity fetch system "fetch.sgml">
<!entity grant system "grant.sgml"> <!entity grant system "grant.sgml">
...@@ -117,12 +102,15 @@ ...@@ -117,12 +102,15 @@
<!entity createuser system "createuser.sgml"> <!entity createuser system "createuser.sgml">
<!entity destroydb system "destroydb.sgml"> <!entity destroydb system "destroydb.sgml">
<!entity destroyuser system "destroyuser.sgml"> <!entity destroyuser system "destroyuser.sgml">
<!entity ecpgRef system "ecpg-ref.sgml">
<!entity initdb system "initdb.sgml"> <!entity initdb system "initdb.sgml">
<!entity initlocation system "initlocation.sgml"> <!entity initlocation system "initlocation.sgml">
<!entity ipcclean system "ipcclean.sgml">
<!entity pgAccess system "pgaccess-ref.sgml"> <!entity pgAccess system "pgaccess-ref.sgml">
<!entity pgAdmin system "pgadmin-ref.sgml"> <!entity pgAdmin system "pgadmin-ref.sgml">
<!entity pgDump system "pg_dump.sgml"> <!entity pgDump system "pg_dump.sgml">
<!entity pgDumpall system "pg_dumpall.sgml"> <!entity pgDumpall system "pg_dumpall.sgml">
<!entity pgPasswd system "pg_passwd.sgml">
<!entity pgUpgrade system "pg_upgrade.sgml"> <!entity pgUpgrade system "pg_upgrade.sgml">
<!entity postgres system "postgres-ref.sgml"> <!entity postgres system "postgres-ref.sgml">
<!entity postmaster system "postmaster.sgml"> <!entity postmaster system "postmaster.sgml">
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/alter_table.sgml,v 1.8 1999/07/22 15:09:06 thomas Exp $
Postgres documentation
-->
<refentry id="SQL-ALTERTABLE"> <refentry id="SQL-ALTERTABLE">
<refmeta> <refmeta>
<refentrytitle> <refentrytitle id="sql-altertable-title">
ALTER TABLE ALTER TABLE
</refentrytitle> </refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo> <refmiscinfo>SQL - Language Statements</refmiscinfo>
...@@ -15,7 +20,7 @@ ...@@ -15,7 +20,7 @@
</refnamediv> </refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
<refsynopsisdivinfo> <refsynopsisdivinfo>
<date>1998-04-15</date> <date>1999-07-20</date>
</refsynopsisdivinfo> </refsynopsisdivinfo>
<synopsis> <synopsis>
ALTER TABLE <replaceable class="PARAMETER">table</replaceable> ALTER TABLE <replaceable class="PARAMETER">table</replaceable>
...@@ -166,9 +171,37 @@ ERROR ...@@ -166,9 +171,37 @@ ERROR
</para> </para>
<para> <para>
<quote>[*]</quote> following a name of a table indicates that statement <quote>*</quote> following a name of a table indicates that the statement
should be run over that table and all tables below it in the should be run over that table and all tables below it in the
inheritance hierarchy. inheritance hierarchy;
by default, the attribute will not be added to or renamed in any of the subclasses.
This should always be done when adding or modifying an attribute in a
superclass. If it is not, queries on the inheritance hierarchy
such as
<programlisting>
SELECT <replaceable>NewColumn</replaceable> FROM <replaceable>SuperClass</replaceable>*
</programlisting>
will not work because the subclasses will be missing an attribute
found in the superclass.
</para>
<para>
For efficiency reasons, default values for added attributes are
not placed in existing instances of a class.
That is, existing instances will have NULL values in the new
attributes. If non-NULL values are desired, a subsequent
<command>UPDATE</command> query
(<xref linkend="sql-update-title" endterm="sql-update-title">)
should be run.
</para>
<para>
You must own the class in order to change its schema.
Renaming any part of the schema of a system
catalog is not permitted.
The <citetitle>PostgreSQL User's Guide</citetitle> has further The <citetitle>PostgreSQL User's Guide</citetitle> has further
information on inheritance. information on inheritance.
</para> </para>
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/alter_user.sgml,v 1.8 1999/07/22 15:09:06 thomas Exp $
Postgres documentation
-->
<refentry id="SQL-ALTERUSER"> <refentry id="SQL-ALTERUSER">
<refmeta> <refmeta>
<refentrytitle> <refentrytitle id="sql-alteruser-title">
ALTER USER ALTER USER
</refentrytitle> </refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo> <refmiscinfo>SQL - Language Statements</refmiscinfo>
...@@ -15,7 +20,7 @@ ...@@ -15,7 +20,7 @@
</refnamediv> </refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
<refsynopsisdivinfo> <refsynopsisdivinfo>
<date>1998-09-08</date> <date>1999-07-20</date>
</refsynopsisdivinfo> </refsynopsisdivinfo>
<synopsis> <synopsis>
ALTER USER <replaceable class="PARAMETER">username</replaceable> [ WITH PASSWORD <replaceable class="PARAMETER">password</replaceable> ] ALTER USER <replaceable class="PARAMETER">username</replaceable> [ WITH PASSWORD <replaceable class="PARAMETER">password</replaceable> ]
...@@ -126,7 +131,7 @@ ERROR: alterUser: user "username" does not exist ...@@ -126,7 +131,7 @@ ERROR: alterUser: user "username" does not exist
<command>ALTER USER</command> is used to change the attributes of a user's <command>ALTER USER</command> is used to change the attributes of a user's
<productname>Postgres</productname> account. <productname>Postgres</productname> account.
Please note that it is not possible Please note that it is not possible
to alter a user's "usesysid" via the alter user to alter a user's "<literal>usesysid</literal>" via the alter user
statement. Also, it is only possible for the statement. Also, it is only possible for the
<productname>Postgres</productname> <productname>Postgres</productname>
user or any user with read and modify permissions on user or any user with read and modify permissions on
...@@ -135,7 +140,7 @@ ERROR: alterUser: user "username" does not exist ...@@ -135,7 +140,7 @@ ERROR: alterUser: user "username" does not exist
<para> <para>
If any of the clauses of the alter user statement are If any of the clauses of the alter user statement are
omitted, the corresponding value in the "pg_shadow" table omitted, the corresponding value in the <literal>pg_shadow</literal> table
is left unchanged. is left unchanged.
</para> </para>
...@@ -205,8 +210,6 @@ ALTER USER miriam IN GROUP sales, payroll; ...@@ -205,8 +210,6 @@ ALTER USER miriam IN GROUP sales, payroll;
<title> <title>
Compatibility Compatibility
</title> </title>
<para>
</para>
<refsect2 id="R2-SQL-ALTERUSER-4"> <refsect2 id="R2-SQL-ALTERUSER-4">
<refsect2info> <refsect2info>
......
<refentry id="SQL-BEGINWORK"> <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/begin.sgml,v 1.9 1999/07/22 15:09:06 thomas Exp $
Postgres documentation
-->
<refentry id="SQL-BEGIN">
<refmeta> <refmeta>
<refentrytitle id="SQL-BEGINWORK-TITLE"> <refentrytitle id="SQL-BEGIN-TITLE">
BEGIN BEGIN
</refentrytitle> </refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo> <refmiscinfo>SQL - Language Statements</refmiscinfo>
...@@ -16,13 +21,13 @@ ...@@ -16,13 +21,13 @@
</refnamediv> </refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
<refsynopsisdivinfo> <refsynopsisdivinfo>
<date>1999-06-11</date> <date>1999-07-20</date>
</refsynopsisdivinfo> </refsynopsisdivinfo>
<synopsis> <synopsis>
BEGIN [ WORK | TRANSACTION ] BEGIN [ WORK | TRANSACTION ]
</synopsis> </synopsis>
<refsect2 id="R2-SQL-BEGINWORK-1"> <refsect2 id="R2-SQL-BEGIN-1">
<refsect2info> <refsect2info>
<date>1999-06-11</date> <date>1999-06-11</date>
</refsect2info> </refsect2info>
...@@ -30,11 +35,22 @@ BEGIN [ WORK | TRANSACTION ] ...@@ -30,11 +35,22 @@ BEGIN [ WORK | TRANSACTION ]
Inputs Inputs
</title> </title>
<para> <para>
None.
<variablelist>
<varlistentry>
<term>WORK</term>
<term>TRANSACTION</term>
<listitem>
<para>
Optional keywords. They have no effect.
</para>
</listitem>
</varlistentry>
</variablelist>
</para> </para>
</refsect2> </refsect2>
<refsect2 id="R2-SQL-BEGINWORK-2"> <refsect2 id="R2-SQL-BEGIN-2">
<refsect2info> <refsect2info>
<date>1999-06-11</date> <date>1999-06-11</date>
</refsect2info> </refsect2info>
...@@ -70,7 +86,7 @@ NOTICE: BeginTransactionBlock and not in default state ...@@ -70,7 +86,7 @@ NOTICE: BeginTransactionBlock and not in default state
</refsect2> </refsect2>
</refsynopsisdiv> </refsynopsisdiv>
<refsect1 id="R1-SQL-BEGINWORK-1"> <refsect1 id="R1-SQL-BEGIN-1">
<refsect1info> <refsect1info>
<date>1999-06-11</date> <date>1999-06-11</date>
</refsect1info> </refsect1info>
...@@ -88,7 +104,9 @@ NOTICE: BeginTransactionBlock and not in default state ...@@ -88,7 +104,9 @@ NOTICE: BeginTransactionBlock and not in default state
(if execution was successful, otherwise a rollback is done). (if execution was successful, otherwise a rollback is done).
<command>BEGIN</command> initiates a user transaction in chained mode, <command>BEGIN</command> initiates a user transaction in chained mode,
i.e. all user statements after <command>BEGIN</command> command will i.e. all user statements after <command>BEGIN</command> command will
be executed in a single transaction until an explicit COMMIT, ROLLBACK be executed in a single transaction until an explicit
<xref linkend="sql-commit-title" endterm="sql-commit-title">,
<xref linkend="sql-rollback-title" endterm="sql-rollback-title">,
or execution abort. Statements in chained mode are executed much faster, or execution abort. Statements in chained mode are executed much faster,
because transaction start/commit requires significant CPU and disk because transaction start/commit requires significant CPU and disk
activity. Execution of multiple statements inside a transaction activity. Execution of multiple statements inside a transaction
...@@ -102,7 +120,7 @@ NOTICE: BeginTransactionBlock and not in default state ...@@ -102,7 +120,7 @@ NOTICE: BeginTransactionBlock and not in default state
is READ COMMITTED, where queries inside the transaction see only changes is READ COMMITTED, where queries inside the transaction see only changes
committed before query execution. So, you have to use committed before query execution. So, you have to use
<command>SET TRANSACTION ISOLATION LEVEL SERIALIZABLE</command> <command>SET TRANSACTION ISOLATION LEVEL SERIALIZABLE</command>
just after BEGIN if you need more rigorous transaction isolation. just after <command>BEGIN</command> if you need more rigorous transaction isolation.
In SERIALIZABLE mode queries will see only changes committed before In SERIALIZABLE mode queries will see only changes committed before
the entire the entire
transaction began (actually, before execution of the first DML statement transaction began (actually, before execution of the first DML statement
...@@ -116,7 +134,7 @@ NOTICE: BeginTransactionBlock and not in default state ...@@ -116,7 +134,7 @@ NOTICE: BeginTransactionBlock and not in default state
(atomic, consistent, isolatable, and durable) property. (atomic, consistent, isolatable, and durable) property.
</para> </para>
<refsect2 id="R2-SQL-BEGINWORK-3"> <refsect2 id="R2-SQL-BEGIN-3">
<refsect2info> <refsect2info>
<date>1999-06-11</date> <date>1999-06-11</date>
</refsect2info> </refsect2info>
...@@ -129,7 +147,8 @@ NOTICE: BeginTransactionBlock and not in default state ...@@ -129,7 +147,8 @@ NOTICE: BeginTransactionBlock and not in default state
</para> </para>
<para> <para>
Refer to the <command>LOCK</command> statement for further information Refer to <xref linkend="sql-lock-title" endterm="sql-lock-title">
for further information
about locking tables inside a transaction. about locking tables inside a transaction.
</para> </para>
...@@ -142,7 +161,7 @@ NOTICE: BeginTransactionBlock and not in default state ...@@ -142,7 +161,7 @@ NOTICE: BeginTransactionBlock and not in default state
</refsect2> </refsect2>
</refsect1> </refsect1>
<refsect1 id="R1-SQL-BEGINWORK-2"> <refsect1 id="R1-SQL-BEGIN-2">
<title> <title>
Usage Usage
</title> </title>
...@@ -156,25 +175,26 @@ BEGIN WORK; ...@@ -156,25 +175,26 @@ BEGIN WORK;
</para> </para>
</refsect1> </refsect1>
<refsect1 id="R1-SQL-BEGINWORK-3"> <refsect1 id="R1-SQL-BEGIN-3">
<title> <title>
Compatibility Compatibility
</title> </title>
<para>
<command>BEGIN</command> <refsect2 id="R2-SQL-BEGIN-4">
is a <productname>Postgres</productname> language extension.
</para>
<refsect2 id="R2-SQL-BEGINWORK-4">
<refsect2info> <refsect2info>
<date>1999-06-11</date> <date>1999-06-11</date>
</refsect2info> </refsect2info>
<title> <title>
SQL92 SQL92
</title> </title>
<para>
There is no explicit BEGIN WORK command in <acronym>SQL92</acronym>; <para>
<command>BEGIN</command>
is a <productname>Postgres</productname> language extension.
There is no explicit <command>BEGIN</command>
command in <acronym>SQL92</acronym>;
transaction initiation is always implicit and it terminates either transaction initiation is always implicit and it terminates either
with a COMMIT or with a ROLLBACK statement. with a <command>COMMIT</command> or <command>ROLLBACK</command> statement.
<note> <note>
<para> <para>
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/close.sgml,v 1.7 1999/07/22 15:09:06 thomas Exp $
Postgres documentation
-->
<refentry id="SQL-CLOSE"> <refentry id="SQL-CLOSE">
<refmeta> <refmeta>
<refentrytitle> <refentrytitle id="SQL-CLOSE-TITLE">
CLOSE CLOSE
</refentrytitle> </refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo> <refmiscinfo>SQL - Language Statements</refmiscinfo>
...@@ -15,7 +20,7 @@ ...@@ -15,7 +20,7 @@
</refnamediv> </refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
<refsynopsisdivinfo> <refsynopsisdivinfo>
<date>1998-09-08</date> <date>1999-07-20</date>
</refsynopsisdivinfo> </refsynopsisdivinfo>
<synopsis> <synopsis>
CLOSE <replaceable class="PARAMETER">cursor</replaceable> CLOSE <replaceable class="PARAMETER">cursor</replaceable>
...@@ -131,8 +136,6 @@ CLOSE liahona; ...@@ -131,8 +136,6 @@ CLOSE liahona;
<title> <title>
Compatibility Compatibility
</title> </title>
<para>
</para>
<refsect2 id="R2-SQL-CLOSE-4"> <refsect2 id="R2-SQL-CLOSE-4">
<refsect2info> <refsect2info>
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/cluster.sgml,v 1.7 1999/07/22 15:09:06 thomas Exp $
Postgres documentation
-->
<refentry id="SQL-CLUSTER"> <refentry id="SQL-CLUSTER">
<refmeta> <refmeta>
<refentrytitle> <refentrytitle id="sql-cluster-title">
CLUSTER CLUSTER
</refentrytitle> </refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo> <refmiscinfo>SQL - Language Statements</refmiscinfo>
...@@ -10,12 +15,12 @@ ...@@ -10,12 +15,12 @@
CLUSTER CLUSTER
</refname> </refname>
<refpurpose> <refpurpose>
Gives storage clustering advice to the backend Gives storage clustering advice to the server
</refpurpose> </refpurpose>
</refnamediv> </refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
<refsynopsisdivinfo> <refsynopsisdivinfo>
<date>1998-09-08</date> <date>1999-07-20</date>
</refsynopsisdivinfo> </refsynopsisdivinfo>
<synopsis> <synopsis>
CLUSTER <replaceable class="PARAMETER">indexname</replaceable> ON <replaceable class="PARAMETER">table</replaceable> CLUSTER <replaceable class="PARAMETER">indexname</replaceable> ON <replaceable class="PARAMETER">table</replaceable>
...@@ -72,7 +77,7 @@ CLUSTER ...@@ -72,7 +77,7 @@ CLUSTER
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><computeroutput> <term><computeroutput>
ERROR: relation &lt;<replaceable class="PARAMETER">tablerelation_number</replaceable>&gt; inherits "invoice" ERROR: relation &lt;<replaceable class="PARAMETER">tablerelation_number</replaceable>&gt; inherits "<replaceable class="PARAMETER">table</replaceable>"
</computeroutput></term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
...@@ -85,12 +90,12 @@ ERROR: relation &lt;<replaceable class="PARAMETER">tablerelation_number</replace ...@@ -85,12 +90,12 @@ ERROR: relation &lt;<replaceable class="PARAMETER">tablerelation_number</replace
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><computeroutput> <term><computeroutput>
ERROR: Relation x does not exist! ERROR: Relation <replaceable class="PARAMETER">table</replaceable> does not exist!
</computeroutput></term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
<comment> <comment>
The relation complained of was not shown in the error message, The specified relation was not shown in the error message,
which contained a random string instead of the relation name. which contained a random string instead of the relation name.
</comment> </comment>
</para> </para>
...@@ -111,12 +116,13 @@ ERROR: Relation x does not exist! ...@@ -111,12 +116,13 @@ ERROR: Relation x does not exist!
<para> <para>
<command>CLUSTER</command> instructs <productname>Postgres</productname> <command>CLUSTER</command> instructs <productname>Postgres</productname>
to cluster the class specified to cluster the class specified
by <replaceable class="parameter">classname</replaceable> approximately by <replaceable class="parameter">table</replaceable> approximately
based on the index specified by based on the index specified by
<replaceable class="parameter">indexname</replaceable>. The index must <replaceable class="parameter">indexname</replaceable>. The index must
already have been defined on already have been defined on
<replaceable class="parameter">classname</replaceable>. <replaceable class="parameter">classname</replaceable>.
</para> </para>
<para> <para>
When a class is clustered, it is physically reordered When a class is clustered, it is physically reordered
based on the index information. The clustering is static. based on the index information. The clustering is static.
...@@ -150,7 +156,8 @@ ERROR: Relation x does not exist! ...@@ -150,7 +156,8 @@ ERROR: Relation x does not exist!
</para> </para>
<para> <para>
Another place <command>CLUSTER</command> is helpful is in cases where you use an Another place where <command>CLUSTER</command> is helpful is in
cases where you use an
index to pull out several rows from a table. If you are index to pull out several rows from a table. If you are
requesting a range of indexed values from a table, or a requesting a range of indexed values from a table, or a
single indexed value that has multiple rows that match, single indexed value that has multiple rows that match,
...@@ -173,11 +180,14 @@ ERROR: Relation x does not exist! ...@@ -173,11 +180,14 @@ ERROR: Relation x does not exist!
<para> <para>
Another way to cluster data is to use Another way to cluster data is to use
<programlisting> <programlisting>
SELECT ... INTO TABLE <replaceable class="parameter">temp</replaceable> FROM ... ORDER BY ... SELECT <replaceable class="parameter">columnlist</replaceable> INTO TABLE <replaceable class="parameter">newtable</replaceable>
FROM <replaceable class="parameter">table</replaceable> ORDER BY <replaceable class="parameter">columnlist</replaceable>
</programlisting> </programlisting>
This uses the <productname>Postgres</productname> sorting code in
ORDER BY to match the index, and is much faster for which uses the <productname>Postgres</productname> sorting code in
the ORDER BY clause to match the index, and which is much faster for
unordered data. You then drop the old table, use unordered data. You then drop the old table, use
<command>ALTER TABLE/RENAME</command> <command>ALTER TABLE/RENAME</command>
to rename <replaceable class="parameter">temp</replaceable> to the old name, and to rename <replaceable class="parameter">temp</replaceable> to the old name, and
...@@ -205,8 +215,6 @@ CLUSTER emp_ind ON emp; ...@@ -205,8 +215,6 @@ CLUSTER emp_ind ON emp;
<title> <title>
Compatibility Compatibility
</title> </title>
<para>
</para>
<refsect2 id="R2-SQL-CLUSTER-4"> <refsect2 id="R2-SQL-CLUSTER-4">
<refsect2info> <refsect2info>
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/Attic/commands.sgml,v 1.17 1999/07/22 15:09:06 thomas Exp $
Postgres documentation
-->
<chapter id="sql-commands"> <chapter id="sql-commands">
<Title>SQL Commands</Title> <Title>SQL Commands</Title>
...@@ -45,6 +50,7 @@ ...@@ -45,6 +50,7 @@
&dropType &dropType
&dropUser; &dropUser;
&dropView; &dropView;
&end;
&explain; &explain;
&fetch; &fetch;
&grant; &grant;
...@@ -88,7 +94,7 @@ functions supported by <productname>Postgres</productname>. ...@@ -88,7 +94,7 @@ functions supported by <productname>Postgres</productname>.
--> -->
<chapter Id="utilities"> <chapter Id="applications">
<title>Applications</title> <title>Applications</title>
<abstract> <abstract>
...@@ -103,19 +109,37 @@ functions supported by <productname>Postgres</productname>. ...@@ -103,19 +109,37 @@ functions supported by <productname>Postgres</productname>.
&createuser; &createuser;
&destroydb; &destroydb;
&destroyuser; &destroyuser;
&initdb; &ecpgRef;
&initlocation;
&pgAccess; &pgAccess;
&pgAdmin; &pgAdmin;
&pgDump; &pgDump;
&pgDumpall; &pgDumpall;
&postgres;
&postmaster;
&psqlRef; &psqlRef;
&vacuumdb; &vacuumdb;
</chapter> </chapter>
<chapter Id="utilities">
<title>System Applications</title>
<abstract>
<para>
This is reference information for
<productname>Postgres</productname>
servers and support utilities.
</para>
</abstract>
&initdb;
&initlocation;
&ipcclean;
&pgPasswd;
&pgUpgrade;
&postgres;
&postmaster;
</chapter>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file
Local variables: Local variables:
mode: sgml mode: sgml
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/commit.sgml,v 1.8 1999/07/22 15:09:06 thomas Exp $
Postgres documentation
-->
<refentry id="SQL-COMMIT"> <refentry id="SQL-COMMIT">
<refmeta> <refmeta>
<refentrytitle id="SQL-COMMIT-TITLE"> <refentrytitle id="SQL-COMMIT-TITLE">
...@@ -16,7 +21,7 @@ ...@@ -16,7 +21,7 @@
<refsynopsisdiv> <refsynopsisdiv>
<refsynopsisdivinfo> <refsynopsisdivinfo>
<date>1998-09-08</date> <date>1999-07-20</date>
</refsynopsisdivinfo> </refsynopsisdivinfo>
<synopsis> <synopsis>
COMMIT [ WORK | TRANSACTION ] COMMIT [ WORK | TRANSACTION ]
...@@ -30,7 +35,18 @@ COMMIT [ WORK | TRANSACTION ] ...@@ -30,7 +35,18 @@ COMMIT [ WORK | TRANSACTION ]
Inputs Inputs
</title> </title>
<para> <para>
None.
<variablelist>
<varlistentry>
<term>WORK</term>
<term>TRANSACTION</term>
<listitem>
<para>
Optional keywords. They have no effect.
</para>
</listitem>
</varlistentry>
</variablelist>
</para> </para>
</refsect2> </refsect2>
...@@ -116,8 +132,6 @@ COMMIT WORK; ...@@ -116,8 +132,6 @@ COMMIT WORK;
<title> <title>
Compatibility Compatibility
</title> </title>
<para>
</para>
<refsect2 id="R2-SQL-COMMIT-4"> <refsect2 id="R2-SQL-COMMIT-4">
<refsect2info> <refsect2info>
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/copy.sgml,v 1.9 1999/07/22 15:09:07 thomas Exp $
Postgres documentation
-->
<refentry id="SQL-COPY"> <refentry id="SQL-COPY">
<refmeta> <refmeta>
<refentrytitle> <refentrytitle id="sql-copy-title">
COPY COPY
</refentrytitle> </refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo> <refmiscinfo>SQL - Language Statements</refmiscinfo>
...@@ -15,16 +20,14 @@ ...@@ -15,16 +20,14 @@
</refnamediv> </refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
<refsynopsisdivinfo> <refsynopsisdivinfo>
<date>1998-09-08</date> <date>1999-07-20</date>
</refsynopsisdivinfo> </refsynopsisdivinfo>
<synopsis> <synopsis>
COPY [ BINARY ] <replaceable class="parameter">table</replaceable> [ WITH OIDS ] COPY [ BINARY ] <replaceable class="parameter">table</replaceable> [ WITH OIDS ]
FROM { '<replaceable class="parameter">filename</replaceable>' | FROM { '<replaceable class="parameter">filename</replaceable>' | <filename>stdin</filename> }
<filename>stdin</filename> }
[ USING DELIMITERS '<replaceable class="parameter">delimiter</replaceable>' ] [ USING DELIMITERS '<replaceable class="parameter">delimiter</replaceable>' ]
COPY [ BINARY ] <replaceable class="parameter">table</replaceable> [ WITH OIDS ] COPY [ BINARY ] <replaceable class="parameter">table</replaceable> [ WITH OIDS ]
TO { '<replaceable class="parameter">filename</replaceable>' | TO { '<replaceable class="parameter">filename</replaceable>' | <filename>stdout</filename> }
<filename>stdout</filename> }
[ USING DELIMITERS '<replaceable class="parameter">delimiter</replaceable>' ] [ USING DELIMITERS '<replaceable class="parameter">delimiter</replaceable>' ]
</synopsis> </synopsis>
...@@ -47,6 +50,7 @@ COPY [ BINARY ] <replaceable class="parameter">table</replaceable> [ WITH OIDS ] ...@@ -47,6 +50,7 @@ COPY [ BINARY ] <replaceable class="parameter">table</replaceable> [ WITH OIDS ]
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><replaceable class="parameter">table</replaceable></term> <term><replaceable class="parameter">table</replaceable></term>
<listitem> <listitem>
...@@ -55,6 +59,7 @@ COPY [ BINARY ] <replaceable class="parameter">table</replaceable> [ WITH OIDS ] ...@@ -55,6 +59,7 @@ COPY [ BINARY ] <replaceable class="parameter">table</replaceable> [ WITH OIDS ]
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>WITH OIDS</term> <term>WITH OIDS</term>
<listitem> <listitem>
...@@ -63,6 +68,7 @@ COPY [ BINARY ] <replaceable class="parameter">table</replaceable> [ WITH OIDS ] ...@@ -63,6 +68,7 @@ COPY [ BINARY ] <replaceable class="parameter">table</replaceable> [ WITH OIDS ]
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><replaceable class="parameter">filename</replaceable></term> <term><replaceable class="parameter">filename</replaceable></term>
<listitem> <listitem>
...@@ -71,6 +77,7 @@ COPY [ BINARY ] <replaceable class="parameter">table</replaceable> [ WITH OIDS ] ...@@ -71,6 +77,7 @@ COPY [ BINARY ] <replaceable class="parameter">table</replaceable> [ WITH OIDS ]
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><filename>stdin</filename></term> <term><filename>stdin</filename></term>
<listitem> <listitem>
...@@ -79,6 +86,7 @@ COPY [ BINARY ] <replaceable class="parameter">table</replaceable> [ WITH OIDS ] ...@@ -79,6 +86,7 @@ COPY [ BINARY ] <replaceable class="parameter">table</replaceable> [ WITH OIDS ]
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><filename>stdout</filename></term> <term><filename>stdout</filename></term>
<listitem> <listitem>
...@@ -87,6 +95,7 @@ COPY [ BINARY ] <replaceable class="parameter">table</replaceable> [ WITH OIDS ] ...@@ -87,6 +95,7 @@ COPY [ BINARY ] <replaceable class="parameter">table</replaceable> [ WITH OIDS ]
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><replaceable class="parameter">delimiter</replaceable></term> <term><replaceable class="parameter">delimiter</replaceable></term>
<listitem> <listitem>
...@@ -121,7 +130,7 @@ COPY ...@@ -121,7 +130,7 @@ COPY
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><computeroutput> <term><computeroutput>
ERROR: <replaceable>error message</replaceable> ERROR: <replaceable>reason</replaceable>
</computeroutput></term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
...@@ -144,7 +153,7 @@ ERROR: <replaceable>error message</replaceable> ...@@ -144,7 +153,7 @@ ERROR: <replaceable>error message</replaceable>
<para> <para>
<command>COPY</command> moves data between <command>COPY</command> moves data between
<productname>Postgres</productname> tables and <productname>Postgres</productname> tables and
standard Unix files. standard file-system files.
<command>COPY</command> instructs <command>COPY</command> instructs
the <productname>Postgres</productname> backend the <productname>Postgres</productname> backend
...@@ -175,8 +184,10 @@ ERROR: <replaceable>error message</replaceable> ...@@ -175,8 +184,10 @@ ERROR: <replaceable>error message</replaceable>
</para> </para>
<para> <para>
You must have select access on any table whose values are read by You must have <firstterm>select access</firstterm> on any table
<command>COPY</command>, and either insert or update access to a whose values are read by
<command>COPY</command>, and either
<firstterm>insert or update access</firstterm> to a
table into which values are being inserted by <command>COPY</command>. table into which values are being inserted by <command>COPY</command>.
The backend also needs appropriate Unix permissions for any file read The backend also needs appropriate Unix permissions for any file read
or written by <command>COPY</command>. or written by <command>COPY</command>.
...@@ -195,6 +206,44 @@ ERROR: <replaceable>error message</replaceable> ...@@ -195,6 +206,44 @@ ERROR: <replaceable>error message</replaceable>
</para> </para>
</tip> </tip>
</para> </para>
<para>
<command>COPY</command> neither invokes rules nor acts on column defaults.
It does invoke triggers, however.
</para>
<para>
<command>COPY</command> stops operation at the first error. This
should not lead to problems in the event of
a <command>COPY FROM</command>, but the
target relation will, of course, be partially modified in a
<command>COPY TO</command>.
<command>VACUUM</command> should be used to clean up
after a failed copy.
</para>
<para>
Because the Postgres backend's current working directory
is not usually the same as the user's
working directory, the result of copying to a file
"<filename>foo</filename>" (without
additional path information) may yield unexpected results for the
naive user. In this case, <filename>foo</filename>
will wind up in <filename>$PGDATA/foo</filename>. In
general, the full pathname as it would appear to the backend server machine
should be used when specifying files to
be copied.
</para>
<para>
Files used as arguments to <command>COPY</command>
must reside on or be
accessible to the database server machine by being either on
local disks or on a networked file system.
</para>
<para>
When a TCP/IP connection from one machine to another is used, and a
target file is specified, the target file will be written on the
machine where the backend is running rather than the user's
machine.
</para>
</refsect2> </refsect2>
</refsect1> </refsect1>
...@@ -249,6 +298,7 @@ ERROR: <replaceable>error message</replaceable> ...@@ -249,6 +298,7 @@ ERROR: <replaceable>error message</replaceable>
properly. properly.
</para> </para>
</refsect2> </refsect2>
<refsect2> <refsect2>
<refsect2info> <refsect2info>
<date>1998-05-04</date> <date>1998-05-04</date>
...@@ -385,53 +435,10 @@ has the termination sequence on the last line): ...@@ -385,53 +435,10 @@ has the termination sequence on the last line):
</programlisting> </programlisting>
</refsect1> </refsect1>
<refsect1 id="R1-SQL-COPY-5">
<title>Bugs and features</title>
<para>
<command>COPY</command> neither invokes rules nor acts on column defaults.
It does invoke triggers, however.
</para>
<para>
<command>COPY</command> stops operation at the first error. This
should not lead to problems in the event of
a <command>COPY FROM</command>, but the
target relation will, of course, be partially modified in a
<command>COPY TO</command>.
The <command>VACUUM</command> query should be used to clean up
after a failed copy.
</para>
<para>
Because the Postgres backend's current working directory
is not usually the same as the user's
working directory, the result of copying to a file
"<filename>foo</filename>" (without
additional path information) may yield unexpected results for the
naive user. In this case, <filename>foo</filename>
will wind up in <filename>$PGDATA/foo</filename>. In
general, the full pathname as it would appear to the backend server machine
should be used when specifying files to
be copied.
</para>
<para>
Files used as arguments to <command>COPY</command>
must reside on or be
accessible to the database server machine by being either on
local disks or on a networked file system.
</para>
<para>
When a TCP/IP connection from one machine to another is used, and a
target file is specified, the target file will be written on the
machine where the backend is running rather than the user's
machine.
</para>
</refsect1>
<refsect1 id="R1-SQL-COPY-6"> <refsect1 id="R1-SQL-COPY-6">
<title> <title>
Compatibility Compatibility
</title> </title>
<para>
</para>
<refsect2 id="R2-SQL-COPY-4"> <refsect2 id="R2-SQL-COPY-4">
<refsect2info> <refsect2info>
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_aggregate.sgml,v 1.7 1999/07/22 15:09:07 thomas Exp $
Postgres documentation
-->
<refentry id="SQL-CREATEAGGREGATE"> <refentry id="SQL-CREATEAGGREGATE">
<refmeta> <refmeta>
<refentrytitle> <refentrytitle id="sql-createaggregate-title">
CREATE AGGREGATE CREATE AGGREGATE
</refentrytitle> </refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo> <refmiscinfo>SQL - Language Statements</refmiscinfo>
...@@ -16,19 +21,15 @@ ...@@ -16,19 +21,15 @@
</refnamediv> </refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
<refsynopsisdivinfo> <refsynopsisdivinfo>
<date>1998-09-09</date> <date>1999-07-20</date>
</refsynopsisdivinfo> </refsynopsisdivinfo>
<synopsis> <synopsis>
CREATE AGGREGATE <replaceable class="PARAMETER">name</replaceable> [ AS ] CREATE AGGREGATE <replaceable class="PARAMETER">name</replaceable> [ AS ] ( BASETYPE = <replaceable class="PARAMETER">data_type</replaceable>
( BASETYPE = <replaceable class="PARAMETER">data_type</replaceable> [ , SFUNC1 = <replaceable class="PARAMETER">sfunc1</replaceable>, STYPE1 = <replaceable class="PARAMETER">sfunc1_return_type</replaceable> ]
[ , SFUNC1 = <replaceable class="PARAMETER">sfunc1</replaceable> [ , SFUNC2 = <replaceable class="PARAMETER">sfunc2</replaceable>, STYPE2 = <replaceable class="PARAMETER">sfunc2_return_type</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> ] [ , FINALFUNC = <replaceable class="PARAMETER">ffunc</replaceable> ]
[ , INITCOND1 = <replaceable class="PARAMETER">initial_condition1</replaceable> ] [ , INITCOND1 = <replaceable class="PARAMETER">initial_condition1</replaceable> ]
[ , INITCOND2 = <replaceable class="PARAMETER">initial_condition2</replaceable> ] [ , INITCOND2 = <replaceable class="PARAMETER">initial_condition2</replaceable> ] )
)
</synopsis> </synopsis>
<refsect2 id="R2-SQL-CREATEAGGREGATE-1"> <refsect2 id="R2-SQL-CREATEAGGREGATE-1">
...@@ -296,10 +297,9 @@ CREATE ...@@ -296,10 +297,9 @@ CREATE
</title> </title>
<para> <para>
Refer to the chapter on aggregate functions Refer to the chapter on aggregate functions
in the <citetitle>PostgreSQL Programmer's Guide</citetitle> in the <citetitle>PostgreSQL Programmer's Guide</citetitle> for
on aggregate functions for
complete examples of usage. complete examples of usage.
</para> </para>
</refsect1> </refsect1>
<refsect1 id="R1-SQL-CREATEAGGREGATE-3"> <refsect1 id="R1-SQL-CREATEAGGREGATE-3">
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_database.sgml,v 1.9 1999/07/22 15:09:07 thomas Exp $
Postgres documentation
-->
<refentry id="SQL-CREATEDATABASE"> <refentry id="SQL-CREATEDATABASE">
<refmeta> <refmeta>
<refentrytitle> <refentrytitle id="sql-createdatabase-title">
CREATE DATABASE CREATE DATABASE
</refentrytitle> </refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo> <refmiscinfo>SQL - Language Statements</refmiscinfo>
...@@ -15,7 +20,7 @@ ...@@ -15,7 +20,7 @@
</refnamediv> </refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
<refsynopsisdivinfo> <refsynopsisdivinfo>
<date>1998-04-15</date> <date>1999-07-20</date>
</refsynopsisdivinfo> </refsynopsisdivinfo>
<synopsis> <synopsis>
CREATE DATABASE <replaceable class="PARAMETER">name</replaceable> [ WITH LOCATION = '<replaceable class="parameter">dbpath</replaceable>' ] CREATE DATABASE <replaceable class="PARAMETER">name</replaceable> [ WITH LOCATION = '<replaceable class="parameter">dbpath</replaceable>' ]
...@@ -43,12 +48,7 @@ CREATE DATABASE <replaceable class="PARAMETER">name</replaceable> [ WITH LOCATIO ...@@ -43,12 +48,7 @@ CREATE DATABASE <replaceable class="PARAMETER">name</replaceable> [ WITH LOCATIO
<term><replaceable class="parameter">dbpath</replaceable></term> <term><replaceable class="parameter">dbpath</replaceable></term>
<listitem> <listitem>
<para> <para>
An alternate location can be specified as either an An alternate location for the new database. See below for caveats.
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> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -114,6 +114,16 @@ ERROR: Unable to create database directory <replaceable class="parameter">direc ...@@ -114,6 +114,16 @@ ERROR: Unable to create database directory <replaceable class="parameter">direc
The creator becomes the administrator of the new database. The creator becomes the administrator of the new database.
</para> </para>
<para>
An alternate location can be specified as either an
environment variable known to the backend server
(e.g. '<envar>PGDATA2</envar>') or, if the server is built to
allow it, 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>
<refsect2 id="R2-SQL-CREATEDATABASE-3"> <refsect2 id="R2-SQL-CREATEDATABASE-3">
<refsect2info> <refsect2info>
<date>1998-04-15</date> <date>1998-04-15</date>
...@@ -128,6 +138,28 @@ ERROR: Unable to create database directory <replaceable class="parameter">direc ...@@ -128,6 +138,28 @@ ERROR: Unable to create database directory <replaceable class="parameter">direc
<para> <para>
Use <command>DROP DATABASE</command> to remove a database. Use <command>DROP DATABASE</command> to remove a database.
</para> </para>
<para>
There are security and data integrity issues
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>
<!--
comment from Olly; response from Thomas...
<comment>
initlocation does not create a PG_VERSION file in the specified location.
How will Postgres handle the situation if it is upgraded to an
incompatible database version?
</comment>
Hmm. This isn't an issue since the upgrade would do
a dump/reload from the main database area also.
Not sure if the dump/reload would guarantee that
the alternate data area gets refreshed though...
-->
</refsect2> </refsect2>
</refsect1> </refsect1>
...@@ -166,31 +198,6 @@ ERROR: Unable to create database directory <replaceable class="parameter">direc ...@@ -166,31 +198,6 @@ ERROR: Unable to create database directory <replaceable class="parameter">direc
</para> </para>
</refsect1> </refsect1>
<refsect1 id="R1-SQL-CREATEDATABASE-3">
<title>
Bugs
</title>
<para>
There are security and data integrity issues
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>
</refsect1>
<!--
comment from Olly; response from Thomas...
<comment>
initlocation does not create a PG_VERSION file in the specified location.
How will Postgres handle the situation if it is upgraded to an
incompatible database version?
</comment>
Hmm. This isn't an issue since the upgrade would do a dump/reload from the main database area also.
Not sure if the dump/reload would guarantee that the alternate data area gets refreshed though...
-->
<refsect1 id="R1-SQL-CREATEDATABASE-4"> <refsect1 id="R1-SQL-CREATEDATABASE-4">
<title> <title>
Compatibility Compatibility
...@@ -205,8 +212,6 @@ Not sure if the dump/reload would guarantee that the alternate data area gets re ...@@ -205,8 +212,6 @@ Not sure if the dump/reload would guarantee that the alternate data area gets re
</title> </title>
<para> <para>
There is no <command>CREATE DATABASE</command> statement in SQL92. There is no <command>CREATE DATABASE</command> statement in SQL92.
</para>
<para>
The equivalent command in standard SQL is <command>CREATE SCHEMA</command>. The equivalent command in standard SQL is <command>CREATE SCHEMA</command>.
</para> </para>
</refsect2> </refsect2>
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_function.sgml,v 1.9 1999/07/22 15:09:07 thomas Exp $
Postgres documentation
-->
<refentry id="SQL-CREATEFUNCTION"> <refentry id="SQL-CREATEFUNCTION">
<refmeta> <refmeta>
<refentrytitle> <refentrytitle id="sql-createfunction-title">
CREATE FUNCTION CREATE FUNCTION
</refentrytitle> </refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo> <refmiscinfo>SQL - Language Statements</refmiscinfo>
...@@ -15,7 +20,7 @@ ...@@ -15,7 +20,7 @@
</refnamediv> </refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
<refsynopsisdivinfo> <refsynopsisdivinfo>
<date>1998-09-09</date> <date>1999-07-20</date>
</refsynopsisdivinfo> </refsynopsisdivinfo>
<synopsis> <synopsis>
CREATE FUNCTION <replaceable class="parameter">name</replaceable> ( [ <replaceable class="parameter">ftype</replaceable> [, ...] ] ) CREATE FUNCTION <replaceable class="parameter">name</replaceable> ( [ <replaceable class="parameter">ftype</replaceable> [, ...] ] )
...@@ -47,6 +52,10 @@ CREATE FUNCTION <replaceable class="parameter">name</replaceable> ( [ <replaceab ...@@ -47,6 +52,10 @@ CREATE FUNCTION <replaceable class="parameter">name</replaceable> ( [ <replaceab
<listitem> <listitem>
<para> <para>
The data type of function arguments. The data type of function arguments.
The input types may be base or complex types, or
<firstterm>opaque</firstterm>.
<literal>opaque</literal> indicates that the function
accepts arguments of an invalid type such as <type>char *</type>.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -55,6 +64,12 @@ CREATE FUNCTION <replaceable class="parameter">name</replaceable> ( [ <replaceab ...@@ -55,6 +64,12 @@ CREATE FUNCTION <replaceable class="parameter">name</replaceable> ( [ <replaceab
<listitem> <listitem>
<para> <para>
The return data type. The return data type.
The output type may be specified as a base type, complex type,
<literal>setof <replaceable class="parameter">type</replaceable></literal>,
or <literal>opaque</literal>.
The <literal>setof</literal>
modifier indicates that the function will return a set of items,
rather than a single item.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -77,7 +92,9 @@ CREATE FUNCTION <replaceable class="parameter">name</replaceable> ( [ <replaceab ...@@ -77,7 +92,9 @@ CREATE FUNCTION <replaceable class="parameter">name</replaceable> ( [ <replaceab
or '<replaceable class="parameter">plname</replaceable>', or '<replaceable class="parameter">plname</replaceable>',
where '<replaceable class="parameter">plname</replaceable>' where '<replaceable class="parameter">plname</replaceable>'
is the name of a created procedural is the name of a created procedural
language. See <command>CREATE LANGUAGE</command> for details. language. See
<xref linkend="sql-createlanguage-title" endterm="sql-createlanguage-title">
for details.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -133,43 +150,52 @@ CREATE ...@@ -133,43 +150,52 @@ CREATE
Notes Notes
</title> </title>
<para> <para>
Refer to the chapter on functions Refer to the chapter in
in the <citetitle>PostgreSQL Programmer's Guide</citetitle> the <citetitle>PostgreSQL Programmer's Guide</citetitle>
for further information. on extending
<productname>Postgres</productname> via functions
for further information on writing external functions.
</para> </para>
<para> <para>
Use <command>DROP FUNCTION</command> Use <command>DROP FUNCTION</command>
to drop user-defined functions. to drop user-defined functions.
</para> </para>
<para> <para>
<productname>Postgres</productname> allows function "overloading"; <productname>Postgres</productname> allows function "overloading";
that is, the same name can be used for several different functions that is, the same name can be used for several different functions
so long as they have distinct argument types. This facility must be so long as they have distinct argument types. This facility must be
used with caution for INTERNAL and C-language functions, however. used with caution for <literal>internal</literal>
</para> and C-language functions, however.
</para>
<para> <para>
Two INTERNAL functions cannot have the same C name without causing Two <literal>internal</literal>
errors at link time. To get around that, give them different C names functions cannot have the same C name without causing
(for example, use the argument types as part of the C names), then errors at link time. To get around that, give them different C names
specify those names in the AS clause of <command>CREATE FUNCTION</command>. (for example, use the argument types as part of the C names), then
If the AS clause is left empty then <command>CREATE FUNCTION</command> specify those names in the AS clause of <command>CREATE FUNCTION</command>.
assumes the C name of the function is the same as the SQL name. If the AS clause is left empty then <command>CREATE FUNCTION</command>
</para> assumes the C name of the function is the same as the SQL name.
</para>
<para> <para>
For dynamically-loaded C functions, the SQL name of the function must For dynamically-loaded C functions, the SQL name of the function must
be the same as the C function name, because the AS clause is used to be the same as the C function name, because the AS clause is used to
give the path name of the object file containing the C code. In this give the path name of the object file containing the C code. In this
situation it is best not to try to overload SQL function names. It situation it is best not to try to overload SQL function names. It
might work to load a C function that has the same C name as an internal might work to load a C function that has the same C name as an internal
function or another dynamically-loaded function --- or it might not. function or another dynamically-loaded function --- or it might not.
On some platforms the dynamic loader may botch the load in interesting On some platforms the dynamic loader may botch the load in interesting
ways if there is a conflict of C function names. So, even if it works ways if there is a conflict of C function names. So, even if it works
for you today, you might regret overloading names later when you try for you today, you might regret overloading names later when you try
to run the code somewhere else. to run the code somewhere else.
</para> </para>
<para>
A C function cannot return a set of values.
</para>
</refsect2> </refsect2>
</refsect1> </refsect1>
...@@ -195,7 +221,7 @@ SELECT one() AS answer; ...@@ -195,7 +221,7 @@ SELECT one() AS answer;
</para> </para>
<para> <para>
To create a C function, calling a routine from a user-created This example creates a C function by calling a routine from a user-created
shared library. This particular routine calculates a check shared library. This particular routine calculates a check
digit and returns TRUE if the check digit in the function parameters digit and returns TRUE if the check digit in the function parameters
is correct. It is intended for use in a CHECK contraint. is correct. It is intended for use in a CHECK contraint.
...@@ -216,25 +242,26 @@ CREATE TABLE product ( ...@@ -216,25 +242,26 @@ CREATE TABLE product (
</programlisting> </programlisting>
</refsect1> </refsect1>
<refsect1 id="R1-SQL-CREATEFUNCTION-3">
<title>
Bugs
</title>
<para>
A C function cannot return a set of values.
</para>
</refsect1>
<refsect1 id="R1-SQL-CREATEFUNCTION-4"> <refsect1 id="R1-SQL-CREATEFUNCTION-4">
<title> <title>
Compatibility Compatibility
</title> </title>
<para>
<command>CREATE FUNCTION</command> is
a <productname>Postgres</productname> language extension.
</para>
<refsect2 id="R2-SQL-CREATEFUNCTION-4"> <refsect2 id="R2-SQL-CREATEFUNCTION-4">
<refsect2info>
<date>1998-04-15</date>
</refsect2info>
<title>
SQL92
</title>
<para>
<command>CREATE FUNCTION</command> is
a <productname>Postgres</productname> language extension.
</para>
</refsect2>
<refsect2 id="R2-SQL-CREATEFUNCTION-5">
<refsect2info> <refsect2info>
<date>1998-09-09</date> <date>1998-09-09</date>
</refsect2info> </refsect2info>
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_index.sgml,v 1.9 1999/07/22 15:09:07 thomas Exp $
Postgres documentation
-->
<refentry id="SQL-CREATEINDEX"> <refentry id="SQL-CREATEINDEX">
<refmeta> <refmeta>
<refentrytitle> <refentrytitle id="sql-createindex-title">
CREATE INDEX CREATE INDEX
</refentrytitle> </refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo> <refmiscinfo>SQL - Language Statements</refmiscinfo>
...@@ -15,15 +20,13 @@ ...@@ -15,15 +20,13 @@
</refnamediv> </refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
<refsynopsisdivinfo> <refsynopsisdivinfo>
<date>1998-09-09</date> <date>1999-07-20</date>
</refsynopsisdivinfo> </refsynopsisdivinfo>
<synopsis> <synopsis>
CREATE [ UNIQUE ] INDEX <replaceable class="parameter">index_name</replaceable> CREATE [ UNIQUE ] INDEX <replaceable class="parameter">index_name</replaceable> ON <replaceable class="parameter">table</replaceable>
ON <replaceable class="parameter">table</replaceable> [ USING <replaceable class="parameter">acc_name</replaceable> ] [ USING <replaceable class="parameter">acc_name</replaceable> ] ( <replaceable class="parameter">column</replaceable> [ <replaceable class="parameter">ops_name</replaceable>] [, ...] )
( <replaceable class="parameter">column</replaceable> [ <replaceable class="parameter">ops_name</replaceable>] [, ...] ) CREATE [ UNIQUE ] INDEX <replaceable class="parameter">index_name</replaceable> ON <replaceable class="parameter">table</replaceable>
CREATE [ UNIQUE ] INDEX <replaceable class="parameter">index_name</replaceable> [ USING <replaceable class="parameter">acc_name</replaceable> ] ( <replaceable class="parameter">func_name</replaceable>( <replaceable class="parameter">r">col</replaceable>le> [, ... ]) <replaceable class="parameter">ops_name</replaceable> )
ON <replaceable class="parameter">table</replaceable> [ USING <replaceable class="parameter">acc_name</replaceable> ]
( <replaceable class="parameter">func_name</replaceable>( <replaceable class="parameter">r">col</replaceable>le> [, ... ]) <replaceable class="parameter">ops_name</replaceable> )
</synopsis> </synopsis>
<refsect2 id="R2-SQL-CREATEINDEX-1"> <refsect2 id="R2-SQL-CREATEINDEX-1">
...@@ -48,6 +51,7 @@ CREATE [ UNIQUE ] INDEX <replaceable class="parameter">index_name</replaceable> ...@@ -48,6 +51,7 @@ CREATE [ UNIQUE ] INDEX <replaceable class="parameter">index_name</replaceable>
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><replaceable class="parameter">index_name</replaceable></term> <term><replaceable class="parameter">index_name</replaceable></term>
<listitem> <listitem>
...@@ -56,6 +60,7 @@ CREATE [ UNIQUE ] INDEX <replaceable class="parameter">index_name</replaceable> ...@@ -56,6 +60,7 @@ CREATE [ UNIQUE ] INDEX <replaceable class="parameter">index_name</replaceable>
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><replaceable class="parameter">table</replaceable></term> <term><replaceable class="parameter">table</replaceable></term>
<listitem> <listitem>
...@@ -64,6 +69,7 @@ CREATE [ UNIQUE ] INDEX <replaceable class="parameter">index_name</replaceable> ...@@ -64,6 +69,7 @@ CREATE [ UNIQUE ] INDEX <replaceable class="parameter">index_name</replaceable>
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><replaceable class="parameter">acc_name</replaceable></term> <term><replaceable class="parameter">acc_name</replaceable></term>
<listitem> <listitem>
...@@ -71,6 +77,7 @@ CREATE [ UNIQUE ] INDEX <replaceable class="parameter">index_name</replaceable> ...@@ -71,6 +77,7 @@ CREATE [ UNIQUE ] INDEX <replaceable class="parameter">index_name</replaceable>
the name of the access method which is to be used for the name of the access method which is to be used for
the index. The default access method is BTREE. the index. The default access method is BTREE.
Postgres provides three access methods for secondary indexes: Postgres provides three access methods for secondary indexes:
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term>BTREE</term> <term>BTREE</term>
...@@ -81,6 +88,7 @@ CREATE [ UNIQUE ] INDEX <replaceable class="parameter">index_name</replaceable> ...@@ -81,6 +88,7 @@ CREATE [ UNIQUE ] INDEX <replaceable class="parameter">index_name</replaceable>
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>RTREE</term> <term>RTREE</term>
<listitem> <listitem>
...@@ -89,6 +97,7 @@ CREATE [ UNIQUE ] INDEX <replaceable class="parameter">index_name</replaceable> ...@@ -89,6 +97,7 @@ CREATE [ UNIQUE ] INDEX <replaceable class="parameter">index_name</replaceable>
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>HASH</term> <term>HASH</term>
<listitem> <listitem>
...@@ -98,7 +107,6 @@ CREATE [ UNIQUE ] INDEX <replaceable class="parameter">index_name</replaceable> ...@@ -98,7 +107,6 @@ CREATE [ UNIQUE ] INDEX <replaceable class="parameter">index_name</replaceable>
</listitem> </listitem>
</varlistentry> </varlistentry>
</variablelist> </variablelist>
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -111,27 +119,16 @@ CREATE [ UNIQUE ] INDEX <replaceable class="parameter">index_name</replaceable> ...@@ -111,27 +119,16 @@ CREATE [ UNIQUE ] INDEX <replaceable class="parameter">index_name</replaceable>
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><replaceable class="parameter">ops_name</replaceable></term> <term><replaceable class="parameter">ops_name</replaceable></term>
<listitem> <listitem>
<para> <para>
An associated operator class. An associated operator class. See below for details.
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
FROM pg_am am, pg_amop amop,
pg_opclass opc, pg_operator opr
WHERE amop.amopid = am.oid AND
amop.amopclaid = opc.oid AND
amop.amopopr = opr.oid
ORDER BY acc_name, ops_name, ops_comp
</programlisting>
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><replaceable class="parameter">func_name</replaceable></term> <term><replaceable class="parameter">func_name</replaceable></term>
<listitem> <listitem>
...@@ -190,9 +187,8 @@ ERROR: Cannot create index: 'index_name' already exists. ...@@ -190,9 +187,8 @@ ERROR: Cannot create index: 'index_name' already exists.
</title> </title>
<para> <para>
<command>CREATE INDEX</command> constructs an index <command>CREATE INDEX</command> constructs an index
<replaceable class="parameter">index_name</replaceable>. <replaceable class="parameter">index_name</replaceable>
on the specified on the specified <replaceable class="parameter">table</replaceable>.
<replaceable class="parameter">table</replaceable>.
<tip> <tip>
<para> <para>
...@@ -201,6 +197,7 @@ ERROR: Cannot create index: 'index_name' already exists. ...@@ -201,6 +197,7 @@ ERROR: Cannot create index: 'index_name' already exists.
</para> </para>
</tip> </tip>
</para> </para>
<para> <para>
In the first syntax shown above, the key fields for the In the first syntax shown above, the key fields for the
index are specified as column names; a column may also have index are specified as column names; a column may also have
...@@ -213,16 +210,30 @@ ERROR: Cannot create index: 'index_name' already exists. ...@@ -213,16 +210,30 @@ ERROR: Cannot create index: 'index_name' already exists.
operator class is the appropriate operator class for that operator class is the appropriate operator class for that
field type. field type.
</para> </para>
<para> <para>
In the second syntax, an index is defined In the second syntax shown above, an index is defined
on the result of a user-defined function on the result of a user-defined function
<replaceable class="parameter">func_name</replaceable> applied <replaceable class="parameter">func_name</replaceable> applied
to one or more attributes of a single class. These functional to one or more attributes of a single class.
indexes can be used to obtain fast access to data These <firstterm>functional indices</firstterm>
can be used to obtain fast access to data
based on operators that would normally require some based on operators that would normally require some
transformation to apply them to the base data. transformation to apply them to the base data.
</para> </para>
<para>
Postgres provides btree, rtree and hash access methods for
secondary indices. The btree access method is an implementation of
the Lehman-Yao high-concurrency btrees. The rtree access method
implements standard rtrees using Guttman's quadratic split algorithm.
The hash access method is an implementation of Litwin's linear
hashing. We mention the algorithms used solely to indicate that all
of these access methods are fully dynamic and do not have to be
optimized periodically (as is the case with, for example, static hash
access methods).
</para>
<refsect2 id="R2-SQL-CREATEINDEX-3"> <refsect2 id="R2-SQL-CREATEINDEX-3">
<refsect2info> <refsect2info>
<date>1998-09-09</date> <date>1998-09-09</date>
...@@ -230,14 +241,90 @@ ERROR: Cannot create index: 'index_name' already exists. ...@@ -230,14 +241,90 @@ ERROR: Cannot create index: 'index_name' already exists.
<title> <title>
Notes Notes
</title> </title>
<para>
The Postgres query optimizer will consider using btree indices in a scan
whenever an indexed attribute is involved in a comparison using one of:
<simplelist type="inline">
<member>&lt;</member>
<member>&lt;=</member>
<member>=</member>
<member>&gt;=</member>
<member>&gt;</member>
</simplelist>
</para>
<para>
Both box classes support indices on the <literal>box</literal> data
type in <productname>Postgres</productname>.
The difference between them is that <literal>bigbox_ops</literal>
scales box coordinates down, to avoid floating point exceptions from
doing multiplication, addition, and subtraction on very large
floating-point coordinates. If the field on which your rectangles lie
is about 20,000 units square or larger, you should use
<literal>bigbox_ops</literal>.
The <literal>poly_ops</literal> operator class supports rtree
indices on <literal>polygon</literal> data.
</para>
<para>
The <productname>Postgres</productname>
query optimizer will consider using an rtree index whenever
an indexed attribute is involved in a comparison using one of:
<simplelist type="inline">
<member>&lt;&lt;</member>
<member>&amp;&lt;</member>
<member>&amp;&gt;</member>
<member>&gt;&gt;</member>
<member>@</member>
<member>~=</member>
<member>&amp;&amp;</member>
</simplelist>
</para>
<para>
The <productname>Postgres</productname>
query optimizer will consider using a hash index whenever
an indexed attribute is involved in a comparison using
the <literal>=</literal> operator.
</para>
<para> <para>
Currently, only the BTREE access method supports multi-column Currently, only the BTREE access method supports multi-column
indexes. Up to 7 keys may be specified. indexes. Up to 7 keys may be specified.
</para> </para>
<para> <para>
Use <command>DROP INDEX</command> Use <xref linkend="sql-dropindex-title" endterm="sql-dropindex-title">
to remove an index. to remove an index.
</para> </para>
<para>
The <literal>int24_ops</literal>
operator class is useful for constructing indices on int2 data, and
doing comparisons against int4 data in query qualifications.
Similarly, <literal>int42_ops</literal>
support indices on int4 data that is to be compared against int2 data
in queries.
</para>
<para>
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
FROM pg_am am, pg_amop amop,
pg_opclass opc, pg_operator opr
WHERE amop.amopid = am.oid AND
amop.amopclaid = opc.oid AND
amop.amopopr = opr.oid
ORDER BY acc_name, ops_name, ops_comp
</programlisting>
</para>
</refsect2> </refsect2>
</refsect1> </refsect1>
...@@ -276,8 +363,6 @@ SELECT * FROM points ...@@ -276,8 +363,6 @@ SELECT * FROM points
<title> <title>
Compatibility Compatibility
</title> </title>
<para>
</para>
<refsect2 id="R2-SQL-CREATEINDEX-4"> <refsect2 id="R2-SQL-CREATEINDEX-4">
<refsect2info> <refsect2info>
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_language.sgml,v 1.8 1999/07/22 15:09:07 thomas Exp $
Postgres documentation
-->
<refentry id="SQL-CREATELANGUAGE"> <refentry id="SQL-CREATELANGUAGE">
<refmeta> <refmeta>
<refentrytitle> <refentrytitle id="sql-createlanguage-title">
CREATE LANGUAGE CREATE LANGUAGE
</refentrytitle> </refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo> <refmiscinfo>SQL - Language Statements</refmiscinfo>
...@@ -15,7 +20,7 @@ ...@@ -15,7 +20,7 @@
</refnamediv> </refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
<refsynopsisdivinfo> <refsynopsisdivinfo>
<date>1998-09-09</date> <date>1999-07-20</date>
</refsynopsisdivinfo> </refsynopsisdivinfo>
<synopsis> <synopsis>
CREATE [ TRUSTED ] PROCEDURAL LANGUAGE '<replaceable class="parameter">langname</replaceable>' CREATE [ TRUSTED ] PROCEDURAL LANGUAGE '<replaceable class="parameter">langname</replaceable>'
...@@ -59,7 +64,8 @@ CREATE [ TRUSTED ] PROCEDURAL LANGUAGE '<replaceable class="parameter">langname< ...@@ -59,7 +64,8 @@ CREATE [ TRUSTED ] PROCEDURAL LANGUAGE '<replaceable class="parameter">langname<
<productname>Postgres</productname>. <productname>Postgres</productname>.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>HANDLER <replaceable class="parameter">call_handler</replaceable></term> <term>HANDLER <replaceable class="parameter">call_handler</replaceable></term>
<listitem> <listitem>
...@@ -71,6 +77,7 @@ CREATE [ TRUSTED ] PROCEDURAL LANGUAGE '<replaceable class="parameter">langname< ...@@ -71,6 +77,7 @@ CREATE [ TRUSTED ] PROCEDURAL LANGUAGE '<replaceable class="parameter">langname<
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><replaceable class="parameter">comment</replaceable></term> <term><replaceable class="parameter">comment</replaceable></term>
<listitem> <listitem>
...@@ -242,32 +249,22 @@ C |/bin/cc ...@@ -242,32 +249,22 @@ C |/bin/cc
sql |postgres sql |postgres
</computeroutput> </computeroutput>
</programlisting> </programlisting>
</para>
<para>
Since the call handler for a procedural language must be
registered with <productname>Postgres</productname> in the 'C' language,
it inherits
all the capabilities and restrictions of 'C' functions.
</para>
<para>
At present, the definitions for a procedural language cannot be
changed once they have been created.
</para> </para>
</refsect2> </refsect2>
</refsect1> </refsect1>
<refsect1 id="R1-SQL-CREATELANGUAGE-4">
<title>
Restrictions
</title>
<para>
Since the call handler for a procedural language must be
registered with <productname>Postgres</productname> in the 'C' language,
it inherits
all the capabilities and restrictions of 'C' functions.
</para>
</refsect1>
<refsect1 id="R1-SQL-CREATELANGUAGE-5">
<title>
Bugs
</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"> <refsect1 id="R1-SQL-CREATELANGUAGE-6">
<title> <title>
Usage Usage
...@@ -340,9 +337,6 @@ CREATE PROCEDURAL LANGUAGE 'plsample' ...@@ -340,9 +337,6 @@ CREATE PROCEDURAL LANGUAGE 'plsample'
<title> <title>
Compatibility Compatibility
</title> </title>
<para>
CREATE LANGUAGE is a <productname>Postgres</productname> extension.
</para>
<refsect2 id="R2-SQL-CREATELANGUAGE-5"> <refsect2 id="R2-SQL-CREATELANGUAGE-5">
<refsect2info> <refsect2info>
...@@ -351,7 +345,10 @@ CREATE PROCEDURAL LANGUAGE 'plsample' ...@@ -351,7 +345,10 @@ CREATE PROCEDURAL LANGUAGE 'plsample'
<title> <title>
SQL92 SQL92
</title> </title>
<para> <para>
<command>CREATE LANGUAGE</command>
is a <productname>Postgres</productname> extension.
There is no <command>CREATE LANGUAGE</command> statement in There is no <command>CREATE LANGUAGE</command> statement in
<acronym>SQL92</acronym>. <acronym>SQL92</acronym>.
</para> </para>
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_operator.sgml,v 1.11 1999/07/22 15:09:08 thomas Exp $
Postgres documentation
-->
<refentry id="SQL-CREATEOPERATOR"> <refentry id="SQL-CREATEOPERATOR">
<refmeta> <refmeta>
<refentrytitle> <refentrytitle id="sql-createoperator-title">
CREATE OPERATOR CREATE OPERATOR
</refentrytitle> </refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo> <refmiscinfo>SQL - Language Statements</refmiscinfo>
...@@ -15,21 +20,14 @@ ...@@ -15,21 +20,14 @@
</refnamediv> </refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
<refsynopsisdivinfo> <refsynopsisdivinfo>
<date>1999-04-14</date> <date>1999-07-20</date>
</refsynopsisdivinfo> </refsynopsisdivinfo>
<synopsis> <synopsis>
CREATE OPERATOR <replaceable>name</replaceable> ( CREATE OPERATOR <replaceable>name</replaceable> ( PROCEDURE = <replaceable class="parameter">func_name</replaceable>
PROCEDURE = <replaceable class="parameter">func_name</replaceable> [, LEFTARG = <replaceable class="parameter">type1</replaceable> ] [, RIGHTARG = <replaceable class="parameter">type2</replaceable> ]
[, LEFTARG = <replaceable class="parameter">type1</replaceable> ] [, COMMUTATOR = <replaceable class="parameter">com_op</replaceable> ] [, NEGATOR = <replaceable class="parameter">neg_op</replaceable> ]
[, RIGHTARG = <replaceable class="parameter">type2</replaceable> ] [, RESTRICT = <replaceable class="parameter">res_proc</replaceable> ] [, JOIN = <replaceable class="parameter">join_proc</replaceable> ]
[, COMMUTATOR = <replaceable class="parameter">com_op</replaceable> ] [, HASHES ] [, SORT1 = <replaceable class="parameter">left_sort_op</replaceable> ] [, SORT2 = <replaceable class="parameter">right_sort_op</replaceable> ] )
[, NEGATOR = <replaceable class="parameter">neg_op</replaceable> ]
[, RESTRICT = <replaceable class="parameter">res_proc</replaceable> ]
[, JOIN = <replaceable class="parameter">join_proc</replaceable> ]
[, HASHES ]
[, SORT1 = <replaceable class="parameter">left_sort_op</replaceable> ]
[, SORT2 = <replaceable class="parameter">right_sort_op</replaceable> ]
)
</synopsis> </synopsis>
<refsect2 id="R2-SQL-CREATEOPERATOR-1"> <refsect2 id="R2-SQL-CREATEOPERATOR-1">
...@@ -384,9 +382,6 @@ CREATE OPERATOR === ( ...@@ -384,9 +382,6 @@ CREATE OPERATOR === (
<title> <title>
Compatibility Compatibility
</title> </title>
<para>
CREATE OPERATOR is a <productname>Postgres</productname> extension.
</para>
<refsect2 id="R2-SQL-CREATEOPERATOR-4"> <refsect2 id="R2-SQL-CREATEOPERATOR-4">
<refsect2info> <refsect2info>
...@@ -395,8 +390,12 @@ CREATE OPERATOR === ( ...@@ -395,8 +390,12 @@ CREATE OPERATOR === (
<title> <title>
SQL92 SQL92
</title> </title>
<para> <para>
There is no CREATE OPERATOR statement in <acronym>SQL92</acronym>. <command>CREATE OPERATOR</command>
is a <productname>Postgres</productname> extension.
There is no <command>CREATE OPERATOR</command>
statement in <acronym>SQL92</acronym>.
</para> </para>
</refsect2> </refsect2>
</refsect1> </refsect1>
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_rule.sgml,v 1.10 1999/07/22 15:09:08 thomas Exp $
Postgres documentation
-->
<refentry id="SQL-CREATERULE"> <refentry id="SQL-CREATERULE">
<refmeta> <refmeta>
<refentrytitle> <refentrytitle id="sql-createrule-title">
CREATE RULE CREATE RULE
</refentrytitle> </refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo> <refmiscinfo>SQL - Language Statements</refmiscinfo>
...@@ -15,7 +20,7 @@ ...@@ -15,7 +20,7 @@
</refnamediv> </refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
<refsynopsisdivinfo> <refsynopsisdivinfo>
<date>1998-09-11</date> <date>1999-07-20</date>
</refsynopsisdivinfo> </refsynopsisdivinfo>
<synopsis> <synopsis>
CREATE RULE <replaceable class="parameter">name</replaceable> AS ON <replaceable class="parameter">event</replaceable> CREATE RULE <replaceable class="parameter">name</replaceable> AS ON <replaceable class="parameter">event</replaceable>
...@@ -117,6 +122,15 @@ CREATE ...@@ -117,6 +122,15 @@ CREATE
<title> <title>
Description Description
</title> </title>
<para>
The <productname>Postgres</productname>
<firstterm>rule system</firstterm> allows one to define an
alternate action to be performed on updates, inserts, or deletions
from database tables or classes. Currently, rules are used to
implement table views.
</para>
<para> <para>
The semantics of a rule is that at the time an individual instance is The semantics of a rule is that at the time an individual instance is
accessed, updated, inserted or deleted, there is a current instance (for accessed, updated, inserted or deleted, there is a current instance (for
...@@ -131,6 +145,7 @@ CREATE ...@@ -131,6 +145,7 @@ CREATE
<literal>current.</literal><replaceable class="parameter">attribute-name</replaceable> <literal>current.</literal><replaceable class="parameter">attribute-name</replaceable>
and <literal>new.</literal><replaceable class="parameter">attribute-name</replaceable>. and <literal>new.</literal><replaceable class="parameter">attribute-name</replaceable>.
</para> </para>
<para> <para>
The <replaceable class="parameter">action</replaceable> part of the rule The <replaceable class="parameter">action</replaceable> part of the rule
executes with the same command and transaction identifier as the user executes with the same command and transaction identifier as the user
...@@ -209,13 +224,32 @@ CREATE RULE bad_rule_combination_2 AS ...@@ -209,13 +224,32 @@ CREATE RULE bad_rule_combination_2 AS
SELECT * FROM emp; SELECT * FROM emp;
</programlisting></para> </programlisting></para>
</example> </example>
</para> </para>
<para> <para>
You must have rule definition access to a class in order You must have rule definition access to a class in order
to define a rule on it. Use <command>GRANT</command> to define a rule on it. Use <command>GRANT</command>
and <command>REVOKE</command> to change permissions. and <command>REVOKE</command> to change permissions.
</para> </para>
<para>
The object in a <acronym>SQL</acronym> rule cannot be an array reference and
cannot have parameters.
</para>
<para>
Aside from the "oid" field, system attributes cannot be
referenced anywhere in a rule. Among other things, this
means that functions of instances (e.g., <literal>foo(emp)</literal> where
<literal>emp</literal> is a class) cannot be called anywhere in a rule.
</para>
<para>
The rule system stores the rule text and query plans 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>
</refsect2> </refsect2>
</refsect1> </refsect1>
...@@ -284,36 +318,10 @@ CREATE RULE example_5 AS ...@@ -284,36 +318,10 @@ CREATE RULE example_5 AS
</para> </para>
</refsect1> </refsect1>
<refsect1 id="R1-SQL-CREATERULE-3">
<title>
Bugs
</title>
<para>
The object in a <acronym>SQL</acronym> rule cannot be an array reference and
cannot have parameters.
</para>
<para>
Aside from the "oid" field, system attributes cannot be
referenced anywhere in a rule. Among other things, this
means that functions of instances (e.g., "<literal>foo(emp)</literal>" where
"<literal>emp</literal>" is a class) cannot be called anywhere in a rule.
</para>
<para>
The rule system stores the rule text and query plans 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>
</refsect1>
<refsect1 id="R1-SQL-CREATERULE-4"> <refsect1 id="R1-SQL-CREATERULE-4">
<title> <title>
Compatibility Compatibility
</title> </title>
<para>
<command>CREATE RULE</command> statement is a <productname>Postgres</productname>
language extension.
</para>
<refsect2 id="R2-SQL-CREATERULE-4"> <refsect2 id="R2-SQL-CREATERULE-4">
<refsect2info> <refsect2info>
...@@ -322,7 +330,10 @@ CREATE RULE example_5 AS ...@@ -322,7 +330,10 @@ CREATE RULE example_5 AS
<title> <title>
SQL92 SQL92
</title> </title>
<para> <para>
<command>CREATE RULE</command> statement is a <productname>Postgres</productname>
language extension.
There is no <command>CREATE RULE</command> statement in <acronym>SQL92</acronym>. There is no <command>CREATE RULE</command> statement in <acronym>SQL92</acronym>.
</para> </para>
</refsect2> </refsect2>
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_sequence.sgml,v 1.11 1999/07/22 15:09:08 thomas Exp $
Postgres documentation
-->
<refentry id="SQL-CREATESEQUENCE"> <refentry id="SQL-CREATESEQUENCE">
<refmeta> <refmeta>
<refentrytitle> <refentrytitle id="sql-createsequence-title">
CREATE SEQUENCE CREATE SEQUENCE
</refentrytitle> </refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo> <refmiscinfo>SQL - Language Statements</refmiscinfo>
...@@ -15,16 +20,12 @@ ...@@ -15,16 +20,12 @@
</refnamediv> </refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
<refsynopsisdivinfo> <refsynopsisdivinfo>
<date>1998-04-15</date> <date>1999-07-20</date>
</refsynopsisdivinfo> </refsynopsisdivinfo>
<synopsis> <synopsis>
CREATE SEQUENCE <replaceable class="parameter">seqname</replaceable> CREATE SEQUENCE <replaceable class="parameter">seqname</replaceable> [ INCREMENT <replaceable class="parameter">increment</replaceable> ]
[ INCREMENT <replaceable class="parameter">increment</replaceable> ] [ MINVALUE <replaceable class="parameter">minvalue</replaceable> ] [ MAXVALUE <replaceable class="parameter">maxvalue</replaceable> ]
[ MINVALUE <replaceable class="parameter">minvalue</replaceable> ] [ START <replaceable class="parameter">start</replaceable> ] [ CACHE <replaceable class="parameter">cache</replaceable> ] [ CYCLE ]
[ MAXVALUE <replaceable class="parameter">maxvalue</replaceable> ]
[ START <replaceable class="parameter">start</replaceable> ]
[ CACHE <replaceable class="parameter">cache</replaceable> ]
[ CYCLE ]
</synopsis> </synopsis>
<refsect2 id="R2-SQL-CREATESEQUENCE-1"> <refsect2 id="R2-SQL-CREATESEQUENCE-1">
...@@ -45,6 +46,7 @@ CREATE SEQUENCE <replaceable class="parameter">seqname</replaceable> ...@@ -45,6 +46,7 @@ CREATE SEQUENCE <replaceable class="parameter">seqname</replaceable>
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><replaceable class="parameter">increment</replaceable></term> <term><replaceable class="parameter">increment</replaceable></term>
<listitem> <listitem>
...@@ -57,6 +59,7 @@ CREATE SEQUENCE <replaceable class="parameter">seqname</replaceable> ...@@ -57,6 +59,7 @@ CREATE SEQUENCE <replaceable class="parameter">seqname</replaceable>
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><replaceable class="parameter">minvalue</replaceable></term> <term><replaceable class="parameter">minvalue</replaceable></term>
<listitem> <listitem>
...@@ -69,6 +72,7 @@ CREATE SEQUENCE <replaceable class="parameter">seqname</replaceable> ...@@ -69,6 +72,7 @@ CREATE SEQUENCE <replaceable class="parameter">seqname</replaceable>
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><replaceable class="parameter">maxvalue</replaceable></term> <term><replaceable class="parameter">maxvalue</replaceable></term>
<listitem> <listitem>
...@@ -81,6 +85,7 @@ CREATE SEQUENCE <replaceable class="parameter">seqname</replaceable> ...@@ -81,6 +85,7 @@ CREATE SEQUENCE <replaceable class="parameter">seqname</replaceable>
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><replaceable class="parameter">start</replaceable></term> <term><replaceable class="parameter">start</replaceable></term>
<listitem> <listitem>
...@@ -96,6 +101,7 @@ CREATE SEQUENCE <replaceable class="parameter">seqname</replaceable> ...@@ -96,6 +101,7 @@ CREATE SEQUENCE <replaceable class="parameter">seqname</replaceable>
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><replaceable class="parameter">cache</replaceable></term> <term><replaceable class="parameter">cache</replaceable></term>
<listitem> <listitem>
...@@ -108,6 +114,7 @@ CREATE SEQUENCE <replaceable class="parameter">seqname</replaceable> ...@@ -108,6 +114,7 @@ CREATE SEQUENCE <replaceable class="parameter">seqname</replaceable>
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>CYCLE</term> <term>CYCLE</term>
<listitem> <listitem>
...@@ -208,6 +215,7 @@ ERROR: DefineSequence: MINVALUE (<replaceable class="parameter">min</replaceabl ...@@ -208,6 +215,7 @@ ERROR: DefineSequence: MINVALUE (<replaceable class="parameter">min</replaceabl
table with the name <replaceable class="parameter">seqname</replaceable>. table with the name <replaceable class="parameter">seqname</replaceable>.
The generator will be "owned" by the user issuing the command. The generator will be "owned" by the user issuing the command.
</para> </para>
<para> <para>
After a sequence is created, you may use the function After a sequence is created, you may use the function
<function>nextval(<replaceable class="parameter">seqname</replaceable>)</function> <function>nextval(<replaceable class="parameter">seqname</replaceable>)</function>
...@@ -228,18 +236,24 @@ ERROR: DefineSequence: MINVALUE (<replaceable class="parameter">min</replaceabl ...@@ -228,18 +236,24 @@ ERROR: DefineSequence: MINVALUE (<replaceable class="parameter">min</replaceabl
<para> <para>
Use a query like Use a query like
<programlisting> <programlisting>
SELECT * FROM sequence_name; SELECT * FROM sequence_name;
</programlisting> </programlisting>
to get the parameters of a sequence. to get the parameters of a sequence.
Aside from fetching the original Aside from fetching the original
parameters, you can use parameters, you can use
<programlisting> <programlisting>
SELECT last_value FROM sequence_name; SELECT last_value FROM sequence_name;
</programlisting> </programlisting>
to obtain the last value allocated by any backend. to obtain the last value allocated by any backend.
parameters, you can use parameters, you can use
</para> </para>
<para> <para>
Low-level locking is used to enable multiple simultaneous Low-level locking is used to enable multiple simultaneous
calls to a generator. calls to a generator.
...@@ -332,10 +346,6 @@ END; ...@@ -332,10 +346,6 @@ END;
<title> <title>
Compatibility Compatibility
</title> </title>
<para>
<command>CREATE SEQUENCE</command> is a <productname>Postgres</productname>
language extension.
</para>
<refsect2 id="R2-SQL-CREATESEQUENCE-4"> <refsect2 id="R2-SQL-CREATESEQUENCE-4">
<refsect2info> <refsect2info>
...@@ -344,7 +354,10 @@ END; ...@@ -344,7 +354,10 @@ END;
<title> <title>
SQL92 SQL92
</title> </title>
<para> <para>
<command>CREATE SEQUENCE</command> is a <productname>Postgres</productname>
language extension.
There is no <command>CREATE SEQUENCE</command> statement There is no <command>CREATE SEQUENCE</command> statement
in <acronym>SQL92</acronym>. in <acronym>SQL92</acronym>.
</para> </para>
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_table.sgml,v 1.17 1999/07/22 15:09:08 thomas Exp $
Postgres documentation
-->
<refentry id="SQL-CREATETABLE"> <refentry id="SQL-CREATETABLE">
<refmeta> <refmeta>
<refentrytitle> <refentrytitle id="sql-createtable-title">
CREATE TABLE CREATE TABLE
</refentrytitle> </refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo> <refmiscinfo>SQL - Language Statements</refmiscinfo>
...@@ -15,7 +20,7 @@ ...@@ -15,7 +20,7 @@
</refnamediv> </refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
<refsynopsisdivinfo> <refsynopsisdivinfo>
<date>1998-09-11</date> <date>1999-07-20</date>
</refsynopsisdivinfo> </refsynopsisdivinfo>
<synopsis> <synopsis>
CREATE [ TEMPORARY | TEMP ] TABLE <replaceable class="PARAMETER">table</replaceable> ( CREATE [ TEMPORARY | TEMP ] TABLE <replaceable class="PARAMETER">table</replaceable> (
...@@ -56,7 +61,7 @@ CREATE [ TEMPORARY | TEMP ] TABLE <replaceable class="PARAMETER">table</replacea ...@@ -56,7 +61,7 @@ CREATE [ TEMPORARY | TEMP ] TABLE <replaceable class="PARAMETER">table</replacea
<term><replaceable class="PARAMETER">table</replaceable></term> <term><replaceable class="PARAMETER">table</replaceable></term>
<listitem> <listitem>
<para> <para>
The name of a new table to be created. The name of a new class or table to be created.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -213,11 +218,49 @@ ERROR: DEFAULT: type mismatched ...@@ -213,11 +218,49 @@ ERROR: DEFAULT: type mismatched
<title> <title>
Description Description
</title> </title>
<para> <para>
<command>CREATE TABLE</command> will enter a new table into the current data <command>CREATE TABLE</command> will enter a new class or table
base. The table will be "owned" by the user issuing the into the current data base. The table will be "owned" by the user issuing the
command. command.
</para> </para>
<para>
Each <replaceable class="PARAMETER">type</replaceable>
may be a simple type, a complex type (set) or an array type.
Each attribute may be specified to be non-null and
each may have a default value, specified by the
<xref linkend="R1-SQL-DEFAULTCLAUSE-1-TITLE" endterm="R1-SQL-DEFAULTCLAUSE-1-TITLE">.
</para>
<para>
<note>
<para>
As of Postgres version 6.0, consistant array dimensions within an
attribute are not enforced. This will likely change in a future
release.
</para>
</note>
</para>
<para>
The optional INHERITS
clause specifies a collection of class names from which this class
automatically inherits all fields. If any inherited field name
appears more than once, Postgres reports an error. Postgres automatically
allows the created class to inherit functions on classes above it in
the inheritance hierarchy. Inheritance of functions is done according
to the conventions of the Common Lisp Object System (CLOS).
</para>
<para>
Each new table or class <replaceable class="PARAMETER">table</replaceable>
is automatically created as a type. Therefore, one or more instances
from the class are automatically a type and can be used in
<xref linkend="sql-altertable-title" endterm="sql-altertable-title">
or other <command>CREATE TABLE</command> statements.
</para>
<para> <para>
The new table is created as a heap with no initial data. The new table is created as a heap with no initial data.
A table can have no more than 1600 columns (realistically, A table can have no more than 1600 columns (realistically,
...@@ -232,7 +275,7 @@ ERROR: DEFAULT: type mismatched ...@@ -232,7 +275,7 @@ ERROR: DEFAULT: type mismatched
<refsect1info> <refsect1info>
<date>1998-09-11</date> <date>1998-09-11</date>
</refsect1info> </refsect1info>
<title> <title id="R1-SQL-DEFAULTCLAUSE-1-TITLE">
DEFAULT Clause DEFAULT Clause
</title> </title>
<para> <para>
...@@ -427,7 +470,7 @@ CREATE TABLE distributors ( ...@@ -427,7 +470,7 @@ CREATE TABLE distributors (
<refsect1info> <refsect1info>
<date>1998-09-11</date> <date>1998-09-11</date>
</refsect1info> </refsect1info>
<title> <title id="R1-SQL-COLUMNCONSTRAINT-1-TITLE">
Column CONSTRAINT Clause Column CONSTRAINT Clause
</title> </title>
<para> <para>
...@@ -446,6 +489,7 @@ CREATE TABLE distributors ( ...@@ -446,6 +489,7 @@ CREATE TABLE distributors (
Inputs Inputs
</title> </title>
<para> <para>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term><replaceable class="parameter">name</replaceable></term> <term><replaceable class="parameter">name</replaceable></term>
...@@ -523,20 +567,34 @@ CREATE TABLE distributors ( ...@@ -523,20 +567,34 @@ CREATE TABLE distributors (
<title> <title>
Description Description
</title> </title>
<para>
The optional constraint
clauses specify constraints or tests which new or updated entries
must satisfy for an insert or update operation to succeed. Each constraint
must evaluate to a boolean expression. Multiple attributes may be referenced within
a single constraint. The use of PRIMARY KEY
as a table constraint
is mutually incompatible with PRIMARY KEY as a column constraint.
</para>
<para> <para>
A Constraint is a named rule: an SQL object which helps define A constraint is a named rule: an SQL object which helps define
valid sets of values by putting limits on the results of INSERT, valid sets of values by putting limits on the results of INSERT,
UPDATE or DELETE operations performed on a Base Table. UPDATE or DELETE operations performed on a Base Table.
</para> </para>
<para> <para>
There are two ways to define integrity constraints: There are two ways to define integrity constraints:
table constraints, covered later, and column constraints, covered here. table constraints, covered later, and column constraints, covered here.
</para> </para>
<para> <para>
A column constraint is an integrity constraint defined as part A column constraint is an integrity constraint defined as part
of a column definition, and logically becomes a table of a column definition, and logically becomes a table
constraint as soon as it is created. The column constraint as soon as it is created. The column
constraints available are: constraints available are:
<simplelist columns="1"> <simplelist columns="1">
<member>PRIMARY KEY</member> <member>PRIMARY KEY</member>
<member>REFERENCES</member> <member>REFERENCES</member>
......
<refentry id="CREATETABLEAS"> <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_table_as.sgml,v 1.3 1999/07/22 15:09:08 thomas Exp $
Postgres documentation
-->
<refentry id="SQL-CREATETABLEAS">
<refmeta> <refmeta>
<refentrytitle> <refentrytitle id="SQL-CREATETABLEAS-TITLE">
CREATE TABLE AS CREATE TABLE AS
</refentrytitle> </refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo> <refmiscinfo>SQL - Language Statements</refmiscinfo>
...@@ -15,7 +20,7 @@ ...@@ -15,7 +20,7 @@
</refnamediv> </refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
<refsynopsisdivinfo> <refsynopsisdivinfo>
<date>1998-09-22</date> <date>1999-07-20</date>
</refsynopsisdivinfo> </refsynopsisdivinfo>
<synopsis> <synopsis>
CREATE TABLE <replaceable>table</replaceable> [ (<replaceable>column</replaceable> [, ...] ) ] CREATE TABLE <replaceable>table</replaceable> [ (<replaceable>column</replaceable> [, ...] ) ]
...@@ -87,8 +92,10 @@ CREATE TABLE <replaceable>table</replaceable> [ (<replaceable>column</replaceabl ...@@ -87,8 +92,10 @@ CREATE TABLE <replaceable>table</replaceable> [ (<replaceable>column</replaceabl
Description Description
</title> </title>
<para> <para>
<command>CREATE TABLE AS</command> enables a table to be created from the contents of <command>CREATE TABLE AS</command> enables a table to be created
an existing table. It has functionality equivalent to <command>SELECT TABLE INTO</command>, from the contents of an existing table.
It is functionality equivalent to
<xref linkend="sql-selectinto-title" endterm="sql-selectinto-title">,
but with perhaps a more direct syntax. but with perhaps a more direct syntax.
</para> </para>
</refsect1> </refsect1>
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_trigger.sgml,v 1.8 1999/07/22 15:09:08 thomas Exp $
Postgres documentation
-->
<refentry id="SQL-CREATETRIGGER"> <refentry id="SQL-CREATETRIGGER">
<refmeta> <refmeta>
<refentrytitle> <refentrytitle id="SQL-CREATETRIGGER-TITLE">
CREATE TRIGGER CREATE TRIGGER
</refentrytitle> </refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo> <refmiscinfo>SQL - Language Statements</refmiscinfo>
...@@ -15,7 +20,7 @@ ...@@ -15,7 +20,7 @@
</refnamediv> </refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
<refsynopsisdivinfo> <refsynopsisdivinfo>
<date>1998-09-21</date> <date>1999-07-20</date>
</refsynopsisdivinfo> </refsynopsisdivinfo>
<synopsis> <synopsis>
CREATE TRIGGER <replaceable class="PARAMETER">name</replaceable> { BEFORE | AFTER } { <replaceable class="PARAMETER">event</replaceable> [OR ...] } CREATE TRIGGER <replaceable class="PARAMETER">name</replaceable> { BEFORE | AFTER } { <replaceable class="PARAMETER">event</replaceable> [OR ...] }
...@@ -101,29 +106,37 @@ CREATE ...@@ -101,29 +106,37 @@ CREATE
<title> <title>
Description Description
</title> </title>
<para> <para>
<command>CREATE TRIGGER</command> will enter a new trigger into the current <command>CREATE TRIGGER</command> will enter a new trigger into the current
data base. The trigger will be associated with the relation data base. The trigger will be associated with the relation
<replaceable class="parameter">relname</replaceable> and will execute <replaceable class="parameter">relname</replaceable> and will execute
the specified function <replaceable class="parameter">funcname</replaceable>. the specified function <replaceable class="parameter">funcname</replaceable>.
</para> </para>
<para> <para>
The trigger can be specified to fire either before the The trigger can be specified to fire either before BEFORE the
operation is attempted on a tuple (before constraints operation is attempted on a tuple (before constraints
are checked and the INSERT, UPDATE or DELETE is attempted) or are checked and the <command>INSERT</command>, <command>UPDATE</command> or
after the operation has been attempted (e.g. after constraints <command>DELETE</command> is attempted) or
are checked and the INSERT, UPDATE or DELETE has completed). If the AFTER the operation has been attempted (e.g. after constraints
are checked and the <command>INSERT</command>,
<command>UPDATE</command> or <command>DELETE</command> has
completed). If the
trigger fires before the event, the trigger may trigger fires before the event, the trigger may
skip the operation for the current tuple, or change the tuple skip the operation for the current tuple, or change the tuple
being inserted (for INSERT and UPDATE operations only). If being inserted (for <command>INSERT</command> and
<command>UPDATE</command> operations only). If
the trigger fires after the event, all changes, including the the trigger fires after the event, all changes, including the
last insertion, update, or deletion, are "visible" to the trigger. last insertion, update, or deletion, are "visible" to the trigger.
</para> </para>
<para> <para>
Refer to the chapters on SPI and Triggers in the Refer to the chapters on SPI and Triggers in the
<citetitle>PostgreSQL Programmer's Guide</citetitle> for more <citetitle>PostgreSQL Programmer's Guide</citetitle> for more
information. information.
</para> </para>
<refsect2 id="R2-SQL-CREATETRIGGER-3"> <refsect2 id="R2-SQL-CREATETRIGGER-3">
<refsect2info> <refsect2info>
<date>1998-09-21</date> <date>1998-09-21</date>
...@@ -133,7 +146,7 @@ CREATE ...@@ -133,7 +146,7 @@ CREATE
</title> </title>
<para> <para>
<command>CREATE TRIGGER</command> is a <productname>Postgres</productname> <command>CREATE TRIGGER</command> is a <productname>Postgres</productname>
language extension. language extension.
</para> </para>
<para> <para>
Only the relation owner may create a trigger on this relation. Only the relation owner may create a trigger on this relation.
...@@ -177,8 +190,6 @@ CREATE TRIGGER if_film_exists ...@@ -177,8 +190,6 @@ CREATE TRIGGER if_film_exists
<title> <title>
Compatibility Compatibility
</title> </title>
<para>
</para>
<refsect2 id="R2-SQL-CREATETRIGGER-4"> <refsect2 id="R2-SQL-CREATETRIGGER-4">
<refsect2info> <refsect2info>
...@@ -187,6 +198,7 @@ CREATE TRIGGER if_film_exists ...@@ -187,6 +198,7 @@ CREATE TRIGGER if_film_exists
<title> <title>
SQL92 SQL92
</title> </title>
<para> <para>
There is no <command>CREATE TRIGGER</command> in <acronym>SQL92</acronym>. There is no <command>CREATE TRIGGER</command> in <acronym>SQL92</acronym>.
</para> </para>
...@@ -207,7 +219,7 @@ CREATE TABLE distributors ( ...@@ -207,7 +219,7 @@ CREATE TABLE distributors (
</para> </para>
<para> <para>
However, foreign keys are not yet implemented (as of version 6.4) in However, foreign keys are not yet implemented (as of version 6.5) in
<productname>Postgres</productname>. <productname>Postgres</productname>.
</para> </para>
</refsect2> </refsect2>
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_type.sgml,v 1.10 1999/07/22 15:09:08 thomas Exp $
Postgres documentation
-->
<refentry id="SQL-CREATETYPE"> <refentry id="SQL-CREATETYPE">
<refmeta> <refmeta>
<refentrytitle> <refentrytitle>
...@@ -15,21 +20,15 @@ ...@@ -15,21 +20,15 @@
</refnamediv> </refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
<refsynopsisdivinfo> <refsynopsisdivinfo>
<date>1998-09-21</date> <date>1999-07-20</date>
</refsynopsisdivinfo> </refsynopsisdivinfo>
<synopsis> <synopsis>
CREATE TYPE <replaceable class="parameter">typename</replaceable> ( CREATE TYPE <replaceable class="parameter">typename</replaceable> ( INPUT = <replaceable class="parameter">input_function</replaceable>, OUTPUT = <replaceable class="parameter">output_function</replaceable>
INPUT = <replaceable class="parameter">input_function</replaceable> , INTERNALLENGTH = { <replaceable class="parameter">internallength</replaceable> | VARIABLE } [ , EXTERNALLENGTH = { <replaceable class="parameter">externallength</replaceable> | VARIABLE } ]
, OUTPUT = <replaceable class="parameter">output_function</replaceable> [ , DEFAULT = "<replaceable class="parameter">default</replaceable>" ]
, INTERNALLENGTH = (<replaceable class="parameter">internallength</replaceable> | VARIABLE) [ , ELEMENT = <replaceable class="parameter">element</replaceable> ] [ , DELIMITER = <replaceable class="parameter">delimiter</replaceable> ]
[ , EXTERNALLENGTH = (<replaceable class="parameter">externallength</replaceable> | VARIABLE) ] [ , SEND = <replaceable class="parameter">send_function</replaceable> ] [ , RECEIVE = <replaceable class="parameter">receive_function</replaceable> ]
[ , ELEMENT = <replaceable class="parameter">element</replaceable> ] [ , PASSEDBYVALUE ] )
[ , DELIMITER = <replaceable class="parameter">delimiter</replaceable> ]
[ , DEFAULT = "<replaceable class="parameter">default</replaceable>" ]
[ , SEND = <replaceable class="parameter">send_function</replaceable> ]
[ , RECEIVE = <replaceable class="parameter">receive_function</replaceable> ]
[ , PASSEDBYVALUE ]
)
</synopsis> </synopsis>
<refsect2 id="R2-SQL-CREATETYPE-1"> <refsect2 id="R2-SQL-CREATETYPE-1">
...@@ -50,8 +49,9 @@ CREATE TYPE <replaceable class="parameter">typename</replaceable> ( ...@@ -50,8 +49,9 @@ CREATE TYPE <replaceable class="parameter">typename</replaceable> (
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>INTERNALLENGTH <replaceable class="parameter">internallength</replaceable></term> <term><replaceable class="parameter">internallength</replaceable></term>
<listitem> <listitem>
<para> <para>
A literal value, which specifies the internal length of A literal value, which specifies the internal length of
...@@ -59,8 +59,9 @@ CREATE TYPE <replaceable class="parameter">typename</replaceable> ( ...@@ -59,8 +59,9 @@ CREATE TYPE <replaceable class="parameter">typename</replaceable> (
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>EXTERNALLENGTH <replaceable class="parameter">externallength</replaceable></term> <term><replaceable class="parameter">externallength</replaceable></term>
<listitem> <listitem>
<para> <para>
A literal value, which specifies the external length of A literal value, which specifies the external length of
...@@ -68,18 +69,21 @@ CREATE TYPE <replaceable class="parameter">typename</replaceable> ( ...@@ -68,18 +69,21 @@ CREATE TYPE <replaceable class="parameter">typename</replaceable> (
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>INPUT <replaceable class="parameter">input_function</replaceable></term> <term><replaceable class="parameter">input_function</replaceable></term>
<listitem> <listitem>
<para> <para>
The name of a function, created by CREATE FUNCTION, which The name of a function, created by
<command>CREATE FUNCTION</command>, which
converts data from its external form to the type's converts data from its external form to the type's
internal form. internal form.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>OUTPUT <replaceable class="parameter">output_function</replaceable></term> <term><replaceable class="parameter">output_function</replaceable></term>
<listitem> <listitem>
<para> <para>
The name of a function, created by CREATE FUNCTION, which The name of a function, created by CREATE FUNCTION, which
...@@ -88,6 +92,7 @@ CREATE TYPE <replaceable class="parameter">typename</replaceable> ( ...@@ -88,6 +92,7 @@ CREATE TYPE <replaceable class="parameter">typename</replaceable> (
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><replaceable class="parameter">element</replaceable></term> <term><replaceable class="parameter">element</replaceable></term>
<listitem> <listitem>
...@@ -97,6 +102,7 @@ CREATE TYPE <replaceable class="parameter">typename</replaceable> ( ...@@ -97,6 +102,7 @@ CREATE TYPE <replaceable class="parameter">typename</replaceable> (
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><replaceable class="parameter">delimiter</replaceable></term> <term><replaceable class="parameter">delimiter</replaceable></term>
<listitem> <listitem>
...@@ -105,6 +111,7 @@ CREATE TYPE <replaceable class="parameter">typename</replaceable> ( ...@@ -105,6 +111,7 @@ CREATE TYPE <replaceable class="parameter">typename</replaceable> (
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><replaceable class="parameter">default</replaceable></term> <term><replaceable class="parameter">default</replaceable></term>
<listitem> <listitem>
...@@ -118,10 +125,9 @@ CREATE TYPE <replaceable class="parameter">typename</replaceable> ( ...@@ -118,10 +125,9 @@ CREATE TYPE <replaceable class="parameter">typename</replaceable> (
<term><replaceable class="parameter">send_function</replaceable></term> <term><replaceable class="parameter">send_function</replaceable></term>
<listitem> <listitem>
<para> <para>
The name of a function, created by CREATE FUNCTION, which The name of a function, created by <command>CREATE FUNCTION</command>, which
converts data of this type into a form suitable for converts data of this type into a form suitable for
transmission to another machine. transmission to another machine.
<comment>Is this right?</comment>
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -129,10 +135,9 @@ CREATE TYPE <replaceable class="parameter">typename</replaceable> ( ...@@ -129,10 +135,9 @@ CREATE TYPE <replaceable class="parameter">typename</replaceable> (
<term><replaceable class="parameter">receive_function</replaceable></term> <term><replaceable class="parameter">receive_function</replaceable></term>
<listitem> <listitem>
<para> <para>
The name of a function, created by CREATE FUNCTION, which The name of a function, created by <command>CREATE FUNCTION</command>, which
converts data of this type from a form suitable for converts data of this type from a form suitable for
transmission from another machine to internal form. transmission from another machine to internal form.
<comment>Is this right?</comment>
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -172,6 +177,7 @@ CREATE ...@@ -172,6 +177,7 @@ CREATE
<title> <title>
Description Description
</title> </title>
<para> <para>
<command>CREATE TYPE</command> allows the user to register a new user data <command>CREATE TYPE</command> allows the user to register a new user data
type with Postgres for use in the current data base. The type with Postgres for use in the current data base. The
...@@ -180,6 +186,7 @@ CREATE ...@@ -180,6 +186,7 @@ CREATE
the name of the new type and must be unique within the the name of the new type and must be unique within the
types defined for this database. types defined for this database.
</para> </para>
<para> <para>
<command>CREATE TYPE</command> requires the registration of two functions <command>CREATE TYPE</command> requires the registration of two functions
(using create function) before defining the type. The (using create function) before defining the type. The
...@@ -193,6 +200,7 @@ CREATE ...@@ -193,6 +200,7 @@ CREATE
the input and output functions must be declared to take the input and output functions must be declared to take
one or two arguments of type "<literal>opaque</literal>". one or two arguments of type "<literal>opaque</literal>".
</para> </para>
<para> <para>
New base data types can be fixed length, in which case New base data types can be fixed length, in which case
<replaceable class="parameter">internallength</replaceable> is a <replaceable class="parameter">internallength</replaceable> is a
...@@ -207,6 +215,7 @@ CREATE ...@@ -207,6 +215,7 @@ CREATE
<replaceable class="parameter">externallength</replaceable> <replaceable class="parameter">externallength</replaceable>
keyword. keyword.
</para> </para>
<para> <para>
To indicate that a type is an array and to indicate that a To indicate that a type is an array and to indicate that a
type has array elements, indicate the type of the array type has array elements, indicate the type of the array
...@@ -214,6 +223,7 @@ CREATE ...@@ -214,6 +223,7 @@ CREATE
an array of 4 byte integers ("int4"), specify an array of 4 byte integers ("int4"), specify
<programlisting>ELEMENT = int4</programlisting> <programlisting>ELEMENT = int4</programlisting>
</para> </para>
<para> <para>
To indicate the delimiter to be used on arrays of this To indicate the delimiter to be used on arrays of this
type, <replaceable class="parameter">delimiter</replaceable> type, <replaceable class="parameter">delimiter</replaceable>
...@@ -221,6 +231,7 @@ CREATE ...@@ -221,6 +231,7 @@ CREATE
set to a specific character. The default delimiter is the comma set to a specific character. The default delimiter is the comma
("<literal>,</literal>"). ("<literal>,</literal>").
</para> </para>
<para> <para>
A default value is optionally available in case a user A default value is optionally available in case a user
wants some specific bit pattern to mean "data not present." wants some specific bit pattern to mean "data not present."
...@@ -228,8 +239,9 @@ CREATE ...@@ -228,8 +239,9 @@ CREATE
<comment>How does the user specify that bit pattern and associate <comment>How does the user specify that bit pattern and associate
it with the fact that the data is not present></comment> it with the fact that the data is not present></comment>
</para> </para>
<para> <para>
The optional functions The optional arguments
<replaceable class="parameter">send_function</replaceable> and <replaceable class="parameter">send_function</replaceable> and
<replaceable class="parameter">receive_function</replaceable> <replaceable class="parameter">receive_function</replaceable>
are used when the application program requesting Postgres are used when the application program requesting Postgres
...@@ -246,6 +258,7 @@ CREATE ...@@ -246,6 +258,7 @@ CREATE
characters do not have to be converted if passed from characters do not have to be converted if passed from
a Sun-4 to a DECstation, but many other types do. a Sun-4 to a DECstation, but many other types do.
</para> </para>
<para> <para>
The optional flag, <option>PASSEDBYVALUE</option>, indicates that operators The optional flag, <option>PASSEDBYVALUE</option>, indicates that operators
and functions which use this data type should be passed an and functions which use this data type should be passed an
...@@ -253,6 +266,7 @@ CREATE ...@@ -253,6 +266,7 @@ CREATE
may not pass by value types whose internal representation is may not pass by value types whose internal representation is
more than four bytes. more than four bytes.
</para> </para>
<para> <para>
For new base types, a user can define operators, functions For new base types, a user can define operators, functions
and aggregates using the appropriate facilities described and aggregates using the appropriate facilities described
...@@ -287,15 +301,16 @@ CREATE ...@@ -287,15 +301,16 @@ CREATE
<para> <para>
This command creates the box data type and then uses the This command creates the box data type and then uses the
type in a class definition: type in a class definition:
</para> <programlisting>
<programlisting>
CREATE TYPE box (INTERNALLENGTH = 8, CREATE TYPE box (INTERNALLENGTH = 8,
INPUT = my_procedure_1, OUTPUT = my_procedure_2); INPUT = my_procedure_1, OUTPUT = my_procedure_2);
CREATE TABLE myboxes (id INT4, description box); CREATE TABLE myboxes (id INT4, description box);
</programlisting> </programlisting>
</para>
<para> <para>
This command creates a variable length array type with This command creates a variable length array type with
integer elements. integer elements:
<programlisting> <programlisting>
CREATE TYPE int4array (INPUT = array_in, OUTPUT = array_out, CREATE TYPE int4array (INPUT = array_in, OUTPUT = array_out,
...@@ -303,6 +318,7 @@ CREATE TYPE int4array (INPUT = array_in, OUTPUT = array_out, ...@@ -303,6 +318,7 @@ CREATE TYPE int4array (INPUT = array_in, OUTPUT = array_out,
CREATE TABLE myarrays (id int4, numbers int4array); CREATE TABLE myarrays (id int4, numbers int4array);
</programlisting> </programlisting>
</para> </para>
<para> <para>
This command creates a large object type and uses it in This command creates a large object type and uses it in
a class definition: a class definition:
...@@ -314,8 +330,14 @@ CREATE TABLE big_objs (id int4, obj bigobj); ...@@ -314,8 +330,14 @@ CREATE TABLE big_objs (id int4, obj bigobj);
</programlisting> </programlisting>
</para> </para>
<refsect2> <refsect2 id="R2-SQL-CREATETYPE-3">
<title>Restrictions</title> <refsect2info>
<date>1998-09-21</date>
</refsect2info>
<title>
Notes
</title>
<para> <para>
Type names cannot begin with the underscore character Type names cannot begin with the underscore character
("_") and can only be 31 characters long. This is because ("_") and can only be 31 characters long. This is because
...@@ -323,15 +345,7 @@ CREATE TABLE big_objs (id int4, obj bigobj); ...@@ -323,15 +345,7 @@ CREATE TABLE big_objs (id int4, obj bigobj);
with a name consisting of the base type's name prepended with a name consisting of the base type's name prepended
with an underscore. with an underscore.
</para> </para>
</refsect2>
<refsect2 id="R2-SQL-CREATETYPE-3">
<refsect2info>
<date>1998-09-21</date>
</refsect2info>
<title>
Notes
</title>
<para> <para>
Refer to <command>DROP TYPE</command> to remove an existing type. Refer to <command>DROP TYPE</command> to remove an existing type.
</para> </para>
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_user.sgml,v 1.8 1999/07/22 15:09:08 thomas Exp $
Postgres documentation
-->
<refentry id="SQL-CREATEUSER"> <refentry id="SQL-CREATEUSER">
<refmeta> <refmeta>
<refentrytitle> <refentrytitle>
...@@ -15,13 +20,12 @@ ...@@ -15,13 +20,12 @@
</refnamediv> </refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
<refsynopsisdivinfo> <refsynopsisdivinfo>
<date>1998-09-21</date> <date>1999-07-20</date>
</refsynopsisdivinfo> </refsynopsisdivinfo>
<synopsis> <synopsis>
CREATE USER<replaceable class="PARAMETER"> username</replaceable> CREATE USER<replaceable class="PARAMETER"> username</replaceable>
[ WITH PASSWORD <replaceable class="PARAMETER">password</replaceable> ] [ WITH PASSWORD <replaceable class="PARAMETER">password</replaceable> ]
[ CREATEDB | NOCREATEDB ] [ CREATEDB | NOCREATEDB ] [ CREATEUSER | NOCREATEUSER ]
[ CREATEUSER | NOCREATEUSER ]
[ IN GROUP <replaceable class="PARAMETER">groupname</replaceable> [, ...] ] [ IN GROUP <replaceable class="PARAMETER">groupname</replaceable> [, ...] ]
[ VALID UNTIL '<replaceable class="PARAMETER">abstime</replaceable>' ] [ VALID UNTIL '<replaceable class="PARAMETER">abstime</replaceable>' ]
</synopsis> </synopsis>
...@@ -34,6 +38,7 @@ CREATE USER<replaceable class="PARAMETER"> username</replaceable> ...@@ -34,6 +38,7 @@ CREATE USER<replaceable class="PARAMETER"> username</replaceable>
Inputs Inputs
</title> </title>
<para> <para>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term><replaceable class="parameter">username</replaceable></term> <term><replaceable class="parameter">username</replaceable></term>
...@@ -170,6 +175,7 @@ CREATE USER ...@@ -170,6 +175,7 @@ CREATE USER
CREATE USER will add a new user to an instance of CREATE USER will add a new user to an instance of
<productname>Postgres</productname>. <productname>Postgres</productname>.
</para> </para>
<para> <para>
The new user will be given a <filename>usesysid</filename> of: The new user will be given a <filename>usesysid</filename> of:
...@@ -270,8 +276,6 @@ CREATE USER manuel WITH PASSWORD jw8s0F4 CREATEDB ...@@ -270,8 +276,6 @@ CREATE USER manuel WITH PASSWORD jw8s0F4 CREATEDB
<title> <title>
Compatibility Compatibility
</title> </title>
<para>
</para>
<refsect2 id="R2-SQL-CREATEUSER-4"> <refsect2 id="R2-SQL-CREATEUSER-4">
<refsect2info> <refsect2info>
...@@ -280,6 +284,7 @@ CREATE USER manuel WITH PASSWORD jw8s0F4 CREATEDB ...@@ -280,6 +284,7 @@ CREATE USER manuel WITH PASSWORD jw8s0F4 CREATEDB
<title> <title>
SQL92 SQL92
</title> </title>
<para> <para>
There is no <command>CREATE USER</command> statement in SQL92. There is no <command>CREATE USER</command> statement in SQL92.
</para> </para>
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_view.sgml,v 1.7 1999/07/22 15:09:08 thomas Exp $
Postgres documentation
-->
<refentry id="SQL-CREATEVIEW"> <refentry id="SQL-CREATEVIEW">
<refmeta> <refmeta>
<refentrytitle> <refentrytitle id="SQL-CREATEVIEW-TITLE">
CREATE VIEW CREATE VIEW
</refentrytitle> </refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo> <refmiscinfo>SQL - Language Statements</refmiscinfo>
...@@ -15,11 +20,10 @@ ...@@ -15,11 +20,10 @@
</refnamediv> </refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
<refsynopsisdivinfo> <refsynopsisdivinfo>
<date>1998-09-21</date> <date>1999-07-20</date>
</refsynopsisdivinfo> </refsynopsisdivinfo>
<synopsis> <synopsis>
CREATE VIEW <replaceable class="PARAMETER">view</replaceable> CREATE VIEW <replaceable class="PARAMETER">view</replaceable> AS SELECT <replaceable class="PARAMETER">query</replaceable>
AS SELECT <replaceable class="PARAMETER">query</replaceable>
</synopsis> </synopsis>
<refsect2 id="R2-SQL-CREATEVIEW-1"> <refsect2 id="R2-SQL-CREATEVIEW-1">
...@@ -30,6 +34,7 @@ CREATE VIEW <replaceable class="PARAMETER">view</replaceable> ...@@ -30,6 +34,7 @@ CREATE VIEW <replaceable class="PARAMETER">view</replaceable>
Inputs Inputs
</title> </title>
<para> <para>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term><replaceable class="parameter">view</replaceable></term> <term><replaceable class="parameter">view</replaceable></term>
...@@ -116,10 +121,10 @@ CREATE VIEW vista AS SELECT 'Hello World'::text ...@@ -116,10 +121,10 @@ CREATE VIEW vista AS SELECT 'Hello World'::text
Description Description
</title> </title>
<para> <para>
<command>CREATE VIEW</command> will define a view of a table. This view is <command>CREATE VIEW</command> will define a view of a table or
not physically materialized. Specifically, a query class. This view is not physically materialized. Specifically, a query
rewrite retrieve rule is automatically generated rewrite retrieve rule is automatically generated to support
to support retrieve operations on views. retrieve operations on views.
</para> </para>
<refsect2 id="R2-SQL-CREATEVIEW-3"> <refsect2 id="R2-SQL-CREATEVIEW-3">
...@@ -129,20 +134,13 @@ CREATE VIEW vista AS SELECT 'Hello World'::text ...@@ -129,20 +134,13 @@ CREATE VIEW vista AS SELECT 'Hello World'::text
<title> <title>
Notes Notes
</title> </title>
<para> <para>
Use the <command>DROP VIEW</command> statement to drop views. Currently, views are read only.
</para> </para>
</refsect2>
<refsect2 id="R2-SQL-CREATEVIEW-4">
<refsect2info>
<date>1998-09-21</date>
</refsect2info>
<title>
Bugs
</title>
<para> <para>
Currently, views are read only. Use the <command>DROP VIEW</command> statement to drop views.
</para> </para>
</refsect2> </refsect2>
</refsect1> </refsect1>
...@@ -174,8 +172,6 @@ C_701|There's a Girl in my Soup|107|1970-06-11|Comedy | 01:36 ...@@ -174,8 +172,6 @@ C_701|There's a Girl in my Soup|107|1970-06-11|Comedy | 01:36
<title> <title>
Compatibility Compatibility
</title> </title>
<para>
</para>
<refsect2 id="R2-SQL-CREATEVIEW-5"> <refsect2 id="R2-SQL-CREATEVIEW-5">
<refsect2info> <refsect2info>
...@@ -210,6 +206,7 @@ CREATE VIEW <replaceable class="parameter">view</replaceable> [ <replaceable cla ...@@ -210,6 +206,7 @@ CREATE VIEW <replaceable class="parameter">view</replaceable> [ <replaceable cla
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>LOCAL</term> <term>LOCAL</term>
<listitem> <listitem>
...@@ -218,6 +215,7 @@ CREATE VIEW <replaceable class="parameter">view</replaceable> [ <replaceable cla ...@@ -218,6 +215,7 @@ CREATE VIEW <replaceable class="parameter">view</replaceable> [ <replaceable cla
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>CASCADE</term> <term>CASCADE</term>
<listitem> <listitem>
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/createdb.sgml,v 1.5 1999/07/22 15:09:09 thomas Exp $
Postgres documentation
-->
<refentry id="APP-CREATEDB"> <refentry id="APP-CREATEDB">
<refmeta> <refmeta>
<refentrytitle> <refentrytitle id="APP-CREATEDB-TITLE">
<application>createdb</application> <application>createdb</application>
</refentrytitle> </refentrytitle>
<refmiscinfo>Application</refmiscinfo> <refmiscinfo>Application</refmiscinfo>
...@@ -15,7 +20,7 @@ ...@@ -15,7 +20,7 @@
</refnamediv> </refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
<refsynopsisdivinfo> <refsynopsisdivinfo>
<date>1998-10-02</date> <date>1999-07-20</date>
</refsynopsisdivinfo> </refsynopsisdivinfo>
<synopsis> <synopsis>
createdb [ <replaceable class="parameter">dbname</replaceable> ] createdb [ <replaceable class="parameter">dbname</replaceable> ]
...@@ -224,8 +229,7 @@ createdb: database creation failed on <replaceable class="parameter">dbname</rep ...@@ -224,8 +229,7 @@ createdb: database creation failed on <replaceable class="parameter">dbname</rep
<envar>PGREALM</envar> <envar>PGREALM</envar>
environment variables will be passed on to environment variables will be passed on to
<application>psql</application> <application>psql</application>
and processed as described in <xref endterm="psql-ref" and processed as described in <xref endterm="app-psql-title" linkend="app-psql-title">.
linkend="app-psql">.
</para> </para>
</refsect1> </refsect1>
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/createuser.sgml,v 1.5 1999/07/22 15:09:09 thomas Exp $
Postgres documentation
-->
<refentry id="APP-CREATEUSER"> <refentry id="APP-CREATEUSER">
<refmeta> <refmeta>
<refentrytitle> <refentrytitle id="APP-CREATEUSER-TITLE">
<application>createuser</application> <application>createuser</application>
</refentrytitle> </refentrytitle>
<refmiscinfo>Application</refmiscinfo> <refmiscinfo>Application</refmiscinfo>
...@@ -15,7 +20,7 @@ ...@@ -15,7 +20,7 @@
</refnamediv> </refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
<refsynopsisdivinfo> <refsynopsisdivinfo>
<date>1998-10-02</date> <date>1999-07-20</date>
</refsynopsisdivinfo> </refsynopsisdivinfo>
<synopsis> <synopsis>
createuser [ <replaceable class="parameter">username</replaceable> ] createuser [ <replaceable class="parameter">username</replaceable> ]
...@@ -246,7 +251,8 @@ database access failed ...@@ -246,7 +251,8 @@ database access failed
<envar>PGREALM</envar> <envar>PGREALM</envar>
environment variables will be passed on to environment variables will be passed on to
<application>psql</application> <application>psql</application>
and processed as described in <xref endterm="psql-ref" linkend="app-psql">. and processed as described in
<xref endterm="app-psql-title" linkend="app-psql-title">.
</para> </para>
<para> <para>
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/Attic/current_date.sgml,v 1.4 1999/07/22 15:09:09 thomas Exp $
Postgres documentation
-->
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/Attic/current_date.sgml,v 1.4 1999/07/22 15:09:09 thomas Exp $
Postgres documentation
-->
<REFENTRY ID="SQL-CURRENT-DATE"> <REFENTRY ID="SQL-CURRENT-DATE">
<REFMETA> <REFMETA>
<REFENTRYTITLE> <REFENTRYTITLE>
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/Attic/current_time.sgml,v 1.4 1999/07/22 15:09:09 thomas Exp $
Postgres documentation
-->
<REFENTRY ID="SQL-CURRENT-TIME"> <REFENTRY ID="SQL-CURRENT-TIME">
<REFMETA> <REFMETA>
<REFENTRYTITLE> <REFENTRYTITLE>
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/Attic/current_timestamp.sgml,v 1.4 1999/07/22 15:09:09 thomas Exp $
Postgres documentation
-->
<REFENTRY ID="SQL-CURRENT-TIMESTAMP"> <REFENTRY ID="SQL-CURRENT-TIMESTAMP">
<REFMETA> <REFMETA>
<REFENTRYTITLE> <REFENTRYTITLE>
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/Attic/current_user.sgml,v 1.4 1999/07/22 15:09:09 thomas Exp $
Postgres documentation
-->
<REFENTRY ID="SQL-CURRENT-USER"> <REFENTRY ID="SQL-CURRENT-USER">
<REFMETA> <REFMETA>
<REFENTRYTITLE> <REFENTRYTITLE>
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/declare.sgml,v 1.7 1999/07/22 15:09:09 thomas Exp $
Postgres documentation
-->
<refentry id="SQL-DECLARE"> <refentry id="SQL-DECLARE">
<refmeta> <refmeta>
<refentrytitle> <refentrytitle id="SQL-DECLARE-TITLE">
DECLARE DECLARE
</refentrytitle> </refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo> <refmiscinfo>SQL - Language Statements</refmiscinfo>
...@@ -15,7 +20,7 @@ ...@@ -15,7 +20,7 @@
</refnamediv> </refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
<refsynopsisdivinfo> <refsynopsisdivinfo>
<date>1998-09-04</date> <date>1999-07-20</date>
</refsynopsisdivinfo> </refsynopsisdivinfo>
<synopsis> <synopsis>
DECLARE <replaceable class="parameter">cursor</replaceable> [ BINARY ] [ INSENSITIVE ] [ SCROLL ] DECLARE <replaceable class="parameter">cursor</replaceable> [ BINARY ] [ INSENSITIVE ] [ SCROLL ]
...@@ -181,27 +186,25 @@ ERROR: Named portals may only be used in begin/end transaction blocks ...@@ -181,27 +186,25 @@ ERROR: Named portals may only be used in begin/end transaction blocks
Description Description
</title> </title>
<para> <para>
<command>DECLARE</command> allows a user to create cursors, which can be used to retrieve <command>DECLARE</command> allows a user to create cursors, which
a small number of rows at a time out of a larger query. Cursors can return can be used to retrieve
data either in text or in binary foramt. a small number of rows at a time out of a larger query. Cursors can
return data either in text or in binary format using
<xref linkend="sql-fetch-title" endterm="sql-fetch-title">.
</para> </para>
<para> <para>
Normal cursors return data in text format, either ASCII or another Normal cursors return data in text format, either ASCII or another
encoding scheme depending on how the <productname>Postgres</productname> encoding scheme depending on how the <productname>Postgres</productname>
backend was built. Since backend was built. Since
data is stored natively in binary format, the system must data is stored natively in binary format, the system must
do a conversion to produce the text format. In addition, do a conversion to produce the text format. In addition,
text formats are often larger in size than the corresponding binary format. text formats are often larger in size than the corresponding binary format.
Once the information comes back in text form, the client Once the information comes back in text form, the client
application may have to convert it to a binary format to application may need to convert it to a binary format to
manipulate it anyway. manipulate it.
</para>
<para>
BINARY cursors give you back the data in the native binary BINARY cursors give you back the data in the native binary
representation. So binary cursors will tend to be a representation.
little faster since they suffer less conversion overhead.
</para> </para>
<para> <para>
...@@ -209,23 +212,26 @@ ERROR: Named portals may only be used in begin/end transaction blocks ...@@ -209,23 +212,26 @@ ERROR: Named portals may only be used in begin/end transaction blocks
you would get a string of '1' with a default cursor you would get a string of '1' with a default cursor
whereas with a binary cursor you would get whereas with a binary cursor you would get
a 4-byte value equal to control-A ('^A'). a 4-byte value equal to control-A ('^A').
</para>
<caution> <para>
<para> BINARY cursors should be used carefully. User applications such
BINARY cursors should be used carefully. User applications such as <application>psql</application> are not aware of binary cursors
as <application>psql</application> are not aware of binary cursors and expect data to come back in a text format.
and expect data to come back in a text format.
</para>
</caution>
</para> </para>
<para> <para>
However, string representation is architecture-neutral whereas binary String representation is architecture-neutral whereas binary
representation can differ between different machine architectures. representation can differ between different machine architectures
and <emphasis><productname>Postgres</productname> does not resolve
byte ordering or representation issues for binary cursors</emphasis>.
Therefore, if your client machine and server machine use different Therefore, if your client machine and server machine use different
representations (e.g. "big-endian" versus "little-endian"), 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. binary format.
However, binary cursors may be a
little more efficient since there is less conversion overhead in
the server to client data transfer.
<tip> <tip>
<para> <para>
...@@ -243,23 +249,26 @@ ERROR: Named portals may only be used in begin/end transaction blocks ...@@ -243,23 +249,26 @@ ERROR: Named portals may only be used in begin/end transaction blocks
<title> <title>
Notes Notes
</title> </title>
<para> <para>
Cursors are only available in transactions. Cursors are only available in transactions. Use to
<xref linkend="sql-begin-title" endterm="sql-begin-title">,
<xref linkend="sql-commit-title" endterm="sql-commit-title">
and
<xref linkend="sql-rollback-title" endterm="sql-rollback-title">
to define a transaction block.
</para> </para>
<para> <para>
<productname>Postgres</productname> In <acronym>SQL92</acronym> cursors are only available in
does not have an explicit <command>OPEN cursor</command> embedded <acronym>SQL</acronym> (<acronym>ESQL</acronym>) applications.
The <productname>Postgres</productname> backend
does not implement an explicit <command>OPEN cursor</command>
statement; a cursor is considered to be open when it is declared. statement; a cursor is considered to be open when it is declared.
However, <application>ecpg</application>, the
<note> embedded SQL preprocessor for <productname>Postgres</productname>,
<para> supports the <acronym>SQL92</acronym> cursor conventions, including those
In <acronym>SQL92</acronym> cursors are only available in involving DECLARE and OPEN statements.
embedded applications. <application>ecpg</application>, the
embedded SQL preprocessor for <productname>Postgres</productname>,
supports the <acronym>SQL92</acronym> conventions, including those
involving DECLARE and OPEN statements.
</para>
</note>
</para> </para>
</refsect2> </refsect2>
</refsect1> </refsect1>
...@@ -282,8 +291,6 @@ DECLARE liahona CURSOR ...@@ -282,8 +291,6 @@ DECLARE liahona CURSOR
<title> <title>
Compatibility Compatibility
</title> </title>
<para>
</para>
<refsect2 id="R2-SQL-DECLARESTATEMENT-4"> <refsect2 id="R2-SQL-DECLARESTATEMENT-4">
<refsect2info> <refsect2info>
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/delete.sgml,v 1.7 1999/07/22 15:09:09 thomas Exp $
Postgres documentation
-->
<refentry id="SQL-DELETE"> <refentry id="SQL-DELETE">
<refmeta> <refmeta>
<refentrytitle> <refentrytitle id="SQL-DELETE-TITLE">
DELETE DELETE
</refentrytitle> </refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo> <refmiscinfo>SQL - Language Statements</refmiscinfo>
...@@ -16,7 +21,7 @@ ...@@ -16,7 +21,7 @@
</refnamediv> </refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
<refsynopsisdivinfo> <refsynopsisdivinfo>
<date>1998-04-15</date> <date>1999-07-20</date>
</refsynopsisdivinfo> </refsynopsisdivinfo>
<synopsis> <synopsis>
DELETE FROM <replaceable class="PARAMETER">table</replaceable> [ WHERE <replaceable class="PARAMETER">condition</replaceable> ] DELETE FROM <replaceable class="PARAMETER">table</replaceable> [ WHERE <replaceable class="PARAMETER">condition</replaceable> ]
...@@ -93,15 +98,18 @@ DELETE <replaceable class="parameter">count</replaceable> ...@@ -93,15 +98,18 @@ DELETE <replaceable class="parameter">count</replaceable>
<title> <title>
Description Description
</title> </title>
<para> <para>
<command>DELETE</command> removes rows which satisfy the WHERE <command>DELETE</command> removes rows which satisfy the WHERE
clause from the specified table. clause from the specified table.
</para> </para>
<para> <para>
If the <firstterm>condition</firstterm> (WHERE clause) is absent, If the <firstterm>condition</firstterm> (WHERE clause) is absent,
the effect is to delete all rows in the table. the effect is to delete all rows in the table.
The result is a valid, but empty table. The result is a valid, but empty table.
</para> </para>
<para> <para>
You must have write access to the table in order to modify You must have write access to the table in order to modify
it, as well as read access to any table whose values are it, as well as read access to any table whose values are
...@@ -119,12 +127,14 @@ DELETE <replaceable class="parameter">count</replaceable> ...@@ -119,12 +127,14 @@ DELETE <replaceable class="parameter">count</replaceable>
DELETE FROM films WHERE kind &lt;&gt; 'Musical'; DELETE FROM films WHERE kind &lt;&gt; 'Musical';
SELECT * FROM films; SELECT * FROM films;
<computeroutput>
code |title |did| date_prod|kind |len code |title |did| date_prod|kind |len
-----+-------------------------+---+----------+----------+------ -----+-------------------------+---+----------+----------+------
UA501|West Side Story |105|1961-01-03|Musical | 02:32 UA501|West Side Story |105|1961-01-03|Musical | 02:32
TC901|The King and I |109|1956-08-11|Musical | 02:13 TC901|The King and I |109|1956-08-11|Musical | 02:13
WD101|Bed Knobs and Broomsticks|111| |Musical | 01:57 WD101|Bed Knobs and Broomsticks|111| |Musical | 01:57
(3 rows) (3 rows)
</computeroutput>
</programlisting> </programlisting>
</para> </para>
...@@ -134,9 +144,11 @@ WD101|Bed Knobs and Broomsticks|111| |Musical | 01:57 ...@@ -134,9 +144,11 @@ WD101|Bed Knobs and Broomsticks|111| |Musical | 01:57
DELETE FROM films; DELETE FROM films;
SELECT * FROM films; SELECT * FROM films;
<computeroutput>
code|title|did|date_prod|kind|len code|title|did|date_prod|kind|len
----+-----+---+---------+----+--- ----+-----+---+---------+----+---
(0 rows) (0 rows)
</computeroutput>
</programlisting> </programlisting>
</para> </para>
</refsect1> </refsect1>
...@@ -145,8 +157,6 @@ code|title|did|date_prod|kind|len ...@@ -145,8 +157,6 @@ code|title|did|date_prod|kind|len
<title> <title>
Compatibility Compatibility
</title> </title>
<para>
</para>
<refsect2 id="R2-SQL-DELETE-4"> <refsect2 id="R2-SQL-DELETE-4">
<refsect2info> <refsect2info>
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/Attic/destroydb.sgml,v 1.5 1999/07/22 15:09:10 thomas Exp $
Postgres documentation
-->
<refentry id="APP-DESTROYDB"> <refentry id="APP-DESTROYDB">
<refmeta> <refmeta>
<refentrytitle> <refentrytitle id="APP-DESTROYDB-TITLE">
<application>destroydb</application> <application>destroydb</application>
</refentrytitle> </refentrytitle>
<refmiscinfo>Application</refmiscinfo> <refmiscinfo>Application</refmiscinfo>
...@@ -15,7 +20,7 @@ ...@@ -15,7 +20,7 @@
</refnamediv> </refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
<refsynopsisdivinfo> <refsynopsisdivinfo>
<date>1998-10-02</date> <date>1999-07-20</date>
</refsynopsisdivinfo> </refsynopsisdivinfo>
<synopsis> <synopsis>
destroydb [ <replaceable class="parameter">dbname</replaceable> ] destroydb [ <replaceable class="parameter">dbname</replaceable> ]
...@@ -230,8 +235,7 @@ destroydb: database destroy failed on <replaceable class="parameter">dbname</rep ...@@ -230,8 +235,7 @@ destroydb: database destroy failed on <replaceable class="parameter">dbname</rep
<envar>PGREALM</envar> <envar>PGREALM</envar>
environment variables will be passed on to environment variables will be passed on to
<application>psql</application> <application>psql</application>
and processed as described in <xref endterm="psql-ref" and processed as described in <xref endterm="app-psql-title" linkend="app-psql-title">.
linkend="app-psql">.
</para> </para>
</refsect1> </refsect1>
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/Attic/destroyuser.sgml,v 1.5 1999/07/22 15:09:10 thomas Exp $
Postgres documentation
-->
<refentry id="APP-DESTROYUSER"> <refentry id="APP-DESTROYUSER">
<refmeta> <refmeta>
<refentrytitle> <refentrytitle id="APP-DESTROYUSER-TITLE">
<application>destroyuser</application> <application>destroyuser</application>
</refentrytitle> </refentrytitle>
<refmiscinfo>Application</refmiscinfo> <refmiscinfo>Application</refmiscinfo>
...@@ -15,7 +20,7 @@ ...@@ -15,7 +20,7 @@
</refnamediv> </refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
<refsynopsisdivinfo> <refsynopsisdivinfo>
<date>1998-10-02</date> <date>1999-07-20</date>
</refsynopsisdivinfo> </refsynopsisdivinfo>
<synopsis> <synopsis>
destroyuser [ <replaceable class="parameter">username</replaceable> ] destroyuser [ <replaceable class="parameter">username</replaceable> ]
...@@ -225,9 +230,9 @@ delete of user <replaceable class="parameter">username</replaceable> was UNSUCCE ...@@ -225,9 +230,9 @@ delete of user <replaceable class="parameter">username</replaceable> was UNSUCCE
<envar>PGREALM</envar> <envar>PGREALM</envar>
environment variables will be passed on to environment variables will be passed on to
<application>psql</application> <application>psql</application>
and processed as described in <xref endterm="psql-ref" and processed as described in <xref endterm="app-psql-title" linkend="app-psql-title">.
linkend="app-psql">.
</para> </para>
<para> <para>
Once invoked, <application>destroyuser</application> Once invoked, <application>destroyuser</application>
will warn you about the databases that will be destroyed in the will warn you about the databases that will be destroyed in the
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_aggregate.sgml,v 1.6 1999/07/22 15:09:10 thomas Exp $
Postgres documentation
-->
<refentry id="SQL-DROPAGGREGATE"> <refentry id="SQL-DROPAGGREGATE">
<refmeta> <refmeta>
<refentrytitle> <refentrytitle id="SQL-DROPAGGREGATE-TITLE">
DROP AGGREGATE DROP AGGREGATE
</refentrytitle> </refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo> <refmiscinfo>SQL - Language Statements</refmiscinfo>
...@@ -15,7 +20,7 @@ ...@@ -15,7 +20,7 @@
</refnamediv> </refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
<refsynopsisdivinfo> <refsynopsisdivinfo>
<date>1998-04-15</date> <date>1999-07-20</date>
</refsynopsisdivinfo> </refsynopsisdivinfo>
<synopsis> <synopsis>
DROP AGGREGATE <replaceable class="PARAMETER">name</replaceable> <replaceable class="PARAMETER">type</replaceable> DROP AGGREGATE <replaceable class="PARAMETER">name</replaceable> <replaceable class="PARAMETER">type</replaceable>
...@@ -109,14 +114,11 @@ WARN RemoveAggregate: aggregate '<replaceable class="parameter">agg</replaceable ...@@ -109,14 +114,11 @@ WARN RemoveAggregate: aggregate '<replaceable class="parameter">agg</replaceable
<title> <title>
Notes Notes
</title> </title>
<para> <para>
The <command>DROP AGGREGATE</command> statement is a Use
<productname>Postgres</productname> <xref linkend="sql-createaggregate-title" endterm="sql-createaggregate-title">
language extension. to create aggregate functions.
</para>
<para>
Refer to the <command>CREATE AGGREGATE</command> statement to
create aggregate functions.
</para> </para>
</refsect2> </refsect2>
</refsect1> </refsect1>
...@@ -138,8 +140,6 @@ DROP AGGREGATE myavg int4; ...@@ -138,8 +140,6 @@ DROP AGGREGATE myavg int4;
<title> <title>
Compatibility Compatibility
</title> </title>
<para>
</para>
<refsect2 id="R2-SQL-DROPAGGREGATE-4"> <refsect2 id="R2-SQL-DROPAGGREGATE-4">
<refsect2info> <refsect2info>
...@@ -148,8 +148,12 @@ DROP AGGREGATE myavg int4; ...@@ -148,8 +148,12 @@ DROP AGGREGATE myavg int4;
<title> <title>
SQL92 SQL92
</title> </title>
<para> <para>
There is no DROP AGGREGATE statement in <acronym>SQL92</acronym>. There is no <command>DROP AGGREGATE</command> statement
in <acronym>SQL92</acronym>; the statement is a
<productname>Postgres</productname>
language extension.
</para> </para>
</refsect2> </refsect2>
</refsect1> </refsect1>
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_database.sgml,v 1.6 1999/07/22 15:09:10 thomas Exp $
Postgres documentation
-->
<refentry id="SQL-DROPDATABASE"> <refentry id="SQL-DROPDATABASE">
<refmeta> <refmeta>
<refentrytitle> <refentrytitle id="SQL-DROPDATABASE-TITLE">
DROP DATABASE DROP DATABASE
</refentrytitle> </refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo> <refmiscinfo>SQL - Language Statements</refmiscinfo>
...@@ -15,7 +20,7 @@ ...@@ -15,7 +20,7 @@
</refnamediv> </refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
<refsynopsisdivinfo> <refsynopsisdivinfo>
<date>1998-04-15</date> <date>1999-07-20</date>
</refsynopsisdivinfo> </refsynopsisdivinfo>
<synopsis> <synopsis>
DROP DATABASE <replaceable class="PARAMETER">name</replaceable> DROP DATABASE <replaceable class="PARAMETER">name</replaceable>
...@@ -110,21 +115,17 @@ WARN: destroydb: database "<replaceable class="parameter">name</replaceable>" do ...@@ -110,21 +115,17 @@ WARN: destroydb: database "<replaceable class="parameter">name</replaceable>" do
</title> </title>
<para> <para>
<command>DROP DATABASE</command> statement is a <productname>Postgres</productname> This query cannot be executed while connected to the target
language extension. database. It is usually preferable to use
<xref linkend="app-destroydb-title" endterm="app-destroydb-title">
<tip> instead.
<para>
This query cannot be executed while connected to the target
database. It is usually preferable to use the
<command>destroydb</command> script instead.
</para>
</tip>
</para> </para>
<para> <para>
Refer to the <command>CREATE DATABASE</command> statement for Refer to
information on how to create a database. <xref linkend="app-createdb-title" endterm="app-createdb-title"> and
<xref linkend="sql-createdatabase-title" endterm="sql-createdatabase-title">
for information on how to create a database.
</para> </para>
</refsect2> </refsect2>
</refsect1> </refsect1>
...@@ -133,8 +134,6 @@ WARN: destroydb: database "<replaceable class="parameter">name</replaceable>" do ...@@ -133,8 +134,6 @@ WARN: destroydb: database "<replaceable class="parameter">name</replaceable>" do
<title> <title>
Compatibility Compatibility
</title> </title>
<para>
</para>
<refsect2 id="R2-SQL-DROPDATABASE-4"> <refsect2 id="R2-SQL-DROPDATABASE-4">
<refsect2info> <refsect2info>
...@@ -143,8 +142,11 @@ WARN: destroydb: database "<replaceable class="parameter">name</replaceable>" do ...@@ -143,8 +142,11 @@ WARN: destroydb: database "<replaceable class="parameter">name</replaceable>" do
<title> <title>
SQL92 SQL92
</title> </title>
<para> <para>
There is no <command>DROP DATABASE</command> in <acronym>SQL92</acronym>. <command>DROP DATABASE</command> statement is a
<productname>Postgres</productname> language extension;
there is no such command in <acronym>SQL92</acronym>.
</para> </para>
</refsect2> </refsect2>
</refsect1> </refsect1>
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_function.sgml,v 1.7 1999/07/22 15:09:10 thomas Exp $
Postgres documentation
-->
<refentry id="SQL-DROPFUNCTION"> <refentry id="SQL-DROPFUNCTION">
<refmeta> <refmeta>
<refentrytitle> <refentrytitle id="SQL-DROPFUNCTION-TITLE">
DROP FUNCTION DROP FUNCTION
</refentrytitle> </refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo> <refmiscinfo>SQL - Language Statements</refmiscinfo>
...@@ -15,7 +20,7 @@ ...@@ -15,7 +20,7 @@
</refnamediv> </refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
<refsynopsisdivinfo> <refsynopsisdivinfo>
<date>1998-04-15</date> <date>1999-07-20</date>
</refsynopsisdivinfo> </refsynopsisdivinfo>
<synopsis> <synopsis>
DROP FUNCTION <replaceable class="parameter">name</replaceable> ( [ <replaceable class="parameter">type</replaceable> [, ...] ] ) DROP FUNCTION <replaceable class="parameter">name</replaceable> ( [ <replaceable class="parameter">type</replaceable> [, ...] ] )
...@@ -108,9 +113,16 @@ WARN RemoveFunction: Function "<replaceable class="parameter">name</replaceable> ...@@ -108,9 +113,16 @@ WARN RemoveFunction: Function "<replaceable class="parameter">name</replaceable>
<title> <title>
Notes Notes
</title> </title>
<para>
Refer to
<xref linkend="sql-createfunction-title" endterm="sql-createfunction-title">
for information on creating aggregate functions.
</para>
<para> <para>
Refer to <command>CREATE FUNCTION</command> No checks are made to ensure that types, operators or access
to create aggregate functions. methods that rely on the function have been removed first.
</para> </para>
</refsect2> </refsect2>
</refsect1> </refsect1>
...@@ -119,6 +131,7 @@ WARN RemoveFunction: Function "<replaceable class="parameter">name</replaceable> ...@@ -119,6 +131,7 @@ WARN RemoveFunction: Function "<replaceable class="parameter">name</replaceable>
<title> <title>
Usage Usage
</title> </title>
<para> <para>
This command removes the square root function: This command removes the square root function:
...@@ -128,25 +141,26 @@ DROP FUNCTION sqrt(int4); ...@@ -128,25 +141,26 @@ DROP FUNCTION sqrt(int4);
</para> </para>
</refsect1> </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"> <refsect1 id="R1-SQL-DROPFUNCTION-4">
<title> <title>
Compatibility Compatibility
</title> </title>
<para>
DROP FUNCTION is a <productname>Postgres</productname> language extension.
</para>
<refsect2 id="R2-SQL-DROPFUNCTION-4"> <refsect2 id="R2-SQL-DROPFUNCTION-4">
<refsect2info>
<date>1999-07-20</date>
</refsect2info>
<title>
SQL92
</title>
<para>
<command>DROP FUNCTION</command>
is a <productname>Postgres</productname> language extension.
</para>
</refsect2>
<refsect2 id="R2-SQL-DROPFUNCTION-5">
<refsect2info> <refsect2info>
<date>1998-04-15</date> <date>1998-04-15</date>
</refsect2info> </refsect2info>
...@@ -156,9 +170,10 @@ DROP FUNCTION sqrt(int4); ...@@ -156,9 +170,10 @@ DROP FUNCTION sqrt(int4);
<para> <para>
SQL/PSM is a proposed standard to enable function extensibility. SQL/PSM is a proposed standard to enable function extensibility.
The SQL/PSM DROP FUNCTION statement has the following syntax: The SQL/PSM DROP FUNCTION statement has the following syntax:
<programlisting>
<synopsis>
DROP [ SPECIFIC ] FUNCTION <replaceable class="parameter">name</replaceable> { RESTRICT | CASCADE } DROP [ SPECIFIC ] FUNCTION <replaceable class="parameter">name</replaceable> { RESTRICT | CASCADE }
</programlisting> </synopsis>
</para> </para>
</refsect2> </refsect2>
</refsect1> </refsect1>
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_index.sgml,v 1.7 1999/07/22 15:09:10 thomas Exp $
Postgres documentation
-->
<refentry id="SQL-DROPINDEX"> <refentry id="SQL-DROPINDEX">
<refmeta> <refmeta>
<refentrytitle> <refentrytitle id="SQL-DROPINDEX-TITLE">
DROP INDEX DROP INDEX
</refentrytitle> </refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo> <refmiscinfo>SQL - Language Statements</refmiscinfo>
...@@ -15,7 +20,7 @@ ...@@ -15,7 +20,7 @@
</refnamediv> </refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
<refsynopsisdivinfo> <refsynopsisdivinfo>
<date>1998-04-15</date> <date>1999-07-20</date>
</refsynopsisdivinfo> </refsynopsisdivinfo>
<synopsis> <synopsis>
DROP INDEX <replaceable class="PARAMETER">index_name</replaceable> DROP INDEX <replaceable class="PARAMETER">index_name</replaceable>
...@@ -102,8 +107,9 @@ ERROR: index "<replaceable class="PARAMETER">index_name</replaceable>" nonexiste ...@@ -102,8 +107,9 @@ ERROR: index "<replaceable class="PARAMETER">index_name</replaceable>" nonexiste
language extension. language extension.
</para> </para>
<para> <para>
Refer to the <command>CREATE INDEX</command> statement for Refer to
information on how to create indexes. <xref linkend="sql-createindex-title" endterm="sql-createindex-title">
for information on how to create indexes.
</para> </para>
</refsect2> </refsect2>
</refsect1> </refsect1>
...@@ -125,8 +131,6 @@ ERROR: index "<replaceable class="PARAMETER">index_name</replaceable>" nonexiste ...@@ -125,8 +131,6 @@ ERROR: index "<replaceable class="PARAMETER">index_name</replaceable>" nonexiste
<title> <title>
Compatibility Compatibility
</title> </title>
<para>
</para>
<refsect2 id="R2-SQL-DROPINDEX-4"> <refsect2 id="R2-SQL-DROPINDEX-4">
<refsect2info> <refsect2info>
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_language.sgml,v 1.7 1999/07/22 15:09:10 thomas Exp $
Postgres documentation
-->
<refentry id="SQL-DROPLANGUAGE"> <refentry id="SQL-DROPLANGUAGE">
<refmeta> <refmeta>
<refentrytitle> <refentrytitle id="SQL-DROPLANGUAGE-TITLE">
DROP LANGUAGE DROP LANGUAGE
</refentrytitle> </refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo> <refmiscinfo>SQL - Language Statements</refmiscinfo>
...@@ -15,7 +20,7 @@ ...@@ -15,7 +20,7 @@
</refnamediv> </refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
<refsynopsisdivinfo> <refsynopsisdivinfo>
<date>1998-04-15</date> <date>1999-07-20</date>
</refsynopsisdivinfo> </refsynopsisdivinfo>
<synopsis> <synopsis>
DROP PROCEDURAL LANGUAGE '<replaceable class="PARAMETER">name</replaceable>' DROP PROCEDURAL LANGUAGE '<replaceable class="PARAMETER">name</replaceable>'
...@@ -104,18 +109,11 @@ ERROR: Language "<replaceable class="parameter">name</replaceable>" doesn't exis ...@@ -104,18 +109,11 @@ ERROR: Language "<replaceable class="parameter">name</replaceable>" doesn't exis
a <productname>Postgres</productname> language extension. a <productname>Postgres</productname> language extension.
</para> </para>
<para> <para>
Refer to <command>CREATE PROCEDURAL LANGUAGE</command> Refer to
<xref linkend="sql-createlanguage-title" endterm="sql-createlanguage-title">
for information on how to create procedural languages. for information on how to create procedural languages.
</para> </para>
</refsect2>
<refsect2 id="R2-SQL-DROPLANGUAGE-4">
<refsect2info>
<date>1998-04-15</date>
</refsect2info>
<title>
Bugs
</title>
<para> <para>
No checks are made if functions or trigger procedures registered No checks are made if functions or trigger procedures registered
in this language still exist. To re-enable them without having in this language still exist. To re-enable them without having
...@@ -143,8 +141,6 @@ DROP PROCEDURAL LANGUAGE 'plsample'; ...@@ -143,8 +141,6 @@ DROP PROCEDURAL LANGUAGE 'plsample';
<title> <title>
Compatibility Compatibility
</title> </title>
<para>
</para>
<refsect2 id="R2-SQL-DROPLANGUAGE-5"> <refsect2 id="R2-SQL-DROPLANGUAGE-5">
<refsect2info> <refsect2info>
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_operator.sgml,v 1.6 1999/07/22 15:09:10 thomas Exp $
Postgres documentation
-->
<refentry id="SQL-DROPOPERATOR"> <refentry id="SQL-DROPOPERATOR">
<refmeta> <refmeta>
<refentrytitle> <refentrytitle id="SQL-DROPOPERATOR-TITLE">
DROP OPERATOR DROP OPERATOR
</refentrytitle> </refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo> <refmiscinfo>SQL - Language Statements</refmiscinfo>
...@@ -16,7 +21,7 @@ ...@@ -16,7 +21,7 @@
<refsynopsisdiv> <refsynopsisdiv>
<refsynopsisdivinfo> <refsynopsisdivinfo>
<date>1998-09-22</date> <date>1999-07-20</date>
</refsynopsisdivinfo> </refsynopsisdivinfo>
<synopsis> <synopsis>
DROP OPERATOR <replaceable class="PARAMETER">id</replaceable> ( <replaceable class="PARAMETER">type</replaceable> | NONE [,...] ) DROP OPERATOR <replaceable class="PARAMETER">id</replaceable> ( <replaceable class="PARAMETER">type</replaceable> | NONE [,...] )
...@@ -138,8 +143,9 @@ ERROR: RemoveOperator: right unary operator '<replaceable class="PARAMETER">ope ...@@ -138,8 +143,9 @@ ERROR: RemoveOperator: right unary operator '<replaceable class="PARAMETER">ope
language extension. language extension.
</para> </para>
<para> <para>
Refer to <command>CREATE OPERATOR</command> for Refer to
information on how to create operators. <xref linkend="sql-createoperator-title" endterm="sql-createoperator-title">
for information on how to create operators.
</para> </para>
<para> <para>
It is the user's responsibility to remove any access methods and It is the user's responsibility to remove any access methods and
...@@ -178,8 +184,6 @@ DROP OPERATOR ! (int4, none); ...@@ -178,8 +184,6 @@ DROP OPERATOR ! (int4, none);
<title> <title>
Compatibility Compatibility
</title> </title>
<para>
</para>
<refsect2 id="R2-SQL-DROPOPERATOR-4"> <refsect2 id="R2-SQL-DROPOPERATOR-4">
<refsect2info> <refsect2info>
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_rule.sgml,v 1.6 1999/07/22 15:09:10 thomas Exp $
Postgres documentation
-->
<refentry id="SQL-DROPRULE"> <refentry id="SQL-DROPRULE">
<refmeta> <refmeta>
<refentrytitle> <refentrytitle id="SQL-DROPRULE-TITLE">
DROP RULE DROP RULE
</refentrytitle> </refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo> <refmiscinfo>SQL - Language Statements</refmiscinfo>
...@@ -103,19 +108,12 @@ ERROR: RewriteGetRuleEventRel: rule "<replaceable class="parameter">name</repla ...@@ -103,19 +108,12 @@ ERROR: RewriteGetRuleEventRel: rule "<replaceable class="parameter">name</repla
<productname>Postgres</productname> <productname>Postgres</productname>
language extension. language extension.
</para> </para>
<para> <para>
Refer to <command>CREATE RULE</command> for Refer to <command>CREATE RULE</command> for
information on how to create rules. information on how to create rules.
</para> </para>
</refsect2>
<refsect2 id="R2-SQL-DROPRULE-4">
<refsect2info>
<date>1998-09-22</date>
</refsect2info>
<title>
Bugs
</title>
<para> <para>
Once a rule is dropped, access to historical information Once a rule is dropped, access to historical information
the rule has written may disappear. the rule has written may disappear.
...@@ -140,9 +138,7 @@ DROP RULE newrule; ...@@ -140,9 +138,7 @@ DROP RULE newrule;
<title> <title>
Compatibility Compatibility
</title> </title>
<para>
</para>
<refsect2 id="R2-SQL-DROPRULE-5"> <refsect2 id="R2-SQL-DROPRULE-5">
<refsect2info> <refsect2info>
<date>1998-09-22</date> <date>1998-09-22</date>
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_sequence.sgml,v 1.6 1999/07/22 15:09:10 thomas Exp $
Postgres documentation
-->
<refentry id="SQL-DROPSEQUENCE"> <refentry id="SQL-DROPSEQUENCE">
<refmeta> <refmeta>
<refentrytitle> <refentrytitle id="SQL-DROPSEQUENCE-TITLE">
DROP SEQUENCE DROP SEQUENCE
</refentrytitle> </refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo> <refmiscinfo>SQL - Language Statements</refmiscinfo>
...@@ -15,7 +20,7 @@ ...@@ -15,7 +20,7 @@
</refnamediv> </refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
<refsynopsisdivinfo> <refsynopsisdivinfo>
<date>1998-09-22</date> <date>1999-07-20</date>
</refsynopsisdivinfo> </refsynopsisdivinfo>
<synopsis> <synopsis>
DROP SEQUENCE <replaceable class="PARAMETER">name</replaceable> [, ...] DROP SEQUENCE <replaceable class="PARAMETER">name</replaceable> [, ...]
...@@ -127,8 +132,6 @@ DROP SEQUENCE serial; ...@@ -127,8 +132,6 @@ DROP SEQUENCE serial;
<title> <title>
Compatibility Compatibility
</title> </title>
<para>
</para>
<refsect2 id="R2-SQL-DROPSEQUENCE-4"> <refsect2 id="R2-SQL-DROPSEQUENCE-4">
<refsect2info> <refsect2info>
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_table.sgml,v 1.6 1999/07/22 15:09:11 thomas Exp $
Postgres documentation
-->
<refentry id="SQL-DROPTABLE"> <refentry id="SQL-DROPTABLE">
<refmeta> <refmeta>
<refentrytitle> <refentrytitle id="SQL-DROPTABLE-TITLE">
DROP TABLE DROP TABLE
</refentrytitle> </refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo> <refmiscinfo>SQL - Language Statements</refmiscinfo>
...@@ -15,7 +20,7 @@ ...@@ -15,7 +20,7 @@
</refnamediv> </refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
<refsynopsisdivinfo> <refsynopsisdivinfo>
<date>1998-09-22</date> <date>1999-07-20</date>
</refsynopsisdivinfo> </refsynopsisdivinfo>
<synopsis> <synopsis>
DROP TABLE <replaceable class="PARAMETER">name</replaceable> [, ...] DROP TABLE <replaceable class="PARAMETER">name</replaceable> [, ...]
...@@ -127,8 +132,6 @@ DROP TABLE films, distributors; ...@@ -127,8 +132,6 @@ DROP TABLE films, distributors;
<title> <title>
Compatibility Compatibility
</title> </title>
<para>
</para>
<refsect2 id="R2-SQL-DROPTABLE-4"> <refsect2 id="R2-SQL-DROPTABLE-4">
<refsect2info> <refsect2info>
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_trigger.sgml,v 1.6 1999/07/22 15:09:11 thomas Exp $
Postgres documentation
-->
<refentry id="SQL-DROPTRIGGER"> <refentry id="SQL-DROPTRIGGER">
<refmeta> <refmeta>
<refentrytitle> <refentrytitle id="SQL-DROPTRIGGER-TITLE">
DROP TRIGGER DROP TRIGGER
</refentrytitle> </refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo> <refmiscinfo>SQL - Language Statements</refmiscinfo>
...@@ -135,8 +140,6 @@ DROP TRIGGER if_dist_exists ON films; ...@@ -135,8 +140,6 @@ DROP TRIGGER if_dist_exists ON films;
<title> <title>
Compatibility Compatibility
</title> </title>
<para>
</para>
<refsect2 id="R2-SQL-DROPTRIGGER-4"> <refsect2 id="R2-SQL-DROPTRIGGER-4">
<refsect2info> <refsect2info>
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_type.sgml,v 1.6 1999/07/22 15:09:11 thomas Exp $
Postgres documentation
-->
<refentry id="SQL-DROPTYPE"> <refentry id="SQL-DROPTYPE">
<refmeta> <refmeta>
<refentrytitle> <refentrytitle id="SQL-DROPTYPE-TITLE">
DROP TYPE DROP TYPE
</refentrytitle> </refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo> <refmiscinfo>SQL - Language Statements</refmiscinfo>
...@@ -15,7 +20,7 @@ ...@@ -15,7 +20,7 @@
</refnamediv> </refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
<refsynopsisdivinfo> <refsynopsisdivinfo>
<date>1998-09-22</date> <date>1999-07-20</date>
</refsynopsisdivinfo> </refsynopsisdivinfo>
<synopsis> <synopsis>
DROP TYPE <replaceable class="PARAMETER">typename</replaceable> DROP TYPE <replaceable class="PARAMETER">typename</replaceable>
...@@ -111,15 +116,7 @@ ERROR: RemoveType: type '<replaceable class="parameter">typename</replaceable>' ...@@ -111,15 +116,7 @@ ERROR: RemoveType: type '<replaceable class="parameter">typename</replaceable>'
functions, aggregates, access methods, subtypes, and classes functions, aggregates, access methods, subtypes, and classes
that use a deleted type. that use a deleted type.
</para> </para>
</refsect2>
<refsect2 id="R2-SQL-DROPTYPE-4">
<refsect2info>
<date>1998-09-22</date>
</refsect2info>
<title>
Bugs
</title>
<para> <para>
If a built-in type is removed, the behavior of the backend If a built-in type is removed, the behavior of the backend
is unpredictable. is unpredictable.
...@@ -144,8 +141,6 @@ DROP TYPE box; ...@@ -144,8 +141,6 @@ DROP TYPE box;
<title> <title>
Compatibility Compatibility
</title> </title>
<para>
</para>
<refsect2 id="R2-SQL-DROPTYPE-5"> <refsect2 id="R2-SQL-DROPTYPE-5">
<refsect2info> <refsect2info>
...@@ -155,7 +150,7 @@ DROP TYPE box; ...@@ -155,7 +150,7 @@ DROP TYPE box;
SQL3 SQL3
</title> </title>
<para> <para>
DROP TYPE is a <acronym>SQL3</acronym> statement. <command>DROP TYPE</command> is a <acronym>SQL3</acronym> statement.
</para> </para>
</refsect2> </refsect2>
</refsect1> </refsect1>
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_user.sgml,v 1.7 1999/07/22 15:09:11 thomas Exp $
Postgres documentation
-->
<refentry id="SQL-DROPUSER"> <refentry id="SQL-DROPUSER">
<refmeta> <refmeta>
<refentrytitle> <refentrytitle id="SQL-DROPUSER-TITLE">
DROP USER DROP USER
</refentrytitle> </refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo> <refmiscinfo>SQL - Language Statements</refmiscinfo>
...@@ -15,7 +20,7 @@ ...@@ -15,7 +20,7 @@
</refnamediv> </refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
<refsynopsisdivinfo> <refsynopsisdivinfo>
<date>1998-09-22</date> <date>1999-07-20</date>
</refsynopsisdivinfo> </refsynopsisdivinfo>
<synopsis> <synopsis>
DROP USER <replaceable class="PARAMETER">name</replaceable> DROP USER <replaceable class="PARAMETER">name</replaceable>
...@@ -129,8 +134,6 @@ DROP USER Jonathan; ...@@ -129,8 +134,6 @@ DROP USER Jonathan;
<title> <title>
Compatibility Compatibility
</title> </title>
<para>
</para>
<refsect2 id="R2-SQL-DROPUSER-4"> <refsect2 id="R2-SQL-DROPUSER-4">
<refsect2info> <refsect2info>
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_view.sgml,v 1.6 1999/07/22 15:09:11 thomas Exp $
Postgres documentation
-->
<refentry id="SQL-DROPVIEW"> <refentry id="SQL-DROPVIEW">
<refmeta> <refmeta>
<refentrytitle> <refentrytitle id="SQL-DROPVIEW-TITLE">
DROP VIEW DROP VIEW
</refentrytitle> </refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo> <refmiscinfo>SQL - Language Statements</refmiscinfo>
...@@ -15,7 +20,7 @@ ...@@ -15,7 +20,7 @@
</refnamediv> </refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
<refsynopsisdivinfo> <refsynopsisdivinfo>
<date>1998-09-22</date> <date>1999-07-20</date>
</refsynopsisdivinfo> </refsynopsisdivinfo>
<synopsis> <synopsis>
DROP VIEW <replaceable class="PARAMETER">name</replaceable> DROP VIEW <replaceable class="PARAMETER">name</replaceable>
...@@ -126,8 +131,6 @@ DROP VIEW kinds; ...@@ -126,8 +131,6 @@ DROP VIEW kinds;
<title> <title>
Compatibility Compatibility
</title> </title>
<para>
</para>
<refsect2 id="R2-SQL-DROPVIEW-4"> <refsect2 id="R2-SQL-DROPVIEW-4">
<refsect2info> <refsect2info>
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/ecpg-ref.sgml,v 1.1 1999/07/22 15:09:11 thomas Exp $
Postgres documentation
-->
<refentry id="APP-ECPG">
<refmeta>
<refentrytitle id="app-ecpg-title">
<application>ecpg</application>
</refentrytitle>
<refmiscinfo>Application</refmiscinfo>
</refmeta>
<refnamediv>
<refname>
<application>ecpg</application>
</refname>
<refpurpose>
Embedded SQL C preprocessor
</refpurpose>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
<date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
ecpg [ -v ] [ -t ] [ -I include-path ] [ -o outfile ] file1 [ file2 ] [ ... ]
</synopsis>
<refsect2 id="R2-APP-ECPG-1">
<refsect2info>
<date>1999-07-20</date>
</refsect2info>
<title>
Inputs
</title>
<para>
<application>ecpg</application> accepts the following command
line arguments:
<variablelist>
<varlistentry>
<term><replaceable class="parameter">file</replaceable></term>
<listitem>
<para>
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
<refsect2 id="R2-APP-ECPG-2">
<refsect2info>
<date>1998-11-05</date>
</refsect2info>
<title>
Outputs
</title>
<para>
<application>ecpg</application> will create a file or
write to <filename>stdout</filename>.
<variablelist>
<varlistentry>
<term><computeroutput>
</computeroutput></term>
<listitem>
<para>
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
</refsynopsisdiv>
<refsect1 id="R1-APP-ECPG-1">
<refsect1info>
<date>1998-11-05</date>
</refsect1info>
<title>
Description
</title>
<para>
<!--
.TH ECPG UNIX 11/28/98 PostgreSQL \fIPostgreSQL\fP
.SH NAME
ecpg - embedded SQL preprocessor for C / PostgreSQL
.SH SYNOPSIS
.\" \fBecpg\fR [-v ] [-t] [-I include-path ] [-o outfile ] file1 [ file2 ] [ ... ]
\fBecpg\fR [-v ] [-t] [-I include-path ] [-o outfile ] file1 [ file2 ] [ ... ]
.SH DESCRIPTION
.B \fIecpg\fP
is an embedded SQL preprocessor for C / PostgreSQL. It
enables development of C programs with embedded SQL code.
.PP
.B \fIecpg\fP
is ultimately intended to be as compliant as possible with the
ANSI SQL-2 standard and existing commercial ESQL/C packages.
.SH OPTIONS
.B \fIecpg\fP
interprets the following flags when it is invoked
on the command line:
.PP
.PD 0
.TP 10
.BI \-v
Print version information.
.PD
.TP
.B \-t
Turn off auto-transactin mode.
.PD
.TP
.PD
.TP
.B \-I include-path
Specify additional include path. Defaults are \.,
/usr/local/include, the PostgreSQL include path which is defined at compile
time (default: /usr/local/pgsql/lib), /usr/include
.PD
.TP
.B \-o
Specifies that ecpg should write all its output to outfile.
If no such option is given the output is written to foo.c
(if the input file was named foo.pgc.)
If the input file was named foo.bar the output file will be
named foo.bar.c.
.PD
.TP
.B file1, file2...
The files to be processed.
.\"
.SH INSTALLATION
The
.B \fIecpg\fP
preprocessor is built during the PostgreSQL installation. Binaries and
libraries are installed into the PGBASE (i.e., /usr/local/pgsql/... )
subdirectories.
.SH PREPROCESSING FOR COMPILATION
.B \fIecpg\fP
.\" (-d ) (-o file) file.pgc ( 2> ecpf.log)
(-o file) file.pgc
.LP
.\" The optional \-d flag turns on debugging and 2> ecpg.log
.\" redirects the debug output. The .pgc extension is an
.\" arbitrary means of denoting ecpg source.
The .pgc extension is an arbitrary means of denoting ecpg source.
.SH COMPILING AND LINKING
Assuming the \fIPostgreSQL\fP binaries are in /usr/local/pgsql:
.LP
gcc -g -i /usr/local/pgsql/include (-o file) file.c
-L /usr/local/pgsql/lib -lecpg -lpq
.SH ECPG GRAMMAR
.LP
.SH LIBRARIES
.LP
The preprocessor will prepend two directives to the source:
.LP
\fI#include <ecpgtype.h>\fP and \fI#include <ecpglib.h>\fP
.SH VARIABLE DECLARATION
Variables declared within ecpg source code must be prepended with:
.LP
EXEC SQL BEGIN DECLARE SECTION;
.LP
Similarly, variable declaration sections must terminate with:
.LP
EXEC SQL END DECLARE SECTION;
.LP
NOTE: prior to version 2.1.0, each variable had to be declared
on a separate line. As of version 2.1.0 multiple variables may
be declared on a single line:
.LP
char foo(16), bar(16);
.LP
.SH ERROR HANDLING
The SQL communication area is defined with:
.LP
EXEC SQL INCLUDE sqlca;
.LP
NOTE: the lowercase `sqlca'. While SQL convention may be
followed, i.e., using uppercase to separate embedded SQL
from C statements, sqlca (which includes the sqlca.h
header file) MUST be lowercase. This is because the EXEC SQL
prefix indicates that this INCLUDE will be parsed by ecpg.
ecpg observes case sensitivity (SQLCA.h will not be found.)
EXEC SQL INCLUDE can be used to include other header files
as long as case sensitivity is observed.
.LP
The sqlprint command is used with the EXEC SQL WHENEVER
statement to turn on error handling throughout the
program:
.LP
EXEC SQL WHENEVER sqlerror sqlprint;
.LP
EXEC SQL WHENEVER not found sqlprint;
.LP
PLEASE NOTE: this is *not* an exhaustive example of usage for
the EXEC SQL WHENEVER statement. Further examples of usage may
be found in SQL manuals (e.g., `The LAN TIMES Guide to SQL' by
Groff and Weinberg.)
.LP
.SH CONNECTING TO THE DATABASE SERVER
Prior to version 2.1.0 the database name was single quoted:
.RS
EXEC SQL CONNECT 'test1';
.RE
.LP
As of version 2.1.0, the syntax has been simplified:
.LP
.RS
EXEC SQL CONNECT test1;
.RE
(The database name is no longer quoted.)
.LP
Specifying a server and port name in the connect statement is also possible
as of version 6.4. of PostgreSQL. The syntax is:
.LP
.RS
dbname[@server][:port]
.RE
.LP
or
.LP
.RS
<tcp|unix>:postgresql://server[:port][/dbname][?options]
.RE
.SH QUERIES
.LP
.SS Create Table:
.LP
EXEC SQL CREATE TABLE foo (number int4, ascii char(16));
.RS
EXEC SQL CREATE UNIQUE index num1 on foo(number);
.RE
EXEC SQL COMMIT;
.LP
.SS Insert:
.LP
EXEC SQL INSERT INTO foo (number, ascii)
.RS
VALUES (9999, 'doodad');
.RE
EXEC SQL COMMIT;
.LP
.SS Delete:
.LP
EXEC SQL DELETE FROM foo
.RS
WHERE number = 9999;
.RE
EXEC SQL COMMIT;
.LP
.SS Singleton Select:
.LP
EXEC SQL SELECT foo INTO :FooBar FROM table1
.RS
WHERE ascii = 'doodad';
.RE
.LP
.SS Select using Cursors:
.LP
EXEC SQL DECLARE foo_bar CURSOR FOR
.RS
SELECT number, ascii FROM foo
.RS
ORDER BY ascii;
.RE
.RE
EXEC SQL FETCH foo_bar INTO :FooBar, DooDad;
.LP
...
EXEC SQL CLOSE foo_bar;
.RS
EXEC SQL COMMIT;
.RE
.LP
.SS Updates
.LP
EXEC SQL UPDATE foo
.RS
SET ascii = 'foobar'
.RE
.RS
WHERE number = 9999;
.RE
EXEC SQL COMMIT;
.LP
.SH BUGS
.LP
The is no EXEC SQL PREPARE statement.
.LP
The complete structure definition MUST be listed
inside the declare section.
.LP
See the TODO file in the source for some more missing features.
.LP
.SH "RETURN VALUE"
.LP
ecpg returns 0 to the shell on successful completion, -1
for errors.
.LP
.SH "SEE ALSO"
.PD 0
.TP
\fIcc\fP(1), \fIpgintro\fP(l), \fIcommit\fP(l), \fIdelete\fP(l)
.TP
\fIfetch\fP(l), \fIselect\fP(l), \fIsql\fP(l) , \fIupdate\fP(l)
.PD
.SH FILES
.PD 0
.TP
.B /usr/src/pgsql/postgresql-${ver}/src/interfaces...
./ecpg/include.......source for \fIecpg\fP header files.
./ecpg/lib...........source for \fIecpg\fP libraries.
./ecpg/preproc.......source for \fIecpg\fP header files.
./ecpg/test..........source for \fIecpg\fP libraries.
(test contains examples of syntax for ecpg SQL-C.)
.PD
.TP
.B /usr/local/pgsql/bin
\fIPostgreSQL\fP binaries including \fIecpg\fP.
.PD
.TP
.B /usr/local/pgsql/include
\fIPostgreSQL\fP headers including \fIecpglib.h\fP \fIecpgtype.h\fP
and \fIsqlca.h\fP.
.PD
.TP
.B /usr/local/pgsql/lib
\fIPostgreSQL\fP libraries including \fIlibecpg.a\fP and
\fIlibecpg.so\fP.
.SH AUTHORS
Linus Tolke \fI<linus@epact.se>\fP
- original author of ECPG (up to version 0.2).
.br
.PP
Michael Meskes \fI<meskes@debian.org>\fP
- actual author and maintainer of ECPG.
.br
.PP
Thomas Good \fI<tomg@q8.nrnet.org>\fP
- author of this revision of the ecpg man page.
.br
.zZ
-->
</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:
-->
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/end.sgml,v 1.1 1999/07/22 15:09:11 thomas Exp $
Postgres documentation
-->
<refentry id="SQL-END">
<refmeta>
<refentrytitle id="SQL-END-TITLE">
END
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta>
<refnamediv>
<refname>
END
</refname>
<refpurpose>
Commits the current transaction
</refpurpose>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
<date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
END [ WORK | TRANSACTION ]
</synopsis>
<refsect2 id="R2-SQL-END-1">
<refsect2info>
<date>1998-09-08</date>
</refsect2info>
<title>
Inputs
</title>
<para>
<variablelist>
<varlistentry>
<term>WORK</term>
<term>TRANSACTION</term>
<listitem>
<para>
Optional keywords. They have no effect.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
<refsect2 id="R2-SQL-END-2">
<refsect2info>
<date>1998-09-08</date>
</refsect2info>
<title>
Outputs
</title>
<para>
<variablelist>
<varlistentry>
<term><computeroutput>
END
</computeroutput></term>
<listitem>
<para>
Message returned if the transaction is successfully committed.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><computeroutput>
NOTICE EndTransactionBlock and not inprogress/abort state
</computeroutput></term>
<listitem>
<para>
If there is no transaction in progress.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
</refsynopsisdiv>
<refsect1 id="R1-SQL-END-1">
<refsect1info>
<date>1998-09-08</date>
</refsect1info>
<title>
Description
</title>
<para>
<command>END</command> is a <productname>Postgres</productname>
synonym for
<xref linkend="sql-commit-title" endterm="sql-commit-title">.
</para>
<refsect2 id="R2-SQL-END-3">
<refsect2info>
<date>1998-09-08</date>
</refsect2info>
<title>
Notes
</title>
<para>
The keywords WORK and TRANSACTION are noise and can be omitted.
</para>
<para>
Use <xref linkend="SQL-ROLLBACK-TITLE" endterm="SQL-ROLLBACK-TITLE">
to abort a transaction.
</para>
</refsect2>
</refsect1>
<refsect1 id="R1-SQL-END-2">
<title>
Usage
</title>
<para>
To make all changes permanent:
<programlisting>
END WORK;
</programlisting>
</para>
</refsect1>
<refsect1 id="R1-SQL-END-3">
<title>
Compatibility
</title>
<refsect2 id="R2-SQL-END-4">
<refsect2info>
<date>1998-09-08</date>
</refsect2info>
<title>
SQL92
</title>
<para>
<command>END</command> is a <productname>Postgres</productname>
extension which provides functionality equivalent to
<xref linkend="sql-commit-title" endterm="sql-commit-title">.
</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:
-->
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/explain.sgml,v 1.8 1999/07/22 15:09:12 thomas Exp $
Postgres documentation
-->
<refentry id="SQL-EXPLAIN"> <refentry id="SQL-EXPLAIN">
<refmeta> <refmeta>
<refentrytitle> <refentrytitle id="SQL-EXPLAIN-TITLE">
EXPLAIN EXPLAIN
</refentrytitle> </refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo> <refmiscinfo>SQL - Language Statements</refmiscinfo>
...@@ -16,7 +21,7 @@ ...@@ -16,7 +21,7 @@
<refsynopsisdiv> <refsynopsisdiv>
<refsynopsisdivinfo> <refsynopsisdivinfo>
<date>1998-09-01</date> <date>1999-07-20</date>
</refsynopsisdivinfo> </refsynopsisdivinfo>
<synopsis> <synopsis>
EXPLAIN [ VERBOSE ] <replaceable class="PARAMETER">query</replaceable> EXPLAIN [ VERBOSE ] <replaceable class="PARAMETER">query</replaceable>
...@@ -95,6 +100,7 @@ EXPLAIN ...@@ -95,6 +100,7 @@ EXPLAIN
<title> <title>
Description Description
</title> </title>
<para> <para>
This command outputs details about the supplied query. This command outputs details about the supplied query.
The default output is the computed query cost. The default output is the computed query cost.
...@@ -127,16 +133,54 @@ EXPLAIN ...@@ -127,16 +133,54 @@ EXPLAIN
<title> <title>
Usage Usage
</title> </title>
<para>
To show a query plan for a simple query on a table with a single
<type>int4</type> column and 128 rows:
<programlisting>
EXPLAIN SELECT * FROM foo;
<computeroutput>
NOTICE: QUERY PLAN:
Seq Scan on foo (cost=5.22 rows=128 width=4)
EXPLAIN
</computeroutput>
</programlisting>
</para>
<para> <para>
To show a query plan for a simple query: For the same table with an index to support an
<firstterm>equijoin</firstterm> condition on the query,
<command>EXPLAIN</command> will show a different plan:
<programlisting> <programlisting>
EXPLAIN select * from foo; EXPLAIN SELECT * FROM foo WHERE i = 4;
<computeroutput>
NOTICE: QUERY PLAN: NOTICE: QUERY PLAN:
Seq Scan on foo (cost=0.00 rows=0 width=4) Index Scan using fi on foo (cost=2.05 rows=1 width=4)
EXPLAIN EXPLAIN
</computeroutput>
</programlisting>
</para>
<para>
And finally, for the same table with an index to support an
<firstterm>equijoin</firstterm> condition on the query,
<command>EXPLAIN</command> will show the following for a query
using an aggregate function:
<programlisting>
EXPLAIN SELECT sum(i) FROM foo WHERE i = 4;
<computeroutput>
NOTICE: QUERY PLAN:
Aggregate (cost=2.05 rows=1 width=4)
-> Index Scan using fi on foo (cost=2.05 rows=1 width=4)
</computeroutput>
</programlisting> </programlisting>
</para> </para>
</refsect1> </refsect1>
...@@ -145,8 +189,6 @@ EXPLAIN ...@@ -145,8 +189,6 @@ EXPLAIN
<title> <title>
Compatibility Compatibility
</title> </title>
<para>
</para>
<refsect2 id="R2-SQL-EXPLAIN-4"> <refsect2 id="R2-SQL-EXPLAIN-4">
<refsect2info> <refsect2info>
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/fetch.sgml,v 1.7 1999/07/22 15:09:12 thomas Exp $
Postgres documentation
-->
<refentry id="SQL-FETCH"> <refentry id="SQL-FETCH">
<refmeta> <refmeta>
<refentrytitle> <refentrytitle id="SQL-FETCH-TITLE">
FETCH FETCH
</refentrytitle> </refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo> <refmiscinfo>SQL - Language Statements</refmiscinfo>
...@@ -15,7 +20,7 @@ ...@@ -15,7 +20,7 @@
</refnamediv> </refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
<refsynopsisdivinfo> <refsynopsisdivinfo>
<date>1998-09-01</date> <date>1999-07-20</date>
</refsynopsisdivinfo> </refsynopsisdivinfo>
<synopsis> <synopsis>
FETCH [ <replaceable class="PARAMETER">selector</replaceable> ] [ <replaceable class="PARAMETER">count</replaceable> ] { IN | FROM } <replaceable class="PARAMETER">cursor</replaceable> FETCH [ <replaceable class="PARAMETER">selector</replaceable> ] [ <replaceable class="PARAMETER">count</replaceable> ] { IN | FROM } <replaceable class="PARAMETER">cursor</replaceable>
...@@ -212,8 +217,9 @@ FETCH RELATIVE 0 FROM <replaceable class="PARAMETER">cursor</replaceable> ...@@ -212,8 +217,9 @@ FETCH RELATIVE 0 FROM <replaceable class="PARAMETER">cursor</replaceable>
<title> <title>
Description Description
</title> </title>
<para> <para>
FETCH allows a user to retrieve rows using a cursor. <command>FETCH</command> allows a user to retrieve rows using a cursor.
The number of rows retrieved is specified by The number of rows retrieved is specified by
<replaceable class="PARAMETER">#</replaceable>. <replaceable class="PARAMETER">#</replaceable>.
If the number of rows remaining in the cursor is less If the number of rows remaining in the cursor is less
...@@ -226,38 +232,13 @@ FETCH RELATIVE 0 FROM <replaceable class="PARAMETER">cursor</replaceable> ...@@ -226,38 +232,13 @@ FETCH RELATIVE 0 FROM <replaceable class="PARAMETER">cursor</replaceable>
<tip> <tip>
<para> <para>
Negative numbers are now allowed to be specified for the Negative numbers are allowed to be specified for the
row count. A negative number is equivalent to reversing row count. A negative number is equivalent to reversing
the sense of the FORWARD and BACKWARD keywords. For example, the sense of the FORWARD and BACKWARD keywords. For example,
<command>FORWARD -1</command> is the same as <command>BACKWARD 1</command>. <command>FORWARD -1</command> is the same as <command>BACKWARD 1</command>.
</para> </para>
</tip> </tip>
</para> </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>
Updating data in a cursor is not supported by
<productname>Postgres</productname>,
because mapping cursor updates back to base tables is
not generally possible, as is also the case with VIEW updates.
Consequently,
users must issue explicit UPDATE commands to replace data.
</para>
<para>
Cursors may only be used inside of transactions because
the data that they store spans multiple user queries.
</para>
<refsect2 id="R2-SQL-FETCH-3"> <refsect2 id="R2-SQL-FETCH-3">
<refsect2info> <refsect2info>
...@@ -266,11 +247,45 @@ FETCH RELATIVE 0 FROM <replaceable class="PARAMETER">cursor</replaceable> ...@@ -266,11 +247,45 @@ FETCH RELATIVE 0 FROM <replaceable class="PARAMETER">cursor</replaceable>
<title> <title>
Notes Notes
</title> </title>
<para> <para>
Use <command>MOVE</command> to change cursor position. Note that the FORWARD and BACKWARD keywords are
<command>DECLARE</command> will define a cursor. <productname>Postgres</productname> extensions.
Refer to <command>BEGIN</command>, <command>COMMIT</command>, and The <acronym>SQL92</acronym> syntax is also supported, specified
<command>ROLLBACK</command> 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>
Updating data in a cursor is not supported by
<productname>Postgres</productname>,
because mapping cursor updates back to base tables is
not generally possible, as is also the case with VIEW updates.
Consequently,
users must issue explicit UPDATE commands to replace data.
</para>
<para>
Cursors may only be used inside of transactions because
the data that they store spans multiple user queries.
</para>
<para>
Use
<xref linkend="sql-move-title" endterm="sql-move-title">
to change cursor position.
<xref linkend="sql-declare-title" endterm="sql-declare-title">
will define a cursor.
Refer to
<xref linkend="sql-begin-title" endterm="sql-begin-title">,
<xref linkend="sql-commit-title" endterm="sql-commit-title">,
and
<xref linkend="sql-rollback-title" endterm="sql-rollback-title">
for further information about transactions. for further information about transactions.
</para> </para>
</refsect2> </refsect2>
...@@ -280,7 +295,10 @@ FETCH RELATIVE 0 FROM <replaceable class="PARAMETER">cursor</replaceable> ...@@ -280,7 +295,10 @@ FETCH RELATIVE 0 FROM <replaceable class="PARAMETER">cursor</replaceable>
<title> <title>
Usage Usage
</title> </title>
<para> <para>
The following examples traverses a table using a cursor.
<programlisting> <programlisting>
--set up and use a cursor: --set up and use a cursor:
-- --
...@@ -292,6 +310,7 @@ FETCH RELATIVE 0 FROM <replaceable class="PARAMETER">cursor</replaceable> ...@@ -292,6 +310,7 @@ FETCH RELATIVE 0 FROM <replaceable class="PARAMETER">cursor</replaceable>
-- --
FETCH FORWARD 5 IN liahona; FETCH FORWARD 5 IN liahona;
<computeroutput>
code |title |did| date_prod|kind |len code |title |did| date_prod|kind |len
-----+-----------------------+---+----------+----------+------ -----+-----------------------+---+----------+----------+------
BL101|The Third Man |101|1949-12-23|Drama | 01:44 BL101|The Third Man |101|1949-12-23|Drama | 01:44
...@@ -299,15 +318,17 @@ FETCH RELATIVE 0 FROM <replaceable class="PARAMETER">cursor</replaceable> ...@@ -299,15 +318,17 @@ FETCH RELATIVE 0 FROM <replaceable class="PARAMETER">cursor</replaceable>
JL201|Une Femme est une Femme|102|1961-03-12|Romantic | 01:25 JL201|Une Femme est une Femme|102|1961-03-12|Romantic | 01:25
P_301|Vertigo |103|1958-11-14|Action | 02:08 P_301|Vertigo |103|1958-11-14|Action | 02:08
P_302|Becket |103|1964-02-03|Drama | 02:28 P_302|Becket |103|1964-02-03|Drama | 02:28
</computeroutput>
--Fetch previous row: --Fetch previous row:
-- --
FETCH BACKWARD 1 IN liahona; FETCH BACKWARD 1 IN liahona;
<computeroutput>
code |title |did| date_prod|kind |len code |title |did| date_prod|kind |len
-----+-----------------------+---+----------+----------+------ -----+-----------------------+---+----------+----------+------
P_301|Vertigo |103|1958-11-14|Action | 02:08 P_301|Vertigo |103|1958-11-14|Action | 02:08
</computeroutput>
-- close the cursor and commit work: -- close the cursor and commit work:
-- --
...@@ -321,11 +342,6 @@ FETCH RELATIVE 0 FROM <replaceable class="PARAMETER">cursor</replaceable> ...@@ -321,11 +342,6 @@ FETCH RELATIVE 0 FROM <replaceable class="PARAMETER">cursor</replaceable>
<title> <title>
Compatibility Compatibility
</title> </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"> <refsect2 id="R2-SQL-FETCH-4">
<refsect2info> <refsect2info>
...@@ -334,6 +350,17 @@ FETCH RELATIVE 0 FROM <replaceable class="PARAMETER">cursor</replaceable> ...@@ -334,6 +350,17 @@ FETCH RELATIVE 0 FROM <replaceable class="PARAMETER">cursor</replaceable>
<title> <title>
SQL92 SQL92
</title> </title>
<para>
<note>
<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>
</note>
</para>
<para> <para>
<acronym>SQL92</acronym> allows absolute positioning of the cursor for <acronym>SQL92</acronym> allows absolute positioning of the cursor for
FETCH, and allows placing the results into explicit variables. FETCH, and allows placing the results into explicit variables.
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/grant.sgml,v 1.6 1999/07/22 15:09:12 thomas Exp $
Postgres documentation
-->
<refentry id="SQL-GRANT"> <refentry id="SQL-GRANT">
<refmeta> <refmeta>
<refentrytitle> <refentrytitle id="SQL-GRANT-TITLE">
GRANT GRANT
</refentrytitle> </refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo> <refmiscinfo>SQL - Language Statements</refmiscinfo>
...@@ -15,7 +20,7 @@ ...@@ -15,7 +20,7 @@
</refnamediv> </refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
<refsynopsisdivinfo> <refsynopsisdivinfo>
<date>1998-09-23</date> <date>1999-07-20</date>
</refsynopsisdivinfo> </refsynopsisdivinfo>
<synopsis> <synopsis>
GRANT <replaceable class="PARAMETER">privilege</replaceable> [, ...] ON <replaceable class="PARAMETER">object</replaceable> [, ...] GRANT <replaceable class="PARAMETER">privilege</replaceable> [, ...] ON <replaceable class="PARAMETER">object</replaceable> [, ...]
...@@ -216,6 +221,7 @@ ERROR: ChangeAcl: class "<replaceable class="PARAMETER">object</replaceable>" n ...@@ -216,6 +221,7 @@ ERROR: ChangeAcl: class "<replaceable class="PARAMETER">object</replaceable>" n
<title> <title>
Description Description
</title> </title>
<para> <para>
<command>GRANT</command> allows the creator of an object to give specific permissions to <command>GRANT</command> allows the creator of an object to give specific permissions to
all users (PUBLIC) or to a certain user or group. all users (PUBLIC) or to a certain user or group.
...@@ -274,6 +280,7 @@ ERROR: ChangeAcl: class "<replaceable class="PARAMETER">object</replaceable>" n ...@@ -274,6 +280,7 @@ ERROR: ChangeAcl: class "<replaceable class="PARAMETER">object</replaceable>" n
<para> <para>
Currently, to create a GROUP you have to insert Currently, to create a GROUP you have to insert
data manually into table pg_group as: data manually into table pg_group as:
<programlisting> <programlisting>
INSERT INTO pg_group VALUES ('todos'); INSERT INTO pg_group VALUES ('todos');
CREATE USER miriam IN GROUP todos; CREATE USER miriam IN GROUP todos;
...@@ -313,8 +320,6 @@ GRANT ALL ON kinds TO manuel; ...@@ -313,8 +320,6 @@ GRANT ALL ON kinds TO manuel;
<title> <title>
Compatibility Compatibility
</title> </title>
<para>
</para>
<refsect2 id="R2-SQL-GRANT-4"> <refsect2 id="R2-SQL-GRANT-4">
<refsect2info> <refsect2info>
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/initdb.sgml,v 1.5 1999/07/22 15:09:12 thomas Exp $
Postgres documentation
-->
<refentry id="APP-INITDB"> <refentry id="APP-INITDB">
<refmeta> <refmeta>
<refentrytitle> <refentrytitle id="APP-INITDB-TITLE">
<application>initdb</application> <application>initdb</application>
</refentrytitle> </refentrytitle>
<refmiscinfo>Application</refmiscinfo> <refmiscinfo>Application</refmiscinfo>
...@@ -15,7 +20,7 @@ ...@@ -15,7 +20,7 @@
</refnamediv> </refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
<refsynopsisdivinfo> <refsynopsisdivinfo>
<date>1998-10-02</date> <date>1999-07-20</date>
</refsynopsisdivinfo> </refsynopsisdivinfo>
<synopsis> <synopsis>
initdb [ --pgdata=<replaceable class="parameter">dbdir</replaceable> | -r <replaceable class="parameter">dbdir</replaceable> ] initdb [ --pgdata=<replaceable class="parameter">dbdir</replaceable> | -r <replaceable class="parameter">dbdir</replaceable> ]
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/Attic/initlocation.sgml,v 1.4 1999/07/22 15:09:12 thomas Exp $
Postgres documentation
-->
<refentry id="APP-INITLOCATION"> <refentry id="APP-INITLOCATION">
<refmeta> <refmeta>
<refentrytitle> <refentrytitle id="APP-INITLOCATION-TITLE">
<application>initlocation</application> <application>initlocation</application>
</refentrytitle> </refentrytitle>
<refmiscinfo>Application</refmiscinfo> <refmiscinfo>Application</refmiscinfo>
...@@ -15,7 +20,7 @@ ...@@ -15,7 +20,7 @@
</refnamediv> </refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
<refsynopsisdivinfo> <refsynopsisdivinfo>
<date>1998-10-02</date> <date>1999-07-20</date>
</refsynopsisdivinfo> </refsynopsisdivinfo>
<synopsis> <synopsis>
initlocation [ --location=<replaceable class="parameter">er">al</replaceable>ble> | -D <replaceable class="parameter">altdir</replaceable> ] initlocation [ --location=<replaceable class="parameter">er">al</replaceable>ble> | -D <replaceable class="parameter">altdir</replaceable> ]
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/insert.sgml,v 1.6 1999/07/22 15:09:12 thomas Exp $
Postgres documentation
-->
<refentry id="SQL-INSERT"> <refentry id="SQL-INSERT">
<refmeta> <refmeta>
<refentrytitle> <refentrytitle id="SQL-INSERT-TITLE">
INSERT INSERT
</refentrytitle> </refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo> <refmiscinfo>SQL - Language Statements</refmiscinfo>
...@@ -15,7 +20,7 @@ ...@@ -15,7 +20,7 @@
</refnamediv> </refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
<refsynopsisdivinfo> <refsynopsisdivinfo>
<date>1998-09-23</date> <date>1999-07-20</date>
</refsynopsisdivinfo> </refsynopsisdivinfo>
<synopsis> <synopsis>
INSERT INTO <replaceable class="PARAMETER">table</replaceable> [ ( <replaceable class="PARAMETER">column</replaceable> [, ...] ) ] INSERT INTO <replaceable class="PARAMETER">table</replaceable> [ ( <replaceable class="PARAMETER">column</replaceable> [, ...] ) ]
...@@ -118,16 +123,27 @@ INSERT 0 <replaceable>#</replaceable> ...@@ -118,16 +123,27 @@ INSERT 0 <replaceable>#</replaceable>
<title> <title>
Description Description
</title> </title>
<para> <para>
<command>INSERT</command> allows one to insert new rows into a table. One can insert <command>INSERT</command> allows one to insert new rows into a
class or table. One can insert
a single row at time or several rows as a result of a query. a single row at time or several rows as a result of a query.
The columns in the target list may be listed in any order. The columns in the target list may be listed in any order.
In every column not present in the target list will be inserted </para>
the default value, if column has not a declared default value
it will be assumed as NULL. If the expression for each column <para>
Each column not present in the target list will be inserted
using a default value, either a declared DEFAULT value
or NULL. <productname>Postgres</productname> will reject the new
column if a NULL is inserted into a column declared NOT NULL.
</para>
<para>
If the expression for each column
is not of the correct data type, automatic type coercion will be is not of the correct data type, automatic type coercion will be
attempted. attempted.
</para> </para>
<para> <para>
You must have insert privilege to a table in order to append You must have insert privilege to a table in order to append
to it, as well as select privilege on any table specified to it, as well as select privilege on any table specified
...@@ -177,7 +193,8 @@ INSERT INTO films SELECT * FROM tmp; ...@@ -177,7 +193,8 @@ INSERT INTO films SELECT * FROM tmp;
</para> </para>
<para> <para>
Insert into arrays (refer to <citetitle>The PostgreSQL User's Guide</citetitle> for further Insert into arrays (refer to
<citetitle>The PostgreSQL User's Guide</citetitle> for further
information about arrays): information about arrays):
<programlisting> <programlisting>
...@@ -197,8 +214,6 @@ INSERT INTO tictactoe (game, board) ...@@ -197,8 +214,6 @@ INSERT INTO tictactoe (game, board)
<title> <title>
Compatibility Compatibility
</title> </title>
<para>
</para>
<refsect2 id="R2-SQL-INSERT-4"> <refsect2 id="R2-SQL-INSERT-4">
<refsect2info> <refsect2info>
...@@ -211,7 +226,8 @@ INSERT INTO tictactoe (game, board) ...@@ -211,7 +226,8 @@ INSERT INTO tictactoe (game, board)
<command>INSERT</command> is fully compatible with <acronym>SQL92</acronym>. <command>INSERT</command> is fully compatible with <acronym>SQL92</acronym>.
Possible limitations in features of the Possible limitations in features of the
<replaceable class="PARAMETER">query</replaceable> <replaceable class="PARAMETER">query</replaceable>
clause are documented for the SELECT statement. clause are documented for
<xref linkend="sql-select-title" endterm="sql-select-title">.
</para> </para>
</refsect2> </refsect2>
</refsect1> </refsect1>
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/Attic/ipcclean.sgml,v 1.1 1999/07/22 15:09:12 thomas Exp $
Postgres documentation
-->
<refentry id="APP-IPCCLEAN">
<refmeta>
<refentrytitle id="APP-IPCCLEAN-TITLE">
<application>ipcclean</application>
</refentrytitle>
<refmiscinfo>Application</refmiscinfo>
</refmeta>
<refnamediv>
<refname>
<application>ipcclean</application>
</refname>
<refpurpose>
Clean up shared memory and semaphores from aborted backends
</refpurpose>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
<date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
ipcclean
</synopsis>
<refsect2 id="R2-APP-IPCCLEAN-1">
<refsect2info>
<date>1999-07-20</date>
</refsect2info>
<title>
Inputs
</title>
<para>
None.
</para>
</refsect2>
<refsect2 id="R2-APP-IPCCLEAN-2">
<refsect2info>
<date>1999-07-30</date>
</refsect2info>
<title>
Outputs
</title>
<para>
None.
</para>
</refsect2>
</refsynopsisdiv>
<refsect1 id="R1-APP-IPCCLEAN-1">
<refsect1info>
<date>1999-07-20</date>
</refsect1info>
<title>
Description
</title>
<para>
<application>ipcclean</application>
cleans up shared memory and semaphore space from aborted backends by
deleting all instances owned by user <literal>postgres</literal>.
Only the DBA
should execute this program as it can cause bizarre behavior (i.e.,
crashes) if run during multi-user execution. This program should be
executed if messages such as
<computeroutput>
semget: No space left on device
</computeroutput>
are encountered when starting up the
<application>postmaster</application> or the backend server.
</para>
<para>
If this command is executed while <application>postmaster</application>
is running, the shared memory and semaphores allocated by the
<application>postmaster</application>
will be deleted. This will result in a general failure of the
backends servers started by that
<application>postmaster</application>.
</para>
<para>
This script is a hack, but in the many years since it was written, no
one has come up with an equally effective and portable solution.
Suggestions are welcome.
</para>
<para>
The script makes assumption about the format of output of the
<application>ipcs</application>
utility which may not be true across different operating systems.
Therefore, it may not work on your particular OS.
</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:
-->
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/listen.sgml,v 1.7 1999/07/22 15:09:12 thomas Exp $
Postgres documentation
-->
<refentry id="SQL-LISTEN"> <refentry id="SQL-LISTEN">
<refmeta> <refmeta>
<refentrytitle> <refentrytitle id="SQL-LISTEN-TITLE">
LISTEN LISTEN
</refentrytitle> </refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo> <refmiscinfo>SQL - Language Statements</refmiscinfo>
...@@ -15,7 +20,7 @@ ...@@ -15,7 +20,7 @@
</refnamediv> </refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
<refsynopsisdivinfo> <refsynopsisdivinfo>
<date>1998-10-07</date> <date>1999-07-20</date>
</refsynopsisdivinfo> </refsynopsisdivinfo>
<synopsis> <synopsis>
LISTEN <replaceable class="PARAMETER">name</replaceable> LISTEN <replaceable class="PARAMETER">name</replaceable>
...@@ -85,11 +90,14 @@ NOTICE Async_Listen: We are already listening on <replaceable class="PARAMETER"> ...@@ -85,11 +90,14 @@ NOTICE Async_Listen: We are already listening on <replaceable class="PARAMETER">
<title> <title>
Description Description
</title> </title>
<para> <para>
<command>LISTEN</command> registers the current <productname>Postgres</productname> backend as a <command>LISTEN</command> registers the current
<productname>Postgres</productname> backend as a
listener on the notify condition listener on the notify condition
<replaceable class="PARAMETER">name</replaceable>. <replaceable class="PARAMETER">name</replaceable>.
</para> </para>
<para> <para>
Whenever the command Whenever the command
<command>NOTIFY <replaceable class="PARAMETER">name</replaceable></command> <command>NOTIFY <replaceable class="PARAMETER">name</replaceable></command>
...@@ -99,11 +107,13 @@ NOTICE Async_Listen: We are already listening on <replaceable class="PARAMETER"> ...@@ -99,11 +107,13 @@ NOTICE Async_Listen: We are already listening on <replaceable class="PARAMETER">
frontend application. See the discussion of <command>NOTIFY</command> frontend application. See the discussion of <command>NOTIFY</command>
for more information. for more information.
</para> </para>
<para> <para>
A backend can be unregistered for a given notify condition with the A backend can be unregistered for a given notify condition with the
<command>UNLISTEN</command> command. Also, a backend's listen registrations <command>UNLISTEN</command> command. Also, a backend's listen registrations
are automatically cleared when the backend process exits. are automatically cleared when the backend process exits.
</para> </para>
<para> <para>
The method a frontend application must use to detect notify events depends on The method a frontend application must use to detect notify events depends on
which <productname>Postgres</productname> application programming interface it which <productname>Postgres</productname> application programming interface it
...@@ -116,8 +126,10 @@ NOTICE Async_Listen: We are already listening on <replaceable class="PARAMETER"> ...@@ -116,8 +126,10 @@ NOTICE Async_Listen: We are already listening on <replaceable class="PARAMETER">
<command>LISTEN</command> or <command>UNLISTEN</command> directly. See the <command>LISTEN</command> or <command>UNLISTEN</command> directly. See the
documentation for the library you are using for more details. documentation for the library you are using for more details.
</para> </para>
<para> <para>
The reference page for <command>NOTIFY</command> contains a more extensive <xref linkend="sql-notify-title" endterm="sql-notify-title">
contains a more extensive
discussion of the use of <command>LISTEN</command> and discussion of the use of <command>LISTEN</command> and
<command>NOTIFY</command>. <command>NOTIFY</command>.
</para> </para>
...@@ -129,6 +141,7 @@ NOTICE Async_Listen: We are already listening on <replaceable class="PARAMETER"> ...@@ -129,6 +141,7 @@ NOTICE Async_Listen: We are already listening on <replaceable class="PARAMETER">
<title> <title>
Notes Notes
</title> </title>
<para> <para>
<replaceable class="PARAMETER">name</replaceable> <replaceable class="PARAMETER">name</replaceable>
can be any string valid as a name; can be any string valid as a name;
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/load.sgml,v 1.7 1999/07/22 15:09:12 thomas Exp $
Postgres documentation
-->
<refentry id="SQL-LOAD"> <refentry id="SQL-LOAD">
<refmeta> <refmeta>
<refentrytitle> <refentrytitle id="SQL-LOAD-TITLE">
LOAD LOAD
</refentrytitle> </refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo> <refmiscinfo>SQL - Language Statements</refmiscinfo>
...@@ -15,7 +20,7 @@ ...@@ -15,7 +20,7 @@
</refnamediv> </refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
<refsynopsisdivinfo> <refsynopsisdivinfo>
<date>1998-09-24</date> <date>1999-07-20</date>
</refsynopsisdivinfo> </refsynopsisdivinfo>
<synopsis> <synopsis>
LOAD '<replaceable class="PARAMETER">filename</replaceable>' LOAD '<replaceable class="PARAMETER">filename</replaceable>'
...@@ -86,12 +91,14 @@ ERROR: LOAD: could not open file '<replaceable class="PARAMETER">filename</repl ...@@ -86,12 +91,14 @@ ERROR: LOAD: could not open file '<replaceable class="PARAMETER">filename</repl
<title> <title>
Description Description
</title> </title>
<para> <para>
Loads an object (or ".o") file into the Loads an object (or ".o") file into the
<productname>Postgres</productname> backend address space. Once a <productname>Postgres</productname> backend address space. Once a
file is loaded, all functions in that file can be accessed. This file is loaded, all functions in that file can be accessed. This
function is used in support of user-defined types and functions. function is used in support of user-defined types and functions.
</para> </para>
<para> <para>
If a file is not loaded using If a file is not loaded using
<command>LOAD</command>, <command>LOAD</command>,
...@@ -102,6 +109,7 @@ ERROR: LOAD: could not open file '<replaceable class="PARAMETER">filename</repl ...@@ -102,6 +109,7 @@ ERROR: LOAD: could not open file '<replaceable class="PARAMETER">filename</repl
recompiled. Only objects created from C language files are supported recompiled. Only objects created from C language files are supported
at this time. at this time.
</para> </para>
<refsect2 id="R2-SQL-LOAD-3"> <refsect2 id="R2-SQL-LOAD-3">
<refsect2info> <refsect2info>
<date>1998-09-24</date> <date>1998-09-24</date>
...@@ -109,6 +117,7 @@ ERROR: LOAD: could not open file '<replaceable class="PARAMETER">filename</repl ...@@ -109,6 +117,7 @@ ERROR: LOAD: could not open file '<replaceable class="PARAMETER">filename</repl
<title> <title>
Notes Notes
</title> </title>
<para> <para>
Functions in loaded object files should not call functions in other Functions in loaded object files should not call functions in other
object files loaded through the object files loaded through the
...@@ -157,8 +166,6 @@ LOAD '/usr/postgres/demo/circle.o' ...@@ -157,8 +166,6 @@ LOAD '/usr/postgres/demo/circle.o'
<title> <title>
Compatibility Compatibility
</title> </title>
<para>
</para>
<refsect2 id="R2-SQL-LOAD-4"> <refsect2 id="R2-SQL-LOAD-4">
<refsect2info> <refsect2info>
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/lock.sgml,v 1.13 1999/07/22 15:09:12 thomas Exp $
Postgres documentation
-->
<refentry id="SQL-LOCK"> <refentry id="SQL-LOCK">
<refmeta> <refmeta>
<refentrytitle> <refentrytitle id="sql-lock-title">
LOCK LOCK
</refentrytitle> </refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo> <refmiscinfo>SQL - Language Statements</refmiscinfo>
...@@ -15,7 +20,7 @@ ...@@ -15,7 +20,7 @@
</refnamediv> </refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
<refsynopsisdivinfo> <refsynopsisdivinfo>
<date>1998-09-24</date> <date>1999-07-20</date>
</refsynopsisdivinfo> </refsynopsisdivinfo>
<synopsis> <synopsis>
LOCK [ TABLE ] <replaceable class="PARAMETER">table</replaceable> LOCK [ TABLE ] <replaceable class="PARAMETER">table</replaceable>
...@@ -356,8 +361,6 @@ COMMIT WORK; ...@@ -356,8 +361,6 @@ COMMIT WORK;
<title> <title>
Compatibility Compatibility
</title> </title>
<para>
</para>
<refsect2 id="R2-SQL-LOCK-4"> <refsect2 id="R2-SQL-LOCK-4">
<refsect2info> <refsect2info>
...@@ -369,7 +372,7 @@ COMMIT WORK; ...@@ -369,7 +372,7 @@ COMMIT WORK;
<para> <para>
There is no <command>LOCK TABLE</command> in <acronym>SQL92</acronym>, There is no <command>LOCK TABLE</command> in <acronym>SQL92</acronym>,
which instead uses <command>SET TRANSACTION</command> to specify which instead uses <command>SET TRANSACTION</command> to specify
concurrency level on transactions. We support that too; see concurrency levels on transactions. We support that too; see
<xref linkend="SQL-SET-TITLE" endterm="SQL-SET-TITLE"> for details. <xref linkend="SQL-SET-TITLE" endterm="SQL-SET-TITLE"> for details.
</para> </para>
</refsect2> </refsect2>
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/move.sgml,v 1.6 1999/07/22 15:09:13 thomas Exp $
Postgres documentation
-->
<refentry id="SQL-MOVE"> <refentry id="SQL-MOVE">
<refmeta> <refmeta>
<refentrytitle> <refentrytitle id="SQL-MOVE-TITLE">
MOVE MOVE
</refentrytitle> </refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo> <refmiscinfo>SQL - Language Statements</refmiscinfo>
...@@ -15,7 +20,7 @@ ...@@ -15,7 +20,7 @@
</refnamediv> </refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
<refsynopsisdivinfo> <refsynopsisdivinfo>
<date>1998-09-24</date> <date>1999-07-20</date>
</refsynopsisdivinfo> </refsynopsisdivinfo>
<synopsis> <synopsis>
MOVE [ <replaceable class="PARAMETER">selector</replaceable> ] [ <replaceable class="PARAMETER">count</replaceable> ] MOVE [ <replaceable class="PARAMETER">selector</replaceable> ] [ <replaceable class="PARAMETER">count</replaceable> ]
...@@ -39,7 +44,9 @@ MOVE [ <replaceable class="PARAMETER">selector</replaceable> ] [ <replaceable cl ...@@ -39,7 +44,9 @@ MOVE [ <replaceable class="PARAMETER">selector</replaceable> ] [ <replaceable cl
not return rows. not return rows.
</para> </para>
<para> <para>
Refer to the <command>FETCH</command> command for details on syntax and usage. Refer to
<xref linkend="sql-fetch-title" endterm="sql-fetch-title">
for details on syntax and usage.
</para> </para>
<refsect2 id="R2-SQL-MOVE-3"> <refsect2 id="R2-SQL-MOVE-3">
...@@ -49,16 +56,24 @@ MOVE [ <replaceable class="PARAMETER">selector</replaceable> ] [ <replaceable cl ...@@ -49,16 +56,24 @@ MOVE [ <replaceable class="PARAMETER">selector</replaceable> ] [ <replaceable cl
<title> <title>
Notes Notes
</title> </title>
<para> <para>
<command>MOVE</command> is a <productname>Postgres</productname> <command>MOVE</command> is a <productname>Postgres</productname>
language extension. language extension.
</para> </para>
<para> <para>
Refer to <command>FETCH</command> for a description Refer to
of valid arguments. <xref linkend="sql-fetch-title" endterm="sql-fetch-title">
Refer to <command>DECLARE</command> to declare a cursor. for a description of valid arguments.
Refer to <command>BEGIN WORK</command>, <command>COMMIT WORK</command>, Refer to
<command>ROLLBACK WORK</command> statements <xref linkend="sql-declare-title" endterm="sql-declare-title">
to define a cursor.
Refer to
<xref linkend="sql-begin-title" endterm="sql-begin-title">,
<xref linkend="sql-commit-title" endterm="sql-commit-title">,
and
<xref linkend="sql-rollback-title" endterm="sql-rollback-title">
for further information about transactions. for further information about transactions.
</para> </para>
</refsect2> </refsect2>
...@@ -100,8 +115,6 @@ COMMIT WORK; ...@@ -100,8 +115,6 @@ COMMIT WORK;
<title> <title>
Compatibility Compatibility
</title> </title>
<para>
</para>
<refsect2 id="R2-SQL-MOVE-4"> <refsect2 id="R2-SQL-MOVE-4">
<refsect2info> <refsect2info>
...@@ -111,10 +124,10 @@ COMMIT WORK; ...@@ -111,10 +124,10 @@ COMMIT WORK;
SQL92 SQL92
</title> </title>
<para> <para>
There is no SQL92 <command>MOVE</command> statement. There is no <acronym>SQL92</acronym> <command>MOVE</command> statement.
Instead, <acronym>SQL92</acronym> allows Instead, <acronym>SQL92</acronym> allows
one to <command>FETCH</command> rows from an absolute cursor position, one to <command>FETCH</command> rows from an absolute cursor position,
implicitly moving the cursor to the correct place. implicitly moving the cursor to the correct position.
</para> </para>
</refsect2> </refsect2>
</refsect1> </refsect1>
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/notify.sgml,v 1.10 1999/07/22 15:09:13 thomas Exp $
Postgres documentation
-->
<refentry id="SQL-NOTIFY"> <refentry id="SQL-NOTIFY">
<refmeta> <refmeta>
<refentrytitle id="sql-notify-ref"> <refentrytitle id="sql-notify-title">
NOTIFY NOTIFY
</refentrytitle> </refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo> <refmiscinfo>SQL - Language Statements</refmiscinfo>
...@@ -15,7 +20,7 @@ ...@@ -15,7 +20,7 @@
</refnamediv> </refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
<refsynopsisdivinfo> <refsynopsisdivinfo>
<date>1998-10-07</date> <date>1999-07-20</date>
</refsynopsisdivinfo> </refsynopsisdivinfo>
<synopsis> <synopsis>
NOTIFY <replaceable class="PARAMETER">name</replaceable> NOTIFY <replaceable class="PARAMETER">name</replaceable>
...@@ -215,8 +220,6 @@ ASYNC NOTIFY of 'virtual' from backend pid '11239' received ...@@ -215,8 +220,6 @@ ASYNC NOTIFY of 'virtual' from backend pid '11239' received
<title> <title>
Compatibility Compatibility
</title> </title>
<para>
</para>
<refsect2 id="R2-SQL-NOTIFY-4"> <refsect2 id="R2-SQL-NOTIFY-4">
<refsect2info> <refsect2info>
......
<refentry id="APP-PG-DUMP"> <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_dump.sgml,v 1.12 1999/07/22 15:09:13 thomas Exp $
Postgres documentation
-->
<refentry id="APP-PGDUMP">
<refmeta> <refmeta>
<refentrytitle id="pg-dump"> <refentrytitle id="app-pgdump-title">
<application>pg_dump</application> <application>pg_dump</application>
</refentrytitle> </refentrytitle>
<refmiscinfo>Application</refmiscinfo> <refmiscinfo>Application</refmiscinfo>
...@@ -15,7 +20,7 @@ ...@@ -15,7 +20,7 @@
</refnamediv> </refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
<refsynopsisdivinfo> <refsynopsisdivinfo>
<date>1998-11-05</date> <date>1999-07-20</date>
</refsynopsisdivinfo> </refsynopsisdivinfo>
<synopsis> <synopsis>
pg_dump [ <replaceable class="parameter">dbname</replaceable> ] pg_dump [ <replaceable class="parameter">dbname</replaceable> ]
......
<refentry id="APP-PG-DUMPALL"> <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_dumpall.sgml,v 1.5 1999/07/22 15:09:13 thomas Exp $
Postgres documentation
-->
<refentry id="APP-PGDUMPALL">
<refmeta> <refmeta>
<refentrytitle> <refentrytitle id="APP-PGDUMPALL-TITLE">
<application>pg_dumpall</application> <application>pg_dumpall</application>
</refentrytitle> </refentrytitle>
<refmiscinfo>Application</refmiscinfo> <refmiscinfo>Application</refmiscinfo>
...@@ -15,7 +20,7 @@ ...@@ -15,7 +20,7 @@
</refnamediv> </refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
<refsynopsisdivinfo> <refsynopsisdivinfo>
<date>1998-10-04</date> <date>1999-07-20</date>
</refsynopsisdivinfo> </refsynopsisdivinfo>
<synopsis> <synopsis>
pg_dumpall pg_dumpall
...@@ -256,7 +261,7 @@ dumpSequence(<replaceable class="parameter">table</replaceable>): SELECT failed ...@@ -256,7 +261,7 @@ dumpSequence(<replaceable class="parameter">table</replaceable>): SELECT failed
</para> </para>
<para> <para>
Refer to Refer to
<xref endterm="pg-dump" linkend="app-pg-dump"> <xref endterm="app-pgdump-title" linkend="app-pgdump-title">
for more information on this capability. for more information on this capability.
</para> </para>
</refsect1> </refsect1>
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/Attic/pg_passwd.sgml,v 1.1 1999/07/22 15:09:13 thomas Exp $
Postgres documentation
-->
<refentry id="APP-PG-PASSWD">
<refmeta>
<refentrytitle id="APP-PG-PASSWD-TITLE">
<application>pg_passwd</application>
</refentrytitle>
<refmiscinfo>Application</refmiscinfo>
</refmeta>
<refnamediv>
<refname>
<application>pg_passwd</application>
</refname>
<refpurpose>
Manipulate the flat password file
</refpurpose>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
<date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
pg_passwd <replaceable class="parameter">filename</replaceable>
</synopsis>
</refsynopsisdiv>
<refsect1 id="R1-APP-PG-PASSWD-1">
<refsect1info>
<date>1999-07-20</date>
</refsect1info>
<title>
Description
</title>
<para>
<application>pg_passwd</application>
is a tool to manipulate the
flat password file functionality of
<productname>Postgres</productname>. This style of password
authentication is not <emphasis>required</emphasis> in an
installation, but is one of several supported security mechanisms.
</para>
<para>
Specify the password file in the same style of
<literal>Ident</literal> authentication in
<filename>$PGDATA/pg_hba.conf</filename>:
<programlisting>
host unv 133.65.96.250 255.255.255.255 password passwd
</programlisting>
where the above line allows access from 133.65.96.250 using the passwords listed
in <filename>$PGDATA/passwd</filename>.
The format of the password file follows those of
<filename>/etc/passwd</filename>
and
<filename>/etc/shadow</filename>.
The first field is the user name, and the second field
is the encrypted password.
The rest is completely ignored.
Thus the following three sample lines specify the same user and password pair:
<programlisting>
pg_guest:/nB7.w5Auq.BY:10031::::::
pg_guest:/nB7.w5Auq.BY:93001:930::/home/guest:/bin/tcsh
pg_guest:/nB7.w5Auq.BY:93001
</programlisting>
</para>
<para>
Supply the password file to the pg_passwd command.
In the case described above, after changing the working directory to
<envar>PGDATA</envar>, the following command execution specify
the new password for <literal>pg_guest</literal>:
<programlisting>
% pg_passwd passwd
Username: pg_guest
Password:
Re-enter password:
</programlisting>
where the <literal>Password:</literal>
and <literal>Re-enter password:</literal>
prompts require the same password input which are not displayed
on the terminal.
The original password file is renamed to
<filename>passwd.bk</filename>.
</para>
<para>
<application>psql</application>
uses the <option>-u</option>
option to invoke this style of
authentication.
</para>
<para>
The following lines show the sample usage of the option:
<programlisting>
% psql -h hyalos -u unv
Username: pg_guest
Password:
Welcome to the POSTGRESQL interactive sql monitor:
Please read the file COPYRIGHT for copyright terms of POSTGRESQL
type \? for help on slash commands
type \q to quit
type \g or terminate with semicolon to execute query
You are currently connected to the database: unv
unv=>
</programlisting>
</para>
<para>
Perl5 authentication
uses the new style of the <filename>Pg.pm</filename> like this:
<programlisting>
$conn = Pg::connectdb("host=hyalos dbname=unv
user=pg_guest password=xxxxxxx");
</programlisting>
For more details, refer to
<filename>src/interfaces/perl5/Pg.pm</filename>.
</para>
<para>
Pg{tcl,tk}sh authentication
uses the
<function>pg_connect</function>
command with the
<option>-conninfo</option>
option thusly:
<programlisting>
% set conn [pg_connect -conninfo \\
"host=hyalos dbname=unv \\
user=pg_guest password=xxxxxxx "]
</programlisting>
You can list all of the keys for the option by executing the following
command:
<programlisting>
% puts [ pg_conndefaults]
</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:
-->
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/Attic/pg_upgrade.sgml,v 1.5 1999/07/22 15:09:13 thomas Exp $
Postgres documentation
-->
<refentry id="APP-PG-UPGRADE"> <refentry id="APP-PG-UPGRADE">
<refmeta> <refmeta>
<refentrytitle> <refentrytitle id="APP-PG-UPGRADE-TITLE">
<application>pg_upgrade</application> <application>pg_upgrade</application>
</refentrytitle> </refentrytitle>
<refmiscinfo>Application</refmiscinfo> <refmiscinfo>Application</refmiscinfo>
...@@ -12,9 +17,10 @@ ...@@ -12,9 +17,10 @@
<refpurpose> <refpurpose>
Allows upgrade from a previous release without reloading data Allows upgrade from a previous release without reloading data
</refpurpose> </refpurpose>
</refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
<refsynopsisdivinfo> <refsynopsisdivinfo>
<date>1998-10-04</date> <date>1999-07-20</date>
</refsynopsisdivinfo> </refsynopsisdivinfo>
<synopsis> <synopsis>
pg_upgrade pg_upgrade
...@@ -29,10 +35,14 @@ pg_upgrade [ -f <replaceable class="parameter">filename</replaceable> ] <replace ...@@ -29,10 +35,14 @@ pg_upgrade [ -f <replaceable class="parameter">filename</replaceable> ] <replace
<title> <title>
Description Description
</title> </title>
<para> <para>
<application>pg_upgrade</application> <application>pg_upgrade</application>
is a utility for upgrading from a previous is a utility for upgrading from a previous
PostgreSQL release without reloading all the data. PostgreSQL release without reloading all the data.
Not all <productname>Postgres</productname> releases can be handled
this way; check the release notes for details on your installation.
</para>
<procedure> <procedure>
<title>Upgrading <productname>Postgres</productname></title> <title>Upgrading <productname>Postgres</productname></title>
...@@ -107,6 +117,8 @@ pg_upgrade [ -f <replaceable class="parameter">filename</replaceable> ] <replace ...@@ -107,6 +117,8 @@ pg_upgrade [ -f <replaceable class="parameter">filename</replaceable> ] <replace
You can delete the <filename>data.old/</filename> directory when you You can delete the <filename>data.old/</filename> directory when you
are finished. are finished.
</para> </para>
</step>
</procedure>
</refsect1> </refsect1>
</refentry> </refentry>
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/Attic/pgaccess-ref.sgml,v 1.3 1999/07/22 15:09:14 thomas Exp $
Postgres documentation
-->
<refentry id="APP-PGACCESS"> <refentry id="APP-PGACCESS">
<refmeta> <refmeta>
<refentrytitle id="pgaccess-ref"> <refentrytitle id="pgaccess-ref">
......
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/Attic/pgadmin-ref.sgml,v 1.3 1999/07/22 15:09:14 thomas Exp $
Postgres documentation
-->
<refentry id="APP-PGADMIN"> <refentry id="APP-PGADMIN">
<refmeta> <refmeta>
<refentrytitle id="pgadmin-ref"> <refentrytitle id="pgadmin-ref">
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment