@@ -159,6 +161,7 @@ Oid lo_import(PGconn *conn, const char *filename);
...
@@ -159,6 +161,7 @@ Oid lo_import(PGconn *conn, const char *filename);
<synopsis>
<synopsis>
int lo_export(PGconn *conn, Oid lobjId, const char *filename);
int lo_export(PGconn *conn, Oid lobjId, const char *filename);
</synopsis>
</synopsis>
<indexterm><primary>lo_export</></>
The <parameter>lobjId</parameter> argument specifies the OID of the large
The <parameter>lobjId</parameter> argument specifies the OID of the large
object to export and the <parameter>filename</parameter> argument specifies
object to export and the <parameter>filename</parameter> argument specifies
the operating system name name of the file.
the operating system name name of the file.
...
@@ -173,6 +176,7 @@ int lo_export(PGconn *conn, Oid lobjId, const char *filename);
...
@@ -173,6 +176,7 @@ int lo_export(PGconn *conn, Oid lobjId, const char *filename);
<synopsis>
<synopsis>
int lo_open(PGconn *conn, Oid lobjId, int mode);
int lo_open(PGconn *conn, Oid lobjId, int mode);
</synopsis>
</synopsis>
<indexterm><primary>lo_open</></>
The <parameter>lobjId</parameter> argument specifies the OID of the large
The <parameter>lobjId</parameter> argument specifies the OID of the large
object to open. The <parameter>mode</parameter> bits control whether the
object to open. The <parameter>mode</parameter> bits control whether the
object is opened for reading (<symbol>INV_READ</>), writing (<symbol>INV_WRITE</symbol>), or
object is opened for reading (<symbol>INV_READ</>), writing (<symbol>INV_WRITE</symbol>), or
...
@@ -194,10 +198,13 @@ int lo_open(PGconn *conn, Oid lobjId, int mode);
...
@@ -194,10 +198,13 @@ int lo_open(PGconn *conn, Oid lobjId, int mode);
<synopsis>
<synopsis>
int lo_write(PGconn *conn, int fd, const char *buf, size_t len);
int lo_write(PGconn *conn, int fd, const char *buf, size_t len);
</synopsis>
</synopsis>
writes <parameter>len</parameter> bytes from <parameter>buf</parameter> to large object <parameter>fd</>. The <parameter>fd</parameter>
<indexterm><primary>lo_write</></> writes
argument must have been returned by a previous <function>lo_open</function>.
<parameter>len</parameter> bytes from <parameter>buf</parameter>
The number of bytes actually written is returned. In
to large object <parameter>fd</>. The <parameter>fd</parameter>
the event of an error, the return value is negative.
argument must have been returned by a previous
<function>lo_open</function>. The number of bytes actually
written is returned. In the event of an error, the return value
is negative.
</para>
</para>
</sect2>
</sect2>
...
@@ -209,10 +216,13 @@ int lo_write(PGconn *conn, int fd, const char *buf, size_t len);
...
@@ -209,10 +216,13 @@ int lo_write(PGconn *conn, int fd, const char *buf, size_t len);
<synopsis>
<synopsis>
int lo_read(PGconn *conn, int fd, char *buf, size_t len);
int lo_read(PGconn *conn, int fd, char *buf, size_t len);
</synopsis>
</synopsis>
reads <parameter>len</parameter> bytes from large object <parameter>fd</parameter> into <parameter>buf</parameter>. The <parameter>fd</parameter>
<indexterm><primary>lo_read</></> reads
argument must have been returned by a previous <function>lo_open</function>.
<parameter>len</parameter> bytes from large object
The number of bytes actually read is returned. In
<parameter>fd</parameter> into <parameter>buf</parameter>. The
the event of an error, the return value is negative.
<parameter>fd</parameter> argument must have been returned by a
previous <function>lo_open</function>. The number of bytes
actually read is returned. In the event of an error, the return
value is negative.
</para>
</para>
</sect2>
</sect2>
...
@@ -225,10 +235,14 @@ int lo_read(PGconn *conn, int fd, char *buf, size_t len);
...
@@ -225,10 +235,14 @@ int lo_read(PGconn *conn, int fd, char *buf, size_t len);
<synopsis>
<synopsis>
int lo_lseek(PGconn *conn, int fd, int offset, int whence);
int lo_lseek(PGconn *conn, int fd, int offset, int whence);
</synopsis>
</synopsis>
This function moves the current location pointer for the
<indexterm><primary>lo_lseek</></> This function moves the
large object described by <parameter>fd</> to the new location specified
current location pointer for the large object described by
by <parameter>offset</>. The valid values for <parameter>whence</> are
<parameter>fd</> to the new location specified by
<symbol>SEEK_SET</> (seek from object start), <symbol>SEEK_CUR</> (seek from current position), and <symbol>SEEK_END</> (seek from object end). The return value is the new location pointer.
<parameter>offset</>. The valid values for <parameter>whence</>
are <symbol>SEEK_SET</> (seek from object start),
<symbol>SEEK_CUR</> (seek from current position), and
<symbol>SEEK_END</> (seek from object end). The return value is
the new location pointer.
</para>
</para>
</sect2>
</sect2>
...
@@ -241,7 +255,8 @@ int lo_lseek(PGconn *conn, int fd, int offset, int whence);
...
@@ -241,7 +255,8 @@ int lo_lseek(PGconn *conn, int fd, int offset, int whence);
<synopsis>
<synopsis>
int lo_tell(PGconn *conn, int fd);
int lo_tell(PGconn *conn, int fd);
</synopsis>
</synopsis>
If there is an error, the return value is negative.
<indexterm><primary>lo_tell</></> If there is an error, the
return value is negative.
</para>
</para>
</sect2>
</sect2>
...
@@ -253,9 +268,10 @@ int lo_tell(PGconn *conn, int fd);
...
@@ -253,9 +268,10 @@ int lo_tell(PGconn *conn, int fd);
<synopsis>
<synopsis>
int lo_close(PGconn *conn, int fd);
int lo_close(PGconn *conn, int fd);
</synopsis>
</synopsis>
where <parameter>fd</> is a large object descriptor returned by
<indexterm><primary>lo_close</></> where <parameter>fd</> is a
<function>lo_open</function>. On success, <function>lo_close</function>
large object descriptor returned by <function>lo_open</function>.
returns zero. On error, the return value is negative.
On success, <function>lo_close</function> returns zero. On
error, the return value is negative.
</para>
</para>
<para>
<para>
...
@@ -272,8 +288,10 @@ int lo_close(PGconn *conn, int fd);
...
@@ -272,8 +288,10 @@ int lo_close(PGconn *conn, int fd);
<synopsis>
<synopsis>
int lo_unlink(PGconn *conn, Oid lobjId);
int lo_unlink(PGconn *conn, Oid lobjId);
</synopsis>
</synopsis>
The <parameter>lobjId</parameter> argument specifies the OID of the large
<indexterm><primary>lo_unlink</></> The
object to remove. In the event of an error, the return value is negative.
<parameter>lobjId</parameter> argument specifies the OID of the
large object to remove. In the event of an error, the return
value is negative.
</para>
</para>
</sect2>
</sect2>
...
@@ -284,11 +302,13 @@ int lo_unlink(PGconn *conn, Oid lobjId);
...
@@ -284,11 +302,13 @@ int lo_unlink(PGconn *conn, Oid lobjId);
<title>Server-side Functions</title>
<title>Server-side Functions</title>
<para>
<para>
There are two built-in server-side functions, <function>lo_import</function>
There are two built-in server-side functions,
and <function>lo_export</function>, for large object access, which are available for use
@@ -175,10 +195,14 @@ FROM <replaceable>table_reference</replaceable> <optional>, <replaceable>table_r
...
@@ -175,10 +195,14 @@ FROM <replaceable>table_reference</replaceable> <optional>, <replaceable>table_r
<term>Qualified joins</term>
<term>Qualified joins</term>
<indexterm>
<indexterm>
<primary>joins</primary>
<primary>join</primary>
<secondary>outer</secondary>
<secondary>outer</secondary>
</indexterm>
</indexterm>
<indexterm>
<primary>outer join</primary>
</indexterm>
<listitem>
<listitem>
<synopsis>
<synopsis>
<replaceable>T1</replaceable> { <optional>INNER</optional> | { LEFT | RIGHT | FULL } <optional>OUTER</optional> } JOIN <replaceable>T2</replaceable> ON <replaceable>boolean_expression</replaceable>
<replaceable>T1</replaceable> { <optional>INNER</optional> | { LEFT | RIGHT | FULL } <optional>OUTER</optional> } JOIN <replaceable>T2</replaceable> ON <replaceable>boolean_expression</replaceable>
...
@@ -227,9 +251,12 @@ FROM <replaceable>table_reference</replaceable> <optional>, <replaceable>table_r
...
@@ -227,9 +251,12 @@ FROM <replaceable>table_reference</replaceable> <optional>, <replaceable>table_r
<para>
<para>
<indexterm>
<indexterm>
<primary>joins</primary>
<primary>join</primary>
<secondary>natural</secondary>
<secondary>natural</secondary>
</indexterm>
</indexterm>
<indexterm>
<primary>natural join</primary>
</indexterm>
Finally, <literal>NATURAL</> is a shorthand form of
Finally, <literal>NATURAL</> is a shorthand form of
<literal>USING</>: it forms a <literal>USING</> list
<literal>USING</>: it forms a <literal>USING</> list
consisting of exactly those column names that appear in both
consisting of exactly those column names that appear in both
...
@@ -256,10 +283,14 @@ FROM <replaceable>table_reference</replaceable> <optional>, <replaceable>table_r
...
@@ -256,10 +283,14 @@ FROM <replaceable>table_reference</replaceable> <optional>, <replaceable>table_r
<term><literal>LEFT OUTER JOIN</></term>
<term><literal>LEFT OUTER JOIN</></term>
<indexterm>
<indexterm>
<primary>joins</primary>
<primary>join</primary>
<secondary>left</secondary>
<secondary>left</secondary>
</indexterm>
</indexterm>
<indexterm>
<primary>left join</primary>
</indexterm>
<listitem>
<listitem>
<para>
<para>
First, an inner join is performed. Then, for each row in
First, an inner join is performed. Then, for each row in
...
@@ -274,6 +305,15 @@ FROM <replaceable>table_reference</replaceable> <optional>, <replaceable>table_r
...
@@ -274,6 +305,15 @@ FROM <replaceable>table_reference</replaceable> <optional>, <replaceable>table_r
<varlistentry>
<varlistentry>
<term><literal>RIGHT OUTER JOIN</></term>
<term><literal>RIGHT OUTER JOIN</></term>
<indexterm>
<primary>join</primary>
<secondary>right</secondary>
</indexterm>
<indexterm>
<primary>right join</primary>
</indexterm>
<listitem>
<listitem>
<para>
<para>
First, an inner join is performed. Then, for each row in
First, an inner join is performed. Then, for each row in
...
@@ -424,13 +464,13 @@ FROM <replaceable>table_reference</replaceable> <optional>, <replaceable>table_r
...
@@ -424,13 +464,13 @@ FROM <replaceable>table_reference</replaceable> <optional>, <replaceable>table_r
<title>Table and Column Aliases</title>
<title>Table and Column Aliases</title>
<indexterm zone="queries-table-aliases">
<indexterm zone="queries-table-aliases">
<primary>label</primary>
<primary>alias</primary>
<secondary>table</secondary>
<secondary>in the FROM clause</secondary>
</indexterm>
</indexterm>
<indexterm>
<indexterm>
<primary>alias</primary>
<primary>label</primary>
<see>label</see>
<see>alias</see>
</indexterm>
</indexterm>
<para>
<para>
...
@@ -530,7 +570,7 @@ SELECT a.* FROM (my_table AS a JOIN your_table AS b ON ...) AS c
...
@@ -530,7 +570,7 @@ SELECT a.* FROM (my_table AS a JOIN your_table AS b ON ...) AS c
<title>Subqueries</title>
<title>Subqueries</title>
<indexterm zone="queries-subqueries">
<indexterm zone="queries-subqueries">
<primary>subqueries</primary>
<primary>subquery</primary>
</indexterm>
</indexterm>
<para>
<para>
...
@@ -556,6 +596,11 @@ FROM (SELECT * FROM table1) AS alias_name
...
@@ -556,6 +596,11 @@ FROM (SELECT * FROM table1) AS alias_name
<refpurpose>change the definition of a function</refpurpose>
<refpurpose>change the definition of a function</refpurpose>
</refnamediv>
</refnamediv>
<indexterm zone="sql-alterfunction">
<primary>ALTER FUNCTION</primary>
</indexterm>
<refsynopsisdiv>
<refsynopsisdiv>
<synopsis>
<synopsis>
ALTER FUNCTION <replaceable>name</replaceable> ( [ <replaceable class="parameter">type</replaceable> [, ...] ] ) RENAME TO <replaceable>newname</replaceable>
ALTER FUNCTION <replaceable>name</replaceable> ( [ <replaceable class="parameter">type</replaceable> [, ...] ] ) RENAME TO <replaceable>newname</replaceable>
<refpurpose>change the definition of an operator class</refpurpose>
<refpurpose>change the definition of an operator class</refpurpose>
</refnamediv>
</refnamediv>
<indexterm zone="sql-alteropclass">
<primary>ALTER OPERATOR CLASS</primary>
</indexterm>
<refsynopsisdiv>
<refsynopsisdiv>
<synopsis>
<synopsis>
ALTER OPERATOR CLASS <replaceable>name</replaceable> USING <replaceable class="parameter">index_method</replaceable> RENAME TO <replaceable>newname</replaceable>
ALTER OPERATOR CLASS <replaceable>name</replaceable> USING <replaceable class="parameter">index_method</replaceable> RENAME TO <replaceable>newname</replaceable>
CREATE [ UNIQUE ] INDEX <replaceable class="parameter">index_name</replaceable> ON <replaceable class="parameter">table</replaceable> [ USING <replaceable class="parameter">method</replaceable> ]
CREATE [ UNIQUE ] INDEX <replaceable class="parameter">index_name</replaceable> ON <replaceable class="parameter">table</replaceable> [ USING <replaceable class="parameter">method</replaceable> ]
<refpurpose>define a new operator class for indexes</refpurpose>
<refpurpose>define a new operator class for indexes</refpurpose>
</refnamediv>
</refnamediv>
<indexterm zone="sql-createopclass">
<primary>CREATE OPERATOR CLASS</primary>
</indexterm>
<refsynopsisdiv>
<refsynopsisdiv>
<synopsis>
<synopsis>
CREATE OPERATOR CLASS <replaceable class="parameter">name</replaceable> [ DEFAULT ] FOR TYPE <replaceable class="parameter">data_type</replaceable> USING <replaceable class="parameter">index_method</replaceable> AS
CREATE OPERATOR CLASS <replaceable class="parameter">name</replaceable> [ DEFAULT ] FOR TYPE <replaceable class="parameter">data_type</replaceable> USING <replaceable class="parameter">index_method</replaceable> AS
<refpurpose>remove a user-defined operator class</refpurpose>
<refpurpose>remove a user-defined operator class</refpurpose>
</refnamediv>
</refnamediv>
<indexterm zone="sql-dropopclass">
<primary>DROP OPERATOR CLASS</primary>
</indexterm>
<refsynopsisdiv>
<refsynopsisdiv>
<synopsis>
<synopsis>
DROP OPERATOR CLASS <replaceable class="PARAMETER">name</replaceable> USING <replaceable class="PARAMETER">index_method</replaceable> [ CASCADE | RESTRICT ]
DROP OPERATOR CLASS <replaceable class="PARAMETER">name</replaceable> USING <replaceable class="PARAMETER">index_method</replaceable> [ CASCADE | RESTRICT ]