Commit 165b830e authored by Thomas G. Lockhart's avatar Thomas G. Lockhart

Add reference pages on user interface applications.

parent 32cfa65e
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
<!entity close system "close.sgml"> <!entity close system "close.sgml">
<!entity cluster system "cluster.sgml"> <!entity cluster system "cluster.sgml">
<!entity commit system "commit.sgml"> <!entity commit system "commit.sgml">
<!entity copy system "copy.sgml"> <!entity copyTable system "copy.sgml">
<!entity createAggregate system "create_aggregate.sgml"> <!entity createAggregate system "create_aggregate.sgml">
<!entity createDatabase system "create_database.sgml"> <!entity createDatabase system "create_database.sgml">
<!entity createFunction system "create_function.sgml"> <!entity createFunction system "create_function.sgml">
...@@ -117,8 +117,10 @@ ...@@ -117,8 +117,10 @@
<!entity destroyuser system "destroyuser.sgml"> <!entity destroyuser system "destroyuser.sgml">
<!entity initdb system "initdb.sgml"> <!entity initdb system "initdb.sgml">
<!entity initlocation system "initlocation.sgml"> <!entity initlocation system "initlocation.sgml">
<!entity pgDump system "pg_dump.sgml"> <!entity pgAccess system "pgaccess-ref.sgml">
<!entity pgDumpall system "pg_dumpall.sgml"> <!entity pgAdmin system "pgadmin-ref.sgml">
<!entity pgDump system "pg_dump.sgml">
<!entity pgDumpall system "pg_dumpall.sgml">
<!entity pgUpgrade system "pg_upgrade.sgml"> <!entity pgUpgrade system "pg_upgrade.sgml">
<!entity psqlRef system "psql-ref.sgml"> <!entity psqlRef system "psql-ref.sgml">
<!entity vacuumdb system "vacuumdb.sgml"> <!entity vacuumdb system "vacuumdb.sgml">
<chapter id="sql-commands"> <chapter id="sql-commands">
<Title>SQL Commands</Title> <Title>SQL Commands</Title>
<Para> <abstract>
This is reference information for the <acronym>SQL</acronym> <Para>
commands supported by <productname>Postgres</productname>. This is reference information for the <acronym>SQL</acronym>
</Para> commands supported by <productname>Postgres</productname>.
</Para>
</abstract>
&abort; &abort;
&alterTable; &alterTable;
&alterUser; &alterUser;
&begin; &begin;
&close; &close;
&cluster; &cluster;
&commit; &commit;
&copy; &copyTable;
&createAggregate; &createAggregate;
&createDatabase; &createDatabase;
&createFunction; &createFunction;
&createIndex; &createIndex;
&createLanguage; &createLanguage;
&createOperator; &createOperator;
&createRule; &createRule;
&createSequence; &createSequence;
&createTable; &createTable;
&createTrigger; &createTrigger;
&createType; &createType;
&createUser; &createUser;
&createView; &createView;
&declare; &declare;
&delete; &delete;
&dropAggregate; &dropAggregate;
&dropDatabase; &dropDatabase;
&dropFunction; &dropFunction;
&dropIndex; &dropIndex;
&dropLanguage; &dropLanguage;
&dropOperator; &dropOperator;
&dropRule; &dropRule;
&dropSequence; &dropSequence;
&dropTable; &dropTable;
&dropTrigger; &dropTrigger;
&dropType &dropType
&dropUser; &dropUser;
&dropView; &dropView;
&explain; &explain;
&fetch; &fetch;
&grant; &grant;
&insert; &insert;
&listen; &listen;
&load; &load;
&lock; &lock;
&move; &move;
&notify; &notify;
&reset; &reset;
&revoke; &revoke;
&rollback; &rollback;
&select; &select;
&set; &set;
&show; &show;
&unlisten; &unlisten;
&update; &update;
&vacuum; &vacuum;
</Chapter> </Chapter>
<!-- <!--
Disable this chapter until we have more functions documented. Disable this chapter until we have more functions documented.
...@@ -84,31 +86,35 @@ functions supported by <productname>Postgres</productname>. ...@@ -84,31 +86,35 @@ functions supported by <productname>Postgres</productname>.
--> -->
<chapter Id="utilities"> <chapter Id="utilities">
<title>Utility Applications</title> <title>Utility Applications</title>
<para> <abstract>
This is reference information for the <para>
<productname>Postgres</productname> support utilities. This is reference information for the
</para> <productname>Postgres</productname> support utilities.
</para>
</abstract>
&createdb; &createdb;
&createuser; &createuser;
&destroydb; &destroydb;
&destroyuser; &destroyuser;
&initdb; &initdb;
&initlocation; &initlocation;
&pgDump; &pgAccess;
&pgDumpall; &pgAdmin;
&psqlRef; &pgDump;
&vacuumdb; &pgDumpall;
&psqlRef;
&vacuumdb;
</chapter> </chapter>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file
Local variables: Local variables:
mode: sgml mode: sgml
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
......
<REFENTRY ID="SQL-LOCK"> <REFENTRY ID="SQL-LOCK">
<REFMETA> <REFMETA>
<REFENTRYTITLE> <REFENTRYTITLE>
LOCK LOCK
</REFENTRYTITLE> </REFENTRYTITLE>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO> <REFMISCINFO>SQL - Language Statements</REFMISCINFO>
</REFMETA> </REFMETA>
<REFNAMEDIV> <REFNAMEDIV>
<REFNAME> <REFNAME>
LOCK LOCK
</REFNAME> </REFNAME>
<REFPURPOSE> <REFPURPOSE>
Explicit lock of a table inside a transaction Explicit lock of a table inside a transaction
</REFPURPOSE> </REFPURPOSE>
</refnamediv> </refnamediv>
<REFSYNOPSISDIV> <REFSYNOPSISDIV>
<REFSYNOPSISDIVINFO> <REFSYNOPSISDIVINFO>
<DATE>1998-09-24</DATE> <DATE>1998-09-24</DATE>
</REFSYNOPSISDIVINFO> </REFSYNOPSISDIVINFO>
<SYNOPSIS> <SYNOPSIS>
LOCK [ TABLE ] <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE> LOCK [ TABLE ] <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE>
</SYNOPSIS> </SYNOPSIS>
<REFSECT2 ID="R2-SQL-LOCK-1"> <REFSECT2 ID="R2-SQL-LOCK-1">
<REFSECT2INFO> <REFSECT2INFO>
<DATE>1998-09-01</DATE> <DATE>1998-09-01</DATE>
</REFSECT2INFO> </REFSECT2INFO>
<TITLE> <TITLE>
Inputs Inputs
</TITLE> </TITLE>
<PARA> <PARA>
</PARA> </PARA>
<VARIABLELIST> <VARIABLELIST>
<VARLISTENTRY> <VARLISTENTRY>
<TERM> <TERM>
<REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE> <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE>
</TERM> </TERM>
<LISTITEM> <LISTITEM>
<PARA> <PARA>
The name of an existing table to lock. The name of an existing table to lock.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</VARIABLELIST> </VARIABLELIST>
</REFSECT2> </REFSECT2>
<REFSECT2 ID="R2-SQL-LOCK-2"> <REFSECT2 ID="R2-SQL-LOCK-2">
<REFSECT2INFO> <REFSECT2INFO>
<DATE>1998-09-24</DATE> <DATE>1998-09-24</DATE>
</REFSECT2INFO> </REFSECT2INFO>
<TITLE> <TITLE>
Outputs Outputs
</TITLE> </TITLE>
<PARA> <PARA>
<VARIABLELIST> <VARIABLELIST>
<VARLISTENTRY> <VARLISTENTRY>
<TERM> <TERM>
DELETE 0 DELETE 0
</TERM> </TERM>
<LISTITEM> <LISTITEM>
<PARA> <PARA>
Message returned on a successful lock. Message returned on a successful lock.
<command>LOCK</command> is implemented as a <command>LOCK</command> is implemented as a
<command>DELETE FROM <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE></command> <command>DELETE FROM <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE></command>
which is guaranteed to not delete any rows. which is guaranteed to not delete any rows.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<VARLISTENTRY> <VARLISTENTRY>
<TERM> <TERM>
ERROR <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE>: Table does not exist. ERROR <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE>: Table does not exist.
</TERM> </TERM>
<LISTITEM> <LISTITEM>
<PARA> <PARA>
Message returned if <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE> Message returned if <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE>
does not exist. does not exist.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</VARIABLELIST> </VARIABLELIST>
</para> </para>
</REFSECT2> </REFSECT2>
</REFSYNOPSISDIV> </REFSYNOPSISDIV>
<REFSECT1 ID="R1-SQL-LOCK-1"> <REFSECT1 ID="R1-SQL-LOCK-1">
<REFSECT1INFO> <REFSECT1INFO>
<DATE>1998-09-24</DATE> <DATE>1998-09-24</DATE>
</REFSECT1INFO> </REFSECT1INFO>
<TITLE> <TITLE>
Description Description
</TITLE> </TITLE>
<PARA> <PARA>
<command>LOCK</command> locks in exclusive mode a table inside <command>LOCK</command> locks in exclusive mode a table inside
a transaction. The classic use for this is a transaction. The classic use for this is
the case where you want to select some data, then the case where you want to select some data, then
update it inside a transaction. update it inside a transaction.
If you don't explicit lock a table using LOCK statement, it will be If you don't explicit lock a table using LOCK statement, it will be
implicit locked only at the first implicit locked only at the first
<command>UPDATE</command>, <command>INSERT</command>, <command>UPDATE</command>, <command>INSERT</command>,
or <command>DELETE</command> operation. or <command>DELETE</command> operation.
If you don't exclusive lock the table before the select, some If you don't exclusive lock the table before the select, some
other user may also read the selected data, and try and do other user may also read the selected data, and try and do
their own update, causing a deadlock while you both wait their own update, causing a deadlock while you both wait
for the other to release the select-induced shared lock so for the other to release the select-induced shared lock so
you can get an exclusive lock to do the update. you can get an exclusive lock to do the update.
</para> </para>
<para> <para>
Another example of deadlock is where one user locks one Another example of deadlock is where one user locks one
table, and another user locks a second table. While both table, and another user locks a second table. While both
keep their existing locks, the first user tries to lock keep their existing locks, the first user tries to lock
the second user's table, and the second user tries to lock the second user's table, and the second user tries to lock
the first user's table. Both users deadlock waiting for the first user's table. Both users deadlock waiting for
the tables to become available. The only solution to this the tables to become available. The only solution to this
is for both users to lock tables in the same order, so is for both users to lock tables in the same order, so
user's lock acquisitions and requests to not form a deadlock. user's lock acquisitions and requests to not form a deadlock.
</para> </para>
<note> <note>
<para> <para>
<productname>Postgres</productname> does detect deadlocks and will <productname>Postgres</productname> does detect deadlocks and will
rollback transactions to resolve the deadlock. Usually, at least one rollback transactions to resolve the deadlock. Usually, at least one
of the deadlocked transactions will complete successfully. of the deadlocked transactions will complete successfully.
</para> </para>
</note> </note>
<REFSECT2 ID="R2-SQL-LOCK-3"> <REFSECT2 ID="R2-SQL-LOCK-3">
<REFSECT2INFO> <REFSECT2INFO>
<DATE>1998-09-24</DATE> <DATE>1998-09-24</DATE>
</REFSECT2INFO> </REFSECT2INFO>
<TITLE> <TITLE>
Notes Notes
</TITLE> </TITLE>
<para> <para>
<command>LOCK</command> is a <productname>Postgres</productname> <command>LOCK</command> is a <productname>Postgres</productname>
language extension. language extension.
</para> </para>
<para> <para>
<command>LOCK</command> works only inside transactions. <command>LOCK</command> works only inside transactions.
<note> <note>
<title>Bug</title> <title>Bug</title>
<para> <para>
If the locked table is dropped then it will be automatically If the locked table is dropped then it will be automatically
unlocked even if a transaction is still in progress. unlocked even if a transaction is still in progress.
</para> </para>
</note> </note>
</para> </para>
</REFSECT2> </REFSECT2>
</refsect1> </refsect1>
<REFSECT1 ID="R1-SQL-LOCK-2"> <REFSECT1 ID="R1-SQL-LOCK-2">
<TITLE> <TITLE>
Usage Usage
</TITLE> </TITLE>
<PARA> <PARA>
</PARA> </PARA>
<ProgramListing> <ProgramListing>
--Explicit locking to prevent deadlock: --Explicit locking to prevent deadlock:
-- --
BEGIN WORK; BEGIN WORK;
LOCK films; LOCK films;
SELECT * FROM films; SELECT * FROM films;
UPDATE films SET len = INTERVAL '100 minute' UPDATE films SET len = INTERVAL '100 minute'
WHERE len = INTERVAL '117 minute'; WHERE len = INTERVAL '117 minute';
COMMIT WORK; COMMIT WORK;
</ProgramListing> </ProgramListing>
</REFSECT1> </REFSECT1>
<REFSECT1 ID="R1-SQL-LOCK-3"> <REFSECT1 ID="R1-SQL-LOCK-3">
<TITLE> <TITLE>
Compatibility Compatibility
</TITLE> </TITLE>
<REFSECT2 ID="R2-SQL-LOCK-4"> <REFSECT2 ID="R2-SQL-LOCK-4">
<REFSECT2INFO> <REFSECT2INFO>
<DATE>1998-09-24</DATE> <DATE>1998-09-24</DATE>
</REFSECT2INFO> </REFSECT2INFO>
<TITLE> <TITLE>
SQL92 SQL92
</TITLE> </TITLE>
<PARA> <PARA>
There is no <command>LOCK TABLE</command> in <acronym>SQL92</acronym>, There is no <command>LOCK TABLE</command> in <acronym>SQL92</acronym>,
which instead uses <command>SET TRANSACTION</command> to specify which instead uses <command>SET TRANSACTION</command> to specify
concurrency level on transactions. concurrency level on transactions.
</para> </para>
</refsect2> </refsect2>
</refsect1> </refsect1>
</REFENTRY> </REFENTRY>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:nil
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../reference.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:"/usr/lib/sgml/CATALOG"
sgml-local-ecat-files:nil
End:
-->
<REFENTRY ID="APP-PGACCESS">
<REFMETA>
<REFENTRYTITLE id="pgaccess-ref">
<application>pgaccess</application>
</REFENTRYTITLE>
<REFMISCINFO>Application</REFMISCINFO>
</REFMETA>
<REFNAMEDIV>
<REFNAME>
<application>pgaccess</application>
</REFNAME>
<REFPURPOSE>
<productname>Postgres</productname> graphical interactive client
</REFPURPOSE>
</refnamediv>
<REFSYNOPSISDIV>
<REFSYNOPSISDIVINFO>
<DATE>1999-05-19</DATE>
</REFSYNOPSISDIVINFO>
<SYNOPSIS>
pgaccess [ <replaceable class="parameter">dbname</replaceable> ]
</SYNOPSIS>
<REFSECT2 ID="R2-APP-PGACCESS-1">
<REFSECT2INFO>
<DATE>1999-05-19</DATE>
</REFSECT2INFO>
<TITLE>
Inputs
</TITLE>
<PARA>
</para>
</refsect2>
<REFSECT2 ID="R2-APP-PGACCESS-2">
<REFSECT2INFO>
<DATE>1999-05-19</DATE>
</REFSECT2INFO>
<TITLE>
Outputs
</TITLE>
<PARA>
</para>
</refsect2>
</refsynopsisdiv>
<REFSECT1 ID="R1-APP-PGACCESS-1">
<REFSECT1INFO>
<DATE>1999-05-19</DATE>
</REFSECT1INFO>
<TITLE>
Description
</TITLE>
<PARA>
</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:
-->
<REFENTRY ID="APP-PGADMIN">
<REFMETA>
<REFENTRYTITLE id="pgadmin-ref">
<application>pgadmin</application>
</REFENTRYTITLE>
<REFMISCINFO>Application</REFMISCINFO>
</REFMETA>
<REFNAMEDIV>
<REFNAME>
<application>pgadmin</application>
</REFNAME>
<REFPURPOSE>
<productname>Postgres</productname> graphical interactive client
</REFPURPOSE>
</refnamediv>
<REFSYNOPSISDIV>
<REFSYNOPSISDIVINFO>
<DATE>1999-05-19</DATE>
</REFSYNOPSISDIVINFO>
<SYNOPSIS>
pgadmin [ <replaceable class="parameter">dbname</replaceable> ]
</SYNOPSIS>
<REFSECT2 ID="R2-APP-PGADMIN-1">
<REFSECT2INFO>
<DATE>1999-05-19</DATE>
</REFSECT2INFO>
<TITLE>
Inputs
</TITLE>
<PARA>
</para>
</refsect2>
<REFSECT2 ID="R2-APP-PGADMIN-2">
<REFSECT2INFO>
<DATE>1999-05-19</DATE>
</REFSECT2INFO>
<TITLE>
Outputs
</TITLE>
<PARA>
</para>
</refsect2>
</refsynopsisdiv>
<REFSECT1 ID="R1-APP-PGADMIN-1">
<REFSECT1INFO>
<DATE>1999-05-19</DATE>
</REFSECT1INFO>
<TITLE>
Description
</TITLE>
<PARA>
</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:
-->
<REFENTRY ID="APP-PSQL"> <REFENTRY ID="APP-PSQL">
<REFMETA> <REFMETA>
<REFENTRYTITLE id="psql-ref"> <REFENTRYTITLE id="psql-ref">
<application>psql</application> <application>psql</application>
</REFENTRYTITLE> </REFENTRYTITLE>
<REFMISCINFO>Application</REFMISCINFO> <REFMISCINFO>Application</REFMISCINFO>
</REFMETA> </REFMETA>
<REFNAMEDIV> <REFNAMEDIV>
<REFNAME> <REFNAME>
<application>psql</application> <application>psql</application>
</REFNAME> </REFNAME>
<REFPURPOSE> <REFPURPOSE>
<productname>Postgres</productname> interactive client <productname>Postgres</productname> interactive client
</REFPURPOSE> </REFPURPOSE>
</refnamediv> </refnamediv>
<REFSYNOPSISDIV> <REFSYNOPSISDIV>
<REFSYNOPSISDIVINFO> <REFSYNOPSISDIVINFO>
<DATE>1998-09-26</DATE> <DATE>1998-09-26</DATE>
</REFSYNOPSISDIVINFO> </REFSYNOPSISDIVINFO>
<SYNOPSIS> <SYNOPSIS>
psql [ <replaceable class="parameter">dbname</replaceable> ] psql [ <replaceable class="parameter">dbname</replaceable> ]
psql -A [ -c <replaceable class="parameter">query</replaceable> ] [ -d <replaceable class="parameter">dbname</replaceable> ] psql -A [ -c <replaceable class="parameter">query</replaceable> ] [ -d <replaceable class="parameter">dbname</replaceable> ]
-e -E [ -f <replaceable class="parameter">filename</replaceable> ] [ -F <replaceable class="parameter">separator</replaceable> ] [ -h <replaceable class="parameter">hostname</replaceable> ] -Hln -e -E [ -f <replaceable class="parameter">filename</replaceable> ] [ -F <replaceable class="parameter">separator</replaceable> ] [ -h <replaceable class="parameter">hostname</replaceable> ] -Hln
[ -o <replaceable class="parameter">filename</replaceable> ] [ -p <replaceable class="parameter">port</replaceable> ] -qsSt ] [ -T <replaceable class="parameter">table_options</replaceable> ] -ux [ <replaceable class="parameter">dbname</replaceable> ] [ -o <replaceable class="parameter">filename</replaceable> ] [ -p <replaceable class="parameter">port</replaceable> ] -qsSt ] [ -T <replaceable class="parameter">table_options</replaceable> ] -ux [ <replaceable class="parameter">dbname</replaceable> ]
</SYNOPSIS> </SYNOPSIS>
<REFSECT2 ID="R2-APP-PSQL-1"> <REFSECT2 ID="R2-APP-PSQL-1">
<REFSECT2INFO> <REFSECT2INFO>
<DATE>1998-09-26</DATE> <DATE>1998-09-26</DATE>
</REFSECT2INFO> </REFSECT2INFO>
<TITLE> <TITLE>
Inputs Inputs
</TITLE> </TITLE>
<PARA> <PARA>
<application>psql</application> accepts many command-line arguments, <application>psql</application> accepts many command-line arguments,
a rich set of meta-commands, and the full <acronym>SQL</acronym> language a rich set of meta-commands, and the full <acronym>SQL</acronym> language
supported by <productname>Postgres</productname>. The most common supported by <productname>Postgres</productname>. The most common
command-line arguments are: command-line arguments are:
<VARIABLELIST> <VARIABLELIST>
<VARLISTENTRY> <VARLISTENTRY>
<TERM> <TERM>
<REPLACEABLE CLASS="PARAMETER">dbname</REPLACEABLE> <REPLACEABLE CLASS="PARAMETER">dbname</REPLACEABLE>
</TERM> </TERM>
<LISTITEM> <LISTITEM>
<PARA> <PARA>
The name of an existing database to access. The name of an existing database to access.
<replaceable class="parameter">dbname</replaceable> <replaceable class="parameter">dbname</replaceable>
defaults to the value of the defaults to the value of the
<envar>USER</envar> <envar>USER</envar>
environment variable or, if that's not set, to the Unix account name of the environment variable or, if that's not set, to the Unix account name of the
current user. current user.
</PARA>
</PARA> </LISTITEM>
</LISTITEM> </VARLISTENTRY>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
-c <replaceable class="parameter">query</replaceable>
</TERM>
<LISTITEM>
<PARA>
A single query to run. <application>psql</application> will exit on completion.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY> </variablelist>
<TERM> </para>
-c <replaceable class="parameter">query</replaceable> <para>
</TERM> The full set of command-line arguments and meta-commands are described in a subsequent
<LISTITEM> section.
<PARA> </para>
A single query to run. <application>psql</application> will exit on completion. <para>
</PARA> There are some environment variables which can be used in liu of
</LISTITEM> command line arguments.
</VARLISTENTRY> Additionally, the <productname>Postgres</productname> frontend library used by
the <application>psql</application> application
looks for other optional environment variables to configure, for example,
the style of date/time representation and the local time zone. Refer
to the chapter on <filename>libpq</filename> in the
<citetitle>Programmer's Guide</citetitle> for more details.
</para>
<para>
You may set any of the following environment variables to avoid
specifying command-line options:
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
<envar>PGHOST</envar>
</TERM>
<LISTITEM>
<PARA>
The <acronym>DNS</acronym> host name of the database server.
Setting <envar>PGHOST</envar> to a non-zero-length string causes
<acronym>TCP/IP</acronym> communication
to be used, rather than the default local Unix domain sockets.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
<envar>PGPORT</envar>
</TERM>
<LISTITEM>
<PARA>
The port number on which a <productname>Postgres</productname> server is listening.
Defaults to <literal>5432</literal>.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
<envar>PGTTY</envar>
</TERM>
<LISTITEM>
<PARA>
The target for display of messages from the client support library.
Not required.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
<envar>PGOPTION</envar>
</TERM>
<LISTITEM>
<PARA>
If <envar>PGOPTION</envar>
is specified, then the options it contains are parsed
<emphasis>before</emphasis>
any command-line options.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
<envar>PGREALM</envar>
</TERM>
<LISTITEM>
<PARA>
<envar>PGREALM</envar>
only applies if
<productname>Kerberos</productname>
authentication is in use.
If this environment variable is set, <productname>Postgres</productname>
will attempt authentication with servers for this realm and will use
separate ticket files to avoid conflicts with local ticket files.
See the <citetitle>PostgreSQL Administrator's Guide</citetitle>
for additional information on
<productname>Kerberos</productname>.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
<REFSECT2 ID="R2-APP-PSQL-2">
<REFSECT2INFO>
<DATE>1998-09-26</DATE>
</REFSECT2INFO>
<TITLE>
Outputs
</TITLE>
<PARA>
<application>psql</application>
returns 0 to the shell on successful completion of all queries,
1 for errors, 2 for abrupt disconnection from the backend.
The default TAB delimiter is used.
<application>psql</application>
will also return 1 if the connection to a database could not be made for
any reason.
</para>
</refsect2>
</refsynopsisdiv>
<REFSECT1 ID="R1-APP-PSQL-1">
<REFSECT1INFO>
<DATE>1998-09-26</DATE>
</REFSECT1INFO>
<TITLE>
Description
</TITLE>
<PARA>
<application>psql</application> is a character-based front-end to
<productname>Postgres</productname>.
It enables you to
type in queries interactively, issue them to <productname>Postgres</productname>,
and see the query
results.
</para>
<para>
<application>psql</application>
is a <productname>Postgres</productname> client application. Hence, a
<application>postmaster</application> process
must be running on the database server host before
<application>psql</application>
is executed. In addition, the correct parameters to identify
the database server, such as the
<application>postmaster</application> host name,
may need to be specified
as described below.
</para>
<para>
When
<application>psql</application>
starts, it reads SQL commands from
<filename>/etc/psqlrc</filename>
and then from
<filename>$(<envar>HOME</envar>)/.psqlrc</filename>
This allows SQL commands like
<command>SET</command>
which can be used to set the date style to be run at the start of
every session.
</para>
<REFSECT2 ID="R2-APP-PSQL-3">
<REFSECT2INFO>
<DATE>1998-09-26</DATE>
</REFSECT2INFO>
<TITLE>
Connecting To A Database
</TITLE>
<para>
<application>psql</application>
attempts to make a connection to the database at the hostname and
port number specified on the command line. If the connection could not
be made for any reason (e.g. insufficient privileges, postmaster is not
running on the server, etc)
.IR <application>psql</application>
will return an error that says
<programlisting>
Connection to database failed.
</programlisting>
The reason for the connection failure is not provided.
</para>
</refsect2>
<REFSECT2 ID="R2-APP-PSQL-4">
<REFSECT2INFO>
<DATE>1998-09-26</DATE>
</REFSECT2INFO>
<TITLE>
Entering Queries
</TITLE>
<para>
In normal operation,
<application>psql</application> provides a prompt with the name of the
database that <application>psql</application> is current connected to
followed by the string "=>".
For example,
<programlisting>
$ <userinput>psql testdb</userinput>
Welcome to the POSTGRESQL interactive sql monitor:
Please read the file COPYRIGHT for copyright terms of POSTGRESQL
[PostgreSQL 6.5.0 on i686-pc-linux-gnu, compiled by gcc 2.7.2.3]
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: testdb
</variablelist> testdb=>
</programlisting>
</para>
<para>
At the prompt, the user may type in <acronym>SQL</acronym> queries.
Unless the -S option
is set, input lines are sent to the backend when a query-terminating
semicolon is reached.
</para>
<para>
Whenever a query is executed,
<application>psql</application> also polls for asynchronous notification
events generated by <command>LISTEN</command> and <command>NOTIFY</command>.
</para>
<para>
<application>psql</application>
can be used in a pipe sequence, and automatically detects when it
is not listening or talking to a real tty.
</para>
</refsect2>
<refsect2 id="R2-APP-PSQL-5">
<Title>Paging To Screen</Title>
<Note>
<Title>Author</Title>
<Para>
From Brett McCormick on the mailing list 1998-04-04.
</Para>
</Note>
<Para>
To affect the paging behavior of your <Command>psql</Command> output,
set or unset your PAGER environment variable. I always have to set mine
before it will pause. And of course you have to do this before
starting the program.
</para>
<Para>
In csh/tcsh or other C shells:
<ProgramListing>
% unsetenv PAGER
</ProgramListing>
while in sh/bash or other Bourne shells:
<ProgramListing>
% unset PAGER
</ProgramListing>
</para>
</refsect2>
</refsect1>
<REFSECT1 ID="R1-APP-PSQL-2">
<REFSECT1INFO>
<DATE>1998-09-26</DATE>
</REFSECT1INFO>
<TITLE>
Command-line Options
</TITLE>
<para>
<application>psql</application>
understands the following command-line options:
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
-A
</TERM>
<LISTITEM>
<PARA>
Turn off fill justification when printing out table elements.
</para> </para>
<para> </listitem>
The full set of command-line arguments and meta-commands are described in a subsequent </varlistentry>
section.
<VARLISTENTRY>
<TERM>
-c <replaceable class="parameter">query</replaceable>
</TERM>
<LISTITEM>
<PARA>
Specifies that
<application>psql</application>
is to execute one query string,
<replaceable class="parameter">query</replaceable>,
and then exit. This is useful for shell scripts, typically in
conjunction with the <option>-q</option> option in shell scripts.
</para> </para>
<para> </listitem>
There are some environment variables which can be used in liu of </varlistentry>
command line arguments.
Additionally, the <productname>Postgres</productname> frontend library used by <VARLISTENTRY>
the <application>psql</application> application <TERM>
looks for other optional environment variables to configure, for example, -d <replaceable class="parameter">dbname</replaceable>
the style of date/time representation and the local time zone. Refer </TERM>
to the chapter on <filename>libpq</filename> in the <LISTITEM>
<citetitle>Programmer's Guide</citetitle> for more details. <PARA>
Specifies the name of the database to connect to. This is equivalent to specifying
<replaceable class="parameter">dbname</replaceable> as the last field in the
command line.
</para> </para>
<para> </listitem>
You may set any of the following environment variables to avoid </varlistentry>
specifying command-line options:
<VARLISTENTRY>
<VARIABLELIST> <TERM>
<VARLISTENTRY> -e
<TERM> </TERM>
<envar>PGHOST</envar> <LISTITEM>
</TERM> <PARA>
<LISTITEM> Echo the query sent to the backend
<PARA>
The <acronym>DNS</acronym> host name of the database server.
Setting <envar>PGHOST</envar> to a non-zero-length string causes
<acronym>TCP/IP</acronym> communication
to be used, rather than the default local Unix domain sockets.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
<envar>PGPORT</envar>
</TERM>
<LISTITEM>
<PARA>
The port number on which a <productname>Postgres</productname> server is listening.
Defaults to <literal>5432</literal>.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
<envar>PGTTY</envar>
</TERM>
<LISTITEM>
<PARA>
The target for display of messages from the client support library.
Not required.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
<envar>PGOPTION</envar>
</TERM>
<LISTITEM>
<PARA>
If <envar>PGOPTION</envar>
is specified, then the options it contains are parsed
<emphasis>before</emphasis>
any command-line options.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
<envar>PGREALM</envar>
</TERM>
<LISTITEM>
<PARA>
<envar>PGREALM</envar>
only applies if
<productname>Kerberos</productname>
authentication is in use.
If this environment variable is set, <productname>Postgres</productname>
will attempt authentication with servers for this realm and will use
separate ticket files to avoid conflicts with local ticket files.
See the <citetitle>PostgreSQL Administrator's Guide</citetitle>
for additional information on
<productname>Kerberos</productname>.
</para>
</listitem>
</varlistentry>
</variablelist>
</para> </para>
</refsect2> </listitem>
</varlistentry>
<REFSECT2 ID="R2-APP-PSQL-2">
<REFSECT2INFO> <VARLISTENTRY>
<DATE>1998-09-26</DATE> <TERM>
</REFSECT2INFO> -E
<TITLE> </TERM>
Outputs <LISTITEM>
</TITLE>
<PARA> <PARA>
Echo the actual query generated by \d and other backslash commands
<application>psql</application>
returns 0 to the shell on successful completion of all queries,
1 for errors, 2 for abrupt disconnection from the backend.
The default TAB delimiter is used.
<application>psql</application>
will also return 1 if the connection to a database could not be made for
any reason.
</para> </para>
</refsect2> </listitem>
</refsynopsisdiv> </varlistentry>
<REFSECT1 ID="R1-APP-PSQL-1"> <VARLISTENTRY>
<REFSECT1INFO> <TERM>
<DATE>1998-09-26</DATE> -f <replaceable class="parameter">filename</replaceable>
</REFSECT1INFO> </TERM>
<TITLE> <LISTITEM>
Description <PARA>
</TITLE> Use the file <replaceable class="parameter">filename</replaceable>
<PARA> as the source of queries instead of reading queries interactively.
<application>psql</application> is a character-based front-end to This file must be specified for and visible to the client frontend.
<productname>Postgres</productname>.
It enables you to
type in queries interactively, issue them to <productname>Postgres</productname>,
and see the query
results.
</para>
<para>
<application>psql</application>
is a <productname>Postgres</productname> client application. Hence, a
<application>postmaster</application> process
must be running on the database server host before
<application>psql</application>
is executed. In addition, the correct parameters to identify
the database server, such as the
<application>postmaster</application> host name,
may need to be specified
as described below.
</para>
<para>
When
<application>psql</application>
starts, it reads SQL commands from
<filename>/etc/psqlrc</filename>
and then from
<filename>$(<envar>HOME</envar>)/.psqlrc</filename>
This allows SQL commands like
<command>SET</command>
which can be used to set the date style to be run at the start of
every session.
</para>
<REFSECT2 ID="R2-APP-PSQL-3">
<REFSECT2INFO>
<DATE>1998-09-26</DATE>
</REFSECT2INFO>
<TITLE>
Connecting To A Database
</TITLE>
<para>
<application>psql</application>
attempts to make a connection to the database at the hostname and
port number specified on the command line. If the connection could not
be made for any reason (e.g. insufficient privileges, postmaster is not
running on the server, etc)
.IR <application>psql</application>
will return an error that says
<programlisting>
Connection to database failed.
</programlisting>
The reason for the connection failure is not provided.
</para> </para>
</refsect2> </listitem>
</varlistentry>
<REFSECT2 ID="R2-APP-PSQL-4">
<REFSECT2INFO> <VARLISTENTRY>
<DATE>1998-09-26</DATE> <TERM>
</REFSECT2INFO> -F <replaceable class="parameter">separator</replaceable>
<TITLE> </TERM>
Entering Queries <LISTITEM>
</TITLE> <PARA>
<para> Use <replaceable class="parameter">separator</replaceable>
In normal operation, as the field separator.
<application>psql</application> provides a prompt with the name of the The default is an ASCII vertical bar ("|").
database that <application>psql</application> is current connected to
followed by the string "=>".
For example,
<programlisting>
$ <userinput>psql testdb</userinput>
Welcome to the POSTGRESQL interactive sql monitor:
Please read the file COPYRIGHT for copyright terms of POSTGRESQL
type \e? for help on slash commands
type \eq to quit
type \eg or terminate with semicolon to execute query
You are currently connected to the database: testdb
testdb=>
</programlisting>
</para> </para>
<para> </listitem>
At the prompt, the user may type in <acronym>SQL</acronym> queries. </varlistentry>
Unless the -S option
is set, input lines are sent to the backend when a query-terminating <VARLISTENTRY>
semicolon is reached. <TERM>
-h <replaceable class="parameter">hostname</replaceable>
</TERM>
<LISTITEM>
<PARA>
Specifies the host name of the machine on which the
<application>postmaster</application>
is running.
Without this option, communication is performed using
local Unix domain sockets.
</para> </para>
<para> </listitem>
Whenever a query is executed, </varlistentry>
<application>psql</application> also polls for asynchronous notification
events generated by <command>LISTEN</command> and <command>NOTIFY</command>. <VARLISTENTRY>
<TERM>
-H
</TERM>
<LISTITEM>
<PARA>
Turns on
<acronym>HTML 3.0</acronym>
tabular output.
</para> </para>
<para> </listitem>
<application>psql</application> </varlistentry>
can be used in a pipe sequence, and automatically detects when it
is not listening or talking to a real tty. <VARLISTENTRY>
<TERM>
-l
</TERM>
<LISTITEM>
<PARA>
Lists all available databases, then exit. Other non-connection options are ignored.
</para> </para>
</refsect2> </listitem>
</refsect1> </varlistentry>
<REFSECT1 ID="R1-APP-PSQL-2"> <VARLISTENTRY>
<REFSECT1INFO> <TERM>
<DATE>1998-09-26</DATE> -n
</REFSECT1INFO> </TERM>
<TITLE> <LISTITEM>
Command-line Options <PARA>
</TITLE> Do not use the readline library for input line editing and command history.
<para> </para>
<application>psql</application> </listitem>
understands the following command-line options: </varlistentry>
<VARIABLELIST> <VARLISTENTRY>
<VARLISTENTRY> <TERM>
<TERM> -o <replaceable class="parameter">filename</replaceable>
-A </TERM>
</TERM> <LISTITEM>
<LISTITEM> <PARA>
<PARA> Put all output into file <replaceable class="parameter">filename</replaceable>.
Turn off fill justification when printing out table elements. The path must be writable by the client.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<VARLISTENTRY> <VARLISTENTRY>
<TERM> <TERM>
-c <replaceable class="parameter">query</replaceable> -p <replaceable class="parameter">port</replaceable>
</TERM> </TERM>
<LISTITEM> <LISTITEM>
<PARA> <PARA>
Specifies that Specifies the TCP/IP port or, by omission, the local Unix domain socket file
<application>psql</application> extension on which the
is to execute one query string, <application>postmaster</application>
<replaceable class="parameter">query</replaceable>, is listening for connections. Defaults to the value of the
and then exit. This is useful for shell scripts, typically in <envar>PGPORT</envar>
conjunction with the <option>-q</option> option in shell scripts. environment variable, if set, or to 5432.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<VARLISTENTRY> <VARLISTENTRY>
<TERM> <TERM>
-d <replaceable class="parameter">dbname</replaceable> -q
</TERM> </TERM>
<LISTITEM> <LISTITEM>
<PARA> <PARA>
Specifies the name of the database to connect to. This is equivalent to specifying Specifies that
<replaceable class="parameter">dbname</replaceable> as the last field in the <application>psql</application>
command line. should do its work quietly. By default, it
</para> prints welcome and exit messages and prompts for each query, and prints
</listitem> out the number of rows returned from a query.
</varlistentry> If this option is used, none of this happens. This is useful with the
<option>-c</option> option.
<VARLISTENTRY> </para>
<TERM> </listitem>
-e </varlistentry>
</TERM>
<LISTITEM> <VARLISTENTRY>
<PARA> <TERM>
Echo the query sent to the backend -s
</para> </TERM>
</listitem> <LISTITEM>
</varlistentry> <PARA>
Run in single-step mode where the user is prompted for each query before
<VARLISTENTRY> it is sent to the backend.
<TERM> </para>
-E </listitem>
</TERM> </varlistentry>
<LISTITEM>
<PARA> <VARLISTENTRY>
Echo the actual query generated by \d and other backslash commands <TERM>
</para> -S
</listitem> </TERM>
</varlistentry> <LISTITEM>
<PARA>
<VARLISTENTRY> Runs in single-line mode where each query is terminated by a newline,
<TERM> instead of a semicolon.
-f <replaceable class="parameter">filename</replaceable> </para>
</TERM> </listitem>
<LISTITEM> </varlistentry>
<PARA>
Use the file <replaceable class="parameter">filename</replaceable> <VARLISTENTRY>
as the source of queries instead of reading queries interactively. <TERM>
This file must be specified for and visible to the client frontend. -t
</para> </TERM>
</listitem> <LISTITEM>
</varlistentry> <PARA>
Turn off printing of column names.
<VARLISTENTRY> This is useful with the
<TERM> <option>-c</option>
-F <replaceable class="parameter">separator</replaceable> option in shell scripts.
</TERM> </para>
<LISTITEM> </listitem>
<PARA> </varlistentry>
Use <replaceable class="parameter">separator</replaceable>
as the field separator. <VARLISTENTRY>
The default is an ASCII vertical bar ("|"). <TERM>
</para> -T <replaceable class="parameter">table_options</replaceable>
</listitem> </TERM>
</varlistentry> <LISTITEM>
<PARA>
<VARLISTENTRY> Allows you to specify options to be placed within the
<TERM> <sgmltag>table ...</sgmltag> tag for <acronym>HTML 3.0</acronym>
-h <replaceable class="parameter">hostname</replaceable> tabular output.For example, <literal>border</literal>
</TERM> will give you tables with borders.
<LISTITEM> This must be used in conjunction with the <option>-H</option> option.
<PARA> </para>
Specifies the host name of the machine on which the </listitem>
<application>postmaster</application> </varlistentry>
is running.
Without this option, communication is performed using <VARLISTENTRY>
local Unix domain sockets. <TERM>
</para> -u
</listitem> </TERM>
</varlistentry> <LISTITEM>
<PARA>
<VARLISTENTRY> Asks the user for the user name and password before connecting to the database.
<TERM> If the database does not require password authentication then these are
-H ignored. If the option is not used (and the PGPASSWORD environment variable
</TERM> is not set) and the database requires password authentication, then the
<LISTITEM> connection will fail. The user name is ignored anyway.
<PARA> </para>
Turns on </listitem>
<acronym>HTML 3.0</acronym> </varlistentry>
tabular output.
</para> <VARLISTENTRY>
</listitem> <TERM>
</varlistentry> -x
</TERM>
<VARLISTENTRY> <LISTITEM>
<TERM> <PARA>
-l Turns on extended row format mode. When enabled each row will have its column
</TERM> names printed on the left with the column values printed on the right.
<LISTITEM> This is useful for rows which are otherwise too long to fit into
<PARA> one screen line. HTML row output supports this mode also.
Lists all available databases, then exit. Other non-connection options are ignored. </para>
</para> </listitem>
</listitem> </varlistentry>
</varlistentry> </variablelist>
</para>
<VARLISTENTRY> <para>
<TERM> You may set environment variables to avoid typing some of the above
-n options. See the section on environment variables below.
</TERM> </para>
<LISTITEM> </refsect1>
<PARA>
Do not use the readline library for input line editing and command history. <REFSECT1 ID="R1-APP-PSQL-3">
</para> <REFSECT1INFO>
</listitem> <DATE>1998-09-26</DATE>
</varlistentry> </REFSECT1INFO>
<TITLE>
<VARLISTENTRY> <application>psql</application> Meta-Commands
<TERM> </TITLE>
-o <replaceable class="parameter">filename</replaceable> <para>
</TERM> Anything you enter in <application>psql</application>
<LISTITEM> that begins with an unquoted backslash is a <application>psql</application>
<PARA> meta-command. Anything else is <acronym>SQL</acronym>
Put all output into file <replaceable class="parameter">filename</replaceable>. and simply goes into the current query buffer
The path must be writable by the client. (and once you have at least one complete query, it gets automatically
</para> submitted to the backend).
</listitem> <Application>psql</Application> meta-commands are also called slash commands.
</varlistentry> </para>
<para>
<VARLISTENTRY> The format of a <application>psql</application> command is the backslash,
<TERM> followed immediately by
-p <replaceable class="parameter">port</replaceable> a command verb, then any arguments. The arguments are separated from the
</TERM> command verb and each other by any number of white space characters.
<LISTITEM> </para>
<PARA> <para>
Specifies the TCP/IP port or, by omission, the local Unix domain socket file With single character command verbs, you don't actually need to separate the
extension on which the command verb from the argument with white space, for historical reasons.
<application>postmaster</application> You should anyway.
is listening for connections. Defaults to the value of the </para>
<envar>PGPORT</envar> <para>
environment variable, if set, or to 5432. The following meta-commands are defined:
</para>
</listitem> <VARIABLELIST>
</varlistentry> <VARLISTENTRY>
<TERM>
<VARLISTENTRY> <literal>\a</literal>
<TERM> </TERM>
-q <LISTITEM>
</TERM> <PARA>
<LISTITEM> Toggle field alignment when printing out table elements.
<PARA> </para>
Specifies that </listitem>
<application>psql</application> </varlistentry>
should do its work quietly. By default, it
prints welcome and exit messages and prompts for each query, and prints <VARLISTENTRY>
out the number of rows returned from a query. <TERM>
If this option is used, none of this happens. This is useful with the <literal>\C</literal> <replaceable class="parameter">caption</replaceable>
<option>-c</option> option. </TERM>
</para> <LISTITEM>
</listitem> <PARA>
</varlistentry> Set the HTML3.0 table caption to
<quote><replaceable class="parameter">caption</replaceable></quote>.
<VARLISTENTRY> </para>
<TERM> </listitem>
-s </varlistentry>
</TERM>
<LISTITEM> <VARLISTENTRY>
<PARA> <TERM>
Run in single-step mode where the user is prompted for each query before <literal>\connect</literal> <replaceable class="parameter">dbname</replaceable> [ <replaceable class="parameter">username</replaceable> ]
it is sent to the backend. </TERM>
</para> <LISTITEM>
</listitem> <PARA>
</varlistentry> Establish a connection to a new database, using the default
<replaceable class="parameter">username</replaceable> if none is specified.
<VARLISTENTRY> The previous connection is closed.
<TERM> </para>
-S </listitem>
</TERM> </varlistentry>
<LISTITEM>
<PARA> <VARLISTENTRY>
Runs in single-line mode where each query is terminated by a newline, <TERM>
instead of a semicolon. <literal>\copy</literal> <replaceable class="parameter">dbname</replaceable> { FROM | TO } <replaceable class="parameter">filename</replaceable>
</para> </TERM>
</listitem> <LISTITEM>
</varlistentry> <PARA>
Perform a frontend (client) copy. This is an operation that runs a SQL COPY command,
<VARLISTENTRY> but instead of the backend reading or writing the specified file, and
<TERM> consequently requiring backend access and special user privilege,
-t <application>psql</application> reads or writes the
</TERM> file and routes the data to or from the backend. The default <literal>tab</literal>
<LISTITEM> delimiter is used.
<PARA> </para>
Turn off printing of column names. <tip>
This is useful with the <para>
<option>-c</option> This operation is not as efficient as the <acronym>SQL</acronym>
option in shell scripts. <command>COPY</command> command because all data must pass through the
</para> client/server IP or socket connection. For large amounts of data this other
</listitem> technique may be preferable.
</varlistentry> </para>
</tip>
<VARLISTENTRY> </listitem>
<TERM> </varlistentry>
-T <replaceable class="parameter">table_options</replaceable>
</TERM> <VARLISTENTRY>
<LISTITEM> <TERM>
<PARA> <literal>\d</literal> [ <replaceable class="parameter">table</replaceable> ]
Allows you to specify options to be placed within the </TERM>
<sgmltag>table ...</sgmltag> tag for <acronym>HTML 3.0</acronym> <LISTITEM>
tabular output.For example, <literal>border</literal> <PARA>
will give you tables with borders. List tables in the database, or if <replaceable class="parameter">table</replaceable>
This must be used in conjunction with the <option>-H</option> option. is specified, list the columns in that table.
</para> If table name is specified as an asterisk (<quote>*</quote>),
</listitem> list all tables and column information for each tables.
</varlistentry> </para>
</listitem>
<VARLISTENTRY> </varlistentry>
<TERM>
-u <VARLISTENTRY>
</TERM> <TERM>
<LISTITEM> <literal>\da</literal>
<PARA> </TERM>
Asks the user for the user name and password before connecting to the database. <LISTITEM>
If the database does not require password authentication then these are <PARA>
ignored. If the option is not used (and the PGPASSWORD environment variable List all available aggregates.
is not set) and the database requires password authentication, then the </para>
connection will fail. The user name is ignored anyway. </listitem>
</para> </varlistentry>
</listitem>
</varlistentry> <VARLISTENTRY>
<TERM>
<VARLISTENTRY> <literal>\dd</literal> <replaceable class="parameter">object</replaceable>
<TERM> </TERM>
-x <LISTITEM>
</TERM> <PARA>
<LISTITEM> List the description from <literal>pg_description</literal>
<PARA> of the specified object, which can be a
Turns on extended row format mode. When enabled each row will have its column table, table.column, type, operator, or aggregate.
names printed on the left with the column values printed on the right. </para>
This is useful for rows which are otherwise too long to fit into <tip>
one screen line. HTML row output supports this mode also. <para>
</para> Not all objects have a description in <literal>pg_description</literal>.
</listitem> This meta-command can be useful to get a quick description of a native
</varlistentry> <productname>Postgres</productname> feature.
</variablelist> </para>
</para> </tip>
<para> </listitem>
You may set environment variables to avoid typing some of the above </varlistentry>
options. See the section on environment variables below.
</para> <VARLISTENTRY>
</refsect1> <TERM>
<literal>\df</literal>
<REFSECT1 ID="R1-APP-PSQL-3"> </TERM>
<REFSECT1INFO> <LISTITEM>
<DATE>1998-09-26</DATE> <PARA>
</REFSECT1INFO> List functions.
<TITLE> </para>
<application>psql</application> Meta-Commands </listitem>
</TITLE> </varlistentry>
<para>
Anything you enter in <application>psql</application> <VARLISTENTRY>
that begins with an unquoted backslash is a <application>psql</application> <TERM>
meta-command. Anything else is <acronym>SQL</acronym> <literal>\di</literal>
and simply goes into the current query buffer </TERM>
(and once you have at least one complete query, it gets automatically <LISTITEM>
submitted to the backend). <PARA>
<Application>psql</Application> meta-commands are also called slash commands. List only indexes.
</para> </para>
<para> </listitem>
The format of a <application>psql</application> command is the backslash, </varlistentry>
followed immediately by
a command verb, then any arguments. The arguments are separated from the <VARLISTENTRY>
command verb and each other by any number of white space characters. <TERM>
</para> <literal>\do</literal>
<para> </TERM>
With single character command verbs, you don't actually need to separate the <LISTITEM>
command verb from the argument with white space, for historical reasons. <PARA>
You should anyway. List only operators.
</para> </para>
<para> </listitem>
The following meta-commands are defined: </varlistentry>
<VARIABLELIST> <VARLISTENTRY>
<VARLISTENTRY> <TERM>
<TERM> <literal>\ds</literal>
<literal>\a</literal> </TERM>
</TERM> <LISTITEM>
<LISTITEM> <PARA>
<PARA> List only sequences.
Toggle field alignment when printing out table elements. </para>
</para> </listitem>
</listitem> </varlistentry>
</varlistentry>
<VARLISTENTRY>
<VARLISTENTRY> <TERM>
<TERM> <literal>\dS</literal>
<literal>\C</literal> <replaceable class="parameter">caption</replaceable> </TERM>
</TERM> <LISTITEM>
<LISTITEM> <PARA>
<PARA> List system tables and indexes.
Set the HTML3.0 table caption to </para>
<quote><replaceable class="parameter">caption</replaceable></quote>. </listitem>
</para> </varlistentry>
</listitem>
</varlistentry> <VARLISTENTRY>
<TERM>
<VARLISTENTRY> <literal>\dt</literal>
<TERM> </TERM>
<literal>\connect</literal> <replaceable class="parameter">dbname</replaceable> [ <replaceable class="parameter">username</replaceable> ] <LISTITEM>
</TERM> <PARA>
<LISTITEM> List only non-system tables.
<PARA> </para>
Establish a connection to a new database, using the default </listitem>
<replaceable class="parameter">username</replaceable> if none is specified. </varlistentry>
The previous connection is closed.
</para> <VARLISTENTRY>
</listitem> <TERM>
</varlistentry> <literal>\dT</literal>
</TERM>
<VARLISTENTRY> <LISTITEM>
<TERM> <PARA>
<literal>\copy</literal> <replaceable class="parameter">dbname</replaceable> { FROM | TO } <replaceable class="parameter">filename</replaceable> List types.
</TERM> </para>
<LISTITEM> </listitem>
<PARA> </varlistentry>
Perform a frontend (client) copy. This is an operation that runs a SQL COPY command,
but instead of the backend reading or writing the specified file, and <VARLISTENTRY>
consequently requiring backend access and special user privilege, <TERM>
<application>psql</application> reads or writes the <literal>\e</literal> [ <replaceable class="parameter">filename</replaceable> ]
file and routes the data to or from the backend. The default <literal>tab</literal> </TERM>
delimiter is used. <LISTITEM>
</para> <PARA>
<tip> Edit the current query buffer or the contents of the file
<para> <replaceable class="parameter">filename</replaceable>.
This operation is not as efficient as the <acronym>SQL</acronym> </para>
<command>COPY</command> command because all data must pass through the </listitem>
client/server IP or socket connection. For large amounts of data this other </varlistentry>
technique may be preferable.
</para> <VARLISTENTRY>
</tip> <TERM>
</listitem> <literal>\E</literal> [ <replaceable class="parameter">filename</replaceable> ]
</varlistentry> </TERM>
<LISTITEM>
<VARLISTENTRY> <PARA>
<TERM> Edit the current query buffer or the contents of the file
<literal>\d</literal> [ <replaceable class="parameter">table</replaceable> ] <replaceable class="parameter">filename</replaceable>
</TERM> and execute it upon editor exit.
<LISTITEM> </para>
<PARA> </listitem>
List tables in the database, or if <replaceable class="parameter">table</replaceable> </varlistentry>
is specified, list the columns in that table.
If table name is specified as an asterisk (<quote>*</quote>), <VARLISTENTRY>
list all tables and column information for each tables. <TERM>
</para> <literal>\f</literal> [ <replaceable class="parameter">separator</replaceable> ]
</listitem> </TERM>
</varlistentry> <LISTITEM>
<PARA>
<VARLISTENTRY> Set the field separator. Default is a single blank space.
<TERM> </para>
<literal>\da</literal> </listitem>
</TERM> </varlistentry>
<LISTITEM>
<PARA> <VARLISTENTRY>
List all available aggregates. <TERM>
</para> <literal>\g</literal> [ { <replaceable class="parameter">filename</replaceable> | <literal>|</literal><replaceable class="parameter">command</replaceable> } ]
</listitem> </TERM>
</varlistentry> <LISTITEM>
<PARA>
<VARLISTENTRY> Send the current query input buffer to the backend and optionally
<TERM> save the output in <replaceable class="parameter">filename</replaceable>
<literal>\dd</literal> <replaceable class="parameter">object</replaceable> or pipe the output into a separate Unix shell to execute
</TERM> <replaceable class="parameter">command</replaceable>.
<LISTITEM> </para>
<PARA> </listitem>
List the description from <literal>pg_description</literal> </varlistentry>
of the specified object, which can be a
table, table.column, type, operator, or aggregate. <VARLISTENTRY>
</para> <TERM>
<tip> <literal>\h</literal> [ <replaceable class="parameter">command</replaceable> ]
<para> </TERM>
Not all objects have a description in <literal>pg_description</literal>. <LISTITEM>
This meta-command can be useful to get a quick description of a native <PARA>
<productname>Postgres</productname> feature. Give syntax help on the specified SQL command.
</para> If <replaceable class="parameter">command</replaceable> is not a defined SQL command
</tip> (or is not documented in <application>psql</application>), or if
</listitem> <replaceable class="parameter">command</replaceable> is not specified,
</varlistentry> then <application>psql</application> will
list all the commands for which syntax help is
<VARLISTENTRY> available. If <replaceable class="parameter">command</replaceable>
<TERM> is an asterisk (<quote>*</quote>), then
<literal>\df</literal> give syntax help on all SQL commands.
</TERM> </para>
<LISTITEM> </listitem>
<PARA> </varlistentry>
List functions.
</para> <VARLISTENTRY>
</listitem> <TERM>
</varlistentry> <literal>\H</literal>
</TERM>
<VARLISTENTRY> <LISTITEM>
<TERM> <PARA>
<literal>\di</literal> Toggle <acronym>HTML3</acronym> output. This is equivalent to the <option>-H</option>
</TERM> command-line option.
<LISTITEM> </para>
<PARA> </listitem>
List only indexes. </varlistentry>
</para>
</listitem> <VARLISTENTRY>
</varlistentry> <TERM>
<literal>\i</literal> <replaceable class="parameter">filename</replaceable>
<VARLISTENTRY> </TERM>
<TERM> <LISTITEM>
<literal>\do</literal> <PARA>
</TERM> Read queries from the file <replaceable class="parameter">filename</replaceable>
<LISTITEM> into the query input buffer.
<PARA> </para>
List only operators. </listitem>
</para> </varlistentry>
</listitem>
</varlistentry> <VARLISTENTRY>
<TERM>
<VARLISTENTRY> <literal>\l</literal>
<TERM> </TERM>
<literal>\ds</literal> <LISTITEM>
</TERM> <PARA>
<LISTITEM> List all the databases in the server.
<PARA> </para>
List only sequences. </listitem>
</para> </varlistentry>
</listitem>
</varlistentry> <VARLISTENTRY>
<TERM>
<VARLISTENTRY> <literal>\m</literal>
<TERM> </TERM>
<literal>\dS</literal> <LISTITEM>
</TERM> <PARA>
<LISTITEM> Toggle the old monitor-like table display, which includes border characters
<PARA> surrounding the table.
List system tables and indexes. This is standard SQL output.
</para> By default, <application>psql</application> includes only field separators
</listitem> between columns.
</varlistentry> </para>
</listitem>
<VARLISTENTRY> </varlistentry>
<TERM>
<literal>\dt</literal> <VARLISTENTRY>
</TERM> <TERM>
<LISTITEM> <literal>\o</literal> [ { <replaceable class="parameter">filename</replaceable> | <literal>|</literal><replaceable class="parameter">command</replaceable> } ]
<PARA> </TERM>
List only non-system tables. <LISTITEM>
</para> <PARA>
</listitem> Save future query results to the file
</varlistentry> <replaceable class="parameter">filename</replaceable> or pipe future
results into a separate Unix shell to execute
<VARLISTENTRY> <replaceable class="parameter">command</replaceable>.
<TERM> If no arguments are specified, send query results to
<literal>\dT</literal> <filename>stdout</filename>.
</TERM> </para>
<LISTITEM> </listitem>
<PARA> </varlistentry>
List types.
</para> <VARLISTENTRY>
</listitem> <TERM>
</varlistentry> <literal>\p</literal>
</TERM>
<VARLISTENTRY> <LISTITEM>
<TERM> <PARA>
<literal>\e</literal> [ <replaceable class="parameter">filename</replaceable> ] Print the current query buffer.
</TERM> </para>
<LISTITEM> </listitem>
<PARA> </varlistentry>
Edit the current query buffer or the contents of the file
<replaceable class="parameter">filename</replaceable>. <VARLISTENTRY>
</para> <TERM>
</listitem> <literal>\q</literal>
</varlistentry> </TERM>
<LISTITEM>
<VARLISTENTRY> <PARA>
<TERM> Quit the <application>psql</application> program.
<literal>\E</literal> [ <replaceable class="parameter">filename</replaceable> ] </para>
</TERM> </listitem>
<LISTITEM> </varlistentry>
<PARA>
Edit the current query buffer or the contents of the file <VARLISTENTRY>
<replaceable class="parameter">filename</replaceable> <TERM>
and execute it upon editor exit. <literal>\r</literal>
</para> </TERM>
</listitem> <LISTITEM>
</varlistentry> <PARA>
Reset(clear) the query buffer.
<VARLISTENTRY> </para>
<TERM> </listitem>
<literal>\f</literal> [ <replaceable class="parameter">separator</replaceable> ] </varlistentry>
</TERM>
<LISTITEM> <VARLISTENTRY>
<PARA> <TERM>
Set the field separator. Default is a single blank space. <literal>\s</literal> [ <replaceable class="parameter">filename</replaceable> ]
</para> </TERM>
</listitem> <LISTITEM>
</varlistentry> <PARA>
Print or save the command line history to
<VARLISTENTRY> <replaceable class="parameter">filename</replaceable>.
<TERM> If <replaceable class="parameter">filename</replaceable> is omitted,
<literal>\g</literal> [ { <replaceable class="parameter">filename</replaceable> | <literal>|</literal><replaceable class="parameter">command</replaceable> } ] do not save subsequent commands to a history file.
</TERM> This option is only available if <application>psql</application> is
<LISTITEM> configured to use readline.
<PARA> </para>
Send the current query input buffer to the backend and optionally </listitem>
save the output in <replaceable class="parameter">filename</replaceable> </varlistentry>
or pipe the output into a separate Unix shell to execute
<replaceable class="parameter">command</replaceable>. <VARLISTENTRY>
</para> <TERM>
</listitem> <literal>\t</literal>
</varlistentry> </TERM>
<LISTITEM>
<VARLISTENTRY> <PARA>
<TERM> Toggle display of output column name headings and row count footer (defaults to on).
<literal>\h</literal> [ <replaceable class="parameter">command</replaceable> ] </para>
</TERM> </listitem>
<LISTITEM> </varlistentry>
<PARA>
Give syntax help on the specified SQL command. <VARLISTENTRY>
If <replaceable class="parameter">command</replaceable> is not a defined SQL command <TERM>
(or is not documented in <application>psql</application>), or if <literal>\T</literal> <replaceable class="parameter">table_options</replaceable>
<replaceable class="parameter">command</replaceable> is not specified, </TERM>
then <application>psql</application> will <LISTITEM>
list all the commands for which syntax help is <PARA>
available. If <replaceable class="parameter">command</replaceable> Allows you to specify options to be placed within the
is an asterisk (<quote>*</quote>), then <sgmltag>table ...</sgmltag> tag
give syntax help on all SQL commands. for <acronym>HTML 3.0</acronym>
</para> tabular output.For example, <literal>border</literal>
</listitem> will give you tables with borders.
</varlistentry> This must be used in conjunction with the <command>\H</command> meta-command.
</para>
<VARLISTENTRY> </listitem>
<TERM> </varlistentry>
<literal>\H</literal>
</TERM> <VARLISTENTRY>
<LISTITEM> <TERM>
<PARA> <literal>\x</literal>
Toggle <acronym>HTML3</acronym> output. This is equivalent to the <option>-H</option> </TERM>
command-line option. <LISTITEM>
</para> <PARA>
</listitem> Toggles extended row format mode. When enabled each row will have its column
</varlistentry> names printed on the left with the column values printed on the right.
This is useful for rows which are otherwise too long to fit into
<VARLISTENTRY> one screen line. <acronym>HTML</acronym> row output mode supports this flag too.
<TERM> </para>
<literal>\i</literal> <replaceable class="parameter">filename</replaceable> </listitem>
</TERM> </varlistentry>
<LISTITEM>
<PARA> <VARLISTENTRY>
Read queries from the file <replaceable class="parameter">filename</replaceable> <TERM>
into the query input buffer. <literal>\w</literal> <replaceable class="parameter">filename</replaceable>
</para> </TERM>
</listitem> <LISTITEM>
</varlistentry> <PARA>
Outputs the current query buffer to the file
<VARLISTENTRY> <replaceable class="parameter">filename</replaceable>.
<TERM> </para>
<literal>\l</literal> </listitem>
</TERM> </varlistentry>
<LISTITEM>
<PARA> <VARLISTENTRY>
List all the databases in the server. <TERM>
</para> <literal>\z</literal>
</listitem> </TERM>
</varlistentry> <LISTITEM>
<PARA>
<VARLISTENTRY> Produces a list of all tables in the database with their appropriate ACLs
<TERM> (grant/revoke permissions) listed.
<literal>\m</literal> </para>
</TERM> </listitem>
<LISTITEM> </varlistentry>
<PARA>
Toggle the old monitor-like table display, which includes border characters <VARLISTENTRY>
surrounding the table. <TERM>
This is standard SQL output. <literal>\!</literal> [ <replaceable class="parameter">command</replaceable> ]
By default, <application>psql</application> includes only field separators </TERM>
between columns. <LISTITEM>
</para> <PARA>
</listitem> Escape to a separate Unix shell or execute the Unix command
</varlistentry> <replaceable class="parameter">command</replaceable>.
</para>
<VARLISTENTRY> </listitem>
<TERM> </varlistentry>
<literal>\o</literal> [ { <replaceable class="parameter">filename</replaceable> | <literal>|</literal><replaceable class="parameter">command</replaceable> } ]
</TERM> <VARLISTENTRY>
<LISTITEM> <TERM>
<PARA> <literal>\?</literal>
Save future query results to the file </TERM>
<replaceable class="parameter">filename</replaceable> or pipe future <LISTITEM>
results into a separate Unix shell to execute <PARA>
<replaceable class="parameter">command</replaceable>. Get help information about the slash (<quote>\</quote>) commands.
If no arguments are specified, send query results to </para>
<filename>stdout</filename>. </listitem>
</para> </varlistentry>
</listitem> </variablelist>
</varlistentry> </para>
</refsect1>
<VARLISTENTRY>
<TERM>
<literal>\p</literal>
</TERM>
<LISTITEM>
<PARA>
Print the current query buffer.
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
<literal>\q</literal>
</TERM>
<LISTITEM>
<PARA>
Quit the <application>psql</application> program.
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
<literal>\r</literal>
</TERM>
<LISTITEM>
<PARA>
Reset(clear) the query buffer.
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
<literal>\s</literal> [ <replaceable class="parameter">filename</replaceable> ]
</TERM>
<LISTITEM>
<PARA>
Print or save the command line history to
<replaceable class="parameter">filename</replaceable>.
If <replaceable class="parameter">filename</replaceable> is omitted,
do not save subsequent commands to a history file.
This option is only available if <application>psql</application> is
configured to use readline.
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
<literal>\t</literal>
</TERM>
<LISTITEM>
<PARA>
Toggle display of output column name headings and row count footer (defaults to on).
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
<literal>\T</literal> <replaceable class="parameter">table_options</replaceable>
</TERM>
<LISTITEM>
<PARA>
Allows you to specify options to be placed within the
<sgmltag>table ...</sgmltag> tag
for <acronym>HTML 3.0</acronym>
tabular output.For example, <literal>border</literal>
will give you tables with borders.
This must be used in conjunction with the <command>\H</command> meta-command.
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
<literal>\x</literal>
</TERM>
<LISTITEM>
<PARA>
Toggles extended row format mode. When enabled each row will have its column
names printed on the left with the column values printed on the right.
This is useful for rows which are otherwise too long to fit into
one screen line. <acronym>HTML</acronym> row output mode supports this flag too.
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
<literal>\w</literal> <replaceable class="parameter">filename</replaceable>
</TERM>
<LISTITEM>
<PARA>
Outputs the current query buffer to the file
<replaceable class="parameter">filename</replaceable>.
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
<literal>\z</literal>
</TERM>
<LISTITEM>
<PARA>
Produces a list of all tables in the database with their appropriate ACLs
(grant/revoke permissions) listed.
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
<literal>\!</literal> [ <replaceable class="parameter">command</replaceable> ]
</TERM>
<LISTITEM>
<PARA>
Escape to a separate Unix shell or execute the Unix command
<replaceable class="parameter">command</replaceable>.
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
<literal>\?</literal>
</TERM>
<LISTITEM>
<PARA>
Get help information about the slash (<quote>\</quote>) commands.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
</refentry> </refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:nil
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../reference.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:"/usr/lib/sgml/CATALOG"
sgml-local-ecat-files:nil
End:
-->
<REFENTRY ID="SQL-SET"> <REFENTRY ID="SQL-SET">
<REFMETA> <REFMETA>
<REFENTRYTITLE> <REFENTRYTITLE>
SET SET
</REFENTRYTITLE> </REFENTRYTITLE>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO> <REFMISCINFO>SQL - Language Statements</REFMISCINFO>
</REFMETA> </REFMETA>
<REFNAMEDIV> <REFNAMEDIV>
<REFNAME> <REFNAME>
SET SET
</REFNAME> </REFNAME>
<REFPURPOSE> <REFPURPOSE>
Set run-time parameters for session Set run-time parameters for session
</REFPURPOSE> </REFPURPOSE>
</refnamediv> </refnamediv>
<REFSYNOPSISDIV> <REFSYNOPSISDIV>
<REFSYNOPSISDIVINFO> <REFSYNOPSISDIVINFO>
<DATE>1998-09-24</DATE> <DATE>1998-09-24</DATE>
</REFSYNOPSISDIVINFO> </REFSYNOPSISDIVINFO>
<SYNOPSIS> <SYNOPSIS>
<REPLACEABLE CLASS="PARAMETER">
</REPLACEABLE>
SET <REPLACEABLE CLASS="PARAMETER">variable</REPLACEABLE> { TO | = } { '<REPLACEABLE CLASS="PARAMETER">value</REPLACEABLE>' | DEFAULT } SET <REPLACEABLE CLASS="PARAMETER">variable</REPLACEABLE> { TO | = } { '<REPLACEABLE CLASS="PARAMETER">value</REPLACEABLE>' | DEFAULT }
SET TIME ZONE { '<REPLACEABLE CLASS="PARAMETER">timezone</REPLACEABLE>' | LOCAL }; SET TIME ZONE { '<REPLACEABLE CLASS="PARAMETER">timezone</REPLACEABLE>' | LOCAL };
</SYNOPSIS> </SYNOPSIS>
<REFSECT2 ID="R2-SQL-SET-1"> <REFSECT2 ID="R2-SQL-SET-1">
<REFSECT2INFO> <REFSECT2INFO>
<DATE>1998-09-24</DATE> <DATE>1998-09-24</DATE>
</REFSECT2INFO> </REFSECT2INFO>
<TITLE> <TITLE>
Inputs Inputs
</TITLE> </TITLE>
<PARA> <PARA>
<VARIABLELIST> <VARIABLELIST>
<VARLISTENTRY> <VARLISTENTRY>
<TERM> <TERM>
<REPLACEABLE CLASS="PARAMETER">variable</REPLACEABLE> <REPLACEABLE CLASS="PARAMETER">variable</REPLACEABLE>
</TERM> </TERM>
<LISTITEM> <LISTITEM>
<para> <para>
Settable global parameter. Settable global parameter.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>
<REPLACEABLE CLASS="PARAMETER">value</REPLACEABLE> <REPLACEABLE CLASS="PARAMETER">value</REPLACEABLE>
</term> </term>
<listitem> <listitem>
<PARA> <PARA>
New value of parameter. New value of parameter.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</variablelist> </variablelist>
</para> </para>
<para> <para>
The possible variables and allowed values are: The possible variables and allowed values are:
<VARIABLELIST> <VARIABLELIST>
<VARLISTENTRY> <VARLISTENTRY>
<TERM> <TERM>
DateStyle DateStyle
</TERM> </TERM>
<LISTITEM> <LISTITEM>
<PARA> <PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
ISO
</TERM>
<LISTITEM>
<PARA>
use ISO 8601-style dates and times
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
SQL
</TERM>
<LISTITEM>
<PARA>
use Oracle/Ingres-style dates and times
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
Postgres
</TERM>
<LISTITEM>
<PARA>
use traditional <productname>Postgres</productname> format
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
European
</TERM>
<LISTITEM>
<PARA>
use dd/mm/yyyy for numeric date representations.
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
NonEuropean
</TERM>
<LISTITEM>
<PARA>
use mm/dd/yyyy for numeric date representations.
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
German
</TERM>
<LISTITEM>
<PARA>
use dd.mm.yyyy for numeric date representations.
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
US
</TERM>
<LISTITEM>
<PARA>
same as 'NonEuropean'
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
default
</TERM>
<LISTITEM>
<PARA>
restores the default values ('US,Postgres')
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
<para>
Date format initialization my be done by:
<simplelist>
<member>
Setting PGDATESTYLE environment variable.
</member>
<member>
Running postmaster using -oe parameter to set
dates to the 'European' convention.
Note that this affects only the some combinations of date styles; for example
the ISO style is not affected by this parameter.
</member>
<member>
Changing variables in
<filename>src/backend/utils/init/globals.c</filename>.
</member>
</simplelist>
</para>
<para>
The variables in <filename>globals.c</filename> which can be changed are:
<simplelist>
<member>
bool EuroDates = false | true
</member>
<member>
int DateStyle = USE_ISO_DATES | USE_POSTGRES_DATES | USE_SQL_DATES | USE_GERMAN_DATES
</member>
</simplelist>
</para>
<para>
<variablelist>
<varlistentry>
<term>
TIMEZONE
</term>
<listitem>
<para>
The possible values for timezone depends on your operating
system. For example on Linux /usr/lib/zoneinfo contains the
database of timezones.
</para>
<para>
Here are some valid values for timezone:
<VARIABLELIST> <variablelist>
<VARLISTENTRY> <varlistentry>
<TERM> <term>
ISO 'PST8PDT'
</TERM> </term>
<LISTITEM> <listitem>
<PARA> <para>
use ISO 8601-style dates and times set the timezone for California
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term>
SQL 'Portugal'
</TERM> </term>
<LISTITEM> <listitem>
<PARA> <para>
use Oracle/Ingres-style dates and times set time zone for Portugal.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term>
Postgres 'Europe/Rome'
</TERM> </term>
<LISTITEM> <listitem>
<PARA> <para>
use traditional <productname>Postgres</productname> format set time zone for Italy.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<VARLISTENTRY> <varlistentry>
<TERM> <term>
European DEFAULT
</TERM> </term>
<LISTITEM> <listitem>
<PARA> <para>
use dd/mm/yyyy for numeric date representations. set time zone to your local timezone
</para> (value of the TZ environment variable).
</listitem> </para>
</varlistentry> </listitem>
<VARLISTENTRY> </varlistentry>
<TERM> </variablelist>
NonEuropean </para>
</TERM> <para>
<LISTITEM> If an invalid time zone is specified, the time zone
<PARA> becomes GMT (on most systems anyway).
use mm/dd/yyyy for numeric date representations. </para>
</para> <para>
</listitem> A frontend which uses libpq may be initialized by setting the PGTZ
</varlistentry> environment variable.
<VARLISTENTRY> </para>
<TERM> <para>
German The second syntax shown above, allows one to set the timezone
</TERM> with a syntax similar to SQL92 <command>SET TIME ZONE</command>.
<LISTITEM> The LOCAL keyword is just an alternate form
<PARA> of DEFAULT for SQL92 compatibility.
use dd.mm.yyyy for numeric date representations. </para>
</para> </listitem>
</listitem> </varlistentry>
</varlistentry> </variablelist>
<VARLISTENTRY> </para>
<TERM> <para>
US There are also several internal or optimization
</TERM> parameters which can be specified
<LISTITEM> by the <command>SET</command> command:
<PARA>
same as 'NonEuropean' <variablelist>
</para> <varlistentry>
</listitem> <term>
</varlistentry> COST_HEAP
<VARLISTENTRY> </term>
<TERM> <listitem>
default <para>
</TERM> Sets the default cost of a heap scan for use by the optimizer.
<LISTITEM>
<PARA> <variablelist>
restores the default values ('US,Postgres') <varlistentry>
</para> <term>
</listitem> <replaceable class="parameter">float4</replaceable>
</varlistentry> </term>
</variablelist> <listitem>
</para> <para>
</listitem> Set the cost of a heap scan to the specified floating point value.
</varlistentry> </para>
</variablelist> </listitem>
</para> </varlistentry>
<varlistentry>
<term>
DEFAULT
</term>
<listitem>
<para>
Sets the cost of a heap scan to the default value.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
<para>
The frontend may be initialized by setting the PGCOSTHEAP
environment variable.
</para>
<variablelist>
<varlistentry>
<term>
COST_INDEX
</term>
<listitem>
<para> <para>
Date format initialization my be done by: Sets the default cost of an index scan for use by the optimizer.
<simplelist>
<member>
Setting PGDATESTYLE environment variable.
</member>
<member>
Running postmaster using -oe parameter to set
dates to the 'European' convention.
Note that this affects only the some combinations of date styles; for example
the ISO style is not affected by this parameter.
</member>
<member>
Changing variables in
<filename>src/backend/utils/init/globals.c</filename>.
</member>
</simplelist>
</para> </para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<replaceable class="parameter">float4</replaceable>
</term>
<listitem>
<para> <para>
The variables in <filename>globals.c</filename> which can be changed are: Set the cost of an index scan to the specified floating point value.
<programlisting>
bool EuroDates = false
true
int DateStyle = USE_ISO_DATES
USE_POSTGRES_DATES
USE_ISO_DATES
USE_SQL_DATES
USE_GERMAN_DATES
</programlisting>
</para> </para>
</listitem>
</varlistentry>
<varlistentry>
<term>
DEFAULT
</term>
<listitem>
<para> <para>
<variablelist> Sets the cost of an index scan to the default value.
<varlistentry>
<term>
TIMEZONE
</term>
<listitem>
<para>
The possible values for timezone depends on your operating
system. For example on Linux /usr/lib/zoneinfo contains the
database of timezones.
</para>
<para>
Here are some valid values for timezone:
<variablelist>
<varlistentry>
<term>
'PST8PDT'
</term>
<listitem>
<para>
set the timezone for California
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
'Portugal'
</term>
<listitem>
<para>
set time zone for Portugal.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
'Europe/Rome'
</term>
<listitem>
<para>
set time zone for Italy.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
DEFAULT
</term>
<listitem>
<para>
set time zone to your local timezone
(value of the TZ environment variable).
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
<para>
If an invalid time zone is specified, the time zone
becomes GMT (on most systems anyway).
</para>
<para>
A frontend which uses libpq may be initialized by setting the PGTZ
environment variable.
</para>
<para>
The second syntax shown above, allows one to set the timezone
with a syntax similar to SQL92 <command>SET TIME ZONE</command>.
The LOCAL keyword is just an alternate form
of DEFAULT for SQL92 compatibility.
</para>
</listitem>
</varlistentry>
</variablelist>
</para> </para>
</listitem>
</varlistentry>
</variablelist>
</listitem>
</varlistentry>
</variablelist>
</para>
<para>
The frontend may be initialized by setting the PGCOSTINDEX
environment variable.
<variablelist>
<varlistentry>
<term>
GEQO
</term>
<listitem>
<para>
Sets the threshold for using the genetic optimizer algorithm.
</para>
<variablelist>
<varlistentry>
<term>
On
</term>
<listitem>
<para> <para>
There are also several internal or optimization enables the genetic optimizer algorithm
parameters which can be specified for statements with 6 or more tables.
by the <command>SET</command> command:
<variablelist>
<varlistentry>
<term>
COST_HEAP
</term>
<listitem>
<para>
Sets the default cost of a heap scan for use by the optimizer.
<variablelist>
<varlistentry>
<term>
<replaceable class="parameter">float4</replaceable>
</term>
<listitem>
<para>
Set the cost of a heap scan to the specified floating point value.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
DEFAULT
</term>
<listitem>
<para>
Sets the cost of a heap scan to the default value.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
<para>
The frontend may be initialized by setting the PGCOSTHEAP
environment variable.
</para>
<variablelist>
<varlistentry>
<term>
COST_INDEX
</term>
<listitem>
<para>
Sets the default cost of an index scan for use by the optimizer.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<replaceable class="parameter">float4</replaceable>
</term>
<listitem>
<para>
Set the cost of an index scan to the specified floating point value.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
DEFAULT
</term>
<listitem>
<para>
Sets the cost of an index scan to the default value.
</para>
</listitem>
</varlistentry>
</variablelist>
</listitem>
</varlistentry>
</variablelist>
</para> </para>
</listitem>
</varlistentry>
<varlistentry>
<term>
On=<replaceable class="parameter">#</replaceable>
</term>
<listitem>
<para> <para>
The frontend may be initialized by setting the PGCOSTINDEX Takes an integer argument to enable the genetic optimizer algorithm
environment variable. for statements with <replaceable class="parameter">#</replaceable>
or more tables in the query.
<variablelist>
<varlistentry>
<term>
GEQO
</term>
<listitem>
<para>
Sets the threshold for using the genetic optimizer algorithm.
</para>
<variablelist>
<varlistentry>
<term>
On
</term>
<listitem>
<para>
enables the genetic optimizer algorithm
for statements with 6 or more tables.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
On=<replaceable class="parameter">#</replaceable>
</term>
<listitem>
<para>
Takes an integer argument to enable the genetic optimizer algorithm
for statements with <replaceable class="parameter">#</replaceable>
or more tables in the query.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
Off
</term>
<listitem>
<para>
disables the genetic optimizer algorithm.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
DEFAULT
</term>
<listitem>
<para>
Equivalent to specifying <command>SET GEQO='on'</command>
</para>
</listitem>
</varlistentry>
</variablelist>
</listitem>
</varlistentry>
</variablelist>
</para> </para>
</listitem>
</varlistentry>
<varlistentry>
<term>
Off
</term>
<listitem>
<para> <para>
This algorithm is on by default, which used GEQO for disables the genetic optimizer algorithm.
statements of eleven or more tables.
(See the chapter on GEQO in the Programmer's Guide
for more information).
</para> </para>
</listitem>
</varlistentry>
<varlistentry>
<term>
DEFAULT
</term>
<listitem>
<para> <para>
The frontend may be initialized by setting PGGEQO Equivalent to specifying <command>SET GEQO='on'</command>
environment variable.
</para> </para>
</listitem>
</varlistentry>
</variablelist>
</listitem>
</varlistentry>
</variablelist>
</para>
<para>
This algorithm is on by default, which used GEQO for
statements of eleven or more tables.
(See the chapter on GEQO in the Programmer's Guide
for more information).
</para>
<para>
The frontend may be initialized by setting PGGEQO
environment variable.
</para>
<para>
It may be useful when joining big relations with
small ones. This algorithm is off by default.
It's not used by GEQO anyway.
<variablelist>
<varlistentry>
<term>
KSQO
</term>
<listitem>
<para>
<firstterm>Key Set Query Optimizer</firstterm> forces the query optimizer
to optimize repetative OR clauses such as generated by
<productname>MicroSoft Access</productname>:
</para>
<variablelist>
<varlistentry>
<term>
On
</term>
<listitem>
<para> <para>
It may be useful when joining big relations with enables this optimization.
small ones. This algorithm is off by default.
It's not used by GEQO anyway.
<variablelist>
<varlistentry>
<term>
KSQO
</term>
<listitem>
<para>
<firstterm>Key Set Query Optimizer</firstterm> forces the query optimizer
to optimize repetative OR clauses such as generated by
<productname>MicroSoft Access</productname>:
</para>
<variablelist>
<varlistentry>
<term>
On
</term>
<listitem>
<para>
enables this optimization.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
Off
</term>
<listitem>
<para>
disables this optimization.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
DEFAULT
</term>
<listitem>
<para>
Equivalent to specifying <command>SET KSQO='off'</command>.
</para>
</listitem>
</varlistentry>
</variablelist>
</listitem>
</varlistentry>
</variablelist>
</para> </para>
</listitem>
</varlistentry>
<varlistentry>
<term>
Off
</term>
<listitem>
<para> <para>
It may be useful when joining big relations with disables this optimization.
small ones. This algorithm is off by default.
It's not used by GEQO anyway.
</para> </para>
</listitem>
</varlistentry>
<varlistentry>
<term>
DEFAULT
</term>
<listitem>
<para> <para>
The frontend may be initialized by setting the PGKSQO Equivalent to specifying <command>SET KSQO='off'</command>.
environment variable.
<variablelist>
<varlistentry>
<term>
QUERY_LIMIT
</term>
<listitem>
<para>
Sets the number of rows returned by a query.
</para>
<variablelist>
<varlistentry>
<term>
Value
</term>
<listitem>
<para>
Maximum number of rows to return for a query. The default is to allow
an unlimited number of rows.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<replaceable class="parameter">#</replaceable>
</term>
<listitem>
<para>
Sets the maximum number of rows returned by a
query to <replaceable class="parameter">#</replaceable>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
DEFAULT
</term>
<listitem>
<para>
Sets the maximum number of rows returned by a query to be unlimited.
</para>
</listitem>
</varlistentry>
</variablelist>
<para>
By default, there is no limit to the number of rows
returned by a query.
</para>
</listitem>
</varlistentry>
</variablelist>
</para> </para>
</REFSECT2> </listitem>
</varlistentry>
<REFSECT2 ID="R2-SQL-SET-2"> </variablelist>
<REFSECT2INFO> </listitem>
<DATE>1998-09-24</DATE> </varlistentry>
</REFSECT2INFO> </variablelist>
<TITLE> </para>
Outputs <para>
</TITLE> It may be useful when joining big relations with
<PARA> small ones. This algorithm is off by default.
It's not used by GEQO anyway.
<VARIABLELIST> </para>
<VARLISTENTRY> <para>
<TERM> The frontend may be initialized by setting the PGKSQO
<returnvalue>SET VARIABLE</returnvalue> environment variable.
</TERM> <variablelist>
<LISTITEM> <varlistentry>
<PARA> <term>
Message returned if successfully. QUERY_LIMIT
</para> </term>
</listitem> <listitem>
</varlistentry> <para>
Sets the number of rows returned by a query.
<VARLISTENTRY> </para>
<TERM>
<returnvalue>WARN: Bad value for <replaceable class="parameter">variable</replaceable> (<replaceable class="parameter">value</replaceable>)</returnvalue> <variablelist>
</TERM> <varlistentry>
<LISTITEM> <term>
<PARA> Value
If the command fails to set variable. </term>
</para> <listitem>
</listitem> <para>
</varlistentry> Maximum number of rows to return for a query. The default is to allow
an unlimited number of rows.
</VARIABLELIST>
</para> </para>
</REFSECT2> </listitem>
</REFSYNOPSISDIV> </varlistentry>
<varlistentry>
<REFSECT1 ID="R1-SQL-SET-1"> <term>
<REFSECT1INFO> <replaceable class="parameter">#</replaceable>
<DATE>1998-09-24</DATE> </term>
</REFSECT1INFO> <listitem>
<TITLE> <para>
Description Sets the maximum number of rows returned by a
</TITLE> query to <replaceable class="parameter">#</replaceable>.
<PARA>
<command>SET</command> will modify configuration parameters for variable during
a session.
</para>
<para>
Current values can be obtained using <command>SHOW</command>, and values
can be restored to the defaults using <command>RESET</command>.
Parameters and values are case-insensitive. Note that the value
field is always specified as a string, so is enclosed in
single-quotes.
</para>
<para>
<command>SET TIME ZONE</command> changes the session's
default time zone offset.
A SQL-session always begins with an initial default time zone
offset.
The <command>SET TIME ZONE</command> statement is used to change the default
time zone offset for the current SQL session.
</para>
<REFSECT2 ID="R2-SQL-SET-3">
<REFSECT2INFO>
<DATE>1998-09-24</DATE>
</REFSECT2INFO>
<TITLE>
Notes
</TITLE>
<PARA>
The <command>SET <replaceable class="parameter">variable</replaceable></command>
statement is a <productname>Postgres</productname> language extension.
</para> </para>
</listitem>
</varlistentry>
<varlistentry>
<term>
DEFAULT
</term>
<listitem>
<para> <para>
Refer to <command>SHOW</command> and <command>RESET</command> to Sets the maximum number of rows returned by a query to be unlimited.
display or reset the current values.
</para> </para>
</REFSECT2> </listitem>
</REFSECT1> </varlistentry>
</variablelist>
<REFSECT1 ID="R1-SQL-SET-2"> <para>
<TITLE> By default, there is no limit to the number of rows
Usage returned by a query.
</TITLE> </para>
<PARA> </listitem>
</PARA> </varlistentry>
<ProgramListing> </variablelist>
--Set the style of date to ISO: </para>
-- </REFSECT2>
SET DATESTYLE TO 'ISO';
</programlisting> <REFSECT2 ID="R2-SQL-SET-2">
<programlisting> <REFSECT2INFO>
--Enable GEQO for queries with 4 or more tables <DATE>1998-09-24</DATE>
-- </REFSECT2INFO>
SET GEQO ON=4; <TITLE>
</programlisting> Outputs
<programlisting> </TITLE>
--Set GEQO to default: <PARA>
--
SET GEQO = DEFAULT; <VARIABLELIST>
</programlisting> <VARLISTENTRY>
<programlisting> <TERM>
--set the timezone for Berkeley, California: <returnvalue>SET VARIABLE</returnvalue>
SET TIME ZONE 'PST8PDT'; </TERM>
<LISTITEM>
SELECT CURRENT_TIMESTAMP AS today; <PARA>
Message returned if successfully.
today </para>
---------------------- </listitem>
1998-03-31 07:41:21-08 </varlistentry>
</programlisting>
<programlisting> <VARLISTENTRY>
--set the timezone for Italy: <TERM>
SET TIME ZONE 'Europe/Rome'; <returnvalue>WARN: Bad value for <replaceable class="parameter">variable</replaceable> (<replaceable class="parameter">value</replaceable>)</returnvalue>
</TERM>
SELECT CURRENT_TIMESTAMP AS today; <LISTITEM>
<PARA>
today If the command fails to set variable.
---------------------- </para>
1998-03-31 17:41:31+02 </listitem>
</ProgramListing> </varlistentry>
</REFSECT1> </VARIABLELIST>
</para>
</REFSECT2>
</REFSYNOPSISDIV>
<REFSECT1 ID="R1-SQL-SET-1">
<REFSECT1INFO>
<DATE>1998-09-24</DATE>
</REFSECT1INFO>
<TITLE>
Description
</TITLE>
<PARA>
<command>SET</command> will modify configuration parameters for variable during
a session.
</para>
<para>
Current values can be obtained using <command>SHOW</command>, and values
can be restored to the defaults using <command>RESET</command>.
Parameters and values are case-insensitive. Note that the value
field is always specified as a string, so is enclosed in
single-quotes.
</para>
<para>
<command>SET TIME ZONE</command> changes the session's
default time zone offset.
A SQL-session always begins with an initial default time zone
offset.
The <command>SET TIME ZONE</command> statement is used to change the default
time zone offset for the current SQL session.
</para>
<REFSECT2 ID="R2-SQL-SET-3">
<REFSECT2INFO>
<DATE>1998-09-24</DATE>
</REFSECT2INFO>
<TITLE>
Notes
</TITLE>
<PARA>
The <command>SET <replaceable class="parameter">variable</replaceable></command>
statement is a <productname>Postgres</productname> language extension.
</para>
<para>
Refer to <command>SHOW</command> and <command>RESET</command> to
display or reset the current values.
</para>
</REFSECT2>
</REFSECT1>
<REFSECT1 ID="R1-SQL-SET-2">
<TITLE>
Usage
</TITLE>
<PARA>
</PARA>
<ProgramListing>
--Set the style of date to ISO:
--
SET DATESTYLE TO 'ISO';
</programlisting>
<programlisting>
--Enable GEQO for queries with 4 or more tables
--
SET GEQO ON=4;
</programlisting>
<programlisting>
--Set GEQO to default:
--
SET GEQO = DEFAULT;
</programlisting>
<programlisting>
--set the timezone for Berkeley, California:
SET TIME ZONE 'PST8PDT';
SELECT CURRENT_TIMESTAMP AS today;
today
----------------------
1998-03-31 07:41:21-08
</programlisting>
<programlisting>
--set the timezone for Italy:
SET TIME ZONE 'Europe/Rome';
SELECT CURRENT_TIMESTAMP AS today;
today
----------------------
1998-03-31 17:41:31+02
</ProgramListing>
</REFSECT1>
<REFSECT1 ID="R1-SQL-SET-3"> <REFSECT1 ID="R1-SQL-SET-3">
<TITLE> <TITLE>
Compatibility Compatibility
</TITLE> </TITLE>
<PARA> <PARA>
</PARA> </PARA>
<REFSECT2 ID="R2-SQL-SET-4"> <REFSECT2 ID="R2-SQL-SET-4">
<REFSECT2INFO> <REFSECT2INFO>
<DATE>1998-09-24</DATE> <DATE>1998-09-24</DATE>
</REFSECT2INFO> </REFSECT2INFO>
<TITLE> <TITLE>
SQL92 SQL92
</TITLE> </TITLE>
<PARA> <PARA>
There is no There is no
<command>SET <replaceable class="parameter">variable</replaceable></command> <command>SET <replaceable class="parameter">variable</replaceable></command>
in <acronym>SQL92</acronym>. in <acronym>SQL92</acronym>.
The <acronym>SQL92</acronym> syntax for <command>SET TIME ZONE</command> The <acronym>SQL92</acronym> syntax for <command>SET TIME ZONE</command>
is slightly different, is slightly different,
allowing only a single integer value for time zone specification: allowing only a single integer value for time zone specification:
<programlisting> <programlisting>
SET TIME ZONE { interval_value_expression | LOCAL } SET TIME ZONE { interval_value_expression | LOCAL }
</programlisting> </programlisting>
</para> </para>
</refsect2> </refsect2>
</refsect1> </refsect1>
</REFENTRY> </REFENTRY>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:nil
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../reference.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:"/usr/lib/sgml/CATALOG"
sgml-local-ecat-files:nil
End:
-->
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