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

Fix markup for docbook2man man page generation.

No big deal; fixed lots of other markup at the same time.
Bigest change: make sure there is no whitespace
 in front of <term> contents.
This will probably help the other output types too.
parent 192a66e3
<REFENTRY ID="SQL-ABORT"> <refentry id="SQL-ABORT">
<REFMETA> <refmeta>
<REFENTRYTITLE> <refentrytitle>
ABORT ABORT
</REFENTRYTITLE> </refentrytitle>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO> <refmiscinfo>SQL - Language Statements</refmiscinfo>
</REFMETA> </refmeta>
<REFNAMEDIV> <refnamediv>
<REFNAME> <refname>
ABORT ABORT
</REFNAME> </refname>
<REFPURPOSE> <refpurpose>
Aborts the current transaction Aborts the current transaction
</REFPURPOSE> </refpurpose>
</REFNAMEDIV> </refnamediv>
<REFSYNOPSISDIV> <refsynopsisdiv>
<REFSYNOPSISDIVINFO> <refsynopsisdivinfo>
<DATE>1998-09-27</DATE> <date>1998-09-27</date>
</REFSYNOPSISDIVINFO> </refsynopsisdivinfo>
<SYNOPSIS> <synopsis>
ABORT ABORT [ TRANSACTION | WORK ]
</SYNOPSIS> </synopsis>
<REFSECT2 ID="R2-SQL-ABORT-1"> <refsect2 id="R2-SQL-ABORT-1">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-27</DATE> <date>1998-09-27</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Inputs Inputs
</TITLE> </title>
<PARA>
None.
</para>
</REFSECT2> <para>
None.
</para>
</refsect2>
<REFSECT2 ID="R2-SQL-ABORT-2"> <refsect2 id="R2-SQL-ABORT-2">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-27</DATE> <date>1998-09-27</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Outputs Outputs
</TITLE> </title>
<PARA>
<VARIABLELIST> <para>
<VARLISTENTRY>
<TERM> <variablelist>
ABORT <varlistentry>
</TERM> <term><computeroutput>
<LISTITEM> ABORT
<PARA> </computeroutput></term>
<listitem>
<para>
Message returned if successful. Message returned if successful.
</para> </para>
</listitem> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
NOTICE: UserAbortTransactionBlock and not in in-progress state NOTICE: UserAbortTransactionBlock and not in in-progress state
ABORT ABORT
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
If there is not any transaction currently in progress. If there is not any transaction currently in progress.
</para> </para>
</listitem> </listitem>
</VARLISTENTRY> </varlistentry>
</VARIABLELIST> </variablelist>
</para> </para>
</REFSECT2> </refsect2>
</REFSYNOPSISDIV> </refsynopsisdiv>
<REFSECT1 ID="R1-SQL-ABORT-1"> <refsect1 id="R1-SQL-ABORT-1">
<REFSECT1INFO> <refsect1info>
<DATE>1998-09-27</DATE> <date>1998-09-27</date>
</REFSECT1INFO> </refsect1info>
<TITLE> <title>
Description Description
</TITLE> </title>
<PARA> <para>
<command>ABORT</command> rolls back the current transaction and causes <command>ABORT</command> rolls back the current transaction and causes
all the updates made by the transaction to be discarded. all the updates made by the transaction to be discarded.
This command is identical This command is identical
in behavior to the <acronym>SQL92</acronym> command <command>ROLLBACK</command>, in behavior to the <acronym>SQL92</acronym> command <command>ROLLBACK</command>,
and is present only for historical reasons. and is present only for historical reasons.
</para> </para>
<REFSECT2 ID="R2-SQL-ABORT-3"> <refsect2 id="R2-SQL-ABORT-3">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-27</DATE> <date>1998-09-27</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Notes Notes
</TITLE> </title>
<para> <para>
Use the <command>COMMIT</command> statement to successfully Use <command>COMMIT</command> to successfully
terminate a transaction. terminate a transaction.
</para> </para>
</refsect2> </refsect2>
</REFSECT1> </refsect1>
<REFSECT1 ID="R1-SQL-ABORT-2"> <refsect1 id="R1-SQL-ABORT-2">
<TITLE> <title>
Usage Usage
</TITLE> </title>
<PARA> <para>
<ProgramListing> To abort all changes:
--To abort all changes <programlisting>
--
ABORT WORK; ABORT WORK;
</ProgramListing> </programlisting>
</para> </para>
</refsect1>
</REFSECT1> <refsect1 id="R1-SQL-ABORT-3">
<title>
Compatibility
</title>
<REFSECT1 ID="R1-SQL-ABORT-3"> <refsect2 id="R2-SQL-ABORT-4">
<TITLE> <refsect2info>
Compatibility <date>1998-09-27</date>
</TITLE> </refsect2info>
<title>
SQL92
</title>
<para>
This command is a <productname>Postgres</productname> extension present
for historical reasons. <command>ROLLBACK</command> is the <acronym>SQL92</acronym>
equivalent command.
</para>
</refsect2>
</refsect1>
<REFSECT2 ID="R2-SQL-ABORT-4"> </refentry>
<REFSECT2INFO>
<DATE>1998-09-27</DATE>
</REFSECT2INFO>
<TITLE>
SQL92
</TITLE>
<para>
This command is a <productname>Postgres</productname> extension present
for historical reasons. <command>ROLLBACK</command> is the <acronym>SQL92</acronym>
equivalent command.
</PARA>
</refsect2>
</refsect1>
</REFENTRY> <!-- 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:
-->
This diff is collapsed.
<refentry id="SQL-ALTERUSER"> <refentry id="SQL-ALTERUSER">
<refmeta> <refmeta>
<refentrytitle> <refentrytitle>
ALTER USER ALTER USER
...@@ -18,10 +18,8 @@ ...@@ -18,10 +18,8 @@
<date>1998-09-08</date> <date>1998-09-08</date>
</refsynopsisdivinfo> </refsynopsisdivinfo>
<synopsis> <synopsis>
ALTER USER <replaceable class="PARAMETER">username</replaceable> ALTER USER <replaceable class="PARAMETER">username</replaceable> [ WITH PASSWORD <replaceable class="PARAMETER">password</replaceable> ]
[ WITH PASSWORD <replaceable class="PARAMETER">password</replaceable> ] [ CREATEDB | NOCREATEDB ] [ CREATEUSER | NOCREATEUSER ]
[ CREATEDB | NOCREATEDB ]
[ CREATEUSER | NOCREATEUSER ]
[ IN GROUP <replaceable class="PARAMETER">groupname</replaceable> [, ...] ] [ IN GROUP <replaceable class="PARAMETER">groupname</replaceable> [, ...] ]
[ VALID UNTIL '<replaceable class="PARAMETER">abstime</replaceable>' ] [ VALID UNTIL '<replaceable class="PARAMETER">abstime</replaceable>' ]
</synopsis> </synopsis>
...@@ -33,15 +31,16 @@ ALTER USER <replaceable class="PARAMETER">username</replaceable> ...@@ -33,15 +31,16 @@ ALTER USER <replaceable class="PARAMETER">username</replaceable>
<title> <title>
Inputs Inputs
</title> </title>
<para> <para>
Refer to <command>CREATE USER</command> for a detailed description of each Refer to <command>CREATE USER</command> for a detailed description of each
clause. clause.
</para> </para>
<para>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term><replaceable class="PARAMETER"> username </replaceable></term>
<replaceable class="PARAMETER"> username </replaceable>
</term>
<listitem> <listitem>
<para> <para>
The Postgres account name of the user whose details are to be altered. The Postgres account name of the user whose details are to be altered.
...@@ -50,9 +49,7 @@ ALTER USER <replaceable class="PARAMETER">username</replaceable> ...@@ -50,9 +49,7 @@ ALTER USER <replaceable class="PARAMETER">username</replaceable>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><replaceable class="PARAMETER"> password </replaceable></term>
<replaceable class="PARAMETER"> password </replaceable>
</term>
<listitem> <listitem>
<para> <para>
The new password to be used for this account. The new password to be used for this account.
...@@ -61,9 +58,7 @@ ALTER USER <replaceable class="PARAMETER">username</replaceable> ...@@ -61,9 +58,7 @@ ALTER USER <replaceable class="PARAMETER">username</replaceable>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><replaceable class="PARAMETER"> groupname </replaceable></term>
<replaceable class="PARAMETER"> groupname </replaceable>
</term>
<listitem> <listitem>
<para> <para>
The name of an access group into which this account is to be put. The name of an access group into which this account is to be put.
...@@ -72,9 +67,7 @@ ALTER USER <replaceable class="PARAMETER">username</replaceable> ...@@ -72,9 +67,7 @@ ALTER USER <replaceable class="PARAMETER">username</replaceable>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><replaceable class="PARAMETER"> abstime </replaceable></term>
<replaceable class="PARAMETER"> abstime </replaceable>
</term>
<listitem> <listitem>
<para> <para>
The date (and, optionally, the time) The date (and, optionally, the time)
...@@ -83,6 +76,7 @@ ALTER USER <replaceable class="PARAMETER">username</replaceable> ...@@ -83,6 +76,7 @@ ALTER USER <replaceable class="PARAMETER">username</replaceable>
</listitem> </listitem>
</varlistentry> </varlistentry>
</variablelist> </variablelist>
</para>
</refsect2> </refsect2>
<refsect2 id="R2-SQL-ALTERUSER-2"> <refsect2 id="R2-SQL-ALTERUSER-2">
...@@ -95,9 +89,9 @@ ALTER USER <replaceable class="PARAMETER">username</replaceable> ...@@ -95,9 +89,9 @@ ALTER USER <replaceable class="PARAMETER">username</replaceable>
<para> <para>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term><computeroutput>
<returnvalue>ALTER USER</returnvalue> ALTER USER
</term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
Message returned if the alteration was successful. Message returned if the alteration was successful.
...@@ -106,13 +100,13 @@ ALTER USER <replaceable class="PARAMETER">username</replaceable> ...@@ -106,13 +100,13 @@ ALTER USER <replaceable class="PARAMETER">username</replaceable>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><computeroutput>
<returnvalue>ERROR: alterUser: user "username" does not exist</returnvalue> ERROR: alterUser: user "username" does not exist
</term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
Error message returned if the user specified doesn't Error message returned if the specified user is not known to
exist. the database.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -136,8 +130,9 @@ ALTER USER <replaceable class="PARAMETER">username</replaceable> ...@@ -136,8 +130,9 @@ ALTER USER <replaceable class="PARAMETER">username</replaceable>
statement. Also, it is only possible for the statement. Also, it is only possible for the
<productname>Postgres</productname> <productname>Postgres</productname>
user or any user with read and modify permissions on user or any user with read and modify permissions on
"pg_shadow" to alter user passwords. <literal>pg_shadow</literal> to alter user passwords.
</para> </para>
<para> <para>
If any of the clauses of the alter user statement are If any of the clauses of the alter user statement are
omitted, the corresponding value in the "pg_shadow" table omitted, the corresponding value in the "pg_shadow" table
...@@ -152,14 +147,13 @@ ALTER USER <replaceable class="PARAMETER">username</replaceable> ...@@ -152,14 +147,13 @@ ALTER USER <replaceable class="PARAMETER">username</replaceable>
Notes Notes
</title> </title>
<para> <para>
<command>ALTER USER</command> statement <command>ALTER USER</command>
is a <productname>Postgres</productname> is a <productname>Postgres</productname>
language extension. language extension.
</para> </para>
<para> <para>
Refer to <command>CREATE/DROP USER</command> Refer to <command>CREATE/DROP USER</command>
to create or remove a user to create or remove a user account.
account.
</para> </para>
<para> <para>
In the current release (v6.5), the IN GROUP clause is parsed In the current release (v6.5), the IN GROUP clause is parsed
...@@ -174,37 +168,37 @@ ALTER USER <replaceable class="PARAMETER">username</replaceable> ...@@ -174,37 +168,37 @@ ALTER USER <replaceable class="PARAMETER">username</replaceable>
Usage Usage
</title> </title>
<para> <para>
Change a user password Change a user password:
</para>
<programlisting> <programlisting>
ALTER USER davide WITH PASSWORD hu8jmn3; ALTER USER davide WITH PASSWORD hu8jmn3;
</programlisting> </programlisting>
<para>
Change a user's valid until date Change a user's valid until date
</para>
<programlisting> <programlisting>
ALTER USER manuel VALID UNTIL 'Jan 31 2030'; ALTER USER manuel VALID UNTIL 'Jan 31 2030';
</programlisting> </programlisting>
<para>
Change a user's valid until date, specifying that his Change a user's valid until date, specifying that his
authorisation should expire at midday on 4th May 1998 using authorisation should expire at midday on 4th May 1998 using
the time zone which is one hour ahead of UTC the time zone which is one hour ahead of UTC
</para>
<programlisting> <programlisting>
ALTER USER chris VALID UNTIL 'May 4 12:00:00 1998 +1'; ALTER USER chris VALID UNTIL 'May 4 12:00:00 1998 +1';
</programlisting> </programlisting>
<para>
Give a user the ability to create other users and new databases. Give a user the ability to create other users and new databases.
</para>
<programlisting> <programlisting>
ALTER USER miriam CREATEUSER CREATEDB; ALTER USER miriam CREATEUSER CREATEDB;
</programlisting> </programlisting>
<para>
Place a user in two groups Place a user in two groups
</para>
<programlisting> <programlisting>
ALTER USER miriam IN GROUP sales, payroll; ALTER USER miriam IN GROUP sales, payroll;
</programlisting> </programlisting>
</para>
</refsect1> </refsect1>
<refsect1 id="R1-SQL-ALTERUSER-3"> <refsect1 id="R1-SQL-ALTERUSER-3">
...@@ -229,7 +223,7 @@ ALTER USER miriam IN GROUP sales, payroll; ...@@ -229,7 +223,7 @@ ALTER USER miriam IN GROUP sales, payroll;
</para> </para>
</refsect2> </refsect2>
</refsect1> </refsect1>
</refentry> </refentry>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file
Local variables: Local variables:
......
...@@ -30,7 +30,7 @@ BEGIN [ WORK | TRANSACTION ] ...@@ -30,7 +30,7 @@ BEGIN [ WORK | TRANSACTION ]
Inputs Inputs
</title> </title>
<para> <para>
None None.
</para> </para>
</refsect2> </refsect2>
...@@ -45,9 +45,9 @@ BEGIN [ WORK | TRANSACTION ] ...@@ -45,9 +45,9 @@ BEGIN [ WORK | TRANSACTION ]
<para> <para>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term><computeroutput>
<returnvalue>BEGIN</returnvalue> BEGIN
</term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
This signifies that a new transaction has been started. This signifies that a new transaction has been started.
...@@ -55,9 +55,9 @@ BEGIN [ WORK | TRANSACTION ] ...@@ -55,9 +55,9 @@ BEGIN [ WORK | TRANSACTION ]
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><computeroutput>
<returnvalue>NOTICE: BeginTransactionBlock and not in default state</returnvalue> NOTICE: BeginTransactionBlock and not in default state
</term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
This indicates that a transaction was already in progress. This indicates that a transaction was already in progress.
......
<REFENTRY ID="SQL-CLOSE"> <refentry id="SQL-CLOSE">
<REFMETA> <refmeta>
<REFENTRYTITLE> <refentrytitle>
CLOSE CLOSE
</REFENTRYTITLE> </refentrytitle>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO> <refmiscinfo>SQL - Language Statements</refmiscinfo>
</REFMETA> </refmeta>
<REFNAMEDIV> <refnamediv>
<REFNAME> <refname>
CLOSE CLOSE
</REFNAME> </refname>
<REFPURPOSE> <refpurpose>
Close a cursor Close a cursor
</REFPURPOSE> </refpurpose>
</refnamediv> </refnamediv>
<REFSYNOPSISDIV> <refsynopsisdiv>
<REFSYNOPSISDIVINFO> <refsynopsisdivinfo>
<DATE>1998-09-08</DATE> <date>1998-09-08</date>
</REFSYNOPSISDIVINFO> </refsynopsisdivinfo>
<SYNOPSIS> <synopsis>
CLOSE <REPLACEABLE CLASS="PARAMETER">cursor</REPLACEABLE> CLOSE <replaceable class="PARAMETER">cursor</replaceable>
</SYNOPSIS> </synopsis>
<REFSECT2 ID="R2-SQL-CLOSE-1"> <refsect2 id="R2-SQL-CLOSE-1">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-08</DATE> <date>1998-09-08</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Inputs Inputs
</TITLE> </title>
<PARA> <para>
<VARIABLELIST>
<VARLISTENTRY> <variablelist>
<TERM> <varlistentry>
<REPLACEABLE CLASS="PARAMETER">cursor</REPLACEABLE> <term><replaceable class="PARAMETER">cursor</replaceable></term>
</TERM> <listitem>
<LISTITEM> <para>
<PARA>
The name of an open cursor to close. The name of an open cursor to close.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
</variablelist> </variablelist>
</para> </para>
</REFSECT2> </refsect2>
<REFSECT2 ID="R2-SQL-CLOSE-2"> <refsect2 id="R2-SQL-CLOSE-2">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-08</DATE> <date>1998-09-08</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Outputs Outputs
</TITLE> </title>
<PARA> <para>
<VARIABLELIST>
<VARLISTENTRY> <variablelist>
<TERM> <varlistentry>
<ReturnValue>CLOSE</ReturnValue> <term><computeroutput>
</TERM> CLOSE
<LISTITEM> </computeroutput></term>
<PARA> <listitem>
<para>
Message returned if the cursor is successfully closed. Message returned if the cursor is successfully closed.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
<ReturnValue>NOTICE PerformPortalClose: portal "<REPLACEABLE CLASS="PARAMETER">cursor</REPLACEABLE>" not found</ReturnValue> NOTICE PerformPortalClose: portal "<replaceable class="PARAMETER">cursor</replaceable>" not found
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
This warning is given if This warning is given if
<REPLACEABLE CLASS="PARAMETER">cursor</REPLACEABLE> is not <replaceable class="PARAMETER">cursor</replaceable> is not
declared or has already been closed. declared or has already been closed.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</VARIABLELIST> </variablelist>
</para> </para>
</REFSECT2> </refsect2>
</REFSYNOPSISDIV> </refsynopsisdiv>
<REFSECT1 ID="R1-SQL-CLOSE-1"> <refsect1 id="R1-SQL-CLOSE-1">
<REFSECT1INFO> <refsect1info>
<DATE>1998-09-08</DATE> <date>1998-09-08</date>
</REFSECT1INFO> </refsect1info>
<TITLE> <title>
Description Description
</TITLE> </title>
<PARA> <para>
<command>CLOSE</command> frees the resources associated with an open cursor. <command>CLOSE</command> frees the resources associated with an open cursor.
After the cursor is closed, no subsequent operations After the cursor is closed, no subsequent operations
are allowed on it. A cursor should be closed when it is are allowed on it. A cursor should be closed when it is
no longer needed. no longer needed.
</PARA> </para>
<PARA> <para>
An implicit close is executed for every open cursor when a An implicit close is executed for every open cursor when a
transaction is terminated by <command>COMMIT</command> transaction is terminated by <command>COMMIT</command>
or <command>ROLLBACK</command>. or <command>ROLLBACK</command>.
</PARA> </para>
<REFSECT2 ID="R2-SQL-CLOSE-3"> <refsect2 id="R2-SQL-CLOSE-3">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-08</DATE> <date>1998-09-08</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Notes Notes
</TITLE> </title>
<PARA> <para>
<productname>Postgres</productname> does not have <productname>Postgres</productname> does not have
an explicit <command>OPEN</command> cursor statement; an explicit <command>OPEN</command> cursor statement;
a cursor is considered open when it is declared. a cursor is considered open when it is declared.
Use the <command>DECLARE</command> statement to declare a cursor. Use the <command>DECLARE</command> statement to declare a cursor.
</PARA> </para>
</REFSECT2> </refsect2>
</refsect1> </refsect1>
<REFSECT1 ID="R1-SQL-CLOSE-2"> <refsect1 id="R1-SQL-CLOSE-2">
<TITLE> <title>
Usage Usage
</TITLE> </title>
<PARA> <para>
Close the cursor liahona: Close the cursor liahona:
</PARA> </para>
<ProgramListing> <programlisting>
CLOSE liahona; CLOSE liahona;
</ProgramListing> </programlisting>
</REFSECT1> </refsect1>
<REFSECT1 ID="R1-SQL-CLOSE-3"> <refsect1 id="R1-SQL-CLOSE-3">
<TITLE> <title>
Compatibility Compatibility
</TITLE> </title>
<PARA> <para>
</PARA> </para>
<REFSECT2 ID="R2-SQL-CLOSE-4"> <refsect2 id="R2-SQL-CLOSE-4">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-08</DATE> <date>1998-09-08</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
SQL92 SQL92
</TITLE> </title>
<PARA> <para>
<command>CLOSE</command> is fully compatible with SQL92. <command>CLOSE</command> is fully compatible with SQL92.
</PARA> </para>
</refsect2> </refsect2>
</refsect1> </refsect1>
</REFENTRY> </refentry>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file
Local variables: Local variables:
......
<REFENTRY ID="SQL-CLUSTER"> <refentry id="SQL-CLUSTER">
<REFMETA> <refmeta>
<REFENTRYTITLE> <refentrytitle>
CLUSTER CLUSTER
</REFENTRYTITLE> </refentrytitle>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO> <refmiscinfo>SQL - Language Statements</refmiscinfo>
</REFMETA> </refmeta>
<REFNAMEDIV> <refnamediv>
<REFNAME> <refname>
CLUSTER CLUSTER
</REFNAME> </refname>
<REFPURPOSE> <refpurpose>
Gives storage clustering advice to the backend Gives storage clustering advice to the backend
</REFPURPOSE> </refpurpose>
</refnamediv> </refnamediv>
<REFSYNOPSISDIV> <refsynopsisdiv>
<REFSYNOPSISDIVINFO> <refsynopsisdivinfo>
<DATE>1998-09-08</DATE> <date>1998-09-08</date>
</REFSYNOPSISDIVINFO> </refsynopsisdivinfo>
<SYNOPSIS> <synopsis>
CLUSTER <REPLACEABLE CLASS="PARAMETER">indexname</REPLACEABLE> ON <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE> CLUSTER <replaceable class="PARAMETER">indexname</replaceable> ON <replaceable class="PARAMETER">table</replaceable>
</SYNOPSIS> </synopsis>
<REFSECT2 ID="R2-SQL-CLUSTER-1"> <refsect2 id="R2-SQL-CLUSTER-1">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-08</DATE> <date>1998-09-08</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Inputs Inputs
</TITLE> </title>
<PARA> <para>
</PARA> </para>
<VARIABLELIST> <variablelist>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="PARAMETER">indexname</replaceable></term>
<REPLACEABLE CLASS="PARAMETER">indexname</REPLACEABLE> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
The name of an index. The name of an index.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="PARAMETER">table</replaceable></term>
<REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
The name of a table. The name of a table.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
</VARIABLELIST> </variablelist>
</REFSECT2> </refsect2>
<REFSECT2 ID="R2-SQL-CLUSTER-2"> <refsect2 id="R2-SQL-CLUSTER-2">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-08</DATE> <date>1998-09-08</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Outputs Outputs
</TITLE> </title>
<PARA> <para>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
<returnvalue>CLUSTER</returnvalue>
</TERM>
<LISTITEM>
<PARA>
The clustering was done successfully.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
<returnvalue>ERROR: relation &lt;<REPLACEABLE CLASS="PARAMETER">tablerelation_number</REPLACEABLE>&gt; inherits "invoice"</returnvalue>
</TERM>
<LISTITEM>
<PARA>
<variablelist>
<varlistentry>
<term><computeroutput>
CLUSTER
</computeroutput></term>
<listitem>
<para>
The clustering was done successfully.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><computeroutput>
ERROR: relation &lt;<replaceable class="PARAMETER">tablerelation_number</replaceable>&gt; inherits "invoice"
</computeroutput></term>
<listitem>
<para>
<comment> <comment>
This is not documented anywhere. It seems not to be possible to This is not documented anywhere. It seems not to be possible to
cluster a table that is inherited. cluster a table that is inherited.
</comment> </comment>
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
<returnvalue>ERROR: Relation x does not exist!</returnvalue> ERROR: Relation x does not exist!
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
<comment> <comment>
The relation complained of was not shown in the error message, The relation complained of was not shown in the error message,
which contained a random string instead of the relation name. which contained a random string instead of the relation name.
</comment> </comment>
</PARA>
</LISTITEM>
</VARLISTENTRY>
</VARIABLELIST>
</para> </para>
</REFSECT2> </listitem>
</REFSYNOPSISDIV> </varlistentry>
</variablelist>
</para>
</refsect2>
</refsynopsisdiv>
<REFSECT1 ID="R1-SQL-CLUSTER-1"> <refsect1 id="R1-SQL-CLUSTER-1">
<REFSECT1INFO> <refsect1info>
<DATE>1998-09-08</DATE> <date>1998-09-08</date>
</REFSECT1INFO> </refsect1info>
<TITLE> <title>
Description Description
</TITLE> </title>
<PARA> <para>
<command>CLUSTER</command> instructs <productname>Postgres</productname> <command>CLUSTER</command> instructs <productname>Postgres</productname>
to cluster the class specified to cluster the class specified
by <replaceable class="parameter">classname</replaceable> approximately by <replaceable class="parameter">classname</replaceable> approximately
based on the index specified by based on the index specified by
<replaceable class="parameter">indexname</replaceable>. The index must <replaceable class="parameter">indexname</replaceable>. The index must
already have been defined on already have been defined on
<replaceable class="parameter">classname</replaceable>. <replaceable class="parameter">classname</replaceable>.
</PARA> </para>
<para> <para>
When a class is clustered, it is physically reordered When a class is clustered, it is physically reordered
based on the index information. The clustering is static. based on the index information. The clustering is static.
...@@ -132,13 +126,13 @@ to cluster the class specified ...@@ -132,13 +126,13 @@ to cluster the class specified
recluster manually by issuing the command again. recluster manually by issuing the command again.
</para> </para>
<REFSECT2 ID="R2-SQL-CLUSTER-3"> <refsect2 id="R2-SQL-CLUSTER-3">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-08</DATE> <date>1998-09-08</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Notes Notes
</TITLE> </title>
<para> <para>
The table is actually copied to a temporary table in index The table is actually copied to a temporary table in index
...@@ -179,13 +173,13 @@ to cluster the class specified ...@@ -179,13 +173,13 @@ to cluster the class specified
<para> <para>
Another way to cluster data is to use Another way to cluster data is to use
<programlisting> <programlisting>
SELECT ... INTO TABLE <replaceable class="parameter">temp</replaceable> FROM ... ORDER BY ... SELECT ... INTO TABLE <replaceable class="parameter">temp</replaceable> FROM ... ORDER BY ...
</programlisting> </programlisting>
This uses the <productname>Postgres</productname> sorting code in This uses the <productname>Postgres</productname> sorting code in
ORDER BY to match the index, and is much faster for ORDER BY to match the index, and is much faster for
unordered data. You then drop the old table, use unordered data. You then drop the old table, use
<command>ALTER TABLE/RENAME</command> <command>ALTER TABLE/RENAME</command>
to rename <replaceable class="parameter">temp</replaceable> to the old name, and to rename <replaceable class="parameter">temp</replaceable> to the old name, and
recreate any indexes. The only problem is that <acronym>OID</acronym>s recreate any indexes. The only problem is that <acronym>OID</acronym>s
will not be preserved. From then on, <command>CLUSTER</command> should be will not be preserved. From then on, <command>CLUSTER</command> should be
...@@ -195,44 +189,43 @@ SELECT ... INTO TABLE <replaceable class="parameter">temp</replaceable> FROM ... ...@@ -195,44 +189,43 @@ SELECT ... INTO TABLE <replaceable class="parameter">temp</replaceable> FROM ...
</refsect2> </refsect2>
</refsect1> </refsect1>
<REFSECT1 ID="R1-SQL-CLUSTER-2"> <refsect1 id="R1-SQL-CLUSTER-2">
<TITLE> <title>
Usage Usage
</TITLE> </title>
<PARA> <para>
Cluster the employees relation on the basis of its salary attribute Cluster the employees relation on the basis of its salary attribute
</PARA> </para>
<ProgramListing> <programlisting>
CLUSTER emp_ind ON emp CLUSTER emp_ind ON emp;
</ProgramListing> </programlisting>
</REFSECT1> </refsect1>
<REFSECT1 ID="R1-SQL-CLUSTER-3"> <refsect1 id="R1-SQL-CLUSTER-3">
<TITLE> <title>
Compatibility Compatibility
</TITLE> </title>
<PARA> <para>
</PARA> </para>
<REFSECT2 ID="R2-SQL-CLUSTER-4"> <refsect2 id="R2-SQL-CLUSTER-4">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-08</DATE> <date>1998-09-08</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
SQL92 SQL92
</TITLE> </title>
<PARA> <para>
There is no <command>CLUSTER</command> statement in SQL92. There is no <command>CLUSTER</command> statement in SQL92.
</PARA> </para>
</refsect2> </refsect2>
</refsect1> </refsect1>
</REFENTRY> </refentry>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file
Local variables: Local variables:
mode: sgml mode: sgml
sgml-omittag:t sgml-omittag:nil
sgml-shorttag:t sgml-shorttag:t
sgml-minimize-attributes:nil sgml-minimize-attributes:nil
sgml-always-quote-attributes:t sgml-always-quote-attributes:t
......
...@@ -30,7 +30,7 @@ COMMIT [ WORK | TRANSACTION ] ...@@ -30,7 +30,7 @@ COMMIT [ WORK | TRANSACTION ]
Inputs Inputs
</title> </title>
<para> <para>
None None.
</para> </para>
</refsect2> </refsect2>
...@@ -45,9 +45,9 @@ COMMIT [ WORK | TRANSACTION ] ...@@ -45,9 +45,9 @@ COMMIT [ WORK | TRANSACTION ]
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term><computeroutput>
<returnvalue>END</returnvalue> END
</term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
Message returned if the transaction is successfully committed. Message returned if the transaction is successfully committed.
...@@ -55,9 +55,9 @@ COMMIT [ WORK | TRANSACTION ] ...@@ -55,9 +55,9 @@ COMMIT [ WORK | TRANSACTION ]
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><computeroutput>
<returnvalue>NOTICE EndTransactionBlock and not inprogress/abort state</returnvalue> NOTICE EndTransactionBlock and not inprogress/abort state
</term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
If there is no transaction in progress. If there is no transaction in progress.
......
This diff is collapsed.
This diff is collapsed.
<REFENTRY ID="SQL-CREATEDATABASE"> <refentry id="SQL-CREATEDATABASE">
<REFMETA> <refmeta>
<REFENTRYTITLE> <refentrytitle>
CREATE DATABASE CREATE DATABASE
</REFENTRYTITLE> </refentrytitle>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO> <refmiscinfo>SQL - Language Statements</refmiscinfo>
</REFMETA> </refmeta>
<REFNAMEDIV> <refnamediv>
<REFNAME> <refname>
CREATE DATABASE CREATE DATABASE
</REFNAME> </refname>
<REFPURPOSE> <refpurpose>
Creates a new database Creates a new database
</REFPURPOSE> </refpurpose>
</refnamediv> </refnamediv>
<REFSYNOPSISDIV> <refsynopsisdiv>
<REFSYNOPSISDIVINFO> <refsynopsisdivinfo>
<DATE>1998-04-15</DATE> <date>1998-04-15</date>
</REFSYNOPSISDIVINFO> </refsynopsisdivinfo>
<SYNOPSIS> <synopsis>
CREATE DATABASE <REPLACEABLE CLASS="PARAMETER">name</REPLACEABLE> [ WITH LOCATION = '<replaceable class="parameter">dbpath</replaceable>' ] CREATE DATABASE <replaceable class="PARAMETER">name</replaceable> [ WITH LOCATION = '<replaceable class="parameter">dbpath</replaceable>' ]
</SYNOPSIS> </synopsis>
<REFSECT2 ID="R2-SQL-CREATEDATABASE-1"> <refsect2 id="R2-SQL-CREATEDATABASE-1">
<REFSECT2INFO> <refsect2info>
<DATE>1998-04-15</DATE> <date>1998-04-15</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Inputs Inputs
</TITLE> </title>
<PARA> <para>
<VARIABLELIST>
<VARLISTENTRY> <variablelist>
<TERM> <varlistentry>
<replaceable class="parameter">name</replaceable> <term><replaceable class="parameter">name</replaceable></term>
</TERM> <listitem>
<LISTITEM> <para>
<PARA>
The name of a database to create. The name of a database to create.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="parameter">dbpath</replaceable></term>
<replaceable class="parameter">dbpath</replaceable> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
An alternate location can be specified as either an An alternate location can be specified as either an
environment variable known to the backend server environment variable known to the backend server
(e.g. '<envar>PGDATA2</envar>') or as an absolute path name (e.g. '<envar>PGDATA2</envar>') or as an absolute path name
(e.g. '<filename>/usr/local/pgsql/data</filename>'). (e.g. '<filename>/usr/local/pgsql/data</filename>').
In either case, the location must be pre-configured In either case, the location must be pre-configured
by <command>initlocation</command>. by <command>initlocation</command>.
</PARA>
</LISTITEM>
</VARLISTENTRY>
</VARIABLELIST>
</para> </para>
</REFSECT2> </listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
<REFSECT2 ID="R2-SQL-CREATEDATABASE-2"> <refsect2 id="R2-SQL-CREATEDATABASE-2">
<REFSECT2INFO> <refsect2info>
<DATE>1998-04-15</DATE> <date>1998-04-15</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Outputs Outputs
</TITLE> </title>
<PARA> <para>
<VARIABLELIST> <variablelist>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
<ReturnValue>CREATEDB</ReturnValue> CREATEDB
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
Message returned if the command completes successfully. Message returned if the command completes successfully.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
<ReturnValue>WARN: createdb: database "<replaceable class="parameter">name</replaceable>" already exists.</ReturnValue> WARN: createdb: database "<replaceable class="parameter">name</replaceable>" already exists.
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
This occurs if <replaceable class="parameter">database</replaceable> specified already exists. This occurs if <replaceable class="parameter">database</replaceable> specified already exists.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
<ReturnValue>ERROR: Unable to create database directory <replaceable class="parameter">directory</replaceable> ERROR: Unable to create database directory <replaceable class="parameter">directory</replaceable>
</ReturnValue> </computeroutput></term>
</TERM> <listitem>
<LISTITEM> <para>
<PARA>
There was a problem with creating the required directory; this operation will There was a problem with creating the required directory; this operation will
need permissions for the <literal>postgres</literal> user on the specified location. need permissions for the <literal>postgres</literal> user on the specified location.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</VARIABLELIST> </variablelist>
</para> </para>
</REFSECT2> </refsect2>
</REFSYNOPSISDIV> </refsynopsisdiv>
<REFSECT1 ID="R1-SQL-CREATEDATABASE-1"> <refsect1 id="R1-SQL-CREATEDATABASE-1">
<REFSECT1INFO> <refsect1info>
<DATE>1998-04-15</DATE> <date>1998-04-15</date>
</REFSECT1INFO> </refsect1info>
<TITLE> <title>
Description Description
</TITLE> </title>
<PARA> <para>
<command>CREATE DATABASE</command> creates a new Postgres database. <command>CREATE DATABASE</command> creates a new Postgres database.
The creator becomes the administrator of the new database. The creator becomes the administrator of the new database.
</PARA> </para>
<REFSECT2 ID="R2-SQL-CREATEDATABASE-3"> <refsect2 id="R2-SQL-CREATEDATABASE-3">
<REFSECT2INFO> <refsect2info>
<DATE>1998-04-15</DATE> <date>1998-04-15</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Notes Notes
</TITLE> </title>
<PARA> <para>
<command>CREATE DATABASE</command> is a <productname>Postgres</productname> <command>CREATE DATABASE</command> is a <productname>Postgres</productname>
language extension. language extension.
</PARA> </para>
<para> <para>
Use <command>DROP DATABASE</command> to remove a database. Use <command>DROP DATABASE</command> to remove a database.
</para> </para>
</REFSECT2> </refsect2>
</refsect1> </refsect1>
<REFSECT1 ID="R1-SQL-CREATEDATABASE-2"> <refsect1 id="R1-SQL-CREATEDATABASE-2">
<TITLE> <title>
Usage Usage
</TITLE> </title>
<PARA> <para>
To create a new database: To create a new database:
</PARA>
<ProgramListing> <programlisting>
<prompt>olly=></prompt> <userinput>create database lusiadas;</userinput> <prompt>olly=></prompt> <userinput>create database lusiadas;</userinput>
</ProgramListing> </programlisting>
<PARA> </para>
<para>
To create a new database in an alternate area <filename>~/private_db</filename>: To create a new database in an alternate area <filename>~/private_db</filename>:
</PARA>
<ProgramListing> <programlisting>
<prompt>$</prompt> <userinput>mkdir private_db</userinput> <prompt>$</prompt> <userinput>mkdir private_db</userinput>
<prompt>$</prompt> <userinput>initlocation ~/private_db</userinput> <prompt>$</prompt> <userinput>initlocation ~/private_db</userinput>
<computeroutput>Creating Postgres database system directory /home/olly/private_db/base</computeroutput> <computeroutput>Creating Postgres database system directory /home/olly/private_db/base</computeroutput>
<prompt>$</prompt> <userinput>psql olly</userinput> <prompt>$</prompt> <userinput>psql olly</userinput>
<computeroutput>Welcome to the POSTGRESQL interactive sql monitor: <computeroutput>Welcome to the POSTGRESQL interactive sql monitor:
...@@ -164,21 +162,22 @@ CREATE DATABASE <REPLACEABLE CLASS="PARAMETER">name</REPLACEABLE> [ WITH LOCATIO ...@@ -164,21 +162,22 @@ CREATE DATABASE <REPLACEABLE CLASS="PARAMETER">name</REPLACEABLE> [ WITH LOCATIO
<prompt>olly=></prompt></computeroutput> <userinput>create database elsewhere with location = '/home/olly/private_db';</userinput> <prompt>olly=></prompt></computeroutput> <userinput>create database elsewhere with location = '/home/olly/private_db';</userinput>
<computeroutput>CREATEDB</computeroutput> <computeroutput>CREATEDB</computeroutput>
</ProgramListing> </programlisting>
</REFSECT1> </para>
</refsect1>
<REFSECT1 ID="R1-SQL-CREATEDATABASE-3"> <refsect1 id="R1-SQL-CREATEDATABASE-3">
<TITLE> <title>
Bugs Bugs
</TITLE> </title>
<PARA> <para>
There are security and data integrity issues There are security and data integrity issues
involved with using alternate database locations involved with using alternate database locations
specified with absolute path names, and by default specified with absolute path names, and by default
only an environment variable known to the backend may be only an environment variable known to the backend may be
specified for an alternate location. specified for an alternate location.
See the Administrator's Guide for more information. See the Administrator's Guide for more information.
</PARA> </para>
</refsect1> </refsect1>
<!-- <!--
...@@ -192,33 +191,32 @@ Hmm. This isn't an issue since the upgrade would do a dump/reload from the main ...@@ -192,33 +191,32 @@ Hmm. This isn't an issue since the upgrade would do a dump/reload from the main
Not sure if the dump/reload would guarantee that the alternate data area gets refreshed though... Not sure if the dump/reload would guarantee that the alternate data area gets refreshed though...
--> -->
<REFSECT1 ID="R1-SQL-CREATEDATABASE-4"> <refsect1 id="R1-SQL-CREATEDATABASE-4">
<TITLE> <title>
Compatibility Compatibility
</TITLE> </title>
<REFSECT2 ID="R2-SQL-CREATEDATABASE-4"> <refsect2 id="R2-SQL-CREATEDATABASE-4">
<REFSECT2INFO> <refsect2info>
<DATE>1998-04-15</DATE> <date>1998-04-15</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
SQL92 SQL92
</TITLE> </title>
<PARA> <para>
There is no <command>CREATE DATABASE</command> statement in SQL92. There is no <command>CREATE DATABASE</command> statement in SQL92.
</PARA> </para>
<para> <para>
The equivalent command in standard SQL is <command>CREATE SCHEMA</command>. The equivalent command in standard SQL is <command>CREATE SCHEMA</command>.
</para> </para>
</refsect2> </refsect2>
</refsect1> </refsect1>
</REFENTRY> </refentry>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file
Local variables: Local variables:
mode: sgml mode: sgml
sgml-omittag:t sgml-omittag:nil
sgml-shorttag:t sgml-shorttag:t
sgml-minimize-attributes:nil sgml-minimize-attributes:nil
sgml-always-quote-attributes:t sgml-always-quote-attributes:t
......
...@@ -32,11 +32,10 @@ CREATE FUNCTION <replaceable class="parameter">name</replaceable> ( [ <replaceab ...@@ -32,11 +32,10 @@ CREATE FUNCTION <replaceable class="parameter">name</replaceable> ( [ <replaceab
Inputs Inputs
</title> </title>
<para> <para>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term><replaceable class="parameter">name</replaceable></term>
<replaceable class="parameter">name</replaceable>
</term>
<listitem> <listitem>
<para> <para>
The name of a function to create. The name of a function to create.
...@@ -44,9 +43,7 @@ CREATE FUNCTION <replaceable class="parameter">name</replaceable> ( [ <replaceab ...@@ -44,9 +43,7 @@ CREATE FUNCTION <replaceable class="parameter">name</replaceable> ( [ <replaceab
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><replaceable class="parameter">ftype</replaceable></term>
<replaceable class="parameter">ftype</replaceable>
</term>
<listitem> <listitem>
<para> <para>
The data type of function arguments. The data type of function arguments.
...@@ -54,9 +51,7 @@ CREATE FUNCTION <replaceable class="parameter">name</replaceable> ( [ <replaceab ...@@ -54,9 +51,7 @@ CREATE FUNCTION <replaceable class="parameter">name</replaceable> ( [ <replaceab
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><replaceable class="parameter">rtype</replaceable></term>
<replaceable class="parameter">rtype</replaceable>
</term>
<listitem> <listitem>
<para> <para>
The return data type. The return data type.
...@@ -64,9 +59,7 @@ CREATE FUNCTION <replaceable class="parameter">name</replaceable> ( [ <replaceab ...@@ -64,9 +59,7 @@ CREATE FUNCTION <replaceable class="parameter">name</replaceable> ( [ <replaceab
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><replaceable class="parameter">definition</replaceable></term>
<replaceable class="parameter">definition</replaceable>
</term>
<listitem> <listitem>
<para> <para>
A string defining the function; the meaning depends on the language. A string defining the function; the meaning depends on the language.
...@@ -76,9 +69,7 @@ CREATE FUNCTION <replaceable class="parameter">name</replaceable> ( [ <replaceab ...@@ -76,9 +69,7 @@ CREATE FUNCTION <replaceable class="parameter">name</replaceable> ( [ <replaceab
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term><replaceable class="parameter">langname</replaceable></term>
<replaceable class="parameter">langname</replaceable>
</term>
<listitem> <listitem>
<para> <para>
may be '<literal>C</literal>', '<literal>sql</literal>', may be '<literal>C</literal>', '<literal>sql</literal>',
...@@ -105,9 +96,9 @@ CREATE FUNCTION <replaceable class="parameter">name</replaceable> ( [ <replaceab ...@@ -105,9 +96,9 @@ CREATE FUNCTION <replaceable class="parameter">name</replaceable> ( [ <replaceab
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term><computeroutput>
<returnvalue>CREATE</returnvalue> CREATE
</term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
This is returned if the command completes successfully. This is returned if the command completes successfully.
...@@ -188,13 +179,12 @@ in the <citetitle>PostgreSQL Programmer's Guide</citetitle> ...@@ -188,13 +179,12 @@ in the <citetitle>PostgreSQL Programmer's Guide</citetitle>
</title> </title>
<para> <para>
To create a simple SQL function: To create a simple SQL function:
</para>
<programlisting> <programlisting>
CREATE FUNCTION one() RETURNS int4 CREATE FUNCTION one() RETURNS int4
AS 'SELECT 1 AS RESULT' AS 'SELECT 1 AS RESULT'
LANGUAGE 'sql'; LANGUAGE 'sql';
SELECT one() AS answer;
SELECT one() AS answer;
<computeroutput> <computeroutput>
answer answer
...@@ -202,6 +192,8 @@ in the <citetitle>PostgreSQL Programmer's Guide</citetitle> ...@@ -202,6 +192,8 @@ in the <citetitle>PostgreSQL Programmer's Guide</citetitle>
1 1
</computeroutput> </computeroutput>
</programlisting> </programlisting>
</para>
<para> <para>
To create a C function, calling a routine from a user-created To create a C function, calling a routine from a user-created
shared library. This particular routine calculates a check shared library. This particular routine calculates a check
...@@ -210,16 +202,16 @@ in the <citetitle>PostgreSQL Programmer's Guide</citetitle> ...@@ -210,16 +202,16 @@ in the <citetitle>PostgreSQL Programmer's Guide</citetitle>
</para> </para>
<programlisting> <programlisting>
<userinput> <userinput>
CREATE FUNCTION ean_checkdigit(bpchar, bpchar) RETURNS bool CREATE FUNCTION ean_checkdigit(bpchar, bpchar) RETURNS bool
AS '/usr1/proj/bray/sql/funcs.so' LANGUAGE 'c'; AS '/usr1/proj/bray/sql/funcs.so' LANGUAGE 'c';
CREATE TABLE product ( CREATE TABLE product (
id char(8) PRIMARY KEY, id char(8) PRIMARY KEY,
eanprefix char(8) CHECK (eanprefix ~ '[0-9]{2}-[0-9]{5}') eanprefix char(8) CHECK (eanprefix ~ '[0-9]{2}-[0-9]{5}')
REFERENCES brandname(ean_prefix), REFERENCES brandname(ean_prefix),
eancode char(6) CHECK (eancode ~ '[0-9]{6}'), eancode char(6) CHECK (eancode ~ '[0-9]{6}'),
CONSTRAINT ean CHECK (ean_checkdigit(eanprefix, eancode)) CONSTRAINT ean CHECK (ean_checkdigit(eanprefix, eancode))
); );
</userinput> </userinput>
</programlisting> </programlisting>
</refsect1> </refsect1>
...@@ -251,27 +243,26 @@ in the <citetitle>PostgreSQL Programmer's Guide</citetitle> ...@@ -251,27 +243,26 @@ in the <citetitle>PostgreSQL Programmer's Guide</citetitle>
</title> </title>
<para> <para>
<note> <note>
<para> <para>
PSM stands for Persistent Stored Modules. It is a procedural PSM stands for Persistent Stored Modules. It is a procedural
language and it was originally hoped that PSM would be ratified language and it was originally hoped that PSM would be ratified
as an official standard by late 1996. As of mid-1998, this as an official standard by late 1996. As of mid-1998, this
has not yet happened, but it is hoped that PSM will has not yet happened, but it is hoped that PSM will
eventually become a standard. eventually become a standard.
</para> </para>
</note> </note>
SQL/PSM <command>CREATE FUNCTION</command> has the following syntax: SQL/PSM <command>CREATE FUNCTION</command> has the following syntax:
<synopsis> <synopsis>
CREATE FUNCTION <replaceable class="parameter">name</replaceable> CREATE FUNCTION <replaceable class="parameter">name</replaceable>
( [ [ IN | OUT | INOUT ] <replaceable class="parameter">eter</replaceable>eable> <replaceable ( [ [ IN | OUT | INOUT ] <replaceable class="parameter">eter</replaceable>eable>eable> <replaceable
class="parameter">type</replaceable> [, ...] ] ) class="parameter">type</replaceable> [, ...] ] )
RETURNS <replaceable class="parameter">rtype</replaceable> RETURNS <replaceable class="parameter">rtype</replaceable>
LANGUAGE '<replaceable class="parameter">langname</replaceable>' LANGUAGE '<replaceable class="parameter">langname</replaceable>'
ESPECIFIC <replaceable class="parameter">routine</replaceable> ESPECIFIC <replaceable class="parameter">routine</replaceable>
<replaceable class="parameter">SQL-statement</replaceable> <replaceable class="parameter">SQL-statement</replaceable>
</synopsis> </synopsis>
</para> </para>
</refsect2> </refsect2>
</refsect1> </refsect1>
......
<REFENTRY ID="SQL-CREATEINDEX"> <refentry id="SQL-CREATEINDEX">
<REFMETA> <refmeta>
<REFENTRYTITLE> <refentrytitle>
CREATE INDEX CREATE INDEX
</REFENTRYTITLE> </refentrytitle>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO> <refmiscinfo>SQL - Language Statements</refmiscinfo>
</REFMETA> </refmeta>
<REFNAMEDIV> <refnamediv>
<REFNAME> <refname>
CREATE INDEX CREATE INDEX
</REFNAME> </refname>
<REFPURPOSE> <refpurpose>
Constructs a secondary index Constructs a secondary index
</REFPURPOSE> </refpurpose>
</refnamediv> </refnamediv>
<REFSYNOPSISDIV> <refsynopsisdiv>
<REFSYNOPSISDIVINFO> <refsynopsisdivinfo>
<DATE>1998-09-09</DATE> <date>1998-09-09</date>
</REFSYNOPSISDIVINFO> </refsynopsisdivinfo>
<SYNOPSIS> <synopsis>
CREATE [ UNIQUE ] INDEX <replaceable class="parameter">index_name</replaceable> CREATE [ UNIQUE ] INDEX <replaceable class="parameter">index_name</replaceable>
ON <replaceable class="parameter">table</replaceable> [ USING <replaceable class="parameter">acc_name</replaceable> ] ON <replaceable class="parameter">table</replaceable> [ USING <replaceable class="parameter">acc_name</replaceable> ]
( <replaceable class="parameter">column</replaceable> [ <replaceable class="parameter">ops_name</replaceable>] [, ...] ) ( <replaceable class="parameter">column</replaceable> [ <replaceable class="parameter">ops_name</replaceable>] [, ...] )
CREATE [ UNIQUE ] INDEX <replaceable class="parameter">index_name</replaceable> CREATE [ UNIQUE ] INDEX <replaceable class="parameter">index_name</replaceable>
ON <replaceable class="parameter">table</replaceable> [ USING <replaceable class="parameter">acc_name</replaceable> ] ON <replaceable class="parameter">table</replaceable> [ USING <replaceable class="parameter">acc_name</replaceable> ]
( <replaceable class="parameter">func_name</replaceable>( <replaceable class="parameter">column</replaceable> [, ... ]) <replaceable class="parameter">ops_name</replaceable> ) ( <replaceable class="parameter">func_name</replaceable>( <replaceable class="parameter">r">col</replaceable>le> [, ... ]) <replaceable class="parameter">ops_name</replaceable> )
</SYNOPSIS> </synopsis>
<REFSECT2 ID="R2-SQL-CREATEINDEX-1"> <refsect2 id="R2-SQL-CREATEINDEX-1">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-09</DATE> <date>1998-09-09</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Inputs Inputs
</TITLE> </title>
<PARA> <para>
<VARIABLELIST>
<VARLISTENTRY> <variablelist>
<TERM> <varlistentry>
UNIQUE <term>UNIQUE</term>
</TERM> <listitem>
<LISTITEM> <para>
<PARA>
Causes the system to check for Causes the system to check for
duplicate values in the table when the index is created (if data duplicate values in the table when the index is created (if data
already exist) and each time data is added. Attempts to already exist) and each time data is added. Attempts to
insert or update non-duplicate data will generate an insert or update non-duplicate data will generate an
error. error.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="parameter">index_name</replaceable></term>
<replaceable class="parameter">index_name</replaceable> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
The name of the index to be created. The name of the index to be created.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="parameter">table</replaceable></term>
<replaceable class="parameter">table</replaceable> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
The name of the table to be indexed. The name of the table to be indexed.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="parameter">acc_name</replaceable></term>
<replaceable class="parameter">acc_name</replaceable> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
the name of the access method which is to be used for the name of the access method which is to be used for
the index. The default access method is BTREE. the index. The default access method is BTREE.
Postgres provides three access methods for secondary indexes: Postgres provides three access methods for secondary indexes:
...@@ -105,29 +98,27 @@ CREATE [ UNIQUE ] INDEX <replaceable class="parameter">index_name</replaceable> ...@@ -105,29 +98,27 @@ CREATE [ UNIQUE ] INDEX <replaceable class="parameter">index_name</replaceable>
</listitem> </listitem>
</varlistentry> </varlistentry>
</variablelist> </variablelist>
</PARA>
</LISTITEM> </para>
</VARLISTENTRY> </listitem>
<VARLISTENTRY> </varlistentry>
<TERM>
<replaceable class="parameter">column</replaceable> <varlistentry>
</TERM> <term><replaceable class="parameter">column</replaceable></term>
<LISTITEM> <listitem>
<PARA> <para>
The name of a column of the table. The name of a column of the table.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><replaceable class="parameter">ops_name</replaceable></term>
<replaceable class="parameter">ops_name</replaceable> <listitem>
</TERM> <para>
<LISTITEM>
<PARA>
An associated operator class. An associated operator class.
The following select list returns all ops_names: The following select list returns all ops_names:
<programlisting> <programlisting>
SELECT am.amname AS acc_name, SELECT am.amname AS acc_name,
opc.opcname AS ops_name, opc.opcname AS ops_name,
opr.oprname AS ops_comp opr.oprname AS ops_comp
...@@ -137,70 +128,67 @@ SELECT am.amname AS acc_name, ...@@ -137,70 +128,67 @@ SELECT am.amname AS acc_name,
amop.amopclaid = opc.oid AND amop.amopclaid = opc.oid AND
amop.amopopr = opr.oid amop.amopopr = opr.oid
ORDER BY acc_name, ops_name, ops_comp ORDER BY acc_name, ops_name, ops_comp
</programlisting> </programlisting>
</para>
</PARA> </listitem>
</LISTITEM> </varlistentry>
</VARLISTENTRY> <varlistentry>
<VARLISTENTRY> <term><replaceable class="parameter">func_name</replaceable></term>
<TERM> <listitem>
<replaceable class="parameter">func_name</replaceable> <para>
</TERM>
<LISTITEM>
<PARA>
A user-defined function, which returns a value that can A user-defined function, which returns a value that can
be indexed. be indexed.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
</variablelist> </variablelist>
</para> </para>
</REFSECT2> </refsect2>
<REFSECT2 ID="R2-SQL-CREATEINDEX-2"> <refsect2 id="R2-SQL-CREATEINDEX-2">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-09</DATE> <date>1998-09-09</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Outputs Outputs
</TITLE> </title>
<PARA> <para>
<VARIABLELIST> <variablelist>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
<ReturnValue>CREATE</ReturnValue> CREATE
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
The message returned if the index is successfully created. The message returned if the index is successfully created.
</PARA> </para>
</LISTITEM> </listitem>
</VARLISTENTRY> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term><computeroutput>
<ReturnValue>ERROR: Cannot create index: 'index_name' already exists.</ReturnValue> ERROR: Cannot create index: 'index_name' already exists.
</TERM> </computeroutput></term>
<LISTITEM> <listitem>
<PARA> <para>
This error occurs if it is impossible to create the index. This error occurs if it is impossible to create the index.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</variablelist> </variablelist>
</para> </para>
</REFSECT2> </refsect2>
</REFSYNOPSISDIV> </refsynopsisdiv>
<REFSECT1 ID="R1-SQL-CREATEINDEX-1"> <refsect1 id="R1-SQL-CREATEINDEX-1">
<REFSECT1INFO> <refsect1info>
<DATE>1998-09-09</DATE> <date>1998-09-09</date>
</REFSECT1INFO> </refsect1info>
<TITLE> <title>
Description Description
</TITLE> </title>
<PARA> <para>
<command>CREATE INDEX</command> constructs an index <command>CREATE INDEX</command> constructs an index
<replaceable class="parameter">index_name</replaceable>. <replaceable class="parameter">index_name</replaceable>.
on the specified on the specified
...@@ -235,35 +223,35 @@ SELECT am.amname AS acc_name, ...@@ -235,35 +223,35 @@ SELECT am.amname AS acc_name,
transformation to apply them to the base data. transformation to apply them to the base data.
</para> </para>
<REFSECT2 ID="R2-SQL-CREATEINDEX-3"> <refsect2 id="R2-SQL-CREATEINDEX-3">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-09</DATE> <date>1998-09-09</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
Notes Notes
</TITLE> </title>
<PARA> <para>
Currently, only the BTREE access method supports multi-column Currently, only the BTREE access method supports multi-column
indexes. Up to 7 keys may be specified. indexes. Up to 7 keys may be specified.
</PARA> </para>
<para> <para>
Use <command>DROP INDEX</command> Use <command>DROP INDEX</command>
to remove an index. to remove an index.
</para> </para>
</REFSECT2> </refsect2>
</refsect1> </refsect1>
<REFSECT1 ID="R1-SQL-CREATEINDEX-2"> <refsect1 id="R1-SQL-CREATEINDEX-2">
<TITLE> <title>
Usage Usage
</TITLE> </title>
<PARA>To create a btree index on the field <literal>title</literal> <para>To create a btree index on the field <literal>title</literal>
in the table <literal>films</literal>: in the table <literal>films</literal>:
</PARA> </para>
<ProgramListing> <programlisting>
CREATE UNIQUE INDEX title_idx CREATE UNIQUE INDEX title_idx
ON films (title); ON films (title);
</ProgramListing> </programlisting>
<!-- <!--
<comment> <comment>
...@@ -282,37 +270,36 @@ SELECT * FROM points ...@@ -282,37 +270,36 @@ SELECT * FROM points
</programlisting> </programlisting>
--> -->
</REFSECT1> </refsect1>
<REFSECT1 ID="R1-SQL-CREATEINDEX-3"> <refsect1 id="R1-SQL-CREATEINDEX-3">
<TITLE> <title>
Compatibility Compatibility
</TITLE> </title>
<PARA> <para>
</PARA> </para>
<REFSECT2 ID="R2-SQL-CREATEINDEX-4"> <refsect2 id="R2-SQL-CREATEINDEX-4">
<REFSECT2INFO> <refsect2info>
<DATE>1998-09-09</DATE> <date>1998-09-09</date>
</REFSECT2INFO> </refsect2info>
<TITLE> <title>
SQL92 SQL92
</TITLE> </title>
<PARA> <para>
CREATE INDEX is a <productname>Postgres</productname> language extension. CREATE INDEX is a <productname>Postgres</productname> language extension.
</PARA> </para>
<para> <para>
There is no <command>CREATE INDEX</command> command in SQL92. There is no <command>CREATE INDEX</command> command in SQL92.
</para> </para>
</refsect2> </refsect2>
</refsect1> </refsect1>
</REFENTRY> </refentry>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file
Local variables: Local variables:
mode: sgml mode: sgml
sgml-omittag:t sgml-omittag:nil
sgml-shorttag:t sgml-shorttag:t
sgml-minimize-attributes:nil sgml-minimize-attributes:nil
sgml-always-quote-attributes:t sgml-always-quote-attributes:t
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment