Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit b5adf46

Browse files
committed
Some more small improvements in response to 7.4 interactive docs comments.
1 parent b19011e commit b5adf46

12 files changed

+209
-78
lines changed

doc/src/sgml/ecpg.sgml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/ecpg.sgml,v 1.61 2005/01/07 05:43:28 momjian Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/ecpg.sgml,v 1.62 2005/01/08 22:13:25 tgl Exp $
33
-->
44

55
<chapter id="ecpg">
@@ -1106,7 +1106,8 @@ struct
11061106
the error message that is stored in
11071107
<literal>sqlca.sqlerrm.sqlerrmc</literal> (the result of
11081108
<function>strlen()</function>, not really interesting for a C
1109-
programmer).
1109+
programmer). Note that some messages are too long to fit in the
1110+
fixed-size <literal>sqlerrmc</literal> array; they will be truncated.
11101111
</para>
11111112

11121113
<para>

doc/src/sgml/gist.sgml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/gist.sgml,v 1.14 2003/11/29 19:51:37 pgsql Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/gist.sgml,v 1.15 2005/01/08 22:13:25 tgl Exp $
33
-->
44

5-
<chapter Id="GiST">
5+
<chapter id="GiST">
66
<title>GiST Indexes</title>
77

88
<sect1 id="intro">
99
<title>Introduction</title>
1010

1111
<para>
12+
<indexterm>
13+
<primary>index</primary>
14+
<secondary>GiST</secondary>
15+
</indexterm>
16+
<indexterm>
17+
<primary>GiST</primary>
18+
<see>index</see>
19+
</indexterm>
1220
<acronym>GiST</acronym> stands for Generalized Search Tree. It is a
1321
balanced, tree-structured access method, that acts as a base template in
1422
which to implement arbitrary indexing schemes. B+-trees, R-trees and many

doc/src/sgml/indices.sgml

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/indices.sgml,v 1.48 2004/12/23 23:07:38 tgl Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/indices.sgml,v 1.49 2005/01/08 22:13:25 tgl Exp $ -->
22

33
<chapter id="indexes">
44
<title id="indexes-title">Indexes</title>
@@ -106,8 +106,13 @@ CREATE INDEX test1_id_index ON test1 (id);
106106

107107
<para>
108108
<productname>PostgreSQL</productname> provides several index types:
109-
B-tree, R-tree, GiST, and Hash. Each index type uses a different
109+
B-tree, R-tree, Hash, and GiST. Each index type uses a different
110110
algorithm that is best suited to different types of queries.
111+
By default, the <command>CREATE INDEX</command> command will create a
112+
B-tree index, which fits the most common situations.
113+
</para>
114+
115+
<para>
111116
<indexterm>
112117
<primary>index</primary>
113118
<secondary>B-tree</secondary>
@@ -116,21 +121,24 @@ CREATE INDEX test1_id_index ON test1 (id);
116121
<primary>B-tree</primary>
117122
<see>index</see>
118123
</indexterm>
119-
By default, the <command>CREATE INDEX</command> command will create a
120-
B-tree index, which fits the most common situations. B-trees can
121-
handle equality and range queries on data that can be sorted into
122-
some ordering. In
123-
particular, the <productname>PostgreSQL</productname> query planner
124+
B-trees can handle equality and range queries on data that can be sorted
125+
into some ordering.
126+
In particular, the <productname>PostgreSQL</productname> query planner
124127
will consider using a B-tree index whenever an indexed column is
125128
involved in a comparison using one of these operators:
126129

127-
<simplelist type="inline">
130+
<simplelist>
128131
<member><literal>&lt;</literal></member>
129132
<member><literal>&lt;=</literal></member>
130133
<member><literal>=</literal></member>
131134
<member><literal>&gt;=</literal></member>
132135
<member><literal>&gt;</literal></member>
133136
</simplelist>
137+
138+
Constructs equivalent to combinations of these operators, such as
139+
<literal>BETWEEN</> and <literal>IN</>, can also be implemented with
140+
a B-tree index search. (But note that <literal>IS NULL</> is not
141+
equivalent to <literal>=</> and is not indexable.)
134142
</para>
135143

136144
<para>
@@ -142,8 +150,8 @@ CREATE INDEX test1_id_index ON test1 (id);
142150
'foo%'</literal> or <literal>col ~ '^foo'</literal>, but not
143151
<literal>col LIKE '%bar'</literal>. However, if your server does
144152
not use the C locale you will need to create the index with a
145-
special operator class. See <xref linkend="indexes-opclass">
146-
below.
153+
special operator class to support indexing of pattern-matching queries.
154+
See <xref linkend="indexes-opclass"> below.
147155
</para>
148156

149157
<para>
@@ -164,7 +172,7 @@ CREATE INDEX <replaceable>name</replaceable> ON <replaceable>table</replaceable>
164172
consider using an R-tree index whenever an indexed column is
165173
involved in a comparison using one of these operators:
166174

167-
<simplelist type="inline">
175+
<simplelist>
168176
<member><literal>&lt;&lt;</literal></member>
169177
<member><literal>&amp;&lt;</literal></member>
170178
<member><literal>&amp;&gt;</literal></member>
@@ -173,7 +181,8 @@ CREATE INDEX <replaceable>name</replaceable> ON <replaceable>table</replaceable>
173181
<member><literal>~=</literal></member>
174182
<member><literal>&amp;&amp;</literal></member>
175183
</simplelist>
176-
(Refer to <xref linkend="functions-geometry"> about the meaning of
184+
185+
(See <xref linkend="functions-geometry"> for the meaning of
177186
these operators.)
178187
</para>
179188

@@ -204,6 +213,14 @@ CREATE INDEX <replaceable>name</replaceable> ON <replaceable>table</replaceable>
204213
</note>
205214
</para>
206215

216+
<para>
217+
GiST indexes are not a single kind of index, but rather an infrastructure
218+
within which many different indexing strategies can be implemented.
219+
Accordingly, the particular operators with which a GiST index can be
220+
used vary depending on the indexing strategy (the <firstterm>operator
221+
class</>). For more information see <xref linkend="GiST">.
222+
</para>
223+
207224
<para>
208225
The B-tree index method is an implementation of Lehman-Yao
209226
high-concurrency B-trees. The R-tree index method implements

doc/src/sgml/installation.sgml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/installation.sgml,v 1.224 2005/01/08 09:54:47 petere Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/installation.sgml,v 1.225 2005/01/08 22:13:26 tgl Exp $ -->
22

33
<chapter id="installation">
44
<title><![%standalone-include[<productname>PostgreSQL</>]]>
@@ -12,7 +12,11 @@
1212
This <![%standalone-include;[document]]>
1313
<![%standalone-ignore;[chapter]]> describes the installation of
1414
<productname>PostgreSQL</productname> from the source code
15-
distribution.
15+
distribution. (If you are installing a pre-packaged distribution,
16+
such as an RPM or Debian package, ignore this
17+
<![%standalone-include;[document]]>
18+
<![%standalone-ignore;[chapter]]>
19+
and read the packager's instructions instead.)
1620
</para>
1721

1822
<sect1 id="install-short">

doc/src/sgml/libpq.sgml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/libpq.sgml,v 1.176 2005/01/06 21:20:43 tgl Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/libpq.sgml,v 1.177 2005/01/08 22:13:28 tgl Exp $
33
-->
44

55
<chapter id="libpq">
@@ -1264,6 +1264,7 @@ statement, instead of giving a query string.
12641264
This feature allows commands
12651265
that will be used repeatedly to be parsed and planned just once, rather
12661266
than each time they are executed.
1267+
The statement must have been prepared previously in the current session.
12671268
<function>PQexecPrepared</> is supported only in protocol 3.0 and later
12681269
connections; it will fail when using protocol 2.0.
12691270
</para>

doc/src/sgml/lobj.sgml

Lines changed: 52 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/lobj.sgml,v 1.34 2004/12/28 22:47:15 tgl Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/lobj.sgml,v 1.35 2005/01/08 22:13:33 tgl Exp $
33
-->
44

55
<chapter id="largeObjects">
@@ -122,15 +122,17 @@ Oid lo_creat(PGconn *conn, int mode);
122122
or'ing together the bits <symbol>INV_READ</symbol> and
123123
<symbol>INV_WRITE</symbol>. The low-order sixteen bits of the mask have
124124
historically been used at Berkeley to designate the storage manager number on which the large object
125-
should reside. These
126-
bits should always be zero now.
127-
The return value is the OID that was assigned to the new large object.
125+
should reside. These bits should always be zero now. (The access type
126+
does not actually do anything anymore either, but one or both flag bits
127+
must be set to avoid an error.)
128+
The return value is the OID that was assigned to the new large object,
129+
or InvalidOid (zero) on failure.
128130
</para>
129131

130132
<para>
131133
An example:
132134
<programlisting>
133-
inv_oid = lo_creat(INV_READ|INV_WRITE);
135+
inv_oid = lo_creat(conn, INV_READ|INV_WRITE);
134136
</programlisting>
135137
</para>
136138
</sect2>
@@ -147,7 +149,8 @@ Oid lo_import(PGconn *conn, const char *filename);
147149
<replaceable class="parameter">filename</replaceable>
148150
specifies the operating system name of
149151
the file to be imported as a large object.
150-
The return value is the OID that was assigned to the new large object.
152+
The return value is the OID that was assigned to the new large object,
153+
or InvalidOid (zero) on failure.
151154
Note that the file is read by the client interface library, not by
152155
the server; so it must exist in the client filesystem and be readable
153156
by the client application.
@@ -164,19 +167,19 @@ Oid lo_import(PGconn *conn, const char *filename);
164167
int lo_export(PGconn *conn, Oid lobjId, const char *filename);
165168
</synopsis>
166169
<indexterm><primary>lo_export</></>
167-
The <parameter>lobjId</parameter> argument specifies the OID of the large
168-
object to export and the <parameter>filename</parameter> argument specifies
169-
the operating system name of the file.
170-
Note that the file is written by the client interface library, not by
171-
the server.
170+
The <parameter>lobjId</parameter> argument specifies the OID of the large
171+
object to export and the <parameter>filename</parameter> argument
172+
specifies the operating system name of the file. Note that the file is
173+
written by the client interface library, not by the server. Returns 1
174+
on success, -1 on failure.
172175
</para>
173176
</sect2>
174177

175178
<sect2>
176179
<title>Opening an Existing Large Object</title>
177180

178181
<para>
179-
To open an existing large object, call
182+
To open an existing large object for reading or writing, call
180183
<synopsis>
181184
int lo_open(PGconn *conn, Oid lobjId, int mode);
182185
</synopsis>
@@ -186,11 +189,13 @@ int lo_open(PGconn *conn, Oid lobjId, int mode);
186189
object is opened for reading (<symbol>INV_READ</>), writing (<symbol>INV_WRITE</symbol>), or
187190
both.
188191
A large object cannot be opened before it is created.
189-
<function>lo_open</function> returns a large object descriptor
190-
for later use in <function>lo_read</function>, <function>lo_write</function>,
191-
<function>lo_lseek</function>, <function>lo_tell</function>, and
192-
<function>lo_close</function>. The descriptor is only valid for
192+
<function>lo_open</function> returns a (non-negative) large object
193+
descriptor for later use in <function>lo_read</function>,
194+
<function>lo_write</function>, <function>lo_lseek</function>,
195+
<function>lo_tell</function>, and <function>lo_close</function>.
196+
The descriptor is only valid for
193197
the duration of the current transaction.
198+
On failure, -1 is returned.
194199
</para>
195200
</sect2>
196201

@@ -246,7 +251,7 @@ int lo_lseek(PGconn *conn, int fd, int offset, int whence);
246251
are <symbol>SEEK_SET</> (seek from object start),
247252
<symbol>SEEK_CUR</> (seek from current position), and
248253
<symbol>SEEK_END</> (seek from object end). The return value is
249-
the new location pointer.
254+
the new location pointer, or -1 on error.
250255
</para>
251256
</sect2>
252257

@@ -294,46 +299,56 @@ int lo_unlink(PGconn *conn, Oid lobjId);
294299
</synopsis>
295300
<indexterm><primary>lo_unlink</></> The
296301
<parameter>lobjId</parameter> argument specifies the OID of the
297-
large object to remove. In the event of an error, the return
298-
value is negative.
302+
large object to remove. Returns 1 if successful, -1 on failure.
299303
</para>
300304
</sect2>
301305

302-
303306
</sect1>
304307

305308
<sect1 id="lo-funcs">
306309
<title>Server-Side Functions</title>
307310

308-
<para>
309-
There are two built-in server-side functions,
310-
<function>lo_import</function><indexterm><primary>lo_import</></>
311-
and
312-
<function>lo_export</function>,<indexterm><primary>lo_export</></>
313-
for large object access, which are available for use in
314-
<acronym>SQL</acronym> commands. Here is an example of their
315-
use:
311+
<para>
312+
There are server-side functions callable from SQL that correspond to
313+
each of the client-side functions described above; indeed, for the
314+
most part the client-side functions are simply interfaces to the
315+
equivalent server-side functions. The ones that are actually useful
316+
to call via SQL commands are
317+
<function>lo_creat</function><indexterm><primary>lo_creat</></>,
318+
<function>lo_unlink</function><indexterm><primary>lo_unlink</></>,
319+
<function>lo_import</function><indexterm><primary>lo_import</></>, and
320+
<function>lo_export</function><indexterm><primary>lo_export</></>.
321+
Here are examples of their use:
322+
316323
<programlisting>
317324
CREATE TABLE image (
318325
name text,
319326
raster oid
320327
);
321328

329+
SELECT lo_creat(-1); -- returns OID of new, empty large object
330+
331+
SELECT lo_unlink(173454); -- deletes large object with OID 173454
332+
322333
INSERT INTO image (name, raster)
323334
VALUES ('beautiful image', lo_import('/etc/motd'));
324335

325336
SELECT lo_export(image.raster, '/tmp/motd') FROM image
326337
WHERE name = 'beautiful image';
327338
</programlisting>
328-
</para>
329-
330-
<para>
331-
These functions read and write files in the server's file system, using the
332-
permissions of the database's owning user. Therefore, their use is restricted
333-
to superusers. (In contrast, the client-side import and export functions
334-
read and write files in the client's file system, using the permissions of
335-
the client program. Their use is not restricted.)
336-
</para>
339+
</para>
340+
341+
<para>
342+
The server-side <function>lo_import</function> and
343+
<function>lo_export</function> functions behave considerably differently
344+
from their client-side analogs. These two functions read and write files
345+
in the server's file system, using the permissions of the database's
346+
owning user. Therefore, their use is restricted to superusers. In
347+
contrast, the client-side import and export functions read and write files
348+
in the client's file system, using the permissions of the client program.
349+
The client-side functions can be used by any
350+
<productname>PostgreSQL</productname> user.
351+
</para>
337352
</sect1>
338353

339354
<sect1 id="lo-examplesect">

doc/src/sgml/manage-ag.sgml

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/manage-ag.sgml,v 2.39 2004/12/27 22:30:10 tgl Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/manage-ag.sgml,v 2.40 2005/01/08 22:13:34 tgl Exp $
33
-->
44

55
<chapter id="managing-databases">
@@ -54,6 +54,21 @@ $PostgreSQL: pgsql/doc/src/sgml/manage-ag.sgml,v 2.39 2004/12/27 22:30:10 tgl Ex
5454
managing schemas is in <xref linkend="ddl-schemas">.
5555
</para>
5656

57+
<para>
58+
Databases are created with the <command>CREATE DATABASE</> command
59+
(see <xref linkend="manage-ag-createdb">) and destroyed with the
60+
<command>DROP DATABASE</> command
61+
(see <xref linkend="manage-ag-dropdb">).
62+
To determine the set of existing databases, examine the
63+
<structname>pg_database</> system catalog, for example
64+
<synopsis>
65+
SELECT datname FROM pg_database;
66+
</synopsis>
67+
The <xref linkend="app-psql"> program's <literal>\l</> meta-command
68+
and <option>-l</> command-line option are also useful for listing the
69+
existing databases.
70+
</para>
71+
5772
<note>
5873
<para>
5974
The <acronym>SQL</> standard calls databases <quote>catalogs</>, but there
@@ -444,8 +459,23 @@ CREATE TABLE foo(i int);
444459
</para>
445460

446461
<para>
447-
To simplify the implementation of tablespaces,
448-
<productname>PostgreSQL</> makes extensive use of symbolic links. This
462+
To remove an empty tablespace, use the <xref linkend="sql-droptablespace">
463+
command.
464+
</para>
465+
466+
<para>
467+
To determine the set of existing tablespaces, examine the
468+
<structname>pg_tablespace</> system catalog, for example
469+
<synopsis>
470+
SELECT spcname FROM pg_tablespace;
471+
</synopsis>
472+
The <xref linkend="app-psql"> program's <literal>\db</> meta-command
473+
is also useful for listing the existing tablespaces.
474+
</para>
475+
476+
<para>
477+
<productname>PostgreSQL</> makes extensive use of symbolic links
478+
to simplify the implementation of tablespaces. This
449479
means that tablespaces can be used <emphasis>only</> on systems
450480
that support symbolic links.
451481
</para>

0 commit comments

Comments
 (0)