Documentation cleanup

This commit is contained in:
Peter Eisentraut 2003-11-12 22:47:47 +00:00
parent fa5c8a055a
commit 934c21344c
13 changed files with 377 additions and 362 deletions

View File

@ -1,5 +1,5 @@
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ecpg.sgml,v 1.53 2003/10/17 18:57:00 tgl Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ecpg.sgml,v 1.54 2003/11/12 22:47:47 petere Exp $
--> -->
<chapter id="ecpg"> <chapter id="ecpg">
@ -284,7 +284,7 @@ EXEC SQL COMMIT;
</para> </para>
<para> <para>
Single-row Select: Single-row select:
<programlisting> <programlisting>
EXEC SQL SELECT foo INTO :FooBar FROM table1 WHERE ascii = 'doodad'; EXEC SQL SELECT foo INTO :FooBar FROM table1 WHERE ascii = 'doodad';
</programlisting> </programlisting>
@ -359,7 +359,7 @@ EXEC SQL AT <replaceable>connection-name</replaceable> SELECT ...;
The second option is to execute a statement to switch the current The second option is to execute a statement to switch the current
connection. That statement is: connection. That statement is:
<programlisting> <programlisting>
SET CONNECTION <replaceable>connection-name</replaceable>; EXEC SQL SET CONNECTION <replaceable>connection-name</replaceable>;
</programlisting> </programlisting>
This option is particularly convenient if many statements are to be This option is particularly convenient if many statements are to be
executed on the same connection. executed on the same connection.
@ -392,7 +392,7 @@ SET CONNECTION <replaceable>connection-name</replaceable>;
write the name of a C variable into the SQL statement, prefixed by write the name of a C variable into the SQL statement, prefixed by
a colon. For example: a colon. For example:
<programlisting> <programlisting>
INSERT INTO sometable VALUES (:v1, 'foo', :v2); EXEC SQL INSERT INTO sometable VALUES (:v1, 'foo', :v2);
</programlisting> </programlisting>
This statements refers to two C variables named This statements refers to two C variables named
<varname>v1</varname> and <varname>v2</varname> and also uses a <varname>v1</varname> and <varname>v2</varname> and also uses a
@ -592,7 +592,7 @@ EXEC SQL BEGIN DECLARE SECTION;
const char *stmt = "CREATE TABLE test1 (...);"; const char *stmt = "CREATE TABLE test1 (...);";
EXEC SQL END DECLARE SECTION; EXEC SQL END DECLARE SECTION;
EXECUTE IMMEDIATE :stmt; EXEC SQL EXECUTE IMMEDIATE :stmt;
</programlisting> </programlisting>
You may not execute statements that retrieve data (e.g., You may not execute statements that retrieve data (e.g.,
<command>SELECT</command>) this way. <command>SELECT</command>) this way.
@ -611,9 +611,9 @@ EXEC SQL BEGIN DECLARE SECTION;
const char *stmt = "INSERT INTO test1 VALUES(?, ?);"; const char *stmt = "INSERT INTO test1 VALUES(?, ?);";
EXEC SQL END DECLARE SECTION; EXEC SQL END DECLARE SECTION;
PREPARE mystmt FROM :stmt; EXEC SQL PREPARE mystmt FROM :stmt;
... ...
EXECUTE mystmt USING 42, 'foobar'; EXEC SQL EXECUTE mystmt USING 42, 'foobar';
</programlisting> </programlisting>
If the statement you are executing returns values, then add an If the statement you are executing returns values, then add an
<literal>INTO</literal> clause: <literal>INTO</literal> clause:
@ -624,9 +624,9 @@ int v1, v2;
VARCHAR v3; VARCHAR v3;
EXEC SQL END DECLARE SECTION; EXEC SQL END DECLARE SECTION;
PREPARE mystmt FROM :stmt; EXEC SQL PREPARE mystmt FROM :stmt;
... ...
EXECUTE mystmt INTO v1, v2, v3 USING 37; EXEC SQL EXECUTE mystmt INTO v1, v2, v3 USING 37;
</programlisting> </programlisting>
An <command>EXECUTE</command> command may have an An <command>EXECUTE</command> command may have an
<literal>INTO</literal> clause, a <literal>USING</literal> clause, <literal>INTO</literal> clause, a <literal>USING</literal> clause,
@ -668,7 +668,7 @@ EXEC SQL DEALLOCATE PREPARE <replaceable>name</replaceable>;
EXEC SQL ALLOCATE DESCRIPTOR <replaceable>identifier</replaceable>; EXEC SQL ALLOCATE DESCRIPTOR <replaceable>identifier</replaceable>;
</programlisting> </programlisting>
The identifier serves as the <quote>variable name</quote> of the The identifier serves as the <quote>variable name</quote> of the
descriptor area. The scope of the allocated descriptor is WHAT?. descriptor area. <comment>The scope of the allocated descriptor is WHAT?.</comment>
When you don't need the descriptor anymore, you should deallocate When you don't need the descriptor anymore, you should deallocate
it: it:
<programlisting> <programlisting>

View File

@ -1,5 +1,5 @@
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/extend.sgml,v 1.25 2003/09/11 21:42:19 momjian Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/extend.sgml,v 1.26 2003/11/12 22:47:47 petere Exp $
--> -->
<chapter id="extend"> <chapter id="extend">
@ -105,52 +105,74 @@ $Header: /cvsroot/pgsql/doc/src/sgml/extend.sgml,v 1.25 2003/09/11 21:42:19 momj
<para> <para>
<productname>PostgreSQL</productname> data types are divided into base <productname>PostgreSQL</productname> data types are divided into base
types, composite types, domain types, and pseudo-types. types, composite types, domains, and pseudo-types.
</para>
<sect2>
<title>Base Types</title>
<para>
Base types are those, like <type>int4</type>, that are
implemented below the level of the <acronym>SQL</> language
(typically in a low-level language such as C). They generally
correspond to what are often known as abstract data types.
<productname>PostgreSQL</productname> can only operate on such
types through functions provided by the user and only understands
the behavior of such types to the extent that the user describes
them. Base types are further subdivided into scalar and array
types. For each scalar type, a corresponding array type is
automatically created that can hold variable-size arrays of that
scalar type.
</para>
</sect2>
<sect2>
<title>Composite Types</title>
<para>
Composite types, or row types, are created whenever the user
creates a table; it's also possible to define a
<quote>stand-alone</> composite type with no associated table. A
composite type is simply a list of base types with associated
field names. A value of a composite type is a row or record of
field values. The user can access the component fields from
<acronym>SQL</> queries.
</para>
</sect2>
<sect2>
<title>Domains</title>
<para>
A domain is based on a particular base type and for many purposes
is interchangeable with its base type. However, a domain may
have constraints that restrict its valid values to a subset of
what the underlying base type would allow.
</para> </para>
<para> <para>
Base types are those, like <type>int4</type>, that are implemented Domains can be created using the <acronym>SQL</> commands
below the level of the <acronym>SQL</> language (typically in a low-level <command>CREATE DOMAIN</command>. Their creation and use is not
language such as C). They generally correspond to discussed in this chapter.
what are often known as abstract data types.
<productname>PostgreSQL</productname>
can only operate on such types through functions provided
by the user and only understands the behavior of such
types to the extent that the user describes them. Base types are
further subdivided into scalar and array types. For each scalar type,
a corresponding array type is automatically created that can hold
variable-size arrays of that scalar type.
</para> </para>
</sect2>
<sect2>
<title>Pseudo-Types</title>
<para> <para>
Composite types, or row types, are created whenever the user creates a There are a few <quote>pseudo-types</> for special purposes.
table; it's also possible to define a <quote>stand-alone</> composite Pseudo-types cannot appear as columns of tables or attributes of
type with no associated table. A composite type is simply a list of composite types, but they can be used to declare the argument and
base types with associated field names. A value of a composite type result types of functions. This provides a mechanism within the
is a row or record of field values. The user can access the component type system to identify special classes of functions. <xref
fields from <acronym>SQL</> queries.
</para>
<para>
A domain type is based on a particular base
type and for many purposes is interchangeable with its base type.
However, a domain may have constraints that restrict its valid values
to a subset of what the underlying base type would allow. Domains can
be created by simple <acronym>SQL</> commands.
</para>
<para>
Finally, there are a few <quote>pseudo-types</> for special purposes.
Pseudo-types cannot appear as fields of tables or composite types, but
they can be used to declare the argument and result types of functions.
This provides a mechanism within the type system to identify special
classes of functions. <xref
linkend="datatype-pseudotypes-table"> lists the existing linkend="datatype-pseudotypes-table"> lists the existing
pseudo-types. pseudo-types.
</para> </para>
</sect2>
<sect2 id="extend-types-polymorphic"> <sect2 id="extend-types-polymorphic">
<title>Polymorphic Types and Functions</title> <title>Polymorphic Types</title>
<indexterm zone="extend-types-polymorphic"> <indexterm zone="extend-types-polymorphic">
<primary>polymorphic type</primary> <primary>polymorphic type</primary>

View File

@ -1,5 +1,5 @@
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/install-win32.sgml,v 1.15 2003/11/04 09:55:38 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/install-win32.sgml,v 1.16 2003/11/12 22:47:47 petere Exp $
--> -->
<chapter id="install-win32"> <chapter id="install-win32">
@ -109,7 +109,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/install-win32.sgml,v 1.15 2003/11/04 09:55:
<para> <para>
<application>psql</application> is compiled as a <quote>console <application>psql</application> is compiled as a <quote>console
application</>. As the Win32 console windows use a different application</>. As the Windows console windows use a different
encoding than the rest of the system, you must take special care encoding than the rest of the system, you must take special care
when using 8-bit characters at the <application>psql</application> when using 8-bit characters at the <application>psql</application>
prompt. When <application>psql</application> detects a problematic prompt. When <application>psql</application> detects a problematic

View File

@ -1,5 +1,5 @@
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/libpq.sgml,v 1.141 2003/11/01 01:56:29 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/libpq.sgml,v 1.142 2003/11/12 22:47:47 petere Exp $
--> -->
<chapter id="libpq"> <chapter id="libpq">
@ -355,7 +355,7 @@ PostgresPollingStatusType PQconnectPoll(PGconn *conn);
whilst doing so. whilst doing so.
The point of this approach is that the waits for I/O to complete can occur The point of this approach is that the waits for I/O to complete can occur
in the application's main loop, rather than down inside in the application's main loop, rather than down inside
<function>PQconnectdb()</>, and so the application can manage this <function>PQconnectdb</>, and so the application can manage this
operation in parallel with other activities. operation in parallel with other activities.
</para> </para>
<para> <para>
@ -829,8 +829,8 @@ has been sent to the server and not yet completed.
<caution> <caution>
<para> <para>
<function>PQtransactionStatus</> will give incorrect results when using <function>PQtransactionStatus</> will give incorrect results when using
a <productname>PostgreSQL</> 7.3 server that has <literal>AUTOCOMMIT</> a <productname>PostgreSQL</> 7.3 server that has the parameter <literal>autocommit</>
set to <literal>OFF</>. The server-side autocommit feature has been set to off. The server-side autocommit feature has been
deprecated and does not exist in later server versions. deprecated and does not exist in later server versions.
</para> </para>
</caution> </caution>
@ -1028,7 +1028,7 @@ PGresult *PQexec(PGconn *conn, const char *command);
It is allowed to include multiple SQL commands (separated by semicolons) in It is allowed to include multiple SQL commands (separated by semicolons) in
the command string. Multiple queries sent in a single <function>PQexec</> the command string. Multiple queries sent in a single <function>PQexec</>
call are processed in a single transaction, unless there are explicit call are processed in a single transaction, unless there are explicit
BEGIN/COMMIT commands included in the query string to divide it into multiple <command>BEGIN</command>/<command>COMMIT</command> commands included in the query string to divide it into multiple
transactions. Note however that the returned <structname>PGresult</structname> transactions. Note however that the returned <structname>PGresult</structname>
structure describes only the result of the last command executed from the structure describes only the result of the last command executed from the
string. Should one of the commands fail, processing of the string stops with string. Should one of the commands fail, processing of the string stops with
@ -1737,7 +1737,7 @@ This function is deprecated (except for its use in connection with
<command>COPY</>), because it is possible for a single <command>COPY</>), because it is possible for a single
<structname>PGresult</> <structname>PGresult</>
to contain text data in some columns and binary data in others. to contain text data in some columns and binary data in others.
<function>PQfformat()</> is preferred. <function>PQbinaryTuples</> <function>PQfformat</> is preferred. <function>PQbinaryTuples</>
returns 1 only if all columns of the result are binary (format 1). returns 1 only if all columns of the result are binary (format 1).
</para> </para>
</listitem> </listitem>
@ -2068,7 +2068,7 @@ unsigned char *PQescapeBytea(const unsigned char *from,
<function>PQescapeBytea</> returns an escaped version of the <function>PQescapeBytea</> returns an escaped version of the
<parameter>from</parameter> parameter binary string in memory <parameter>from</parameter> parameter binary string in memory
allocated with <function>malloc()</>. This memory must be freed allocated with <function>malloc()</>. This memory must be freed
using <function>PQfreemem()</> when the result is no longer needed. using <function>PQfreemem</> when the result is no longer needed.
The return string has all special characters replaced so that they The return string has all special characters replaced so that they
can be properly processed by the can be properly processed by the
<productname>PostgreSQL</productname> string literal parser, and <productname>PostgreSQL</productname> string literal parser, and
@ -2102,7 +2102,7 @@ unsigned char *PQunescapeBytea(const unsigned char *from, size_t *to_length);
It returns a pointer to a buffer allocated with It returns a pointer to a buffer allocated with
<function>malloc()</function>, or null on error, and puts the size of <function>malloc()</function>, or null on error, and puts the size of
the buffer in <parameter>to_length</parameter>. The result must be the buffer in <parameter>to_length</parameter>. The result must be
freed using <function>PQfreemem()</> when it is no longer needed. freed using <function>PQfreemem</> when it is no longer needed.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
@ -2122,9 +2122,9 @@ void PQfreemem(void *ptr);
<function>PQescapeBytea</function>, <function>PQescapeBytea</function>,
<function>PQunescapeBytea</function>, <function>PQunescapeBytea</function>,
and <function>PQnotifies</function>. and <function>PQnotifies</function>.
It is needed by Win32, which can not free memory across It is needed by Microsoft Windows, which cannot free memory across
DLLs, unless multithreaded DLLs (<option>/MD</option> in VC6) are used. DLLs, unless multithreaded DLLs (<option>/MD</option> in VC6) are used.
On other platforms it is the same as <function>free()</>. On other platforms, this function is the same as the standard library function <function>free()</>.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
@ -2420,7 +2420,7 @@ while waiting for input from the database server. However, it is still
possible that the application will block waiting to send output to the possible that the application will block waiting to send output to the
server. This is relatively uncommon but can happen if very long SQL commands server. This is relatively uncommon but can happen if very long SQL commands
or data values are sent. (It is much more probable if the application or data values are sent. (It is much more probable if the application
sends data via COPY IN, however.) To prevent this possibility and achieve sends data via <command>COPY IN</command>, however.) To prevent this possibility and achieve
completely nonblocking database operation, the following additional completely nonblocking database operation, the following additional
functions may be used. functions may be used.
@ -2634,15 +2634,10 @@ After processing a <structname>PGnotify</structname> object returned by
<structname>PGnotify</structname> pointer; the <structname>PGnotify</structname> pointer; the
<structfield>relname</structfield> and <structfield>extra</structfield> fields <structfield>relname</structfield> and <structfield>extra</structfield> fields
do not represent separate allocations. do not represent separate allocations.
(At present, the <structfield>extra</structfield> field is unused and will
always point to an empty string.)
</para> </para>
<note>
<para>
At present the <structfield>extra</structfield> field is unused and will
always point to an empty string.
</para>
</note>
<note> <note>
<para> <para>
In <productname>PostgreSQL</productname> 6.4 and later, In <productname>PostgreSQL</productname> 6.4 and later,
@ -2657,28 +2652,28 @@ of asynchronous notification.
</para> </para>
<para> <para>
<function>PQnotifies()</function> does not actually read data from the server; it just <function>PQnotifies</function> does not actually read data from the server; it just
returns messages previously absorbed by another <application>libpq</application> returns messages previously absorbed by another <application>libpq</application>
function. In prior releases of <application>libpq</application>, the only way function. In prior releases of <application>libpq</application>, the only way
to ensure timely receipt of <command>NOTIFY</> messages was to constantly submit commands, to ensure timely receipt of <command>NOTIFY</> messages was to constantly submit commands,
even empty ones, and then check <function>PQnotifies()</function> after each even empty ones, and then check <function>PQnotifies</function> after each
<function>PQexec()</function>. While this still works, it is <function>PQexec</function>. While this still works, it is
deprecated as a waste of processing power. deprecated as a waste of processing power.
</para> </para>
<para> <para>
A better way to check for <command>NOTIFY</> A better way to check for <command>NOTIFY</>
messages when you have no useful commands to execute is to call messages when you have no useful commands to execute is to call
<function>PQconsumeInput()</function>, then check <function>PQconsumeInput</function>, then check
<function>PQnotifies()</function>. <function>PQnotifies</function>.
You can use <function>select()</function> to wait for data to You can use <function>select()</function> to wait for data to
arrive from the server, thereby using no <acronym>CPU</acronym> power unless there is something arrive from the server, thereby using no <acronym>CPU</acronym> power unless there is something
to do. (See <function>PQsocket()</function> to obtain the file descriptor to do. (See <function>PQsocket</function> to obtain the file descriptor
number to use with <function>select()</function>.) number to use with <function>select()</function>.)
Note that this will work OK whether you submit commands with Note that this will work OK whether you submit commands with
<function>PQsendQuery</function>/<function>PQgetResult</function> or simply <function>PQsendQuery</function>/<function>PQgetResult</function> or simply
use <function>PQexec</function>. You should, however, remember to use <function>PQexec</function>. You should, however, remember to
check <function>PQnotifies()</function> after each check <function>PQnotifies</function> after each
<function>PQgetResult</function> or <function>PQexec</function>, to see <function>PQgetResult</function> or <function>PQexec</function>, to see
if any notifications came in during the processing of the command. if any notifications came in during the processing of the command.
</para> </para>
@ -2813,7 +2808,7 @@ int PQputCopyData(PGconn *conn,
</para> </para>
<para> <para>
Transmits the COPY data in the specified <parameter>buffer</>, of length Transmits the <command>COPY</command> data in the specified <parameter>buffer</>, of length
<parameter>nbytes</>, to the server. The result is 1 if the data was sent, <parameter>nbytes</>, to the server. The result is 1 if the data was sent,
zero if it was not sent because the attempt would block (this case is only zero if it was not sent because the attempt would block (this case is only
possible if the connection is in nonblocking mode), or -1 if an error occurred. possible if the connection is in nonblocking mode), or -1 if an error occurred.
@ -2896,7 +2891,7 @@ int PQgetCopyData(PGconn *conn,
</para> </para>
<para> <para>
Attempts to obtain another row of data from the server during a COPY. Attempts to obtain another row of data from the server during a <command>COPY</command>.
Data is always returned one data row at a time; if only a partial row Data is always returned one data row at a time; if only a partial row
is available, it is not returned. Successful return of a data row is available, it is not returned. Successful return of a data row
involves allocating a chunk of memory to hold the data. The involves allocating a chunk of memory to hold the data. The
@ -2910,17 +2905,17 @@ buffer is returned. A non-<symbol>NULL</symbol> result buffer must be freed usi
When a row is successfully returned, the return value is the number of When a row is successfully returned, the return value is the number of
data bytes in the row (this will always be greater than zero). The data bytes in the row (this will always be greater than zero). The
returned string is always null-terminated, though this is probably only returned string is always null-terminated, though this is probably only
useful for textual COPY. A result of zero indicates that the COPY is useful for textual <command>COPY</command>. A result of zero indicates that the <command>COPY</command> is
still in progress, but no row is yet available (this is only possible still in progress, but no row is yet available (this is only possible
when <parameter>async</> is true). A when <parameter>async</> is true). A
result of -1 indicates that the COPY is done. result of -1 indicates that the <command>COPY</command> is done.
A result of -2 indicates that an error occurred (consult A result of -2 indicates that an error occurred (consult
<function>PQerrorMessage</> for the reason). <function>PQerrorMessage</> for the reason).
</para> </para>
<para> <para>
When <parameter>async</> is true (not zero), <function>PQgetCopyData</> When <parameter>async</> is true (not zero), <function>PQgetCopyData</>
will not block waiting for input; it will return zero if the COPY is still will not block waiting for input; it will return zero if the <command>COPY</command> is still
in progress but no complete row is available. (In this case wait for in progress but no complete row is available. (In this case wait for
read-ready before trying again; it does not matter whether you call read-ready before trying again; it does not matter whether you call
<function>PQconsumeInput</>.) When <parameter>async</> is <function>PQconsumeInput</>.) When <parameter>async</> is
@ -2992,7 +2987,7 @@ for a terminator line).
<term><function>PQgetlineAsync</function><indexterm><primary>PQgetlineAsync</></></term> <term><function>PQgetlineAsync</function><indexterm><primary>PQgetlineAsync</></></term>
<listitem> <listitem>
<para> <para>
Reads a row of COPY data Reads a row of <command>COPY</command> data
(transmitted by the server) into a buffer (transmitted by the server) into a buffer
without blocking. without blocking.
<synopsis> <synopsis>
@ -3031,7 +3026,7 @@ a whole row will be returned at one time. But if the buffer offered by
the caller is too small to hold a row sent by the server, then a partial the caller is too small to hold a row sent by the server, then a partial
data row will be returned. With textual data this can be detected by testing data row will be returned. With textual data this can be detected by testing
whether the last returned byte is <literal>\n</literal> or not. (In a binary whether the last returned byte is <literal>\n</literal> or not. (In a binary
COPY, actual parsing of the COPY data format will be needed to make the <command>COPY</>, actual parsing of the <command>COPY</> data format will be needed to make the
equivalent determination.) equivalent determination.)
The returned string is not null-terminated. (If you want to add a The returned string is not null-terminated. (If you want to add a
terminating null, be sure to pass a <parameter>bufsize</parameter> one smaller terminating null, be sure to pass a <parameter>bufsize</parameter> one smaller
@ -3065,7 +3060,7 @@ call; it is okay to send a partial line or multiple lines per call.
Before <productname>PostgreSQL</productname> protocol 3.0, it was necessary Before <productname>PostgreSQL</productname> protocol 3.0, it was necessary
for the application to explicitly send the two characters for the application to explicitly send the two characters
<literal>\.</literal> as a final line to indicate to the server that it had <literal>\.</literal> as a final line to indicate to the server that it had
finished sending COPY data. While this still works, it is deprecated and the finished sending <command>COPY</> data. While this still works, it is deprecated and the
special meaning of <literal>\.</literal> can be expected to be removed in a special meaning of <literal>\.</literal> can be expected to be removed in a
future release. It is sufficient to call <function>PQendcopy</function> after future release. It is sufficient to call <function>PQendcopy</function> after
having sent the actual data. having sent the actual data.
@ -3162,17 +3157,19 @@ Determines the verbosity of messages returned by
<function>PQerrorMessage</> and <function>PQresultErrorMessage</>. <function>PQerrorMessage</> and <function>PQresultErrorMessage</>.
<synopsis> <synopsis>
typedef enum { typedef enum {
PQERRORS_TERSE, PQERRORS_DEFAULT, PQERRORS_VERBOSE PQERRORS_TERSE,
PQERRORS_DEFAULT,
PQERRORS_VERBOSE
} PGVerbosity; } PGVerbosity;
PGVerbosity PQsetErrorVerbosity(PGconn *conn, PGVerbosity verbosity); PGVerbosity PQsetErrorVerbosity(PGconn *conn, PGVerbosity verbosity);
</synopsis> </synopsis>
<function>PQsetErrorVerbosity</> sets the verbosity mode, returning the <function>PQsetErrorVerbosity</> sets the verbosity mode, returning the
connection's previous setting. connection's previous setting.
In TERSE mode, returned messages include severity, primary text, and position In <firstterm>terse</> mode, returned messages include severity, primary text, and position
only; this will normally fit on a single line. The DEFAULT mode produces only; this will normally fit on a single line. The default mode produces
messages that include the above plus any detail, hint, or context fields messages that include the above plus any detail, hint, or context fields
(these may span multiple lines). The VERBOSE mode includes all available (these may span multiple lines). The <firstterm>VERBOSE</> mode includes all available
fields. Changing the verbosity does not affect the messages available from fields. Changing the verbosity does not affect the messages available from
already-existing <structname>PGresult</> objects, only subsequently-created already-existing <structname>PGresult</> objects, only subsequently-created
ones. ones.
@ -3568,7 +3565,7 @@ If the permissions are less strict than this, the file will be ignored.
</sect1> </sect1>
<sect1 id="libpq-threading"> <sect1 id="libpq-threading">
<title>Threading Behavior</title> <title>Behavior in Threaded Programs</title>
<indexterm zone="libpq-threading"> <indexterm zone="libpq-threading">
<primary>threads</primary> <primary>threads</primary>
@ -3576,11 +3573,14 @@ If the permissions are less strict than this, the file will be ignored.
</indexterm> </indexterm>
<para> <para>
<application>libpq</application> is thread-safe if the library is <application>libpq</application> is reentrant and thread-safe if the
compiled using <filename>configure</filename>'s <filename>configure</filename> command-line option
<literal>--enable-thread-safety</> command-line option. <literal>--enable-thread-safety</> has been used when the PostgreSQL
(In addition, you might need to use other threading command-line distribution was built.
options to compile your client code.) In addition, you might need to use additional compiler command-line
options when you compile your application code. Refer to your system's
documentation for information about how to build thread-enabled
applications.
</para> </para>
<para> <para>

View File

@ -1,5 +1,5 @@
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/lobj.sgml,v 1.31 2003/11/01 01:56:29 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/lobj.sgml,v 1.32 2003/11/12 22:47:47 petere Exp $
--> -->
<chapter id="largeObjects"> <chapter id="largeObjects">
@ -299,7 +299,7 @@ int lo_unlink(PGconn *conn, Oid lobjId);
</sect1> </sect1>
<sect1 id="lo-funcs"> <sect1 id="lo-funcs">
<title>Server-side Functions</title> <title>Server-Side Functions</title>
<para> <para>
There are two built-in server-side functions, There are two built-in server-side functions,

View File

@ -1,5 +1,5 @@
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/plpgsql.sgml,v 1.28 2003/11/01 01:56:29 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/plpgsql.sgml,v 1.29 2003/11/12 22:47:47 petere Exp $
--> -->
<chapter id="plpgsql"> <chapter id="plpgsql">
@ -195,7 +195,7 @@ END;
<para> <para>
<application>PL/pgSQL</> functions may also be declared to accept <application>PL/pgSQL</> functions may also be declared to accept
and return the <quote>polymorphic</> types and return the polymorphic types
<type>anyelement</type> and <type>anyarray</type>. The actual <type>anyelement</type> and <type>anyarray</type>. The actual
data types handled by a polymorphic function can vary from call to data types handled by a polymorphic function can vary from call to
call, as discussed in <xref linkend="extend-types-polymorphic">. call, as discussed in <xref linkend="extend-types-polymorphic">.
@ -255,7 +255,7 @@ end;
</para> </para>
<sect2 id="plpgsql-quote-tips"> <sect2 id="plpgsql-quote-tips">
<title>Handling of Quote Marks</title> <title>Handling of Quotation Marks</title>
<para> <para>
Since the code of a <application>PL/pgSQL</> function is specified in Since the code of a <application>PL/pgSQL</> function is specified in
@ -265,13 +265,13 @@ end;
rather complicated code at times, especially if you are writing a rather complicated code at times, especially if you are writing a
function that generates other functions, as in the example in <xref function that generates other functions, as in the example in <xref
linkend="plpgsql-statements-executing-dyn">. This chart may be useful linkend="plpgsql-statements-executing-dyn">. This chart may be useful
as a summary of the needed numbers of quote marks in as a summary of the needed numbers of quotation marks in
various situations. various situations.
</para> </para>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term>1 quote mark</term> <term>1 quotation mark</term>
<listitem> <listitem>
<para> <para>
To begin and end the function body, for example: To begin and end the function body, for example:
@ -279,14 +279,14 @@ end;
CREATE FUNCTION foo() RETURNS integer AS '...' CREATE FUNCTION foo() RETURNS integer AS '...'
LANGUAGE plpgsql; LANGUAGE plpgsql;
</programlisting> </programlisting>
Anywhere within the function body, quote marks <emphasis>must</> Anywhere within the function body, quotation marks <emphasis>must</>
appear in pairs. appear in pairs.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>2 quote marks</term> <term>2 quotation marks</term>
<listitem> <listitem>
<para> <para>
For string literals inside the function body, for example: For string literals inside the function body, for example:
@ -303,10 +303,10 @@ SELECT * FROM users WHERE f_name='foobar';
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>4 quote marks</term> <term>4 quotation marks</term>
<listitem> <listitem>
<para> <para>
When you need a single quote in a string constant inside the function When you need a single quotation mark in a string constant inside the function
body, for example: body, for example:
<programlisting> <programlisting>
a_output := a_output || '' AND name LIKE ''''foobar'''' AND xyz'' a_output := a_output || '' AND name LIKE ''''foobar'''' AND xyz''
@ -318,10 +318,10 @@ a_output := a_output || '' AND name LIKE ''''foobar'''' AND xyz''
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>6 quote marks</term> <term>6 quotation marks</term>
<listitem> <listitem>
<para> <para>
When a single quote in a string inside the function body is When a single quotation mark in a string inside the function body is
adjacent to the end of that string constant, for example: adjacent to the end of that string constant, for example:
<programlisting> <programlisting>
a_output := a_output || '' AND name LIKE ''''foobar'''''' a_output := a_output || '' AND name LIKE ''''foobar''''''
@ -333,11 +333,11 @@ a_output := a_output || '' AND name LIKE ''''foobar''''''
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>10 quote marks</term> <term>10 quotation marks</term>
<listitem> <listitem>
<para> <para>
When you want two single quotes in a string constant (which When you want two single quotation marks in a string constant (which
accounts for 8 quotes) and this is adjacent to the end of that accounts for 8 quotation marks) and this is adjacent to the end of that
string constant (2 more). You will probably only need that if string constant (2 more). You will probably only need that if
you are writing a function that generates other functions. For you are writing a function that generates other functions. For
example: example:
@ -358,7 +358,7 @@ if v_... like ''...'' then return ''...''; end if;
</variablelist> </variablelist>
<para> <para>
A different approach is to escape quote marks in the function body A different approach is to escape quotation marks in the function body
with a backslash rather than by doubling them. With this method with a backslash rather than by doubling them. With this method
you'll find yourself writing things like <literal>\'\'</> instead you'll find yourself writing things like <literal>\'\'</> instead
of <literal>''''</>. Some find this easier to keep track of, some of <literal>''''</>. Some find this easier to keep track of, some
@ -568,7 +568,7 @@ END;
linkend="extend-types-polymorphic">). linkend="extend-types-polymorphic">).
This allows the function to access its actual return type This allows the function to access its actual return type
as shown in <xref linkend="plpgsql-declaration-type">. as shown in <xref linkend="plpgsql-declaration-type">.
<literal>$0</literal> is initialized to NULL and can be modified by <literal>$0</literal> is initialized to null and can be modified by
the function, so it can be used to hold the return value if desired, the function, so it can be used to hold the return value if desired,
though that is not required. <literal>$0</literal> can also be though that is not required. <literal>$0</literal> can also be
given an alias. For example, this function works on any data type given an alias. For example, this function works on any data type
@ -692,11 +692,9 @@ END;
<sect2 id="plpgsql-declaration-records"> <sect2 id="plpgsql-declaration-records">
<title>Record Types</title> <title>Record Types</title>
<para>
<synopsis> <synopsis>
<replaceable>name</replaceable> RECORD; <replaceable>name</replaceable> RECORD;
</synopsis> </synopsis>
</para>
<para> <para>
Record variables are similar to row-type variables, but they have no Record variables are similar to row-type variables, but they have no
@ -724,14 +722,16 @@ END;
<sect2 id="plpgsql-declaration-renaming-vars"> <sect2 id="plpgsql-declaration-renaming-vars">
<title><literal>RENAME</></title> <title><literal>RENAME</></title>
<para>
<synopsis> <synopsis>
RENAME <replaceable>oldname</replaceable> TO <replaceable>newname</replaceable>; RENAME <replaceable>oldname</replaceable> TO <replaceable>newname</replaceable>;
</synopsis> </synopsis>
Using the RENAME declaration you can change the name of a variable, <para>
record or row. This is primarily useful if NEW or OLD should be Using the <literal>RENAME</literal> declaration you can change the
referenced by another name inside a trigger procedure. See also ALIAS. name of a variable, record or row. This is primarily useful if
<literal>NEW</literal> or <literal>OLD</literal> should be
referenced by another name inside a trigger procedure. See also
<literal>ALIAS</literal>.
</para> </para>
<para> <para>
@ -744,12 +744,12 @@ RENAME this_var TO that_var;
<note> <note>
<para> <para>
RENAME appears to be broken as of <productname>PostgreSQL</> <literal>RENAME</literal> appears to be broken as of
7.3. Fixing this is of low priority, since ALIAS covers most of <productname>PostgreSQL</> 7.3. Fixing this is of low priority,
the practical uses of RENAME. since <literal>ALIAS</literal> covers most of the practical uses
of <literal>RENAME</literal>.
</para> </para>
</note> </note>
</sect2> </sect2>
</sect1> </sect1>
@ -2000,7 +2000,7 @@ CLOSE curs1;
simply assign a string to the <type>refcursor</> variable before simply assign a string to the <type>refcursor</> variable before
opening it. The string value of the <type>refcursor</> variable opening it. The string value of the <type>refcursor</> variable
will be used by <command>OPEN</> as the name of the underlying portal. will be used by <command>OPEN</> as the name of the underlying portal.
However, if the <type>refcursor</> variable is NULL, However, if the <type>refcursor</> variable is null,
<command>OPEN</> automatically generates a name that does not <command>OPEN</> automatically generates a name that does not
conflict with any existing portal, and assigns it to the conflict with any existing portal, and assigns it to the
<type>refcursor</> variable. <type>refcursor</> variable.
@ -2012,7 +2012,7 @@ CLOSE curs1;
representing its name, so that the portal name is the same as representing its name, so that the portal name is the same as
the cursor variable name, unless the programmer overrides it the cursor variable name, unless the programmer overrides it
by assignment before opening the cursor. But an unbound cursor by assignment before opening the cursor. But an unbound cursor
variable defaults to an initial value of NULL, so it will receive variable defaults to the null value initially , so it will receive
an automatically-generated unique name, unless overridden. an automatically-generated unique name, unless overridden.
</para> </para>
</note> </note>

View File

@ -1,4 +1,4 @@
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/plpython.sgml,v 1.20 2003/09/12 22:17:23 tgl Exp $ --> <!-- $Header: /cvsroot/pgsql/doc/src/sgml/plpython.sgml,v 1.21 2003/11/12 22:47:47 petere Exp $ -->
<chapter id="plpython"> <chapter id="plpython">
<title>PL/Python - Python Procedural Language</title> <title>PL/Python - Python Procedural Language</title>
@ -17,18 +17,6 @@
<literal>createlang plpythonu <replaceable>dbname</></literal>. <literal>createlang plpythonu <replaceable>dbname</></literal>.
</para> </para>
<note>
<para>
As of <productname>PostgreSQL</productname> 7.4,
PL/Python is only available as an <quote>untrusted</> language
(meaning it does not offer any way of restricting what users
can do in it). It has therefore been renamed to <literal>plpythonu</>.
The trusted variant <literal>plpython</> may become available again in
future, if a new secure execution mechanism is developed by the Python
community.
</para>
</note>
<tip> <tip>
<para> <para>
If a language is installed into <literal>template1</>, all subsequently If a language is installed into <literal>template1</>, all subsequently
@ -36,6 +24,15 @@
</para> </para>
</tip> </tip>
<para>
As of <productname>PostgreSQL</productname> 7.4, PL/Python is only
available as an <quote>untrusted</> language (meaning it does not
offer any way of restricting what users can do in it). It has
therefore been renamed to <literal>plpythonu</>. The trusted
variant <literal>plpython</> may become available again in future,
if a new secure execution mechanism is developed in Python.
</para>
<note> <note>
<para> <para>
Users of source packages must specially enable the build of Users of source packages must specially enable the build of

View File

@ -1,5 +1,5 @@
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/pltcl.sgml,v 2.26 2003/09/08 23:02:28 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/pltcl.sgml,v 2.27 2003/11/12 22:47:47 petere Exp $
--> -->
<chapter id="pltcl"> <chapter id="pltcl">
@ -136,7 +136,7 @@ CREATE FUNCTION tcl_max(integer, integer) RETURNS integer AS '
<para> <para>
As shown above, As shown above,
to return a NULL value from a PL/Tcl function, execute to return a null value from a PL/Tcl function, execute
<literal>return_null</literal>. This can be done whether the <literal>return_null</literal>. This can be done whether the
function is strict or not. function is strict or not.
</para> </para>

View File

@ -1,5 +1,5 @@
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_function.sgml,v 1.53 2003/10/26 04:34:05 momjian Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/create_function.sgml,v 1.54 2003/11/12 22:47:47 petere Exp $
--> -->
<refentry id="SQL-CREATEFUNCTION"> <refentry id="SQL-CREATEFUNCTION">
@ -95,7 +95,7 @@ CREATE [ OR REPLACE ] FUNCTION <replaceable class="parameter">name</replaceable>
<para> <para>
The data type(s) of the function's arguments (optionally The data type(s) of the function's arguments (optionally
schema-qualified), if any. The argument types may be base, complex, or schema-qualified), if any. The argument types may be base, complex, or
domain types, or copy the type of an existing column. domains, or copy the type of an existing column.
</para> </para>
<para> <para>
The type of a column is referenced by writing The type of a column is referenced by writing
@ -120,8 +120,8 @@ CREATE [ OR REPLACE ] FUNCTION <replaceable class="parameter">name</replaceable>
<listitem> <listitem>
<para> <para>
The return data type (optionally schema-qualified). The return type The return data type (optionally schema-qualified). The return type
may be specified as a base, complex, or domain type, may be a base type, complex type, or a domain,
or may copy the type of an existing column. See the description or may be specified to copy the type of an existing column. See the description
under <literal>argtype</literal> above on how to reference the type under <literal>argtype</literal> above on how to reference the type
of an existing column. of an existing column.
</para> </para>

View File

@ -1,5 +1,5 @@
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/release.sgml,v 1.237 2003/11/10 22:27:00 momjian Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/release.sgml,v 1.238 2003/11/12 22:47:47 petere Exp $
--> -->
<appendix id="release"> <appendix id="release">
@ -878,12 +878,12 @@ zero-row record variable (Tom)</para></listitem>
<itemizedlist> <itemizedlist>
<listitem><para>Allow PQcmdTuples() to return row counts for MOVE and FETCH (Neil)</para></listitem> <listitem><para>Allow PQcmdTuples() to return row counts for MOVE and FETCH (Neil)</para></listitem>
<listitem><para>Add PQfreemem() for freeing memory on Win32, suggest for NOTIFY (Bruce)</para> <listitem><para>Add PQfreemem() for freeing memory on Windows, suggest for NOTIFY (Bruce)</para>
<para> <para>
Win32 requires that memory allocated in a library be freed by a Windows requires that memory allocated in a library be freed by a
function in the same library, hence free() doesn't work for freeing function in the same library, hence free() doesn't work for freeing
memory allocated by libpq. PQfreemem() is the proper way to free memory allocated by libpq. PQfreemem() is the proper way to free
libpq memory, especially on Win32, and is recommended for other libpq memory, especially on Windows, and is recommended for other
platforms as well. platforms as well.
</para> </para>
</listitem> </listitem>
@ -961,8 +961,8 @@ zero-row record variable (Tom)</para></listitem>
<listitem><para>Convert administration scripts to C (Peter)</para></listitem> <listitem><para>Convert administration scripts to C (Peter)</para></listitem>
<listitem><para>Bison >= 1.85 is now required to build the PostgreSQL grammar, if building from CVS</para></listitem> <listitem><para>Bison >= 1.85 is now required to build the PostgreSQL grammar, if building from CVS</para></listitem>
<listitem><para>Merge documentation into one book (Peter)</para></listitem> <listitem><para>Merge documentation into one book (Peter)</para></listitem>
<listitem><para>Add Win32 compatibility functions (Bruce)</para></listitem> <listitem><para>Add Windows compatibility functions (Bruce)</para></listitem>
<listitem><para>Allow client interfaces to compile under MinGW/Win32 (Bruce)</para></listitem> <listitem><para>Allow client interfaces to compile under MinGW (Bruce)</para></listitem>
<listitem><para>New ereport() function for error reporting (Tom)</para></listitem> <listitem><para>New ereport() function for error reporting (Tom)</para></listitem>
<listitem><para>Support Intel Linux compiler (Peter)</para></listitem> <listitem><para>Support Intel Linux compiler (Peter)</para></listitem>
<listitem><para>Improve Linux startup scripts (Slawomir Sudnik, Darko Prenosil)</para></listitem> <listitem><para>Improve Linux startup scripts (Slawomir Sudnik, Darko Prenosil)</para></listitem>
@ -1794,7 +1794,7 @@ of locale?</para></listitem>
<listitem><para>Fix for sending large queries over non-blocking connections (Bernhard Herzog)</para></listitem> <listitem><para>Fix for sending large queries over non-blocking connections (Bernhard Herzog)</para></listitem>
<listitem><para>Fix for libpq using timers on Win9X (David Ford)</para></listitem> <listitem><para>Fix for libpq using timers on Win9X (David Ford)</para></listitem>
<listitem><para>Allow libpq notify to handle servers with different-length identifiers (Tom)</para></listitem> <listitem><para>Allow libpq notify to handle servers with different-length identifiers (Tom)</para></listitem>
<listitem><para>Add libpq PQescapeString() and PQescapeBytea() to Win32 (Bruce)</para></listitem> <listitem><para>Add libpq PQescapeString() and PQescapeBytea() to Windows (Bruce)</para></listitem>
<listitem><para>Fix for SSL with non-blocking connections (Jack Bates)</para></listitem> <listitem><para>Fix for SSL with non-blocking connections (Jack Bates)</para></listitem>
<listitem><para>Add libpq connection timeout parameter (Denis A Ustimenko)</para></listitem> <listitem><para>Add libpq connection timeout parameter (Denis A Ustimenko)</para></listitem>
</itemizedlist> </itemizedlist>
@ -1846,7 +1846,7 @@ of locale?</para></listitem>
<listitem><para>Always enable multibyte in compile, remove --enable-multibyte option (Tatsuo)</para></listitem> <listitem><para>Always enable multibyte in compile, remove --enable-multibyte option (Tatsuo)</para></listitem>
<listitem><para>Always enable locale in compile, remove --enable-locale option (Peter)</para></listitem> <listitem><para>Always enable locale in compile, remove --enable-locale option (Peter)</para></listitem>
<listitem><para>Fix for Win9x DLL creation (Magnus Naeslund)</para></listitem> <listitem><para>Fix for Win9x DLL creation (Magnus Naeslund)</para></listitem>
<listitem><para>Fix for link() usage by WAL code on Win32, BeOS (Jason Tishler)</para></listitem> <listitem><para>Fix for link() usage by WAL code on Windows, BeOS (Jason Tishler)</para></listitem>
<listitem><para>Add sys/types.h to c.h, remove from main files (Peter, Bruce)</para></listitem> <listitem><para>Add sys/types.h to c.h, remove from main files (Peter, Bruce)</para></listitem>
<listitem><para>Fix AIX hang on SMP machines (Tomoyuki Niijima)</para></listitem> <listitem><para>Fix AIX hang on SMP machines (Tomoyuki Niijima)</para></listitem>
<listitem><para>AIX SMP hang fix (Tomoyuki Niijima)</para></listitem> <listitem><para>AIX SMP hang fix (Tomoyuki Niijima)</para></listitem>
@ -1871,7 +1871,7 @@ of locale?</para></listitem>
<listitem><para>New Polish FAQ (Marcin Mazurek)</para></listitem> <listitem><para>New Polish FAQ (Marcin Mazurek)</para></listitem>
<listitem><para>Add Posix semaphore support (Tom)</para></listitem> <listitem><para>Add Posix semaphore support (Tom)</para></listitem>
<listitem><para>Document need for reindex (Bruce)</para></listitem> <listitem><para>Document need for reindex (Bruce)</para></listitem>
<listitem><para>Rename some internal identifiers to simplify Win32 compile (Jan, Katherine Ward)</para></listitem> <listitem><para>Rename some internal identifiers to simplify Windows compile (Jan, Katherine Ward)</para></listitem>
<listitem><para>Add documentation on computing disk space (Bruce)</para></listitem> <listitem><para>Add documentation on computing disk space (Bruce)</para></listitem>
<listitem><para>Remove KSQO from GUC (Bruce)</para></listitem> <listitem><para>Remove KSQO from GUC (Bruce)</para></listitem>
<listitem><para>Fix memory leak in rtree (Kenneth Been)</para></listitem> <listitem><para>Fix memory leak in rtree (Kenneth Been)</para></listitem>
@ -2588,8 +2588,8 @@ of locale?</para></listitem>
<itemizedlist> <itemizedlist>
<listitem><para>Configure, dynamic loader, and shared library fixes (Peter E)</para></listitem> <listitem><para>Configure, dynamic loader, and shared library fixes (Peter E)</para></listitem>
<listitem><para>Fixes in QNX 4 port (Bernd Tegge)</para></listitem> <listitem><para>Fixes in QNX 4 port (Bernd Tegge)</para></listitem>
<listitem><para>Fixes in Cygwin and Win32 ports (Jason Tishler, Gerhard Haring, Dmitry Yurtaev, Darko Prenosil, Mikhail Terekhov)</para></listitem> <listitem><para>Fixes in Cygwin and Windows ports (Jason Tishler, Gerhard Haring, Dmitry Yurtaev, Darko Prenosil, Mikhail Terekhov)</para></listitem>
<listitem><para>Fix for Win32 socket communication failures (Magnus, Mikhail Terekhov)</para></listitem> <listitem><para>Fix for Windows socket communication failures (Magnus, Mikhail Terekhov)</para></listitem>
<listitem><para>Hurd compile fix (Oliver Elphick)</para></listitem> <listitem><para>Hurd compile fix (Oliver Elphick)</para></listitem>
<listitem><para>BeOS fixes (Cyril Velter)</para></listitem> <listitem><para>BeOS fixes (Cyril Velter)</para></listitem>
<listitem><para>Remove configure --enable-unicode-conversion, now enabled by multibyte (Tatsuo)</para></listitem> <listitem><para>Remove configure --enable-unicode-conversion, now enabled by multibyte (Tatsuo)</para></listitem>
@ -3675,7 +3675,7 @@ Clean up #include in /include directory (Bruce)
Add scripts for checking includes (Bruce) Add scripts for checking includes (Bruce)
Remove un-needed #include's from *.c files (Bruce) Remove un-needed #include's from *.c files (Bruce)
Change #include's to use &lt;&gt; and "" as appropriate (Bruce) Change #include's to use &lt;&gt; and "" as appropriate (Bruce)
Enable WIN32 compilation of libpq Enable Windows compilation of libpq
Alpha spinlock fix from Uncle George <email>gatgul@voicenet.com</email> Alpha spinlock fix from Uncle George <email>gatgul@voicenet.com</email>
Overhaul of optimizer data structures (Tom) Overhaul of optimizer data structures (Tom)
Fix to cygipc library (Yutaka Tanida) Fix to cygipc library (Yutaka Tanida)
@ -3688,7 +3688,7 @@ New platform-specific regression handling (Tom)
Rename oid8 -&gt; oidvector and int28 -&gt; int2vector (Bruce) Rename oid8 -&gt; oidvector and int28 -&gt; int2vector (Bruce)
Included all yacc and lex files into the distribution (Peter E.) Included all yacc and lex files into the distribution (Peter E.)
Remove lextest, no longer needed (Peter E) Remove lextest, no longer needed (Peter E)
Fix for libpq and psql on Win32 (Magnus) Fix for libpq and psql on Windows (Magnus)
Internally change datetime and timespan into timestamp and interval (Thomas) Internally change datetime and timespan into timestamp and interval (Thomas)
Fix for plpgsql on BSD/OS Fix for plpgsql on BSD/OS
Add SQL_ASCII test case to the regression test (Tatsuo) Add SQL_ASCII test case to the regression test (Tatsuo)
@ -3772,7 +3772,7 @@ Fixes for CASE in WHERE join clauses(Tom)
Fix BTScan abort(Tom) Fix BTScan abort(Tom)
Repair the check for redundant UNIQUE and PRIMARY KEY indexes(Thomas) Repair the check for redundant UNIQUE and PRIMARY KEY indexes(Thomas)
Improve it so that it checks for multicolumn constraints(Thomas) Improve it so that it checks for multicolumn constraints(Thomas)
Fix for Win32 making problem with MB enabled(Hiroki Kataoka) Fix for Windows making problem with MB enabled(Hiroki Kataoka)
Allow BSD yacc and bison to compile pl code(Bruce) Allow BSD yacc and bison to compile pl code(Bruce)
Fix SET NAMES working Fix SET NAMES working
int8 fixes(Thomas) int8 fixes(Thomas)
@ -4230,7 +4230,7 @@ Source Tree Changes
------------------- -------------------
Improve port matching(Tom) Improve port matching(Tom)
Portability fixes for SunOS Portability fixes for SunOS
Add NT/Win32 backend port and enable dynamic loading(Magnus and Daniel Horak) Add Windows NT backend port and enable dynamic loading(Magnus and Daniel Horak)
New port to Cobalt Qube(Mips) running Linux(Tatsuo) New port to Cobalt Qube(Mips) running Linux(Tatsuo)
Port to NetBSD/m68k(Mr. Mutsuki Nakajima) Port to NetBSD/m68k(Mr. Mutsuki Nakajima)
Port to NetBSD/sun3(Mr. Mutsuki Nakajima) Port to NetBSD/sun3(Mr. Mutsuki Nakajima)
@ -4338,7 +4338,7 @@ Timezone fixes(Tom)
HP-UX fixes(Tom) HP-UX fixes(Tom)
Use implicit type coercion for matching DEFAULT values(Thomas) Use implicit type coercion for matching DEFAULT values(Thomas)
Add routines to help with single-byte (internal) character type(Thomas) Add routines to help with single-byte (internal) character type(Thomas)
Compilation of libpq for Win32 fixes(Magnus) Compilation of libpq for Windows fixes(Magnus)
Upgrade to PyGreSQL 2.2(D'Arcy) Upgrade to PyGreSQL 2.2(D'Arcy)
</programlisting> </programlisting>
</para> </para>
@ -4523,7 +4523,7 @@ New contrib/lo code for large object orphan removal(Peter)
New psql command "SET CLIENT_ENCODING TO 'encoding'" for multibytes New psql command "SET CLIENT_ENCODING TO 'encoding'" for multibytes
feature, see /doc/README.mb(Tatsuo) feature, see /doc/README.mb(Tatsuo)
/contrib/noupdate code to revoke update permission on a column /contrib/noupdate code to revoke update permission on a column
libpq can now be compiled on win32(Magnus) libpq can now be compiled on Windows(Magnus)
Add PQsetdbLogin() in libpq Add PQsetdbLogin() in libpq
New 8-byte integer type, checked by configure for OS support(Thomas) New 8-byte integer type, checked by configure for OS support(Thomas)
Better support for quoted table/column names(Thomas) Better support for quoted table/column names(Thomas)
@ -4586,7 +4586,7 @@ New setval() command to set sequence value(Massimo)
Auto-remove unix socket file on start-up if no postmaster running(Massimo) Auto-remove unix socket file on start-up if no postmaster running(Massimo)
Conditional trace package(Massimo) Conditional trace package(Massimo)
New UNLISTEN command(Massimo) New UNLISTEN command(Massimo)
psql and libpq now compile under win32 using win32.mak(Magnus) psql and libpq now compile under Windows using win32.mak(Magnus)
Lo_read no longer stores trailing NULL(Bruce) Lo_read no longer stores trailing NULL(Bruce)
Identifiers are now truncated to 31 characters internally(Bruce) Identifiers are now truncated to 31 characters internally(Bruce)
Createuser options now availble on the command line Createuser options now availble on the command line
@ -5551,7 +5551,7 @@ new OS-specific template files(Marc)
no more need to edit Makefile.global(Marc) no more need to edit Makefile.global(Marc)
re-arrange include files(Marc) re-arrange include files(Marc)
nextstep patches (Gregor Hoffleit) nextstep patches (Gregor Hoffleit)
removed WIN32-specific code(Bruce) removed Windows-specific code(Bruce)
removed postmaster -e option, now only postgres -e option (Bruce) removed postmaster -e option, now only postgres -e option (Bruce)
merge duplicate library code in front/backends(Martin) merge duplicate library code in front/backends(Martin)
now works with eBones, international Kerberos(Jun) now works with eBones, international Kerberos(Jun)

View File

@ -1,5 +1,5 @@
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/typeconv.sgml,v 1.37 2003/11/04 09:55:39 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/typeconv.sgml,v 1.38 2003/11/12 22:47:47 petere Exp $
--> -->
<chapter Id="typeconv"> <chapter Id="typeconv">
@ -289,7 +289,7 @@ candidate remains, use it; else continue to the next step.
<step performance="required"> <step performance="required">
<para> <para>
Run through all candidates and keep those with the most exact matches Run through all candidates and keep those with the most exact matches
on input types. (Domain types are considered the same as their base type on input types. (Domains are considered the same as their base type
for this purpose.) Keep all candidates if none have any exact matches. for this purpose.) Keep all candidates if none have any exact matches.
If only one candidate remains, use it; else continue to the next step. If only one candidate remains, use it; else continue to the next step.
</para> </para>
@ -542,7 +542,7 @@ candidate remains, use it; else continue to the next step.
<step performance="required"> <step performance="required">
<para> <para>
Run through all candidates and keep those with the most exact matches Run through all candidates and keep those with the most exact matches
on input types. (Domain types are considered the same as their base type on input types. (Domains are considered the same as their base type
for this purpose.) Keep all candidates if none have any exact matches. for this purpose.) Keep all candidates if none have any exact matches.
If only one candidate remains, use it; else continue to the next step. If only one candidate remains, use it; else continue to the next step.
</para> </para>

View File

@ -1,5 +1,5 @@
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/xaggr.sgml,v 1.22 2003/08/31 17:32:20 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/xaggr.sgml,v 1.23 2003/11/12 22:47:47 petere Exp $
--> -->
<sect1 id="xaggr"> <sect1 id="xaggr">
@ -140,16 +140,20 @@ CREATE AGGREGATE array_accum (
<programlisting> <programlisting>
SELECT attrelid::regclass, array_accum(attname) SELECT attrelid::regclass, array_accum(attname)
FROM pg_attribute WHERE attnum > 0 FROM pg_attribute
AND attrelid = 'pg_user'::regclass GROUP BY attrelid; WHERE attnum > 0 AND attrelid = 'pg_user'::regclass
GROUP BY attrelid;
attrelid | array_accum attrelid | array_accum
----------+----------------------------------------------------------------------------- ----------+-----------------------------------------------------------------------------
pg_user | {usename,usesysid,usecreatedb,usesuper,usecatupd,passwd,valuntil,useconfig} pg_user | {usename,usesysid,usecreatedb,usesuper,usecatupd,passwd,valuntil,useconfig}
(1 row) (1 row)
SELECT attrelid::regclass, array_accum(atttypid) SELECT attrelid::regclass, array_accum(atttypid)
FROM pg_attribute WHERE attnum > 0 FROM pg_attribute
AND attrelid = 'pg_user'::regclass GROUP BY attrelid; WHERE attnum > 0 AND attrelid = 'pg_user'::regclass
GROUP BY attrelid;
attrelid | array_accum attrelid | array_accum
----------+------------------------------ ----------+------------------------------
pg_user | {19,23,16,16,16,25,702,1009} pg_user | {19,23,16,16,16,25,702,1009}

View File

@ -1,5 +1,5 @@
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/xfunc.sgml,v 1.77 2003/11/01 01:56:29 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/xfunc.sgml,v 1.78 2003/11/12 22:47:47 petere Exp $
--> -->
<sect1 id="xfunc"> <sect1 id="xfunc">
@ -392,9 +392,9 @@ SELECT name(emp) AS youngster
result of the first function to it: result of the first function to it:
<screen> <screen>
CREATE FUNCTION getname(emp) RETURNS text AS CREATE FUNCTION getname(emp) RETURNS text AS '
'SELECT $1.name;' SELECT $1.name;
LANGUAGE SQL; ' LANGUAGE SQL;
SELECT getname(new_emp()); SELECT getname(new_emp());
getname getname
@ -538,12 +538,12 @@ SELECT name, listchildren(name) FROM nodes;
<para> <para>
<acronym>SQL</acronym> functions may be declared to accept and <acronym>SQL</acronym> functions may be declared to accept and
return the <quote>polymorphic</> types return the polymorphic types <type>anyelement</type> and
<type>anyelement</type> and <type>anyarray</type>. <type>anyarray</type>. See <xref
See <xref linkend="extend-types-polymorphic"> for a more detailed explanation linkend="extend-types-polymorphic"> for a more detailed
of polymorphic functions. Here is a polymorphic function explanation of polymorphic functions. Here is a polymorphic
<function>make_array</function> that builds up an array from two function <function>make_array</function> that builds up an array
arbitrary data type elements: from two arbitrary data type elements:
<screen> <screen>
CREATE FUNCTION make_array(anyelement, anyelement) RETURNS anyarray AS ' CREATE FUNCTION make_array(anyelement, anyelement) RETURNS anyarray AS '
SELECT ARRAY[$1, $2]; SELECT ARRAY[$1, $2];
@ -567,7 +567,7 @@ SELECT make_array(1, 2) AS intarray, make_array('a'::text, 'b') AS textarray;
Without the typecast, you will get errors like this: Without the typecast, you will get errors like this:
<screen> <screen>
<computeroutput> <computeroutput>
ERROR: could not determine ANYARRAY/ANYELEMENT type because input is UNKNOWN ERROR: could not determine "anyarray"/"anyelement" type because input has type "unknown"
</computeroutput> </computeroutput>
</screen> </screen>
</para> </para>
@ -576,7 +576,7 @@ ERROR: could not determine ANYARRAY/ANYELEMENT type because input is UNKNOWN
It is permitted to have polymorphic arguments with a deterministic It is permitted to have polymorphic arguments with a deterministic
return type, but the converse is not. For example: return type, but the converse is not. For example:
<screen> <screen>
CREATE FUNCTION is_greater(anyelement, anyelement) RETURNS bool AS ' CREATE FUNCTION is_greater(anyelement, anyelement) RETURNS boolean AS '
SELECT $1 > $2; SELECT $1 > $2;
' LANGUAGE SQL; ' LANGUAGE SQL;
@ -589,8 +589,8 @@ SELECT is_greater(1, 2);
CREATE FUNCTION invalid_func() RETURNS anyelement AS ' CREATE FUNCTION invalid_func() RETURNS anyelement AS '
SELECT 1; SELECT 1;
' LANGUAGE SQL; ' LANGUAGE SQL;
ERROR: cannot determine result datatype ERROR: cannot determine result data type
DETAIL: A function returning ANYARRAY or ANYELEMENT must have at least one argument of either type. DETAIL: A function returning "anyarray" or "anyelement" must have at least one argument of either type.
</screen> </screen>
</para> </para>
</sect2> </sect2>
@ -758,15 +758,13 @@ CREATE FUNCTION square_root(double precision) RETURNS double precision
that fails as well, the load will fail. that fails as well, the load will fail.
</para> </para>
<note>
<para> <para>
The user ID the <productname>PostgreSQL</productname> server runs The user ID the <productname>PostgreSQL</productname> server runs
as must be able to traverse the path to the file you intend to as must be able to traverse the path to the file you intend to
load. Making the file or a higher-level directory not readable load. Making the file or a higher-level directory not readable
and/or not executable by the <systemitem>postgres</systemitem> user is a and/or not executable by the <systemitem>postgres</systemitem>
common mistake. user is a common mistake.
</para> </para>
</note>
<para> <para>
In any case, the file name that is given in the In any case, the file name that is given in the
@ -785,16 +783,14 @@ CREATE FUNCTION square_root(double precision) RETURNS double precision
</para> </para>
</note> </note>
<note>
<para> <para>
After it is used for the first time, a dynamically loaded object After it is used for the first time, a dynamically loaded object
file is retained in memory. Future calls in the same session to the file is retained in memory. Future calls in the same session to
function(s) in that file will only incur the small overhead of a symbol the function(s) in that file will only incur the small overhead of
table lookup. If you need to force a reload of an object file, for a symbol table lookup. If you need to force a reload of an object
example after recompiling it, use the <command>LOAD</> command or file, for example after recompiling it, use the <command>LOAD</>
begin a fresh session. command or begin a fresh session.
</para> </para>
</note>
<para> <para>
It is recommended to locate shared libraries either relative to It is recommended to locate shared libraries either relative to
@ -805,17 +801,15 @@ CREATE FUNCTION square_root(double precision) RETURNS double precision
command <literal>pg_config --pkglibdir</literal>. command <literal>pg_config --pkglibdir</literal>.
</para> </para>
<note>
<para> <para>
Before <productname>PostgreSQL</productname> release 7.2, only exact Before <productname>PostgreSQL</productname> release 7.2, only
absolute paths to object files could be specified in <command>CREATE exact absolute paths to object files could be specified in
FUNCTION</>. This approach is now deprecated since it makes the <command>CREATE FUNCTION</>. This approach is now deprecated
function definition unnecessarily unportable. It's best to specify since it makes the function definition unnecessarily unportable.
just the shared library name with no path nor extension, and let It's best to specify just the shared library name with no path nor
the search mechanism provide that information instead. extension, and let the search mechanism provide that information
instead.
</para> </para>
</note>
</sect2> </sect2>
<sect2 id="xfunc-c-basetype"> <sect2 id="xfunc-c-basetype">
@ -1685,8 +1679,7 @@ c_overpaid(PG_FUNCTION_ARGS)
<function>c_overpaid</function> in SQL: <function>c_overpaid</function> in SQL:
<programlisting> <programlisting>
CREATE FUNCTION c_overpaid(emp, integer) CREATE FUNCTION c_overpaid(emp, integer) RETURNS boolean
RETURNS boolean
AS '<replaceable>DIRECTORY</replaceable>/funcs', 'c_overpaid' AS '<replaceable>DIRECTORY</replaceable>/funcs', 'c_overpaid'
LANGUAGE C; LANGUAGE C;
</programlisting> </programlisting>
@ -2111,7 +2104,7 @@ CREATE OR REPLACE FUNCTION testpassbyval(integer, integer) RETURNS SETOF __testp
<para> <para>
C-language functions may be declared to accept and C-language functions may be declared to accept and
return the <quote>polymorphic</> types return the polymorphic types
<type>anyelement</type> and <type>anyarray</type>. <type>anyelement</type> and <type>anyarray</type>.
See <xref linkend="extend-types-polymorphic"> for a more detailed explanation See <xref linkend="extend-types-polymorphic"> for a more detailed explanation
of polymorphic functions. When function arguments or return types of polymorphic functions. When function arguments or return types
@ -2178,14 +2171,13 @@ make_array(PG_FUNCTION_ARGS)
<function>make_array</function> in SQL: <function>make_array</function> in SQL:
<programlisting> <programlisting>
CREATE FUNCTION make_array(anyelement) CREATE FUNCTION make_array(anyelement) RETURNS anyarray
RETURNS anyarray
AS '<replaceable>DIRECTORY</replaceable>/funcs', 'make_array' AS '<replaceable>DIRECTORY</replaceable>/funcs', 'make_array'
LANGUAGE 'C' STRICT; LANGUAGE C STRICT;
</programlisting> </programlisting>
Note the use of STRICT; this is essential since the code is not Note the use of <literal>STRICT</literal>; this is essential
bothering to test for a NULL input. since the code is not bothering to test for a null input.
</para> </para>
</sect2> </sect2>
</sect1> </sect1>