ecpg reference page still needs formatting.
+<!--
+$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">
<refmeta>
- <refentrytitle>
+ <refentrytitle id="sql-abort-title">
ABORT
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
- <date>1998-09-27</date>
+ <date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
-ABORT [ TRANSACTION | WORK ]
+ABORT [ WORK | TRANSACTION ]
</synopsis>
<refsect2 id="R2-SQL-ABORT-1">
-<!-- allfiles.sgml
--
-- Complete list of usable sgml source files in this directory.
--
-- -->
+<!--
+$Header: /cvsroot/pgsql/doc/src/sgml/ref/allfiles.sgml,v 1.10 1999/07/22 15:09:06 thomas Exp $
+Postgres documentation
+Complete list of usable sgml source files in this directory.
+-->
<!entity intro-ref system "intro-ref.sgml">
<!entity commands system "commands.sgml">
<!entity trim system "trim.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 -->
<!entity abort system "abort.sgml">
<!entity alterTable system "alter_table.sgml">
<!entity dropType system "drop_type.sgml">
<!entity dropUser system "drop_user.sgml">
<!entity dropView system "drop_view.sgml">
+<!entity end system "end.sgml">
<!entity explain system "explain.sgml">
<!entity fetch system "fetch.sgml">
<!entity grant system "grant.sgml">
<!entity createuser system "createuser.sgml">
<!entity destroydb system "destroydb.sgml">
<!entity destroyuser system "destroyuser.sgml">
+<!entity ecpgRef system "ecpg-ref.sgml">
<!entity initdb system "initdb.sgml">
<!entity initlocation system "initlocation.sgml">
+<!entity ipcclean system "ipcclean.sgml">
<!entity pgAccess system "pgaccess-ref.sgml">
<!entity pgAdmin system "pgadmin-ref.sgml">
<!entity pgDump system "pg_dump.sgml">
<!entity pgDumpall system "pg_dumpall.sgml">
+<!entity pgPasswd system "pg_passwd.sgml">
<!entity pgUpgrade system "pg_upgrade.sgml">
<!entity postgres system "postgres-ref.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">
<refmeta>
- <refentrytitle>
+ <refentrytitle id="sql-altertable-title">
ALTER TABLE
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
- <date>1998-04-15</date>
+ <date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
ALTER TABLE <replaceable class="PARAMETER">table</replaceable>
</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
- 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
information on inheritance.
</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">
<refmeta>
- <refentrytitle>
+ <refentrytitle id="sql-alteruser-title">
ALTER USER
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
- <date>1998-09-08</date>
+ <date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
ALTER USER <replaceable class="PARAMETER">username</replaceable> [ WITH PASSWORD <replaceable class="PARAMETER">password</replaceable> ]
<command>ALTER USER</command> is used to change the attributes of a user's
<productname>Postgres</productname> account.
Please note that it is not possible
- to alter a user's "usesysid" via the alter user
+ to alter a user's "<literal>usesysid</literal>" via the alter user
statement. Also, it is only possible for the
<productname>Postgres</productname>
user or any user with read and modify permissions on
<para>
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.
</para>
<title>
Compatibility
</title>
- <para>
- </para>
<refsect2 id="R2-SQL-ALTERUSER-4">
<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>
- <refentrytitle id="SQL-BEGINWORK-TITLE">
+ <refentrytitle id="SQL-BEGIN-TITLE">
BEGIN
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
- <date>1999-06-11</date>
+ <date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
BEGIN [ WORK | TRANSACTION ]
</synopsis>
- <refsect2 id="R2-SQL-BEGINWORK-1">
+ <refsect2 id="R2-SQL-BEGIN-1">
<refsect2info>
<date>1999-06-11</date>
</refsect2info>
Inputs
</title>
<para>
- None.
+
+ <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-BEGINWORK-2">
+ <refsect2 id="R2-SQL-BEGIN-2">
<refsect2info>
<date>1999-06-11</date>
</refsect2info>
</refsect2>
</refsynopsisdiv>
- <refsect1 id="R1-SQL-BEGINWORK-1">
+ <refsect1 id="R1-SQL-BEGIN-1">
<refsect1info>
<date>1999-06-11</date>
</refsect1info>
(if execution was successful, otherwise a rollback is done).
<command>BEGIN</command> initiates a user transaction in chained mode,
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,
because transaction start/commit requires significant CPU and disk
activity. Execution of multiple statements inside a transaction
is READ COMMITTED, where queries inside the transaction see only changes
committed before query execution. So, you have to use
<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
the entire
transaction began (actually, before execution of the first DML statement
(atomic, consistent, isolatable, and durable) property.
</para>
- <refsect2 id="R2-SQL-BEGINWORK-3">
+ <refsect2 id="R2-SQL-BEGIN-3">
<refsect2info>
<date>1999-06-11</date>
</refsect2info>
</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.
</para>
</refsect2>
</refsect1>
- <refsect1 id="R1-SQL-BEGINWORK-2">
+ <refsect1 id="R1-SQL-BEGIN-2">
<title>
Usage
</title>
</para>
</refsect1>
- <refsect1 id="R1-SQL-BEGINWORK-3">
+ <refsect1 id="R1-SQL-BEGIN-3">
<title>
Compatibility
</title>
- <para>
- <command>BEGIN</command>
- is a <productname>Postgres</productname> language extension.
- </para>
- <refsect2 id="R2-SQL-BEGINWORK-4">
+
+ <refsect2 id="R2-SQL-BEGIN-4">
<refsect2info>
<date>1999-06-11</date>
</refsect2info>
<title>
SQL92
</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
- with a COMMIT or with a ROLLBACK statement.
+ with a <command>COMMIT</command> or <command>ROLLBACK</command> statement.
<note>
<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">
<refmeta>
- <refentrytitle>
+ <refentrytitle id="SQL-CLOSE-TITLE">
CLOSE
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
- <date>1998-09-08</date>
+ <date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
CLOSE <replaceable class="PARAMETER">cursor</replaceable>
<title>
Compatibility
</title>
- <para>
- </para>
<refsect2 id="R2-SQL-CLOSE-4">
<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">
<refmeta>
- <refentrytitle>
+ <refentrytitle id="sql-cluster-title">
CLUSTER
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
CLUSTER
</refname>
<refpurpose>
- Gives storage clustering advice to the backend
+ Gives storage clustering advice to the server
</refpurpose>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
- <date>1998-09-08</date>
+ <date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
CLUSTER <replaceable class="PARAMETER">indexname</replaceable> ON <replaceable class="PARAMETER">table</replaceable>
</varlistentry>
<varlistentry>
<term><computeroutput>
-ERROR: relation <<replaceable class="PARAMETER">tablerelation_number</replaceable>> inherits "invoice"
+ERROR: relation <<replaceable class="PARAMETER">tablerelation_number</replaceable>> inherits "<replaceable class="PARAMETER">table</replaceable>"
</computeroutput></term>
<listitem>
<para>
</varlistentry>
<varlistentry>
<term><computeroutput>
-ERROR: Relation x does not exist!
+ERROR: Relation <replaceable class="PARAMETER">table</replaceable> does not exist!
</computeroutput></term>
<listitem>
<para>
<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.
</comment>
</para>
<para>
<command>CLUSTER</command> instructs <productname>Postgres</productname>
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
<replaceable class="parameter">indexname</replaceable>. The index must
already have been defined on
<replaceable class="parameter">classname</replaceable>.
</para>
+
<para>
When a class is clustered, it is physically reordered
based on the index information. The clustering is static.
</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
requesting a range of indexed values from a table, or a
single indexed value that has multiple rows that match,
<para>
Another way to cluster data is to use
+
<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>
- 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
<command>ALTER TABLE/RENAME</command>
to rename <replaceable class="parameter">temp</replaceable> to the old name, and
<title>
Compatibility
</title>
- <para>
- </para>
<refsect2 id="R2-SQL-CLUSTER-4">
<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">
<Title>SQL Commands</Title>
&dropType
&dropUser;
&dropView;
+ &end;
&explain;
&fetch;
&grant;
-->
- <chapter Id="utilities">
+ <chapter Id="applications">
<title>Applications</title>
<abstract>
&createuser;
&destroydb;
&destroyuser;
- &initdb;
- &initlocation;
+ &ecpgRef;
&pgAccess;
&pgAdmin;
&pgDump;
&pgDumpall;
- &postgres;
- &postmaster;
&psqlRef;
&vacuumdb;
</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
Local variables:
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">
<refmeta>
<refentrytitle id="SQL-COMMIT-TITLE">
<refsynopsisdiv>
<refsynopsisdivinfo>
- <date>1998-09-08</date>
+ <date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
COMMIT [ WORK | TRANSACTION ]
Inputs
</title>
<para>
- None.
+
+ <variablelist>
+ <varlistentry>
+ <term>WORK</term>
+ <term>TRANSACTION</term>
+ <listitem>
+ <para>
+ Optional keywords. They have no effect.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
</para>
</refsect2>
<title>
Compatibility
</title>
- <para>
- </para>
<refsect2 id="R2-SQL-COMMIT-4">
<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">
<refmeta>
- <refentrytitle>
+ <refentrytitle id="sql-copy-title">
COPY
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
- <date>1998-09-08</date>
+ <date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
COPY [ BINARY ] <replaceable class="parameter">table</replaceable> [ WITH OIDS ]
- FROM { '<replaceable class="parameter">filename</replaceable>' |
- <filename>stdin</filename> }
+ FROM { '<replaceable class="parameter">filename</replaceable>' | <filename>stdin</filename> }
[ USING DELIMITERS '<replaceable class="parameter">delimiter</replaceable>' ]
COPY [ BINARY ] <replaceable class="parameter">table</replaceable> [ WITH OIDS ]
- TO { '<replaceable class="parameter">filename</replaceable>' |
- <filename>stdout</filename> }
+ TO { '<replaceable class="parameter">filename</replaceable>' | <filename>stdout</filename> }
[ USING DELIMITERS '<replaceable class="parameter">delimiter</replaceable>' ]
</synopsis>
</para>
</listitem>
</varlistentry>
+
<varlistentry>
<term><replaceable class="parameter">table</replaceable></term>
<listitem>
</para>
</listitem>
</varlistentry>
+
<varlistentry>
<term>WITH OIDS</term>
<listitem>
</para>
</listitem>
</varlistentry>
+
<varlistentry>
<term><replaceable class="parameter">filename</replaceable></term>
<listitem>
</para>
</listitem>
</varlistentry>
+
<varlistentry>
<term><filename>stdin</filename></term>
<listitem>
</para>
</listitem>
</varlistentry>
+
<varlistentry>
<term><filename>stdout</filename></term>
<listitem>
</para>
</listitem>
</varlistentry>
+
<varlistentry>
<term><replaceable class="parameter">delimiter</replaceable></term>
<listitem>
</varlistentry>
<varlistentry>
<term><computeroutput>
-ERROR: <replaceable>error message</replaceable>
+ERROR: <replaceable>reason</replaceable>
</computeroutput></term>
<listitem>
<para>
<para>
<command>COPY</command> moves data between
<productname>Postgres</productname> tables and
- standard Unix files.
+ standard file-system files.
<command>COPY</command> instructs
the <productname>Postgres</productname> backend
</para>
<para>
- You must have select access on any table whose values are read by
- <command>COPY</command>, and either insert or update access to a
+ You must have <firstterm>select access</firstterm> on any table
+ 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>.
The backend also needs appropriate Unix permissions for any file read
or written by <command>COPY</command>.
</para>
</tip>
</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>
</refsect1>
properly.
</para>
</refsect2>
+
<refsect2>
<refsect2info>
<date>1998-05-04</date>
</programlisting>
</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">
<title>
Compatibility
</title>
- <para>
- </para>
<refsect2 id="R2-SQL-COPY-4">
<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">
<refmeta>
- <refentrytitle>
+ <refentrytitle id="sql-createaggregate-title">
CREATE AGGREGATE
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
- <date>1998-09-09</date>
+ <date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
-CREATE AGGREGATE <replaceable class="PARAMETER">name</replaceable> [ AS ]
- ( BASETYPE = <replaceable class="PARAMETER">data_type</replaceable>
- [ , SFUNC1 = <replaceable class="PARAMETER">sfunc1</replaceable>
- , STYPE1 = <replaceable class="PARAMETER">sfunc1_return_type</replaceable> ]
- [ , SFUNC2 = <replaceable class="PARAMETER">sfunc2</replaceable>
- , STYPE2 = <replaceable class="PARAMETER">sfunc2_return_type</replaceable> ]
+CREATE AGGREGATE <replaceable class="PARAMETER">name</replaceable> [ AS ] ( BASETYPE = <replaceable class="PARAMETER">data_type</replaceable>
+ [ , SFUNC1 = <replaceable class="PARAMETER">sfunc1</replaceable>, STYPE1 = <replaceable class="PARAMETER">sfunc1_return_type</replaceable> ]
+ [ , SFUNC2 = <replaceable class="PARAMETER">sfunc2</replaceable>, STYPE2 = <replaceable class="PARAMETER">sfunc2_return_type</replaceable> ]
[ , FINALFUNC = <replaceable class="PARAMETER">ffunc</replaceable> ]
[ , INITCOND1 = <replaceable class="PARAMETER">initial_condition1</replaceable> ]
- [ , INITCOND2 = <replaceable class="PARAMETER">initial_condition2</replaceable> ]
- )
+ [ , INITCOND2 = <replaceable class="PARAMETER">initial_condition2</replaceable> ] )
</synopsis>
<refsect2 id="R2-SQL-CREATEAGGREGATE-1">
</title>
<para>
Refer to the chapter on aggregate functions
- in the <citetitle>PostgreSQL Programmer's Guide</citetitle>
- on aggregate functions for
+ in the <citetitle>PostgreSQL Programmer's Guide</citetitle> for
complete examples of usage.
- </para>
+ </para>
</refsect1>
<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">
<refmeta>
- <refentrytitle>
+ <refentrytitle id="sql-createdatabase-title">
CREATE DATABASE
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
- <date>1998-04-15</date>
+ <date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
CREATE DATABASE <replaceable class="PARAMETER">name</replaceable> [ WITH LOCATION = '<replaceable class="parameter">dbpath</replaceable>' ]
<term><replaceable class="parameter">dbpath</replaceable></term>
<listitem>
<para>
- An alternate location can be specified as either an
- environment variable known to the backend server
- (e.g. '<envar>PGDATA2</envar>') or as an absolute path name
- (e.g. '<filename>/usr/local/pgsql/data</filename>').
- In either case, the location must be pre-configured
- by <command>initlocation</command>.
+ An alternate location for the new database. See below for caveats.
</para>
</listitem>
</varlistentry>
The creator becomes the administrator of the new database.
</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">
<refsect2info>
<date>1998-04-15</date>
<para>
Use <command>DROP DATABASE</command> to remove a database.
</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>
</refsect1>
</para>
</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">
<title>
Compatibility
</title>
<para>
There is no <command>CREATE DATABASE</command> statement in SQL92.
- </para>
- <para>
The equivalent command in standard SQL is <command>CREATE SCHEMA</command>.
</para>
</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">
<refmeta>
- <refentrytitle>
+ <refentrytitle id="sql-createfunction-title">
CREATE FUNCTION
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
- <date>1998-09-09</date>
+ <date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
CREATE FUNCTION <replaceable class="parameter">name</replaceable> ( [ <replaceable class="parameter">ftype</replaceable> [, ...] ] )
<listitem>
<para>
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>
</listitem>
</varlistentry>
<listitem>
<para>
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>
</listitem>
</varlistentry>
or '<replaceable class="parameter">plname</replaceable>',
where '<replaceable class="parameter">plname</replaceable>'
is the name of a created procedural
- language. See <command>CREATE LANGUAGE</command> for details.
+ language. See
+ <xref linkend="sql-createlanguage-title" endterm="sql-createlanguage-title">
+ for details.
</para>
</listitem>
</varlistentry>
Notes
</title>
<para>
- Refer to the chapter on functions
-in the <citetitle>PostgreSQL Programmer's Guide</citetitle>
- for further information.
+ Refer to the chapter in
+ the <citetitle>PostgreSQL Programmer's Guide</citetitle>
+ on extending
+ <productname>Postgres</productname> via functions
+ for further information on writing external functions.
</para>
+
<para>
Use <command>DROP FUNCTION</command>
to drop user-defined functions.
</para>
- <para>
- <productname>Postgres</productname> allows function "overloading";
- that is, the same name can be used for several different functions
- so long as they have distinct argument types. This facility must be
- used with caution for INTERNAL and C-language functions, however.
- </para>
+ <para>
+ <productname>Postgres</productname> allows function "overloading";
+ that is, the same name can be used for several different functions
+ so long as they have distinct argument types. This facility must be
+ used with caution for <literal>internal</literal>
+ and C-language functions, however.
+ </para>
- <para>
- Two INTERNAL functions cannot have the same C name without causing
- errors at link time. To get around that, give them different C names
- (for example, use the argument types as part of the C names), then
- specify those names in the AS clause of <command>CREATE FUNCTION</command>.
- If the AS clause is left empty then <command>CREATE FUNCTION</command>
- assumes the C name of the function is the same as the SQL name.
- </para>
+ <para>
+ Two <literal>internal</literal>
+ functions cannot have the same C name without causing
+ errors at link time. To get around that, give them different C names
+ (for example, use the argument types as part of the C names), then
+ specify those names in the AS clause of <command>CREATE FUNCTION</command>.
+ If the AS clause is left empty then <command>CREATE FUNCTION</command>
+ assumes the C name of the function is the same as the SQL name.
+ </para>
- <para>
- 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
- 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
- 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.
- 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
- for you today, you might regret overloading names later when you try
- to run the code somewhere else.
- </para>
+ <para>
+ 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
+ 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
+ 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.
+ 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
+ for you today, you might regret overloading names later when you try
+ to run the code somewhere else.
+ </para>
+
+ <para>
+ A C function cannot return a set of values.
+ </para>
</refsect2>
</refsect1>
</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
digit and returns TRUE if the check digit in the function parameters
is correct. It is intended for use in a CHECK contraint.
</programlisting>
</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">
<title>
Compatibility
</title>
- <para>
- <command>CREATE FUNCTION</command> is
- a <productname>Postgres</productname> language extension.
- </para>
<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>
<date>1998-09-09</date>
</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">
<refmeta>
- <refentrytitle>
+ <refentrytitle id="sql-createindex-title">
CREATE INDEX
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
- <date>1998-09-09</date>
+ <date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
-CREATE [ UNIQUE ] INDEX <replaceable class="parameter">index_name</replaceable>
- ON <replaceable class="parameter">table</replaceable> [ USING <replaceable class="parameter">acc_name</replaceable> ]
- ( <replaceable class="parameter">column</replaceable> [ <replaceable class="parameter">ops_name</replaceable>] [, ...] )
-CREATE [ UNIQUE ] INDEX <replaceable class="parameter">index_name</replaceable>
- ON <replaceable class="parameter">table</replaceable> [ USING <replaceable class="parameter">acc_name</replaceable> ]
- ( <replaceable class="parameter">func_name</replaceable>( <replaceable class="parameter">r">col</replaceable>le> [, ... ]) <replaceable class="parameter">ops_name</replaceable> )
+CREATE [ UNIQUE ] INDEX <replaceable class="parameter">index_name</replaceable> ON <replaceable class="parameter">table</replaceable>
+ [ USING <replaceable class="parameter">acc_name</replaceable> ] ( <replaceable class="parameter">column</replaceable> [ <replaceable class="parameter">ops_name</replaceable>] [, ...] )
+CREATE [ UNIQUE ] INDEX <replaceable class="parameter">index_name</replaceable> ON <replaceable class="parameter">table</replaceable>
+ [ USING <replaceable class="parameter">acc_name</replaceable> ] ( <replaceable class="parameter">func_name</replaceable>( <replaceable class="parameter">r">col</replaceable>le> [, ... ]) <replaceable class="parameter">ops_name</replaceable> )
</synopsis>
<refsect2 id="R2-SQL-CREATEINDEX-1">
</para>
</listitem>
</varlistentry>
+
<varlistentry>
<term><replaceable class="parameter">index_name</replaceable></term>
<listitem>
</para>
</listitem>
</varlistentry>
+
<varlistentry>
<term><replaceable class="parameter">table</replaceable></term>
<listitem>
</para>
</listitem>
</varlistentry>
+
<varlistentry>
<term><replaceable class="parameter">acc_name</replaceable></term>
<listitem>
the name of the access method which is to be used for
the index. The default access method is BTREE.
Postgres provides three access methods for secondary indexes:
+
<variablelist>
<varlistentry>
<term>BTREE</term>
</para>
</listitem>
</varlistentry>
+
<varlistentry>
<term>RTREE</term>
<listitem>
</para>
</listitem>
</varlistentry>
+
<varlistentry>
<term>HASH</term>
<listitem>
</listitem>
</varlistentry>
</variablelist>
-
</para>
</listitem>
</varlistentry>
</para>
</listitem>
</varlistentry>
+
<varlistentry>
<term><replaceable class="parameter">ops_name</replaceable></term>
<listitem>
<para>
- An associated operator class.
- The following select list returns all ops_names:
-
- <programlisting>
-SELECT am.amname AS acc_name,
- opc.opcname AS ops_name,
- opr.oprname AS ops_comp
- 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>
+ An associated operator class. See below for details.
</para>
</listitem>
</varlistentry>
+
<varlistentry>
<term><replaceable class="parameter">func_name</replaceable></term>
<listitem>
</title>
<para>
<command>CREATE INDEX</command> constructs an index
- <replaceable class="parameter">index_name</replaceable>.
- on the specified
- <replaceable class="parameter">table</replaceable>.
+ <replaceable class="parameter">index_name</replaceable>
+ on the specified <replaceable class="parameter">table</replaceable>.
<tip>
<para>
</para>
</tip>
</para>
+
<para>
In the first syntax shown above, the key fields for the
index are specified as column names; a column may also have
operator class is the appropriate operator class for that
field type.
</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
<replaceable class="parameter">func_name</replaceable> applied
- to one or more attributes of a single class. These functional
- indexes can be used to obtain fast access to data
+ to one or more attributes of a single class.
+ These <firstterm>functional indices</firstterm>
+ can be used to obtain fast access to data
based on operators that would normally require some
transformation to apply them to the base data.
</para>
+ <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">
<refsect2info>
<date>1998-09-09</date>
<title>
Notes
</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><</member>
+ <member><=</member>
+ <member>=</member>
+ <member>>=</member>
+ <member>></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><<</member>
+ <member>&<</member>
+ <member>&></member>
+ <member>>></member>
+ <member>@</member>
+ <member>~=</member>
+ <member>&&</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>
Currently, only the BTREE access method supports multi-column
indexes. Up to 7 keys may be specified.
</para>
+
<para>
- Use <command>DROP INDEX</command>
+ Use <xref linkend="sql-dropindex-title" endterm="sql-dropindex-title">
to remove an index.
</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>
</refsect1>
<title>
Compatibility
</title>
- <para>
- </para>
<refsect2 id="R2-SQL-CREATEINDEX-4">
<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">
<refmeta>
- <refentrytitle>
+ <refentrytitle id="sql-createlanguage-title">
CREATE LANGUAGE
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
- <date>1998-09-09</date>
+ <date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
CREATE [ TRUSTED ] PROCEDURAL LANGUAGE '<replaceable class="parameter">langname</replaceable>'
<productname>Postgres</productname>.
</para>
</listitem>
- </varlistentry>
+ </varlistentry>
+
<varlistentry>
<term>HANDLER <replaceable class="parameter">call_handler</replaceable></term>
<listitem>
</para>
</listitem>
</varlistentry>
+
<varlistentry>
<term><replaceable class="parameter">comment</replaceable></term>
<listitem>
sql |postgres
</computeroutput>
</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>
</refsect2>
</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">
<title>
Usage
<title>
Compatibility
</title>
- <para>
- CREATE LANGUAGE is a <productname>Postgres</productname> extension.
- </para>
<refsect2 id="R2-SQL-CREATELANGUAGE-5">
<refsect2info>
<title>
SQL92
</title>
+
<para>
+ <command>CREATE LANGUAGE</command>
+ is a <productname>Postgres</productname> extension.
There is no <command>CREATE LANGUAGE</command> statement in
<acronym>SQL92</acronym>.
</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">
<refmeta>
- <refentrytitle>
+ <refentrytitle id="sql-createoperator-title">
CREATE OPERATOR
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
- <date>1999-04-14</date>
+ <date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
-CREATE OPERATOR <replaceable>name</replaceable> (
- PROCEDURE = <replaceable class="parameter">func_name</replaceable>
- [, LEFTARG = <replaceable class="parameter">type1</replaceable> ]
- [, RIGHTARG = <replaceable class="parameter">type2</replaceable> ]
- [, COMMUTATOR = <replaceable class="parameter">com_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> ]
- )
+CREATE OPERATOR <replaceable>name</replaceable> ( PROCEDURE = <replaceable class="parameter">func_name</replaceable>
+ [, LEFTARG = <replaceable class="parameter">type1</replaceable> ] [, RIGHTARG = <replaceable class="parameter">type2</replaceable> ]
+ [, COMMUTATOR = <replaceable class="parameter">com_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>
<refsect2 id="R2-SQL-CREATEOPERATOR-1">
<title>
Compatibility
</title>
- <para>
- CREATE OPERATOR is a <productname>Postgres</productname> extension.
- </para>
<refsect2 id="R2-SQL-CREATEOPERATOR-4">
<refsect2info>
<title>
SQL92
</title>
+
<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>
</refsect2>
</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">
<refmeta>
- <refentrytitle>
+ <refentrytitle id="sql-createrule-title">
CREATE RULE
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
- <date>1998-09-11</date>
+ <date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
CREATE RULE <replaceable class="parameter">name</replaceable> AS ON <replaceable class="parameter">event</replaceable>
<title>
Description
</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>
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
<literal>current.</literal><replaceable class="parameter">attribute-name</replaceable>
and <literal>new.</literal><replaceable class="parameter">attribute-name</replaceable>.
</para>
+
<para>
The <replaceable class="parameter">action</replaceable> part of the rule
executes with the same command and transaction identifier as the user
SELECT * FROM emp;
</programlisting></para>
</example>
-
</para>
+
<para>
You must have rule definition access to a class in order
to define a rule on it. Use <command>GRANT</command>
and <command>REVOKE</command> to change permissions.
</para>
+
+ <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>
</refsect1>
</para>
</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">
<title>
Compatibility
</title>
- <para>
- <command>CREATE RULE</command> statement is a <productname>Postgres</productname>
- language extension.
- </para>
<refsect2 id="R2-SQL-CREATERULE-4">
<refsect2info>
<title>
SQL92
</title>
+
<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>.
</para>
</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">
<refmeta>
- <refentrytitle>
+ <refentrytitle id="sql-createsequence-title">
CREATE SEQUENCE
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
- <date>1998-04-15</date>
+ <date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
-CREATE SEQUENCE <replaceable class="parameter">seqname</replaceable>
- [ INCREMENT <replaceable class="parameter">increment</replaceable> ]
- [ MINVALUE <replaceable class="parameter">minvalue</replaceable> ]
- [ MAXVALUE <replaceable class="parameter">maxvalue</replaceable> ]
- [ START <replaceable class="parameter">start</replaceable> ]
- [ CACHE <replaceable class="parameter">cache</replaceable> ]
- [ CYCLE ]
+CREATE SEQUENCE <replaceable class="parameter">seqname</replaceable> [ INCREMENT <replaceable class="parameter">increment</replaceable> ]
+ [ MINVALUE <replaceable class="parameter">minvalue</replaceable> ] [ MAXVALUE <replaceable class="parameter">maxvalue</replaceable> ]
+ [ START <replaceable class="parameter">start</replaceable> ] [ CACHE <replaceable class="parameter">cache</replaceable> ] [ CYCLE ]
</synopsis>
<refsect2 id="R2-SQL-CREATESEQUENCE-1">
</para>
</listitem>
</varlistentry>
+
<varlistentry>
<term><replaceable class="parameter">increment</replaceable></term>
<listitem>
</para>
</listitem>
</varlistentry>
+
<varlistentry>
<term><replaceable class="parameter">minvalue</replaceable></term>
<listitem>
</para>
</listitem>
</varlistentry>
+
<varlistentry>
<term><replaceable class="parameter">maxvalue</replaceable></term>
<listitem>
</para>
</listitem>
</varlistentry>
+
<varlistentry>
<term><replaceable class="parameter">start</replaceable></term>
<listitem>
</para>
</listitem>
</varlistentry>
+
<varlistentry>
<term><replaceable class="parameter">cache</replaceable></term>
<listitem>
</para>
</listitem>
</varlistentry>
+
<varlistentry>
<term>CYCLE</term>
<listitem>
table with the name <replaceable class="parameter">seqname</replaceable>.
The generator will be "owned" by the user issuing the command.
</para>
+
<para>
After a sequence is created, you may use the function
<function>nextval(<replaceable class="parameter">seqname</replaceable>)</function>
<para>
Use a query like
+
<programlisting>
SELECT * FROM sequence_name;
</programlisting>
+
to get the parameters of a sequence.
+
Aside from fetching the original
parameters, you can use
+
<programlisting>
SELECT last_value FROM sequence_name;
</programlisting>
+
to obtain the last value allocated by any backend.
parameters, you can use
</para>
+
<para>
Low-level locking is used to enable multiple simultaneous
calls to a generator.
<title>
Compatibility
</title>
- <para>
- <command>CREATE SEQUENCE</command> is a <productname>Postgres</productname>
- language extension.
- </para>
<refsect2 id="R2-SQL-CREATESEQUENCE-4">
<refsect2info>
<title>
SQL92
</title>
+
<para>
+ <command>CREATE SEQUENCE</command> is a <productname>Postgres</productname>
+ language extension.
There is no <command>CREATE SEQUENCE</command> statement
in <acronym>SQL92</acronym>.
</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">
<refmeta>
- <refentrytitle>
+ <refentrytitle id="sql-createtable-title">
CREATE TABLE
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
- <date>1998-09-11</date>
+ <date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
CREATE [ TEMPORARY | TEMP ] TABLE <replaceable class="PARAMETER">table</replaceable> (
<term><replaceable class="PARAMETER">table</replaceable></term>
<listitem>
<para>
- The name of a new table to be created.
+ The name of a new class or table to be created.
</para>
</listitem>
</varlistentry>
<title>
Description
</title>
+
<para>
- <command>CREATE TABLE</command> will enter a new table into the current data
- base. The table will be "owned" by the user issuing the
+ <command>CREATE TABLE</command> will enter a new class or table
+ into the current data base. The table will be "owned" by the user issuing the
command.
</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>
The new table is created as a heap with no initial data.
A table can have no more than 1600 columns (realistically,
<refsect1info>
<date>1998-09-11</date>
</refsect1info>
- <title>
+ <title id="R1-SQL-DEFAULTCLAUSE-1-TITLE">
DEFAULT Clause
</title>
<para>
<refsect1info>
<date>1998-09-11</date>
</refsect1info>
- <title>
+ <title id="R1-SQL-COLUMNCONSTRAINT-1-TITLE">
Column CONSTRAINT Clause
</title>
<para>
Inputs
</title>
<para>
+
<variablelist>
<varlistentry>
<term><replaceable class="parameter">name</replaceable></term>
<title>
Description
</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>
- 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,
UPDATE or DELETE operations performed on a Base Table.
</para>
+
<para>
There are two ways to define integrity constraints:
table constraints, covered later, and column constraints, covered here.
</para>
+
<para>
A column constraint is an integrity constraint defined as part
of a column definition, and logically becomes a table
constraint as soon as it is created. The column
constraints available are:
+
<simplelist columns="1">
<member>PRIMARY KEY</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>
- <refentrytitle>
+ <refentrytitle id="SQL-CREATETABLEAS-TITLE">
CREATE TABLE AS
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
- <date>1998-09-22</date>
+ <date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
CREATE TABLE <replaceable>table</replaceable> [ (<replaceable>column</replaceable> [, ...] ) ]
Description
</title>
<para>
- <command>CREATE TABLE AS</command> enables a table to be created from the contents of
- an existing table. It has functionality equivalent to <command>SELECT TABLE INTO</command>,
+ <command>CREATE TABLE AS</command> enables a table to be created
+ 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.
</para>
</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">
<refmeta>
- <refentrytitle>
+ <refentrytitle id="SQL-CREATETRIGGER-TITLE">
CREATE TRIGGER
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
- <date>1998-09-21</date>
+ <date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
CREATE TRIGGER <replaceable class="PARAMETER">name</replaceable> { BEFORE | AFTER } { <replaceable class="PARAMETER">event</replaceable> [OR ...] }
<title>
Description
</title>
+
<para>
<command>CREATE TRIGGER</command> will enter a new trigger into the current
data base. The trigger will be associated with the relation
<replaceable class="parameter">relname</replaceable> and will execute
the specified function <replaceable class="parameter">funcname</replaceable>.
</para>
+
<para>
- 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
- are checked and the INSERT, UPDATE or DELETE is attempted) or
- after the operation has been attempted (e.g. after constraints
- are checked and the INSERT, UPDATE or DELETE has completed). If the
+ are checked and the <command>INSERT</command>, <command>UPDATE</command> or
+ <command>DELETE</command> is attempted) or
+ 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
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
last insertion, update, or deletion, are "visible" to the trigger.
</para>
+
<para>
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.
</para>
+
<refsect2 id="R2-SQL-CREATETRIGGER-3">
<refsect2info>
<date>1998-09-21</date>
</title>
<para>
<command>CREATE TRIGGER</command> is a <productname>Postgres</productname>
- language extension.
+ language extension.
</para>
<para>
Only the relation owner may create a trigger on this relation.
<title>
Compatibility
</title>
- <para>
- </para>
<refsect2 id="R2-SQL-CREATETRIGGER-4">
<refsect2info>
<title>
SQL92
</title>
+
<para>
There is no <command>CREATE TRIGGER</command> in <acronym>SQL92</acronym>.
</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>.
</para>
</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">
<refmeta>
<refentrytitle>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
- <date>1998-09-21</date>
+ <date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
-CREATE TYPE <replaceable class="parameter">typename</replaceable> (
- INPUT = <replaceable class="parameter">input_function</replaceable>
- , OUTPUT = <replaceable class="parameter">output_function</replaceable>
- , INTERNALLENGTH = (<replaceable class="parameter">internallength</replaceable> | VARIABLE)
- [ , EXTERNALLENGTH = (<replaceable class="parameter">externallength</replaceable> | VARIABLE) ]
- [ , ELEMENT = <replaceable class="parameter">element</replaceable> ]
- [ , 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 ]
-)
+CREATE TYPE <replaceable class="parameter">typename</replaceable> ( INPUT = <replaceable class="parameter">input_function</replaceable>, OUTPUT = <replaceable class="parameter">output_function</replaceable>
+ , INTERNALLENGTH = { <replaceable class="parameter">internallength</replaceable> | VARIABLE } [ , EXTERNALLENGTH = { <replaceable class="parameter">externallength</replaceable> | VARIABLE } ]
+ [ , DEFAULT = "<replaceable class="parameter">default</replaceable>" ]
+ [ , ELEMENT = <replaceable class="parameter">element</replaceable> ] [ , DELIMITER = <replaceable class="parameter">delimiter</replaceable> ]
+ [ , SEND = <replaceable class="parameter">send_function</replaceable> ] [ , RECEIVE = <replaceable class="parameter">receive_function</replaceable> ]
+ [ , PASSEDBYVALUE ] )
</synopsis>
<refsect2 id="R2-SQL-CREATETYPE-1">
</para>
</listitem>
</varlistentry>
+
<varlistentry>
- <term>INTERNALLENGTH <replaceable class="parameter">internallength</replaceable></term>
+ <term><replaceable class="parameter">internallength</replaceable></term>
<listitem>
<para>
A literal value, which specifies the internal length of
</para>
</listitem>
</varlistentry>
+
<varlistentry>
- <term>EXTERNALLENGTH <replaceable class="parameter">externallength</replaceable></term>
+ <term><replaceable class="parameter">externallength</replaceable></term>
<listitem>
<para>
A literal value, which specifies the external length of
</para>
</listitem>
</varlistentry>
+
<varlistentry>
- <term>INPUT <replaceable class="parameter">input_function</replaceable></term>
+ <term><replaceable class="parameter">input_function</replaceable></term>
<listitem>
<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
internal form.
</para>
</listitem>
</varlistentry>
+
<varlistentry>
- <term>OUTPUT <replaceable class="parameter">output_function</replaceable></term>
+ <term><replaceable class="parameter">output_function</replaceable></term>
<listitem>
<para>
The name of a function, created by CREATE FUNCTION, which
</para>
</listitem>
</varlistentry>
+
<varlistentry>
<term><replaceable class="parameter">element</replaceable></term>
<listitem>
</para>
</listitem>
</varlistentry>
+
<varlistentry>
<term><replaceable class="parameter">delimiter</replaceable></term>
<listitem>
</para>
</listitem>
</varlistentry>
+
<varlistentry>
<term><replaceable class="parameter">default</replaceable></term>
<listitem>
<term><replaceable class="parameter">send_function</replaceable></term>
<listitem>
<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
transmission to another machine.
- <comment>Is this right?</comment>
</para>
</listitem>
</varlistentry>
<term><replaceable class="parameter">receive_function</replaceable></term>
<listitem>
<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
transmission from another machine to internal form.
- <comment>Is this right?</comment>
</para>
</listitem>
</varlistentry>
<title>
Description
</title>
+
<para>
<command>CREATE TYPE</command> allows the user to register a new user data
type with Postgres for use in the current data base. The
the name of the new type and must be unique within the
types defined for this database.
</para>
+
<para>
<command>CREATE TYPE</command> requires the registration of two functions
(using create function) before defining the type. The
the input and output functions must be declared to take
one or two arguments of type "<literal>opaque</literal>".
</para>
+
<para>
New base data types can be fixed length, in which case
<replaceable class="parameter">internallength</replaceable> is a
<replaceable class="parameter">externallength</replaceable>
keyword.
</para>
+
<para>
To indicate that a type is an array and to indicate that a
type has array elements, indicate the type of the array
an array of 4 byte integers ("int4"), specify
<programlisting>ELEMENT = int4</programlisting>
</para>
+
<para>
To indicate the delimiter to be used on arrays of this
type, <replaceable class="parameter">delimiter</replaceable>
set to a specific character. The default delimiter is the comma
("<literal>,</literal>").
</para>
+
<para>
A default value is optionally available in case a user
wants some specific bit pattern to mean "data not present."
<comment>How does the user specify that bit pattern and associate
it with the fact that the data is not present></comment>
</para>
+
<para>
- The optional functions
+ The optional arguments
<replaceable class="parameter">send_function</replaceable> and
<replaceable class="parameter">receive_function</replaceable>
are used when the application program requesting Postgres
characters do not have to be converted if passed from
a Sun-4 to a DECstation, but many other types do.
</para>
+
<para>
The optional flag, <option>PASSEDBYVALUE</option>, indicates that operators
and functions which use this data type should be passed an
may not pass by value types whose internal representation is
more than four bytes.
</para>
+
<para>
For new base types, a user can define operators, functions
and aggregates using the appropriate facilities described
<para>
This command creates the box data type and then uses the
type in a class definition:
- </para>
- <programlisting>
+ <programlisting>
CREATE TYPE box (INTERNALLENGTH = 8,
INPUT = my_procedure_1, OUTPUT = my_procedure_2);
CREATE TABLE myboxes (id INT4, description box);
- </programlisting>
+ </programlisting>
+ </para>
+
<para>
This command creates a variable length array type with
- integer elements.
+ integer elements:
<programlisting>
CREATE TYPE int4array (INPUT = array_in, OUTPUT = array_out,
CREATE TABLE myarrays (id int4, numbers int4array);
</programlisting>
</para>
+
<para>
This command creates a large object type and uses it in
a class definition:
</programlisting>
</para>
- <refsect2>
- <title>Restrictions</title>
+ <refsect2 id="R2-SQL-CREATETYPE-3">
+ <refsect2info>
+ <date>1998-09-21</date>
+ </refsect2info>
+ <title>
+ Notes
+ </title>
+
<para>
Type names cannot begin with the underscore character
("_") and can only be 31 characters long. This is because
with a name consisting of the base type's name prepended
with an underscore.
</para>
- </refsect2>
- <refsect2 id="R2-SQL-CREATETYPE-3">
- <refsect2info>
- <date>1998-09-21</date>
- </refsect2info>
- <title>
- Notes
- </title>
<para>
Refer to <command>DROP TYPE</command> to remove an existing type.
</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">
<refmeta>
<refentrytitle>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
- <date>1998-09-21</date>
+ <date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
CREATE USER<replaceable class="PARAMETER"> username</replaceable>
[ WITH PASSWORD <replaceable class="PARAMETER">password</replaceable> ]
- [ CREATEDB | NOCREATEDB ]
- [ CREATEUSER | NOCREATEUSER ]
+ [ CREATEDB | NOCREATEDB ] [ CREATEUSER | NOCREATEUSER ]
[ IN GROUP <replaceable class="PARAMETER">groupname</replaceable> [, ...] ]
[ VALID UNTIL '<replaceable class="PARAMETER">abstime</replaceable>' ]
</synopsis>
Inputs
</title>
<para>
+
<variablelist>
<varlistentry>
<term><replaceable class="parameter">username</replaceable></term>
CREATE USER will add a new user to an instance of
<productname>Postgres</productname>.
</para>
+
<para>
The new user will be given a <filename>usesysid</filename> of:
<title>
Compatibility
</title>
- <para>
- </para>
<refsect2 id="R2-SQL-CREATEUSER-4">
<refsect2info>
<title>
SQL92
</title>
+
<para>
There is no <command>CREATE USER</command> statement in SQL92.
</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">
<refmeta>
- <refentrytitle>
+ <refentrytitle id="SQL-CREATEVIEW-TITLE">
CREATE VIEW
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
- <date>1998-09-21</date>
+ <date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
-CREATE VIEW <replaceable class="PARAMETER">view</replaceable>
- AS SELECT <replaceable class="PARAMETER">query</replaceable>
+CREATE VIEW <replaceable class="PARAMETER">view</replaceable> AS SELECT <replaceable class="PARAMETER">query</replaceable>
</synopsis>
<refsect2 id="R2-SQL-CREATEVIEW-1">
Inputs
</title>
<para>
+
<variablelist>
<varlistentry>
<term><replaceable class="parameter">view</replaceable></term>
Description
</title>
<para>
- <command>CREATE VIEW</command> will define a view of a table. This view is
- not physically materialized. Specifically, a query
- rewrite retrieve rule is automatically generated
- to support retrieve operations on views.
+ <command>CREATE VIEW</command> will define a view of a table or
+ class. This view is not physically materialized. Specifically, a query
+ rewrite retrieve rule is automatically generated to support
+ retrieve operations on views.
</para>
<refsect2 id="R2-SQL-CREATEVIEW-3">
<title>
Notes
</title>
+
<para>
- Use the <command>DROP VIEW</command> statement to drop views.
+ Currently, views are read only.
</para>
- </refsect2>
- <refsect2 id="R2-SQL-CREATEVIEW-4">
- <refsect2info>
- <date>1998-09-21</date>
- </refsect2info>
- <title>
- Bugs
- </title>
<para>
- Currently, views are read only.
+ Use the <command>DROP VIEW</command> statement to drop views.
</para>
</refsect2>
</refsect1>
<title>
Compatibility
</title>
- <para>
- </para>
<refsect2 id="R2-SQL-CREATEVIEW-5">
<refsect2info>
</para>
</listitem>
</varlistentry>
+
<varlistentry>
<term>LOCAL</term>
<listitem>
</para>
</listitem>
</varlistentry>
+
<varlistentry>
<term>CASCADE</term>
<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">
<refmeta>
- <refentrytitle>
+ <refentrytitle id="APP-CREATEDB-TITLE">
<application>createdb</application>
</refentrytitle>
<refmiscinfo>Application</refmiscinfo>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
- <date>1998-10-02</date>
+ <date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
createdb [ <replaceable class="parameter">dbname</replaceable> ]
<envar>PGREALM</envar>
environment variables will be passed on to
<application>psql</application>
- and processed as described in <xref endterm="psql-ref"
- linkend="app-psql">.
+ and processed as described in <xref endterm="app-psql-title" linkend="app-psql-title">.
</para>
</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">
<refmeta>
- <refentrytitle>
+ <refentrytitle id="APP-CREATEUSER-TITLE">
<application>createuser</application>
</refentrytitle>
<refmiscinfo>Application</refmiscinfo>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
- <date>1998-10-02</date>
+ <date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
createuser [ <replaceable class="parameter">username</replaceable> ]
<envar>PGREALM</envar>
environment variables will be passed on to
<application>psql</application>
- and processed as described in <xref endterm="psql-ref" linkend="app-psql">.
+ and processed as described in
+ <xref endterm="app-psql-title" linkend="app-psql-title">.
</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">
<REFMETA>
<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">
<REFMETA>
<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">
<REFMETA>
<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">
<REFMETA>
<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">
<refmeta>
- <refentrytitle>
+ <refentrytitle id="SQL-DECLARE-TITLE">
DECLARE
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
- <date>1998-09-04</date>
+ <date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
DECLARE <replaceable class="parameter">cursor</replaceable> [ BINARY ] [ INSENSITIVE ] [ SCROLL ]
Description
</title>
<para>
- <command>DECLARE</command> allows a user to create cursors, which can be used to retrieve
- a small number of rows at a time out of a larger query. Cursors can return
- data either in text or in binary foramt.
+ <command>DECLARE</command> allows a user to create cursors, which
+ can be used to retrieve
+ a small number of rows at a time out of a larger query. Cursors can
+ return data either in text or in binary format using
+ <xref linkend="sql-fetch-title" endterm="sql-fetch-title">.
</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>
backend was built. Since
data is stored natively in binary format, the system must
do a conversion to produce the text format. In addition,
text formats are often larger in size than the corresponding binary format.
Once the information comes back in text form, the client
- application may have to convert it to a binary format to
- manipulate it anyway.
- </para>
-
- <para>
+ application may need to convert it to a binary format to
+ manipulate it.
BINARY cursors give you back the data in the native binary
- representation. So binary cursors will tend to be a
- little faster since they suffer less conversion overhead.
+ representation.
</para>
<para>
you would get a string of '1' with a default cursor
whereas with a binary cursor you would get
a 4-byte value equal to control-A ('^A').
+ </para>
- <caution>
- <para>
- BINARY cursors should be used carefully. User applications such
- as <application>psql</application> are not aware of binary cursors
- and expect data to come back in a text format.
- </para>
- </caution>
+ <para>
+ BINARY cursors should be used carefully. User applications such
+ as <application>psql</application> are not aware of binary cursors
+ and expect data to come back in a text format.
</para>
<para>
- However, string representation is architecture-neutral whereas binary
- representation can differ between different machine architectures.
+ String representation is architecture-neutral whereas binary
+ 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
representations (e.g. "big-endian" versus "little-endian"),
you will probably not want your data returned in
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>
<para>
<title>
Notes
</title>
+
<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>
- <productname>Postgres</productname>
- does not have an explicit <command>OPEN cursor</command>
+ In <acronym>SQL92</acronym> cursors are only available in
+ 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.
-
- <note>
- <para>
- In <acronym>SQL92</acronym> cursors are only available in
- 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>
+ However, <application>ecpg</application>, the
+ embedded SQL preprocessor for <productname>Postgres</productname>,
+ supports the <acronym>SQL92</acronym> cursor conventions, including those
+ involving DECLARE and OPEN statements.
</para>
</refsect2>
</refsect1>
<title>
Compatibility
</title>
- <para>
- </para>
<refsect2 id="R2-SQL-DECLARESTATEMENT-4">
<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">
<refmeta>
- <refentrytitle>
+ <refentrytitle id="SQL-DELETE-TITLE">
DELETE
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
- <date>1998-04-15</date>
+ <date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
DELETE FROM <replaceable class="PARAMETER">table</replaceable> [ WHERE <replaceable class="PARAMETER">condition</replaceable> ]
<title>
Description
</title>
+
<para>
<command>DELETE</command> removes rows which satisfy the WHERE
clause from the specified table.
</para>
+
<para>
If the <firstterm>condition</firstterm> (WHERE clause) is absent,
the effect is to delete all rows in the table.
The result is a valid, but empty table.
</para>
+
<para>
You must have write access to the table in order to modify
it, as well as read access to any table whose values are
DELETE FROM films WHERE kind <> 'Musical';
SELECT * FROM films;
+ <computeroutput>
code |title |did| date_prod|kind |len
-----+-------------------------+---+----------+----------+------
UA501|West Side Story |105|1961-01-03|Musical | 02:32
TC901|The King and I |109|1956-08-11|Musical | 02:13
WD101|Bed Knobs and Broomsticks|111| |Musical | 01:57
(3 rows)
+ </computeroutput>
</programlisting>
</para>
DELETE FROM films;
SELECT * FROM films;
+ <computeroutput>
code|title|did|date_prod|kind|len
----+-----+---+---------+----+---
(0 rows)
+ </computeroutput>
</programlisting>
</para>
</refsect1>
<title>
Compatibility
</title>
- <para>
- </para>
<refsect2 id="R2-SQL-DELETE-4">
<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">
<refmeta>
- <refentrytitle>
+ <refentrytitle id="APP-DESTROYDB-TITLE">
<application>destroydb</application>
</refentrytitle>
<refmiscinfo>Application</refmiscinfo>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
- <date>1998-10-02</date>
+ <date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
destroydb [ <replaceable class="parameter">dbname</replaceable> ]
<envar>PGREALM</envar>
environment variables will be passed on to
<application>psql</application>
- and processed as described in <xref endterm="psql-ref"
- linkend="app-psql">.
+ and processed as described in <xref endterm="app-psql-title" linkend="app-psql-title">.
</para>
</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">
<refmeta>
- <refentrytitle>
+ <refentrytitle id="APP-DESTROYUSER-TITLE">
<application>destroyuser</application>
</refentrytitle>
<refmiscinfo>Application</refmiscinfo>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
- <date>1998-10-02</date>
+ <date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
destroyuser [ <replaceable class="parameter">username</replaceable> ]
<envar>PGREALM</envar>
environment variables will be passed on to
<application>psql</application>
- and processed as described in <xref endterm="psql-ref"
- linkend="app-psql">.
+ and processed as described in <xref endterm="app-psql-title" linkend="app-psql-title">.
</para>
+
<para>
Once invoked, <application>destroyuser</application>
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">
<refmeta>
- <refentrytitle>
+ <refentrytitle id="SQL-DROPAGGREGATE-TITLE">
DROP AGGREGATE
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
- <date>1998-04-15</date>
+ <date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
DROP AGGREGATE <replaceable class="PARAMETER">name</replaceable> <replaceable class="PARAMETER">type</replaceable>
<title>
Notes
</title>
+
<para>
- The <command>DROP AGGREGATE</command> statement is a
- <productname>Postgres</productname>
- language extension.
- </para>
- <para>
- Refer to the <command>CREATE AGGREGATE</command> statement to
- create aggregate functions.
+ Use
+ <xref linkend="sql-createaggregate-title" endterm="sql-createaggregate-title">
+ to create aggregate functions.
</para>
</refsect2>
</refsect1>
<title>
Compatibility
</title>
- <para>
- </para>
<refsect2 id="R2-SQL-DROPAGGREGATE-4">
<refsect2info>
<title>
SQL92
</title>
+
<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>
</refsect2>
</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">
<refmeta>
- <refentrytitle>
+ <refentrytitle id="SQL-DROPDATABASE-TITLE">
DROP DATABASE
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
- <date>1998-04-15</date>
+ <date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
DROP DATABASE <replaceable class="PARAMETER">name</replaceable>
</title>
<para>
- <command>DROP DATABASE</command> statement is a <productname>Postgres</productname>
- language extension.
-
- <tip>
- <para>
- This query cannot be executed while connected to the target
- database. It is usually preferable to use the
- <command>destroydb</command> script instead.
- </para>
- </tip>
+ This query cannot be executed while connected to the target
+ database. It is usually preferable to use
+ <xref linkend="app-destroydb-title" endterm="app-destroydb-title">
+ instead.
</para>
<para>
- Refer to the <command>CREATE DATABASE</command> statement for
- information on how to create a database.
+ Refer to
+ <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>
</refsect2>
</refsect1>
<title>
Compatibility
</title>
- <para>
- </para>
<refsect2 id="R2-SQL-DROPDATABASE-4">
<refsect2info>
<title>
SQL92
</title>
+
<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>
</refsect2>
</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">
<refmeta>
- <refentrytitle>
+ <refentrytitle id="SQL-DROPFUNCTION-TITLE">
DROP FUNCTION
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
- <date>1998-04-15</date>
+ <date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
DROP FUNCTION <replaceable class="parameter">name</replaceable> ( [ <replaceable class="parameter">type</replaceable> [, ...] ] )
<title>
Notes
</title>
+
+ <para>
+ Refer to
+ <xref linkend="sql-createfunction-title" endterm="sql-createfunction-title">
+ for information on creating aggregate functions.
+ </para>
+
<para>
- Refer to <command>CREATE FUNCTION</command>
- to create aggregate functions.
+ No checks are made to ensure that types, operators or access
+ methods that rely on the function have been removed first.
</para>
</refsect2>
</refsect1>
<title>
Usage
</title>
+
<para>
This command removes the square root function:
</para>
</refsect1>
- <refsect1 id="R1-SQL-DROPFUNCTION-3">
- <title>
- Bugs
- </title>
- <para>
- No checks are made to ensure that types, operators or access
- methods that rely on the function have been removed first.
- </para>
- </refsect1>
-
<refsect1 id="R1-SQL-DROPFUNCTION-4">
<title>
Compatibility
</title>
- <para>
- DROP FUNCTION is a <productname>Postgres</productname> language extension.
- </para>
<refsect2 id="R2-SQL-DROPFUNCTION-4">
+ <refsect2info>
+ <date>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>
<date>1998-04-15</date>
</refsect2info>
<para>
SQL/PSM is a proposed standard to enable function extensibility.
The SQL/PSM DROP FUNCTION statement has the following syntax:
- <programlisting>
+
+ <synopsis>
DROP [ SPECIFIC ] FUNCTION <replaceable class="parameter">name</replaceable> { RESTRICT | CASCADE }
- </programlisting>
+ </synopsis>
</para>
</refsect2>
</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">
<refmeta>
- <refentrytitle>
+ <refentrytitle id="SQL-DROPINDEX-TITLE">
DROP INDEX
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
- <date>1998-04-15</date>
+ <date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
DROP INDEX <replaceable class="PARAMETER">index_name</replaceable>
language extension.
</para>
<para>
- Refer to the <command>CREATE INDEX</command> statement for
- information on how to create indexes.
+ Refer to
+ <xref linkend="sql-createindex-title" endterm="sql-createindex-title">
+ for information on how to create indexes.
</para>
</refsect2>
</refsect1>
<title>
Compatibility
</title>
- <para>
- </para>
<refsect2 id="R2-SQL-DROPINDEX-4">
<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">
<refmeta>
- <refentrytitle>
+ <refentrytitle id="SQL-DROPLANGUAGE-TITLE">
DROP LANGUAGE
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
- <date>1998-04-15</date>
+ <date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
DROP PROCEDURAL LANGUAGE '<replaceable class="PARAMETER">name</replaceable>'
a <productname>Postgres</productname> language extension.
</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.
</para>
- </refsect2>
-
- <refsect2 id="R2-SQL-DROPLANGUAGE-4">
- <refsect2info>
- <date>1998-04-15</date>
- </refsect2info>
- <title>
- Bugs
- </title>
+
<para>
No checks are made if functions or trigger procedures registered
in this language still exist. To re-enable them without having
<title>
Compatibility
</title>
- <para>
- </para>
<refsect2 id="R2-SQL-DROPLANGUAGE-5">
<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">
<refmeta>
- <refentrytitle>
+ <refentrytitle id="SQL-DROPOPERATOR-TITLE">
DROP OPERATOR
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
<refsynopsisdiv>
<refsynopsisdivinfo>
- <date>1998-09-22</date>
+ <date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
DROP OPERATOR <replaceable class="PARAMETER">id</replaceable> ( <replaceable class="PARAMETER">type</replaceable> | NONE [,...] )
language extension.
</para>
<para>
- Refer to <command>CREATE OPERATOR</command> for
- information on how to create operators.
+ Refer to
+ <xref linkend="sql-createoperator-title" endterm="sql-createoperator-title">
+ for information on how to create operators.
</para>
<para>
It is the user's responsibility to remove any access methods and
<title>
Compatibility
</title>
- <para>
- </para>
<refsect2 id="R2-SQL-DROPOPERATOR-4">
<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">
<refmeta>
- <refentrytitle>
+ <refentrytitle id="SQL-DROPRULE-TITLE">
DROP RULE
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
<productname>Postgres</productname>
language extension.
</para>
+
<para>
Refer to <command>CREATE RULE</command> for
information on how to create rules.
</para>
- </refsect2>
- <refsect2 id="R2-SQL-DROPRULE-4">
- <refsect2info>
- <date>1998-09-22</date>
- </refsect2info>
- <title>
- Bugs
- </title>
<para>
Once a rule is dropped, access to historical information
the rule has written may disappear.
<title>
Compatibility
</title>
- <para>
- </para>
-
+
<refsect2 id="R2-SQL-DROPRULE-5">
<refsect2info>
<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">
<refmeta>
- <refentrytitle>
+ <refentrytitle id="SQL-DROPSEQUENCE-TITLE">
DROP SEQUENCE
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
- <date>1998-09-22</date>
+ <date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
DROP SEQUENCE <replaceable class="PARAMETER">name</replaceable> [, ...]
<title>
Compatibility
</title>
- <para>
- </para>
<refsect2 id="R2-SQL-DROPSEQUENCE-4">
<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">
<refmeta>
- <refentrytitle>
+ <refentrytitle id="SQL-DROPTABLE-TITLE">
DROP TABLE
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
- <date>1998-09-22</date>
+ <date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
DROP TABLE <replaceable class="PARAMETER">name</replaceable> [, ...]
<title>
Compatibility
</title>
- <para>
- </para>
<refsect2 id="R2-SQL-DROPTABLE-4">
<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">
<refmeta>
- <refentrytitle>
+ <refentrytitle id="SQL-DROPTRIGGER-TITLE">
DROP TRIGGER
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
<title>
Compatibility
</title>
- <para>
- </para>
<refsect2 id="R2-SQL-DROPTRIGGER-4">
<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">
<refmeta>
- <refentrytitle>
+ <refentrytitle id="SQL-DROPTYPE-TITLE">
DROP TYPE
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
- <date>1998-09-22</date>
+ <date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
DROP TYPE <replaceable class="PARAMETER">typename</replaceable>
functions, aggregates, access methods, subtypes, and classes
that use a deleted type.
</para>
- </refsect2>
- <refsect2 id="R2-SQL-DROPTYPE-4">
- <refsect2info>
- <date>1998-09-22</date>
- </refsect2info>
- <title>
- Bugs
- </title>
<para>
If a built-in type is removed, the behavior of the backend
is unpredictable.
<title>
Compatibility
</title>
- <para>
- </para>
<refsect2 id="R2-SQL-DROPTYPE-5">
<refsect2info>
SQL3
</title>
<para>
- DROP TYPE is a <acronym>SQL3</acronym> statement.
+ <command>DROP TYPE</command> is a <acronym>SQL3</acronym> statement.
</para>
</refsect2>
</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">
<refmeta>
- <refentrytitle>
+ <refentrytitle id="SQL-DROPUSER-TITLE">
DROP USER
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
- <date>1998-09-22</date>
+ <date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
DROP USER <replaceable class="PARAMETER">name</replaceable>
<title>
Compatibility
</title>
- <para>
- </para>
<refsect2 id="R2-SQL-DROPUSER-4">
<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">
<refmeta>
- <refentrytitle>
+ <refentrytitle id="SQL-DROPVIEW-TITLE">
DROP VIEW
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
- <date>1998-09-22</date>
+ <date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
DROP VIEW <replaceable class="PARAMETER">name</replaceable>
<title>
Compatibility
</title>
- <para>
- </para>
<refsect2 id="R2-SQL-DROPVIEW-4">
<refsect2info>
--- /dev/null
+<!--
+$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:
+-->
--- /dev/null
+<!--
+$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">
<refmeta>
- <refentrytitle>
+ <refentrytitle id="SQL-EXPLAIN-TITLE">
EXPLAIN
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
<refsynopsisdiv>
<refsynopsisdivinfo>
- <date>1998-09-01</date>
+ <date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
EXPLAIN [ VERBOSE ] <replaceable class="PARAMETER">query</replaceable>
<title>
Description
</title>
+
<para>
This command outputs details about the supplied query.
The default output is the computed query cost.
<title>
Usage
</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>
- 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>
-EXPLAIN select * from foo;
+EXPLAIN SELECT * FROM foo WHERE i = 4;
+ <computeroutput>
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
+ </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>
</para>
</refsect1>
<title>
Compatibility
</title>
- <para>
- </para>
<refsect2 id="R2-SQL-EXPLAIN-4">
<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">
<refmeta>
- <refentrytitle>
+ <refentrytitle id="SQL-FETCH-TITLE">
FETCH
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
- <date>1998-09-01</date>
+ <date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
FETCH [ <replaceable class="PARAMETER">selector</replaceable> ] [ <replaceable class="PARAMETER">count</replaceable> ] { IN | FROM } <replaceable class="PARAMETER">cursor</replaceable>
<title>
Description
</title>
+
<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
<replaceable class="PARAMETER">#</replaceable>.
If the number of rows remaining in the cursor is less
<tip>
<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
the sense of the FORWARD and BACKWARD keywords. For example,
<command>FORWARD -1</command> is the same as <command>BACKWARD 1</command>.
</para>
</tip>
</para>
- <para>
- Note that the FORWARD and BACKWARD keywords are
- <productname>Postgres</productname> extensions.
- The <acronym>SQL92</acronym> syntax is also supported, specified
- in the second form of the command. See below for details
- on compatibility issues.
- </para>
- <para>
- Once all rows are fetched, every other fetch access returns
- no rows.
- </para>
-
- <para>
- 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">
<refsect2info>
<title>
Notes
</title>
+
<para>
- Use <command>MOVE</command> to change cursor position.
- <command>DECLARE</command> will define a cursor.
- Refer to <command>BEGIN</command>, <command>COMMIT</command>, and
- <command>ROLLBACK</command>
+ 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>
+
+ <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.
</para>
</refsect2>
<title>
Usage
</title>
+
<para>
+ The following examples traverses a table using a cursor.
+
<programlisting>
--set up and use a cursor:
--
--
FETCH FORWARD 5 IN liahona;
+ <computeroutput>
code |title |did| date_prod|kind |len
-----+-----------------------+---+----------+----------+------
BL101|The Third Man |101|1949-12-23|Drama | 01:44
JL201|Une Femme est une Femme|102|1961-03-12|Romantic | 01:25
P_301|Vertigo |103|1958-11-14|Action | 02:08
P_302|Becket |103|1964-02-03|Drama | 02:28
-
+ </computeroutput>
--Fetch previous row:
--
FETCH BACKWARD 1 IN liahona;
+ <computeroutput>
code |title |did| date_prod|kind |len
-----+-----------------------+---+----------+----------+------
P_301|Vertigo |103|1958-11-14|Action | 02:08
+ </computeroutput>
-- close the cursor and commit work:
--
<title>
Compatibility
</title>
- <para>
- The non-embedded use of cursors is a <productname>Postgres</productname>
- extension. The syntax and usage of cursors is being compared
- against the embedded form of cursors defined in <acronym>SQL92</acronym>.
- </para>
<refsect2 id="R2-SQL-FETCH-4">
<refsect2info>
<title>
SQL92
</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>
<acronym>SQL92</acronym> allows absolute positioning of the cursor for
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">
<refmeta>
- <refentrytitle>
+ <refentrytitle id="SQL-GRANT-TITLE">
GRANT
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
- <date>1998-09-23</date>
+ <date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
GRANT <replaceable class="PARAMETER">privilege</replaceable> [, ...] ON <replaceable class="PARAMETER">object</replaceable> [, ...]
<title>
Description
</title>
+
<para>
<command>GRANT</command> allows the creator of an object to give specific permissions to
all users (PUBLIC) or to a certain user or group.
<para>
Currently, to create a GROUP you have to insert
data manually into table pg_group as:
+
<programlisting>
INSERT INTO pg_group VALUES ('todos');
CREATE USER miriam IN GROUP todos;
<title>
Compatibility
</title>
- <para>
- </para>
<refsect2 id="R2-SQL-GRANT-4">
<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">
<refmeta>
- <refentrytitle>
+ <refentrytitle id="APP-INITDB-TITLE">
<application>initdb</application>
</refentrytitle>
<refmiscinfo>Application</refmiscinfo>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
- <date>1998-10-02</date>
+ <date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
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">
<refmeta>
- <refentrytitle>
+ <refentrytitle id="APP-INITLOCATION-TITLE">
<application>initlocation</application>
</refentrytitle>
<refmiscinfo>Application</refmiscinfo>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
- <date>1998-10-02</date>
+ <date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
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">
<refmeta>
- <refentrytitle>
+ <refentrytitle id="SQL-INSERT-TITLE">
INSERT
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
- <date>1998-09-23</date>
+ <date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
INSERT INTO <replaceable class="PARAMETER">table</replaceable> [ ( <replaceable class="PARAMETER">column</replaceable> [, ...] ) ]
<title>
Description
</title>
+
<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.
The columns in the target list may be listed in any order.
- In every column not present in the target list will be inserted
- the default value, if column has not a declared default value
- it will be assumed as NULL. If the expression for each column
+ </para>
+
+ <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
attempted.
</para>
+
<para>
You must have insert privilege to a table in order to append
to it, as well as select privilege on any table specified
</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):
<programlisting>
<title>
Compatibility
</title>
- <para>
- </para>
<refsect2 id="R2-SQL-INSERT-4">
<refsect2info>
<command>INSERT</command> is fully compatible with <acronym>SQL92</acronym>.
Possible limitations in features of the
<replaceable class="PARAMETER">query</replaceable>
- clause are documented for the SELECT statement.
+ clause are documented for
+ <xref linkend="sql-select-title" endterm="sql-select-title">.
</para>
</refsect2>
</refsect1>
--- /dev/null
+<!--
+$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">
<refmeta>
- <refentrytitle>
+ <refentrytitle id="SQL-LISTEN-TITLE">
LISTEN
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
- <date>1998-10-07</date>
+ <date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
LISTEN <replaceable class="PARAMETER">name</replaceable>
<title>
Description
</title>
+
<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
<replaceable class="PARAMETER">name</replaceable>.
</para>
+
<para>
Whenever the command
<command>NOTIFY <replaceable class="PARAMETER">name</replaceable></command>
frontend application. See the discussion of <command>NOTIFY</command>
for more information.
</para>
+
<para>
A backend can be unregistered for a given notify condition with the
<command>UNLISTEN</command> command. Also, a backend's listen registrations
are automatically cleared when the backend process exits.
</para>
+
<para>
The method a frontend application must use to detect notify events depends on
which <productname>Postgres</productname> application programming interface it
<command>LISTEN</command> or <command>UNLISTEN</command> directly. See the
documentation for the library you are using for more details.
</para>
+
<para>
- The reference page for <command>NOTIFY</command> contains a more extensive
+ <xref linkend="sql-notify-title" endterm="sql-notify-title">
+ contains a more extensive
discussion of the use of <command>LISTEN</command> and
<command>NOTIFY</command>.
</para>
<title>
Notes
</title>
+
<para>
<replaceable class="PARAMETER">name</replaceable>
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">
<refmeta>
- <refentrytitle>
+ <refentrytitle id="SQL-LOAD-TITLE">
LOAD
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
- <date>1998-09-24</date>
+ <date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
LOAD '<replaceable class="PARAMETER">filename</replaceable>'
<title>
Description
</title>
+
<para>
Loads an object (or ".o") file into the
<productname>Postgres</productname> backend address space. Once a
file is loaded, all functions in that file can be accessed. This
function is used in support of user-defined types and functions.
</para>
+
<para>
If a file is not loaded using
<command>LOAD</command>,
recompiled. Only objects created from C language files are supported
at this time.
</para>
+
<refsect2 id="R2-SQL-LOAD-3">
<refsect2info>
<date>1998-09-24</date>
<title>
Notes
</title>
+
<para>
Functions in loaded object files should not call functions in other
object files loaded through the
<title>
Compatibility
</title>
- <para>
- </para>
<refsect2 id="R2-SQL-LOAD-4">
<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">
<refmeta>
- <refentrytitle>
+ <refentrytitle id="sql-lock-title">
LOCK
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
- <date>1998-09-24</date>
+ <date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
LOCK [ TABLE ] <replaceable class="PARAMETER">table</replaceable>
<title>
Compatibility
</title>
- <para>
- </para>
<refsect2 id="R2-SQL-LOCK-4">
<refsect2info>
<para>
There is no <command>LOCK TABLE</command> in <acronym>SQL92</acronym>,
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.
</para>
</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">
<refmeta>
- <refentrytitle>
+ <refentrytitle id="SQL-MOVE-TITLE">
MOVE
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
- <date>1998-09-24</date>
+ <date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
MOVE [ <replaceable class="PARAMETER">selector</replaceable> ] [ <replaceable class="PARAMETER">count</replaceable> ]
not return rows.
</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>
<refsect2 id="R2-SQL-MOVE-3">
<title>
Notes
</title>
+
<para>
<command>MOVE</command> is a <productname>Postgres</productname>
language extension.
</para>
+
<para>
- Refer to <command>FETCH</command> for a description
- of valid arguments.
- Refer to <command>DECLARE</command> to declare a cursor.
- Refer to <command>BEGIN WORK</command>, <command>COMMIT WORK</command>,
- <command>ROLLBACK WORK</command> statements
+ Refer to
+ <xref linkend="sql-fetch-title" endterm="sql-fetch-title">
+ for a description of valid arguments.
+ Refer to
+ <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.
</para>
</refsect2>
<title>
Compatibility
</title>
- <para>
- </para>
<refsect2 id="R2-SQL-MOVE-4">
<refsect2info>
SQL92
</title>
<para>
- There is no SQL92 <command>MOVE</command> statement.
+ There is no <acronym>SQL92</acronym> <command>MOVE</command> statement.
Instead, <acronym>SQL92</acronym> allows
one to <command>FETCH</command> rows from an absolute cursor position,
- implicitly moving the cursor to the correct place.
+ implicitly moving the cursor to the correct position.
</para>
</refsect2>
</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">
<refmeta>
- <refentrytitle id="sql-notify-ref">
+ <refentrytitle id="sql-notify-title">
NOTIFY
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
- <date>1998-10-07</date>
+ <date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
NOTIFY <replaceable class="PARAMETER">name</replaceable>
<title>
Compatibility
</title>
- <para>
- </para>
<refsect2 id="R2-SQL-NOTIFY-4">
<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>
- <refentrytitle id="pg-dump">
+ <refentrytitle id="app-pgdump-title">
<application>pg_dump</application>
</refentrytitle>
<refmiscinfo>Application</refmiscinfo>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
- <date>1998-11-05</date>
+ <date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
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>
- <refentrytitle>
+ <refentrytitle id="APP-PGDUMPALL-TITLE">
<application>pg_dumpall</application>
</refentrytitle>
<refmiscinfo>Application</refmiscinfo>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
- <date>1998-10-04</date>
+ <date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
pg_dumpall
</para>
<para>
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.
</para>
</refsect1>
--- /dev/null
+<!--
+$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">
<refmeta>
- <refentrytitle>
+ <refentrytitle id="APP-PG-UPGRADE-TITLE">
<application>pg_upgrade</application>
</refentrytitle>
<refmiscinfo>Application</refmiscinfo>
<refpurpose>
Allows upgrade from a previous release without reloading data
</refpurpose>
+ </refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
- <date>1998-10-04</date>
+ <date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
pg_upgrade
<title>
Description
</title>
+
<para>
<application>pg_upgrade</application>
is a utility for upgrading from a previous
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>
<title>Upgrading <productname>Postgres</productname></title>
You can delete the <filename>data.old/</filename> directory when you
are finished.
</para>
+ </step>
+ </procedure>
</refsect1>
</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">
<refmeta>
<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">
<refmeta>
<refentrytitle id="pgadmin-ref">
+<!--
+$Header: /cvsroot/pgsql/doc/src/sgml/ref/postgres-ref.sgml,v 1.5 1999/07/22 15:09:14 thomas Exp $
+Postgres documentation
+-->
+
<refentry id="APP-POSTGRES">
<refmeta>
- <refentrytitle>
+ <refentrytitle id="APP-POSTGRES-TITLE">
<application>postgres</application>
</refentrytitle>
<refmiscinfo>Application</refmiscinfo>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
- <date>1999-05-19</date>
+ <date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
postgres [ <replaceable class="parameter">dbname</replaceable> ]
+<!--
+$Header: /cvsroot/pgsql/doc/src/sgml/ref/postmaster.sgml,v 1.4 1999/07/22 15:09:14 thomas Exp $
+Postgres documentation
+-->
+
<refentry id="APP-POSTMASTER">
<refmeta>
- <refentrytitle>
+ <refentrytitle id="APP-POSTMASTER-TITLE">
<application>postmaster</application>
</refentrytitle>
<refmiscinfo>Application</refmiscinfo>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
- <date>1999-05-19</date>
+ <date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
postmaster [ -B <replaceable class="parameter">nBuffers</replaceable> ] [ -D <replaceable class="parameter">DataDir</replaceable> ] [ -i ]
+<!--
+$Header: /cvsroot/pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.10 1999/07/22 15:09:14 thomas Exp $
+Postgres documentation
+-->
+
<refentry id="APP-PSQL">
<refmeta>
- <refentrytitle id="psql-ref">
+ <refentrytitle id="app-psql-title">
<application>psql</application>
</refentrytitle>
<refmiscinfo>Application</refmiscinfo>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
- <date>1998-09-26</date>
+ <date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
psql [ <replaceable class="parameter">dbname</replaceable> ]
+<!--
+$Header: /cvsroot/pgsql/doc/src/sgml/ref/reset.sgml,v 1.7 1999/07/22 15:09:14 thomas Exp $
+Postgres documentation
+-->
+
<refentry id="SQL-RESET">
<refmeta>
- <refentrytitle>
+ <refentrytitle id="SQL-RESET-TITLE">
RESET
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
- <date>1998-09-24</date>
+ <date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
RESET <replaceable class="PARAMETER">variable</replaceable>
<term><replaceable class="PARAMETER">variable</replaceable></term>
<listitem>
<para>
- Refer to the SET statement for more information on available
+ Refer to
+ <xref linkend="sql-set-title" endterm="sql-set-title">
+ for more information on available
variables.
</para>
</listitem>
<para>
<command>RESET</command> restores variables to the
default values.
- Refer to the <command>SET</command> command for details on
- allowed values and defaults.
+ Refer to
+ <xref linkend="sql-set-title" endterm="sql-set-title">
+ for details on allowed values and defaults.
<command>RESET</command> is an alternate form for
- <command>SET <replaceable class="parameter">variable</replaceable> = DEFAULT</command>
+
+ <synopsis>
+SET <replaceable class="parameter">variable</replaceable> = DEFAULT
+ </synopsis>
</para>
<refsect2 id="R2-SQL-RESET-3">
<title>
Notes
</title>
+
<para>
- The RESET statement is a <productname>Postgres</productname>
+ <command>RESET</command> is a <productname>Postgres</productname>
language extension.
</para>
+
<para>
- Refer to SET/SHOW statements to set/show variable values.
+ Use to
+ <xref linkend="sql-set-title" endterm="sql-set-title"> and
+ <xref linkend="sql-show-title" endterm="sql-show-title">
+ to manipulate variable values.
</para>
</refsect2>
</refsect1>
+<!--
+$Header: /cvsroot/pgsql/doc/src/sgml/ref/revoke.sgml,v 1.8 1999/07/22 15:09:14 thomas Exp $
+Postgres documentation
+-->
+
<refentry id="SQL-REVOKE">
<refmeta>
- <refentrytitle>
+ <refentrytitle id="SQL-REVOKE-TITLE">
REVOKE
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
- <date>1998-09-24</date>
+ <date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
REVOKE <replaceable class="PARAMETER">privilege</replaceable> [, ...]
<listitem>
<para>
Privilege to define rules on table/view.
- (See <command>CREATE RULE</command>).
+ (See
+ <xref linkend="sql-createrule-title" endterm="sql-createrule-title">).
</para>
</listitem>
</varlistentry>
<title>
SQL92
</title>
+
<para>
The SQL92 syntax for <command>REVOKE</command>
has additional capabilities for rescinding
</term>
<listitem>
<para>
- Refer to <command>GRANT</command> for details on individual fields.
+ Refer to
+ <xref linkend="sql-grant-title" endterm="sql-grant-title">
+ for details on individual fields.
</para>
</listitem>
</varlistentry>
<para>
Rescinds authority for a user to grant the specified privilege
to others.
- Refer to the <command>GRANT</command> command for details
- on individual fields.
+ Refer to
+ <xref linkend="sql-grant-title" endterm="sql-grant-title">
+ for details on individual fields.
</para>
</listitem>
</varlistentry>
+<!--
+$Header: /cvsroot/pgsql/doc/src/sgml/ref/rollback.sgml,v 1.6 1999/07/22 15:09:14 thomas Exp $
+Postgres documentation
+-->
+
<refentry id="SQL-ROLLBACK">
<refmeta>
<refentrytitle id="SQL-ROLLBACK-TITLE">
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
- <date>1998-09-24</date>
+ <date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
ROLLBACK [ WORK | TRANSACTION ]
<para>
Use <xref linkend="SQL-COMMIT-TITLE" endterm="SQL-COMMIT-TITLE">
to successfully terminate a transaction.
+ <xref linkend="SQL-ABORT-TITLE" endterm="SQL-ABORT-TITLE"> is a
+ synonym for <command>ROLLBACK</command>.
</para>
</refsect2>
</refsect1>
<title>
Compatibility
</title>
- <para>
- </para>
<refsect2 id="R2-SQL-ROLLBACK-4">
<refsect2info>
+<!--
+$Header: /cvsroot/pgsql/doc/src/sgml/ref/select.sgml,v 1.21 1999/07/22 15:09:14 thomas Exp $
+Postgres documentation
+-->
+
<refentry id="SQL-SELECT">
<refmeta>
<refentrytitle id="sql-select-title">
</refpurpose></refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
- <date>1998-09-24</date>
+ <date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
SELECT [ ALL | DISTINCT [ ON <replaceable class="PARAMETER">column</replaceable> ] ]
<title id="where-title">
WHERE Clause
</title>
+
<para>
The optional WHERE condition has the general form:
<synopsis>
-WHERE <replaceable class="PARAMETER">expr</replaceable> <replaceable class="PARAMETER">ETER">c</replaceable>e<replaceable class="PARAMETER">"PAR</replaceable>replaceable> [ <replaceable class="PARAMETER">log_op</replaceable> ... ]
+WHERE <replaceable class="PARAMETER">boolean_expr</replaceable>
</synopsis>
- where <replaceable class="PARAMETER">cond_op</replaceable> can be
- one of: =, <, <=, >, >= or <>,
- a conditional operator like ALL, ANY, IN, LIKE, et cetera or a
+ <replaceable class="PARAMETER">boolean_expr</replaceable>
+ can consist of any expression which evaluates to a boolean value.
+ In many cases, this expression will be
+
+ <synopsis>
+ <replaceable class="PARAMETER">expr</replaceable> <replaceable class="PARAMETER">cond_op</replaceable> <replaceable class="PARAMETER">expr</replaceable>
+ </synopsis>
+
+ or
+
+ <synopsis>
+ <replaceable class="PARAMETER">log_op</replaceable> <replaceable class="PARAMETER">expr</replaceable>
+ </synopsis>
+
+ where <replaceable class="PARAMETER">cond_op</replaceable>
+ can be one of: =, <, <=, >, >= or <>,
+ a conditional operator like ALL, ANY, IN, LIKE, or a
locally-defined operator,
and <replaceable class="PARAMETER">log_op</replaceable> can be one
of: AND, OR, NOT.
<title>
Compatibility
</title>
- <para>
- </para>
<refsect2 id="R2-SQL-SELECT-4">
<refsect2info>
+<!--
+$Header: /cvsroot/pgsql/doc/src/sgml/ref/select_into.sgml,v 1.4 1999/07/22 15:09:14 thomas Exp $
+Postgres documentation
+-->
+
<refentry id="SQL-SELECTINTO">
<refmeta>
- <refentrytitle>
+ <refentrytitle id="SQL-SELECTINTO-TITLE">
SELECT INTO
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refpurpose></refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
- <date>1998-09-22</date>
+ <date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
SELECT [ ALL | DISTINCT ] <replaceable class="PARAMETER">expression</replaceable> [ AS <replaceable class="PARAMETER">name</replaceable> ] [, ...]
<note>
<para>
- CREATE TABLE AS is functionally equivalent to the SELECT INTO command.
+ <xref linkend="sql-createtableas-title" endterm="sql-createtableas-title">
+ is functionally equivalent to the <command>SELECT INTO</command> command.
</para>
</note>
</para>
+<!--
+$Header: /cvsroot/pgsql/doc/src/sgml/ref/set.sgml,v 1.28 1999/07/22 15:09:15 thomas Exp $
+Postgres documentation
+-->
+
<refentry id="SQL-SET">
<refmeta>
- <refentrytitle>
+ <refentrytitle id="SQL-SET-TITLE">
SET
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta>
<refnamediv>
- <refname id="SQL-SET-TITLE">
+ <refname>
SET
</refname>
<refpurpose>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
- <date>1998-09-24</date>
+ <date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
SET <replaceable class="PARAMETER">variable</replaceable> { TO | = } { '<replaceable class="PARAMETER">value</replaceable>' | DEFAULT }
<title>
Compatibility
</title>
- <para>
- </para>
<refsect2 id="R2-SQL-SET-4">
<refsect2info>
+<!--
+$Header: /cvsroot/pgsql/doc/src/sgml/ref/show.sgml,v 1.7 1999/07/22 15:09:15 thomas Exp $
+Postgres documentation
+-->
+
<refentry id="SQL-SHOW">
<refmeta>
- <refentrytitle>
+ <refentrytitle id="SQL-SHOW-TITLE">
SHOW
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
- <date>1998-09-24</date>
+ <date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
SHOW <replaceable class="PARAMETER">keyword</replaceable>
<title>
Compatibility
</title>
- <para>
- </para>
<refsect2 id="R2-SQL-SHOW-4">
<refsect2info>
+<!--
+$Header: /cvsroot/pgsql/doc/src/sgml/ref/unlisten.sgml,v 1.8 1999/07/22 15:09:15 thomas Exp $
+Postgres documentation
+-->
+
<refentry id="SQL-UNLISTEN">
<refmeta>
<refentrytitle>
</para>
<para>
- <xref endterm="sql-notify-ref" linkend="sql-notify">
+ <xref endterm="sql-notify-title" linkend="sql-notify-title">
contains a more extensive
discussion of the use of <command>LISTEN</command> and
<command>NOTIFY</command>.
+<!--
+$Header: /cvsroot/pgsql/doc/src/sgml/ref/update.sgml,v 1.6 1999/07/22 15:09:15 thomas Exp $
+Postgres documentation
+-->
+
<refentry id="SQL-UPDATE">
<refmeta>
- <refentrytitle>
+ <refentrytitle id="SQL-UPDATE-TITLE">
UPDATE
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
- <date>1998-09-24</date>
+ <date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
UPDATE <replaceable class="PARAMETER">table</replaceable> SET <replaceable class="PARAMETER">R">col</replaceable>le> = <replaceable class="PARAMETER">expression</replaceable> [, ...]
<para>
<command>UPDATE</command> changes the values of the columns specified for
all rows which satisfy condition. Only the columns
- to be modified need appear as column.
+ to be modified need appear as columns in the statement.
</para>
<para>
- Array references use the same syntax found in SELECT.
+ Array references use the same syntax found in
+ <xref linkend="sql-select-title" endterm="sql-select-title">.
That is, either single array elements, a range of array
elements or the entire array may be replaced with a single
query.
<title>
Compatibility
</title>
- <para>
- </para>
<refsect2 id="R2-SQL-UPDATE-4">
<refsect2info>
SQL92
</title>
<para>
- SQL92 defines a different syntax for positioned UPDATE statement:
+ <acronym>SQL92</acronym> defines a different syntax for
+ the positioned UPDATE statement:
<synopsis>
UPDATE table SET column = expression [, ...]
-<refentry id="SQL-VACUUM-1">
+<!--
+$Header: /cvsroot/pgsql/doc/src/sgml/ref/vacuum.sgml,v 1.5 1999/07/22 15:09:15 thomas Exp $
+Postgres documentation
+-->
+
+<refentry id="SQL-VACUUM">
<refmeta>
- <refentrytitle id="vacuum">
+ <refentrytitle id="sql-vacuum-title">
VACUUM
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
- <date>1998-10-04</date>
+ <date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
VACUUM [ VERBOSE ] [ ANALYZE ] [ <replaceable class="PARAMETER">table</replaceable> ]
<title>
Compatibility
</title>
+
<refsect2 id="R2-SQL-VACUUM-4">
<refsect2info>
<date>1998-10-04</date>
SQL92
</title>
<para>
- There is no <command>VACUUM</command> statement in SQL92.
+ There is no <command>VACUUM</command> statement in <acronym>SQL92</acronym>.
</para>
</refsect2>
</refsect1>
+<!--
+$Header: /cvsroot/pgsql/doc/src/sgml/ref/vacuumdb.sgml,v 1.5 1999/07/22 15:09:15 thomas Exp $
+Postgres documentation
+-->
+
<refentry id="APP-VACUUMDB">
<refmeta>
- <refentrytitle>
+ <refentrytitle id="APP-VACUUMDB-TITLE">
<application>vacuumdb</application>
</refentrytitle>
<refmiscinfo>Application</refmiscinfo>
</title>
<para>
- See <xref endterm="vacuum" linkend="vacuum"> for more details.
+ See <xref endterm="sql-vacuum-title" linkend="sql-vacuum-title"> for more details.
</para>
</refsect1>