Skip to content

Commit 1b342df

Browse files
committed
Merge documentation updates from 7.3 branch.
1 parent b327906 commit 1b342df

28 files changed

+2268
-2417
lines changed

doc/src/sgml/advanced.sgml

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/advanced.sgml,v 1.30 2002/10/24 17:48:54 petere Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/advanced.sgml,v 1.31 2002/11/11 20:14:02 petere Exp $
33
-->
44

55
<chapter id="tutorial-advanced">
@@ -46,14 +46,14 @@ $Header: /cvsroot/pgsql/doc/src/sgml/advanced.sgml,v 1.30 2002/10/24 17:48:54 pe
4646
<firstterm>view</firstterm> over the query, which gives a name to
4747
the query that you can refer to like an ordinary table.
4848

49-
<programlisting>
49+
<programlisting>
5050
CREATE VIEW myview AS
5151
SELECT city, temp_lo, temp_hi, prcp, date, location
5252
FROM weather, cities
5353
WHERE city = name;
5454

5555
SELECT * FROM myview;
56-
</programlisting>
56+
</programlisting>
5757
</para>
5858

5959
<para>
@@ -101,7 +101,7 @@ SELECT * FROM myview;
101101
<para>
102102
The new declaration of the tables would look like this:
103103

104-
<programlisting>
104+
<programlisting>
105105
CREATE TABLE cities (
106106
city varchar(80) primary key,
107107
location point
@@ -114,23 +114,23 @@ CREATE TABLE weather (
114114
prcp real,
115115
date date
116116
);
117-
</programlisting>
117+
</programlisting>
118118

119119
Now try inserting an invalid record:
120120

121-
<programlisting>
121+
<programlisting>
122122
INSERT INTO weather VALUES ('Berkeley', 45, 53, 0.0, '1994-11-28');
123-
</programlisting>
123+
</programlisting>
124124

125-
<screen>
125+
<screen>
126126
ERROR: &lt;unnamed&gt; referential integrity violation - key referenced from weather not found in cities
127-
</screen>
127+
</screen>
128128
</para>
129129

130130
<para>
131131
The behavior of foreign keys can be finely tuned to your
132132
application. We will not go beyond this simple example in this
133-
tutorial, but just refer you to the &cite-reference;
133+
tutorial, but just refer you to the &cite-user;
134134
for more information. Making correct use of
135135
foreign keys will definitely improve the quality of your database
136136
applications, so you are strongly encouraged to learn about them.
@@ -161,7 +161,7 @@ ERROR: &lt;unnamed&gt; referential integrity violation - key referenced from we
161161
to Bob's account. Simplifying outrageously, the SQL commands for this
162162
might look like
163163

164-
<programlisting>
164+
<programlisting>
165165
UPDATE accounts SET balance = balance - 100.00
166166
WHERE name = 'Alice';
167167
UPDATE branches SET balance = balance - 100.00
@@ -170,7 +170,7 @@ UPDATE accounts SET balance = balance + 100.00
170170
WHERE name = 'Bob';
171171
UPDATE branches SET balance = balance + 100.00
172172
WHERE name = (SELECT branch_name FROM accounts WHERE name = 'Bob');
173-
</programlisting>
173+
</programlisting>
174174
</para>
175175

176176
<para>
@@ -222,13 +222,13 @@ UPDATE branches SET balance = balance + 100.00
222222
<command>BEGIN</> and <command>COMMIT</> commands. So our banking
223223
transaction would actually look like
224224

225-
<programlisting>
225+
<programlisting>
226226
BEGIN;
227227
UPDATE accounts SET balance = balance - 100.00
228228
WHERE name = 'Alice';
229229
-- etc etc
230230
COMMIT;
231-
</programlisting>
231+
</programlisting>
232232
</para>
233233

234234
<para>
@@ -278,7 +278,7 @@ COMMIT;
278278
implicitly when you list all cities. If you're really clever you
279279
might invent some scheme like this:
280280

281-
<programlisting>
281+
<programlisting>
282282
CREATE TABLE capitals (
283283
name text,
284284
population real,
@@ -296,7 +296,7 @@ CREATE VIEW cities AS
296296
SELECT name, population, altitude FROM capitals
297297
UNION
298298
SELECT name, population, altitude FROM non_capitals;
299-
</programlisting>
299+
</programlisting>
300300

301301
This works OK as far as querying goes, but it gets ugly when you
302302
need to update several rows, to name one thing.
@@ -305,7 +305,7 @@ CREATE VIEW cities AS
305305
<para>
306306
A better solution is this:
307307

308-
<programlisting>
308+
<programlisting>
309309
CREATE TABLE cities (
310310
name text,
311311
population real,
@@ -315,7 +315,7 @@ CREATE TABLE cities (
315315
CREATE TABLE capitals (
316316
state char(2)
317317
) INHERITS (cities);
318-
</programlisting>
318+
</programlisting>
319319
</para>
320320

321321
<para>
@@ -336,11 +336,11 @@ CREATE TABLE capitals (
336336
including state capitals, that are located at an altitude
337337
over 500 ft.:
338338

339-
<programlisting>
339+
<programlisting>
340340
SELECT name, altitude
341341
FROM cities
342342
WHERE altitude &gt; 500;
343-
</programlisting>
343+
</programlisting>
344344

345345
which returns:
346346

@@ -359,11 +359,11 @@ SELECT name, altitude
359359
all the cities that are not state capitals and
360360
are situated at an altitude of 500 ft. or higher:
361361

362-
<programlisting>
362+
<programlisting>
363363
SELECT name, altitude
364364
FROM ONLY cities
365365
WHERE altitude &gt; 500;
366-
</programlisting>
366+
</programlisting>
367367

368368
<screen>
369369
name | altitude
@@ -380,7 +380,7 @@ SELECT name, altitude
380380
<classname>cities</classname> table, and not tables below
381381
<classname>cities</classname> in the inheritance hierarchy. Many
382382
of the commands that we have already discussed --
383-
<command>SELECT</command>, <command>UPDATE</command> and
383+
<command>SELECT</command>, <command>UPDATE</command>, and
384384
<command>DELETE</command> -- support this <literal>ONLY</literal>
385385
notation.
386386
</para>

doc/src/sgml/array.sgml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/array.sgml,v 1.23 2002/11/10 00:32:16 momjian Exp $ -->
1+
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/array.sgml,v 1.24 2002/11/11 20:14:02 petere Exp $ -->
22

33
<sect1 id="arrays">
44
<title>Arrays</title>
@@ -21,7 +21,7 @@ CREATE TABLE sal_emp (
2121
</programlisting>
2222
As shown, an array data type is named by appending square brackets
2323
(<literal>[]</>) to the data type name of the array elements.
24-
The above query will create a table named
24+
The above command will create a table named
2525
<structname>sal_emp</structname> with columns including
2626
a <type>text</type> string (<structfield>name</structfield>),
2727
a one-dimensional array of type
@@ -68,7 +68,7 @@ SELECT name FROM sal_emp WHERE pay_by_quarter[1] &lt;&gt; pay_by_quarter[2];
6868

6969
The array subscript numbers are written within square brackets.
7070
By default <productname>PostgreSQL</productname> uses the
71-
<quote>one-based</quote> numbering convention for arrays, that is,
71+
one-based numbering convention for arrays, that is,
7272
an array of <replaceable>n</> elements starts with <literal>array[1]</literal> and
7373
ends with <literal>array[<replaceable>n</>]</literal>.
7474
</para>
@@ -90,10 +90,9 @@ SELECT pay_by_quarter[3] FROM sal_emp;
9090
<para>
9191
We can also access arbitrary rectangular slices of an array, or
9292
subarrays. An array slice is denoted by writing
93-
<literal><replaceable>lower subscript</replaceable> :
94-
<replaceable>upper subscript</replaceable></literal> for one or more
95-
array dimensions. This query retrieves the first item on Bill's
96-
schedule for the first two days of the week:
93+
<literal><replaceable>lower-bound</replaceable>:<replaceable>upper-bound</replaceable></literal>
94+
for one or more array dimensions. This query retrieves the first
95+
item on Bill's schedule for the first two days of the week:
9796

9897
<programlisting>
9998
SELECT schedule[1:2][1:1] FROM sal_emp WHERE name = 'Bill';
@@ -112,9 +111,10 @@ SELECT schedule[1:2][1] FROM sal_emp WHERE name = 'Bill';
112111

113112
with the same result. An array subscripting operation is taken to
114113
represent an array slice if any of the subscripts are written in the
115-
form <replaceable>lower</replaceable> <literal>:</literal>
116-
<replaceable>upper</replaceable>. A lower bound of 1 is assumed for
117-
any subscript where only one value is specified.
114+
form
115+
<literal><replaceable>lower</replaceable>:<replaceable>upper</replaceable></literal>.
116+
A lower bound of 1 is assumed for any subscript where only one value
117+
is specified.
118118
</para>
119119

120120
<para>
@@ -310,7 +310,7 @@ SELECT * FROM sal_emp WHERE pay_by_quarter **= 10000;
310310

311311
<tip>
312312
<para>
313-
Remember that what you write in an SQL query will first be interpreted
313+
Remember that what you write in an SQL command will first be interpreted
314314
as a string literal, and then as an array. This doubles the number of
315315
backslashes you need. For example, to insert a <type>text</> array
316316
value containing a backslash and a double quote, you'd need to write
@@ -323,7 +323,7 @@ INSERT ... VALUES ('{"\\\\","\\""}');
323323
become <literal>\</> and <literal>"</> respectively. (If we were working
324324
with a data type whose input routine also treated backslashes specially,
325325
<type>bytea</> for example, we might need as many as eight backslashes
326-
in the query to get one backslash into the stored array element.)
326+
in the command to get one backslash into the stored array element.)
327327
</para>
328328
</tip>
329329

doc/src/sgml/backup.sgml

Lines changed: 21 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/backup.sgml,v 2.23 2002/10/21 02:11:37 tgl Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/backup.sgml,v 2.24 2002/11/11 20:14:02 petere Exp $
33
-->
44
<chapter id="backup">
55
<title>Backup and Restore</title>
@@ -64,7 +64,7 @@ pg_dump <replaceable class="parameter">dbname</replaceable> &gt; <replaceable cl
6464
<para>
6565
As any other <productname>PostgreSQL</> client application,
6666
<application>pg_dump</> will by default connect with the database
67-
user name that is equal to the current Unix user name. To override
67+
user name that is equal to the current operating system user name. To override
6868
this, either specify the <option>-U</option> option or set the
6969
environment variable <envar>PGUSER</envar>. Remember that
7070
<application>pg_dump</> connections are subject to the normal
@@ -104,9 +104,9 @@ psql <replaceable class="parameter">dbname</replaceable> &lt; <replaceable class
104104
</synopsis>
105105
where <replaceable class="parameter">infile</replaceable> is what
106106
you used as <replaceable class="parameter">outfile</replaceable>
107-
for the pg_dump command. The database <replaceable
107+
for the <command>pg_dump</> command. The database <replaceable
108108
class="parameter">dbname</replaceable> will not be created by this
109-
command, you must create it yourself from template0 before executing
109+
command, you must create it yourself from <literal>template0</> before executing
110110
<application>psql</> (e.g., with <literal>createdb -T template0
111111
<replaceable class="parameter">dbname</></literal>).
112112
<application>psql</> supports similar options to <application>pg_dump</>
@@ -129,23 +129,22 @@ psql <replaceable class="parameter">dbname</replaceable> &lt; <replaceable class
129129
The ability of <application>pg_dump</> and <application>psql</> to
130130
write to or read from pipes makes it possible to dump a database
131131
directly from one server to another, for example
132-
<informalexample>
133132
<programlisting>
134133
pg_dump -h <replaceable>host1</> <replaceable>dbname</> | psql -h <replaceable>host2</> <replaceable>dbname</>
135134
</programlisting>
136-
</informalexample>
137135
</para>
138136

139-
140-
<important>
141-
<para>
142-
The dumps produced by pg_dump are relative to template0. This means
143-
that any languages, procedures, etc. added to template1 will also be
144-
dumped by <application>pg_dump</>. As a result, when restoring, if
145-
you are using a customized template1, you must create the empty
146-
database from template0, as in the example above.
147-
</para>
148-
</important>
137+
<important>
138+
<para>
139+
The dumps produced by <application>pg_dump</> are relative to
140+
<literal>template0</>. This means that any languages, procedures,
141+
etc. added to <literal>template1</> will also be dumped by
142+
<application>pg_dump</>. As a result, when restoring, if you are
143+
using a customized <literal>template1</>, you must create the
144+
empty database from <literal>template0</>, as in the example
145+
above.
146+
</para>
147+
</important>
149148

150149
</sect2>
151150

@@ -222,20 +221,16 @@ cat <replaceable class="parameter">filename</replaceable>.gz | gunzip | psql <re
222221
acceptable in size to the underlying file system. For example, to
223222
make chunks of 1 megabyte:
224223

225-
<informalexample>
226224
<programlisting>
227225
pg_dump <replaceable class="parameter">dbname</replaceable> | split -b 1m - <replaceable class="parameter">filename</replaceable>
228226
</programlisting>
229-
</informalexample>
230227

231228
Reload with
232229

233-
<informalexample>
234230
<programlisting>
235231
createdb <replaceable class="parameter">dbname</replaceable>
236232
cat <replaceable class="parameter">filename</replaceable>* | psql <replaceable class="parameter">dbname</replaceable>
237233
</programlisting>
238-
</informalexample>
239234
</para>
240235
</formalpara>
241236

@@ -249,14 +244,11 @@ cat <replaceable class="parameter">filename</replaceable>* | psql <replaceable c
249244
restored selectively. The following command dumps a database using the
250245
custom dump format:
251246

252-
<informalexample>
253247
<programlisting>
254248
pg_dump -Fc <replaceable class="parameter">dbname</replaceable> > <replaceable class="parameter">filename</replaceable>
255249
</programlisting>
256-
</informalexample>
257250

258251
See the <application>pg_dump</> and <application>pg_restore</> reference pages for details.
259-
260252
</para>
261253
</formalpara>
262254

@@ -284,7 +276,7 @@ pg_dump -Fc <replaceable class="parameter">dbname</replaceable> > <replaceable c
284276
<para>
285277
For reasons of backward compatibility, <application>pg_dump</> does
286278
not dump large objects by default. To dump large objects you must use
287-
either the custom or the TAR output format, and use the -b option in
279+
either the custom or the TAR output format, and use the <option>-b</> option in
288280
<application>pg_dump</>. See the reference pages for details.
289281
The directory <filename>contrib/pg_dumplo</> of the
290282
<productname>PostgreSQL</> source tree also contains a program that can
@@ -308,11 +300,10 @@ pg_dump -Fc <replaceable class="parameter">dbname</replaceable> > <replaceable c
308300
are located, but you have probably found them already if you are
309301
interested in this method. You can use whatever method you prefer
310302
for doing usual file system backups, for example
311-
<informalexample>
303+
312304
<programlisting>
313305
tar -cf backup.tar /usr/local/pgsql/data
314306
</programlisting>
315-
</informalexample>
316307
</para>
317308

318309
<para>
@@ -390,11 +381,11 @@ tar -cf backup.tar /usr/local/pgsql/data
390381
The least downtime can be achieved by installing the new server in
391382
a different directory and running both the old and the new servers
392383
in parallel, on different ports. Then you can use something like
393-
<informalexample>
384+
394385
<programlisting>
395386
pg_dumpall -p 5432 | psql -d template1 -p 6543
396387
</programlisting>
397-
</informalexample>
388+
398389
to transfer your data, or use an intermediate file if you want.
399390
Then you can shut down the old server and start the new server at
400391
the port the old one was running at. You should make sure that the
@@ -410,7 +401,7 @@ pg_dumpall -p 5432 | psql -d template1 -p 6543
410401
do the back up step before installing the new version, bring down
411402
the server, move the old version out of the way, install the new
412403
version, start the new server, restore the data. For example:
413-
<informalexample>
404+
414405
<programlisting>
415406
pg_dumpall > backup
416407
pg_ctl stop
@@ -421,7 +412,7 @@ initdb -D /usr/local/pgsql/data
421412
postmaster -D /usr/local/pgsql/data
422413
psql template1 < backup
423414
</programlisting>
424-
</informalexample>
415+
425416
See <xref linkend="runtime"> about ways to start and stop the
426417
server and other details. The installation instructions will advise
427418
you of strategic places to perform these steps.

0 commit comments

Comments
 (0)