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

Commit c918be6

Browse files
committed
Update description of numeric constants to match 7.3 reality.
Miscellaneous other copy-editing.
1 parent 2b2cf39 commit c918be6

File tree

8 files changed

+137
-115
lines changed

8 files changed

+137
-115
lines changed

doc/src/sgml/advanced.sgml

Lines changed: 5 additions & 6 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.28 2002/06/11 15:32:32 thomas Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/advanced.sgml,v 1.29 2002/10/20 05:05:46 tgl Exp $
33
-->
44

55
<chapter id="tutorial-advanced">
@@ -130,8 +130,8 @@ ERROR: &lt;unnamed&gt; referential integrity violation - key referenced from we
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 <citetitle>Reference
134-
Manual</citetitle> for more information. Making correct use of
133+
tutorial, but just refer you to &cite-reference;
134+
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.
137137
</para>
@@ -394,9 +394,8 @@ SELECT name, altitude
394394
<productname>PostgreSQL</productname> has many features not
395395
touched upon in this tutorial introduction, which has been
396396
oriented toward newer users of <acronym>SQL</acronym>. These
397-
features are discussed in more detail in both the
398-
<citetitle>User's Guide</citetitle> and the
399-
<citetitle>Programmer's Guide</citetitle>.
397+
features are discussed in more detail in both &cite-user;
398+
and &cite-programmer;.
400399
</para>
401400

402401
<para>

doc/src/sgml/ddl.sgml

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/ddl.sgml,v 1.5 2002/09/21 18:32:52 petere Exp $ -->
1+
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/ddl.sgml,v 1.6 2002/10/20 05:05:46 tgl Exp $ -->
22

33
<chapter id="ddl">
44
<title>Data Definition</title>
@@ -10,7 +10,7 @@
1010
explaining how tables are created and modified and what features are
1111
available to control what data is stored in the tables.
1212
Subsequently, we discuss how tables can be organized into
13-
namespaces, and how privileges can be assigned to tables. Finally,
13+
schemas, and how privileges can be assigned to tables. Finally,
1414
we will briefly look at other features that affect the data storage,
1515
such as views, functions, and triggers. Detailed information on
1616
these topics is found in &cite-programmer;.
@@ -78,7 +78,7 @@ CREATE TABLE my_first_table (
7878
<literal>second_column</literal> and the type <type>integer</type>.
7979
The table and column names follow the identifier syntax explained
8080
in <xref linkend="sql-syntax-identifiers">. The type names are
81-
also identifiers, but there are some exceptions. Note that the
81+
usually also identifiers, but there are some exceptions. Note that the
8282
column list is comma-separated and surrounded by parentheses.
8383
</para>
8484

@@ -101,7 +101,7 @@ CREATE TABLE products (
101101
<tip>
102102
<para>
103103
When you create many interrelated tables it is wise to choose a
104-
consistent naming patter for the tables and columns. For
104+
consistent naming pattern for the tables and columns. For
105105
instance, there is a choice of using singular or plural nouns for
106106
table names, both of which are favored by some theorist or other.
107107
</para>
@@ -287,7 +287,7 @@ CREATE TABLE products (
287287
</para>
288288

289289
<para>
290-
The default value may be a scalar expression, which well be
290+
The default value may be a scalar expression, which will be
291291
evaluated whenever the default value is inserted
292292
(<emphasis>not</emphasis> when the table is created).
293293
</para>
@@ -618,7 +618,8 @@ CREATE TABLE example (
618618

619619
<para>
620620
A foreign key constraint specifies that the values in a column (or
621-
a group of columns) must match the values in some other column.
621+
a group of columns) must match the values appearing in some row
622+
of another table.
622623
We say this maintains the <firstterm>referential
623624
integrity</firstterm> between two related tables.
624625
</para>
@@ -758,7 +759,7 @@ CREATE TABLE order_items (
758759
<para>
759760
Restricting and cascading deletes are the two most common options.
760761
<literal>RESTRICT</literal> can also be written as <literal>NO
761-
ACTON</literal> and it's also the default if you don't specify
762+
ACTION</literal> and it's also the default if you don't specify
762763
anything. There are two other options for what should happen with
763764
the foreign key columns when a primary key is deleted:
764765
<literal>SET NULL</literal> and <literal>SET DEFAULT</literal>.
@@ -981,7 +982,7 @@ SET SQL_Inheritance TO OFF;
981982
<para>Add columns,</para>
982983
</listitem>
983984
<listitem>
984-
<para>Remove a column,</para>
985+
<para>Remove columns,</para>
985986
</listitem>
986987
<listitem>
987988
<para>Add constraints,</para>
@@ -993,10 +994,10 @@ SET SQL_Inheritance TO OFF;
993994
<para>Change default values,</para>
994995
</listitem>
995996
<listitem>
996-
<para>Rename a column,</para>
997+
<para>Rename columns,</para>
997998
</listitem>
998999
<listitem>
999-
<para>Rename the table.</para>
1000+
<para>Rename tables.</para>
10001001
</listitem>
10011002
</itemizedlist>
10021003

@@ -1270,7 +1271,7 @@ REVOKE ALL ON accounts FROM PUBLIC;
12701271
</itemizedlist>
12711272

12721273
Schemas are analogous to directories at the operating system level,
1273-
but schemas cannot be nested.
1274+
except that schemas cannot be nested.
12741275
</para>
12751276

12761277
<sect2 id="ddl-schemas-create">
@@ -1341,7 +1342,7 @@ DROP SCHEMA myschema CASCADE;
13411342
(since this is one of the ways to restrict the activities of your
13421343
users to well-defined namespaces). The syntax for that is:
13431344
<programlisting>
1344-
CREATE SCHEMA <replaceable>schemaname</replaceable> AUTHORIZATON <replaceable>username</replaceable>;
1345+
CREATE SCHEMA <replaceable>schemaname</replaceable> AUTHORIZATION <replaceable>username</replaceable>;
13451346
</programlisting>
13461347
You can even omit the schema name, in which case the schema name
13471348
will be the same as the user name. See <xref
@@ -1359,9 +1360,9 @@ CREATE SCHEMA <replaceable>schemaname</replaceable> AUTHORIZATON <replaceable>us
13591360

13601361
<para>
13611362
In the previous sections we created tables without specifying any
1362-
schema names. Those tables (and other objects) are automatically
1363-
put into a schema named <quote>public</quote>. Every new database
1364-
contains such a schema. Thus, the following are equivalent:
1363+
schema names. By default, such tables (and other objects) are
1364+
automatically put into a schema named <quote>public</quote>. Every new
1365+
database contains such a schema. Thus, the following are equivalent:
13651366
<programlisting>
13661367
CREATE TABLE products ( ... );
13671368
</programlisting>
@@ -1550,15 +1551,15 @@ REVOKE CREATE ON public FROM PUBLIC;
15501551

15511552
<para>
15521553
Schemas can be used to organize your data in many ways. There are
1553-
a few usage patterns are recommended and are easily supported by
1554+
a few usage patterns that are recommended and are easily supported by
15541555
the default configuration:
15551556
<itemizedlist>
15561557
<listitem>
15571558
<para>
15581559
If you do not create any schemas then all users access the
15591560
public schema implicitly. This simulates the situation where
15601561
schemas are not available at all. This setup is mainly
1561-
recommended when there is only a single user or few cooperating
1562+
recommended when there is only a single user or a few cooperating
15621563
users in a database. This setup also allows smooth transition
15631564
from the non-schema-aware world.
15641565
</para>
@@ -1586,7 +1587,7 @@ REVOKE CREATE ON public FROM PUBLIC;
15861587
additional functions provided by third parties, etc.), put them
15871588
into separate schemas. Remember to grant appropriate
15881589
privileges to allow the other users to access them. Users can
1589-
then refer to these additional object by qualifying the names
1590+
then refer to these additional objects by qualifying the names
15901591
with a schema name, or they can put the additional schemas into
15911592
their path, as they choose.
15921593
</para>
@@ -1690,9 +1691,10 @@ ERROR: Cannot drop table products because other objects depend on it
16901691
<screen>
16911692
DROP TABLE products CASCADE;
16921693
</screen>
1693-
and all the dependent objects will be removed. Actually, this
1694+
and all the dependent objects will be removed. In this case, it
16941695
doesn't remove the orders table, it only removes the foreign key
1695-
constraint.
1696+
constraint. (If you want to check what DROP ... CASCADE will do,
1697+
run DROP without CASCADE and read the NOTICEs.)
16961698
</para>
16971699

16981700
<para>
@@ -1709,7 +1711,8 @@ DROP TABLE products CASCADE;
17091711
According to the SQL standard, specifying either
17101712
<literal>RESTRICT</literal> or <literal>CASCADE</literal> is
17111713
required. No database system actually implements it that way, but
1712-
the defaults might be different.
1714+
whether the default behavior is <literal>RESTRICT</literal> or
1715+
<literal>CASCADE</literal> varies across systems.
17131716
</para>
17141717
</note>
17151718

@@ -1718,7 +1721,8 @@ DROP TABLE products CASCADE;
17181721
Foreign key constraint dependencies and serial column dependencies
17191722
from <productname>PostgreSQL</productname> versions prior to 7.3
17201723
are <emphasis>not</emphasis> maintained or created during the
1721-
upgrade process. All other dependency types survive the upgrade.
1724+
upgrade process. All other dependency types will be properly
1725+
created during an upgrade.
17221726
</para>
17231727
</note>
17241728
</sect1>

doc/src/sgml/dml.sgml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/dml.sgml,v 1.1 2002/08/05 19:44:57 petere Exp $ -->
1+
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/dml.sgml,v 1.2 2002/10/20 05:05:46 tgl Exp $ -->
22

33
<chapter id="dml">
44
<title>Data Manipulation</title>
@@ -119,8 +119,8 @@ INSERT INTO products DEFAULT VALUES;
119119
necessarily possible to directly specify which row to update.
120120
Instead, you specify which conditions a row must meet in order to
121121
be updated. Only if you have a primary key in the table (no matter
122-
whether you declared it or not) you can address rows individually
123-
by choosing a condition that matches the primary key only.
122+
whether you declared it or not) can you reliably address individual rows,
123+
by choosing a condition that matches the primary key.
124124
Graphical database access tools rely on this fact to allow you to
125125
update rows individually.
126126
</para>
@@ -195,5 +195,13 @@ UPDATE mytable SET a = 5, b = 3, c = 1 WHERE a > 0;
195195
DELETE FROM products WHERE price = 10;
196196
</programlisting>
197197
</para>
198+
199+
<para>
200+
If you simply write
201+
<programlisting>
202+
DELETE FROM products;
203+
</programlisting>
204+
then all rows in the table will be deleted! Caveat programmer.
205+
</para>
198206
</sect1>
199207
</chapter>

doc/src/sgml/queries.sgml

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/queries.sgml,v 1.17 2002/09/20 18:39:41 petere Exp $ -->
1+
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/queries.sgml,v 1.18 2002/10/20 05:05:46 tgl Exp $ -->
22

33
<chapter id="queries">
44
<title>Queries</title>
@@ -35,13 +35,12 @@ SELECT * FROM table1;
3535
<literal>table1</literal>. (The method of retrieval depends on the
3636
client application. For example, the
3737
<application>psql</application> program will display an ASCII-art
38-
table on the screen, client libraries will offer functions to
38+
table on the screen, while client libraries will offer functions to
3939
retrieve individual rows and columns.) The select list
4040
specification <literal>*</literal> means all columns that the table
4141
expression happens to provide. A select list can also select a
42-
subset of the available columns or even make calculations on the
43-
columns before retrieving them; see <xref
44-
linkend="queries-select-lists">. For example, if
42+
subset of the available columns or make calculations using the
43+
columns. For example, if
4544
<literal>table1</literal> has columns named <literal>a</>,
4645
<literal>b</>, and <literal>c</> (and perhaps others) you can make
4746
the following query:
@@ -50,6 +49,7 @@ SELECT a, b + c FROM table1;
5049
</programlisting>
5150
(assuming that <literal>b</> and <literal>c</> are of a numerical
5251
data type).
52+
See <xref linkend="queries-select-lists"> for more details.
5353
</para>
5454

5555
<para>
@@ -62,7 +62,7 @@ SELECT a, b + c FROM table1;
6262
SELECT 3 * 4;
6363
</programlisting>
6464
This is more useful if the expressions in the select list return
65-
varying results. For example, you could call a function this way.
65+
varying results. For example, you could call a function this way:
6666
<programlisting>
6767
SELECT random();
6868
</programlisting>
@@ -266,7 +266,7 @@ FROM <replaceable>table_reference</replaceable> <optional>, <replaceable>table_r
266266
<para>
267267
First, an inner join is performed. Then, for each row in
268268
T1 that does not satisfy the join condition with any row in
269-
T2, a joined row is returned with null values in columns of
269+
T2, a joined row is added with null values in columns of
270270
T2. Thus, the joined table unconditionally has at least
271271
one row for each row in T1.
272272
</para>
@@ -280,7 +280,7 @@ FROM <replaceable>table_reference</replaceable> <optional>, <replaceable>table_r
280280
<para>
281281
First, an inner join is performed. Then, for each row in
282282
T2 that does not satisfy the join condition with any row in
283-
T1, a joined row is returned with null values in columns of
283+
T1, a joined row is added with null values in columns of
284284
T1. This is the converse of a left join: the result table
285285
will unconditionally have a row for each row in T2.
286286
</para>
@@ -294,10 +294,10 @@ FROM <replaceable>table_reference</replaceable> <optional>, <replaceable>table_r
294294
<para>
295295
First, an inner join is performed. Then, for each row in
296296
T1 that does not satisfy the join condition with any row in
297-
T2, a joined row is returned with null values in columns of
297+
T2, a joined row is added with null values in columns of
298298
T2. Also, for each row of T2 that does not satisfy the
299299
join condition with any row in T1, a joined row with null
300-
values in the columns of T1 is returned.
300+
values in the columns of T1 is added.
301301
</para>
302302
</listitem>
303303
</varlistentry>
@@ -602,7 +602,7 @@ FROM a NATURAL JOIN b WHERE b.val &gt; 5
602602
<literal>JOIN</> syntax in the <literal>FROM</> clause is
603603
probably not as portable to other SQL database products. For
604604
outer joins there is no choice in any case: they must be done in
605-
the <literal>FROM</> clause. A <literal>ON</>/<literal>USING</>
605+
the <literal>FROM</> clause. An <literal>ON</>/<literal>USING</>
606606
clause of an outer join is <emphasis>not</> equivalent to a
607607
<literal>WHERE</> condition, because it determines the addition
608608
of rows (for unmatched input rows) as well as the removal of rows
@@ -692,11 +692,11 @@ SELECT <replaceable>select_list</replaceable>
692692

693693
<para>
694694
In the second query, we could not have written <literal>SELECT *
695-
FROM test1 GROUP BY x;</literal>, because there is no single value
695+
FROM test1 GROUP BY x</literal>, because there is no single value
696696
for the column <literal>y</> that could be associated with each
697697
group. In general, if a table is grouped, columns that are not
698698
used in the grouping cannot be referenced except in aggregate
699-
expressions, for example:
699+
expressions. An example with aggregate expressions is:
700700
<screen>
701701
<prompt>=></> <userinput>SELECT x, sum(y) FROM test1 GROUP BY x;</>
702702
x | sum
@@ -717,25 +717,25 @@ SELECT <replaceable>select_list</replaceable>
717717
they have a known constant value per group.
718718
</para>
719719

720-
<note>
720+
<tip>
721721
<para>
722722
Grouping without aggregate expressions effectively calculates the
723723
set of distinct values in a column. This can also be achieved
724724
using the <literal>DISTINCT</> clause (see <xref
725725
linkend="queries-distinct">).
726726
</para>
727-
</note>
727+
</tip>
728728

729729
<para>
730-
Here is another example: A <function>sum(sales)</function> on a
730+
Here is another example: <function>sum(sales)</function> on a
731731
table grouped by product code gives the total sales for each
732732
product, not the total sales on all products.
733733
<programlisting>
734734
SELECT product_id, p.name, (sum(s.units) * p.price) AS sales
735735
FROM products p LEFT JOIN sales s USING (product_id)
736-
GROUP BY pid, p.name, p.price;
736+
GROUP BY product_id, p.name, p.price;
737737
</programlisting>
738-
In this example, the columns <literal>pid</literal>,
738+
In this example, the columns <literal>product_id</literal>,
739739
<literal>p.name</literal>, and <literal>p.price</literal> must be
740740
in the <literal>GROUP BY</> clause since they are referenced in
741741
the query select list. (Depending on how exactly the products
@@ -767,7 +767,7 @@ SELECT product_id, p.name, (sum(s.units) * p.price) AS sales
767767
SELECT <replaceable>select_list</replaceable> FROM ... <optional>WHERE ...</optional> GROUP BY ... HAVING <replaceable>boolean_expression</replaceable>
768768
</synopsis>
769769
Expressions in the <literal>HAVING</> clause can refer both to
770-
grouped expressions and to ungrouped expression (which necessarily
770+
grouped expressions and to ungrouped expressions (which necessarily
771771
involve an aggregate function).
772772
</para>
773773

@@ -794,7 +794,7 @@ SELECT <replaceable>select_list</replaceable> FROM ... <optional>WHERE ...</opti
794794
Again, a more realistic example:
795795
<programlisting>
796796
SELECT product_id, p.name, (sum(s.units) * (p.price - p.cost)) AS profit
797-
FROM products p LEFT JOIN sales s USING (pid)
797+
FROM products p LEFT JOIN sales s USING (product_id)
798798
WHERE s.date > CURRENT_DATE - INTERVAL '4 weeks'
799799
GROUP BY product_id, p.name, p.price, p.cost
800800
HAVING sum(p.price * s.units) > 5000;
@@ -1093,7 +1093,7 @@ SELECT a AS b FROM table1 ORDER BY a;
10931093
<para>
10941094
If more than one sort column is specified, the later entries are
10951095
used to sort rows that are equal under the order imposed by the
1096-
earlier sort specifications.
1096+
earlier sort columns.
10971097
</para>
10981098
</sect1>
10991099

0 commit comments

Comments
 (0)