minor doc improvements
minor doc improvements
От:
Neil Conway <neilc@samurai.com>
Дата:
I've applied the attached patch to HEAD. It does the following:
Add a few more cross-references where appropriate, add more text about
the FROM clause and an example to the UPDATE reference page, and make
a few other SGML tweaks.
Suggestions for further improvement (for example, to the UPDATE ref
page) are welcome.
-Neil
Index: doc/src/sgml/queries.sgml
===================================================================
RCS file: /var/lib/cvs/pgsql-server/doc/src/sgml/queries.sgml,v
retrieving revision 1.28
diff -c -r1.28 queries.sgml
*** a/doc/src/sgml/queries.sgml 29 Nov 2003 19:51:37 -0000 1.28
--- b/doc/src/sgml/queries.sgml 3 Mar 2004 21:57:00 -0000
***************
*** 108,115 ****
The <literal>FROM</literal> Clause
! The FROM</> clause derives a table from one or more other
! tables given in a comma-separated table reference list.
FROM table_reference , table_reference , ...
--- 108,116 ----
The <literal>FROM</literal> Clause
! The derives a
! table from one or more other tables given in a comma-separated
! table reference list.
FROM table_reference , table_reference , ...
***************
*** 677,683 ****
! The syntax of the WHERE</> clause is
WHERE search_condition
--- 678,685 ----
! The syntax of the clause is
WHERE search_condition
***************
*** 783,795 ****
! The GROUP BY</> clause is used to group together those rows in
! a table that share the same values in all the columns listed. The
! order in which the columns are listed does not matter. The
! purpose is to reduce each group of rows sharing common values into
! one group row that is representative of all rows in the group.
! This is done to eliminate redundancy in the output and/or compute
! aggregates that apply to these groups. For instance:
=></> SELECT * FROM test1;</>
x | y
--- 785,798 ----
! The is
! used to group together those rows in a table that share the same
! values in all the columns listed. The order in which the columns
! are listed does not matter. The purpose is to reduce each group
! of rows sharing common values into one group row that is
! representative of all rows in the group. This is done to
! eliminate redundancy in the output and/or compute aggregates that
! apply to these groups. For instance:
=></> SELECT * FROM test1;</>
x | y
***************
*** 1058,1064 ****
SELECT DISTINCT select_list ...
! (Instead of DISTINCT</> the word ALL
can be used to select the default behavior of retaining all rows.)
--- 1061,1067 ----
SELECT DISTINCT select_list ...
! (Instead of DISTINCT</> the key word ALL
can be used to select the default behavior of retaining all rows.)
Index: doc/src/sgml/trigger.sgml
===================================================================
RCS file: /var/lib/cvs/pgsql-server/doc/src/sgml/trigger.sgml,v
retrieving revision 1.34
diff -c -r1.34 trigger.sgml
*** a/doc/src/sgml/trigger.sgml 22 Jan 2004 19:50:21 -0000 1.34
--- b/doc/src/sgml/trigger.sgml 3 Mar 2004 22:08:16 -0000
***************
*** 449,457 ****
The function trigf</> reports the number of rows in the
! table ttest</> and skips the actual operation if the
command attempts to insert a null value into the column
! x</>. (So the trigger acts as a not-null constraint but
doesn't abort the transaction.)
--- 449,457 ----
The function trigf</> reports the number of rows in the
! table ttest</> and skips the actual operation if the
command attempts to insert a null value into the column
! x</>. (So the trigger acts as a not-null constraint but
doesn't abort the transaction.)
Index: doc/src/sgml/ref/select.sgml
===================================================================
RCS file: /var/lib/cvs/pgsql-server/doc/src/sgml/ref/select.sgml,v
retrieving revision 1.74
diff -c -r1.74 select.sgml
*** a/doc/src/sgml/ref/select.sgml 14 Dec 2003 00:15:03 -0000 1.74
--- b/doc/src/sgml/ref/select.sgml 3 Mar 2004 22:00:04 -0000
***************
*** 174,180 ****
! FROM-clause elements can contain:
--- 174,181 ----
! The FROM clause can contain the following
! elements:
***************
*** 289,304 ****
A JOIN clause combines two
FROM</> items. Use parentheses if necessary to
determine the order of nesting. In the absence of parentheses,
! JOINs nest left-to-right. In any case
! JOIN binds more tightly than the commas
! separating FROM</> items.
CROSS JOIN</> and INNER JOIN
produce a simple Cartesian product, the same result as you get from
listing the two items at the top level of FROM</>,
! but restricted by the join condition (if any).
CROSS JOIN</> is equivalent to INNER JOIN ON
(TRUE)</>, that is, no rows are removed by qualification.
These join types are just a notational convenience, since they
--- 290,305 ----
A JOIN clause combines two
FROM</> items. Use parentheses if necessary to
determine the order of nesting. In the absence of parentheses,
! JOINs nest left-to-right. In any case
! JOIN binds more tightly than the commas
! separating FROM</> items.
CROSS JOIN</> and INNER JOIN
produce a simple Cartesian product, the same result as you get from
listing the two items at the top level of FROM</>,
! but restricted by the join condition (if any).
CROSS JOIN</> is equivalent to INNER JOIN ON
(TRUE)</>, that is, no rows are removed by qualification.
These join types are just a notational convenience, since they
***************
*** 647,653 ****
INTERSECT</>, or EXCEPT</> clause may only
specify an output column name or number, not an expression.
!
If an ORDER BY</> expression is a simple name that
matches both a result column name and an input column name,
--- 648,654 ----
INTERSECT</>, or EXCEPT</> clause may only
specify an output column name or number, not an expression.
!
If an ORDER BY</> expression is a simple name that
matches both a result column name and an input column name,
Index: doc/src/sgml/ref/update.sgml
===================================================================
RCS file: /var/lib/cvs/pgsql-server/doc/src/sgml/ref/update.sgml,v
retrieving revision 1.27
diff -c -r1.27 update.sgml
*** a/doc/src/sgml/ref/update.sgml 29 Nov 2003 19:51:39 -0000 1.27
--- b/doc/src/sgml/ref/update.sgml 3 Mar 2004 22:20:39 -0000
***************
*** 32,39 ****
UPDATE changes the values of the specified
columns in all rows that satisfy the condition. Only the columns to
! be modified need be mentioned in the statement; columns not explicitly
! SET</> retain their previous values.
--- 32,39 ----
UPDATE changes the values of the specified
columns in all rows that satisfy the condition. Only the columns to
! be modified need be mentioned in the SET clause;
! columns not explicitly modified retain their previous values.
***************
*** 44,49 ****
--- 44,57 ----
+ There are two ways to modify a table using information contained in
+ other tables in the database: using sub-selects, or specifying
+ additional tables in the FROM clause. Which
+ technique is more appropriate depends on the specific
+ circumstances.
+
+
+
You must have the UPDATE privilege on the table
to update it, as well as the SELECT
privilege to any table whose values are read in the
***************
*** 99,105 ****
A list of table expressions, allowing columns from other tables
! to appear in the WHERE</> condition and the update expressions.
--- 107,118 ----
A list of table expressions, allowing columns from other tables
! to appear in the WHERE</> condition and the update
! expressions. This is similar to the list of tables that can be
! specified in the of a SELECT
! statement; for example, an alias for the table name can be
! specified.
***************
*** 139,145 ****
Change the word Drama</> to Dramatic</> in the
! column kind</> of the table films:
UPDATE films SET kind = 'Dramatic' WHERE kind = 'Drama';
--- 152,158 ----
Change the word Drama</> to Dramatic</> in the
! column kind</> of the table films:
UPDATE films SET kind = 'Dramatic' WHERE kind = 'Drama';
***************
*** 148,154 ****
Adjust temperature entries and reset precipitation to its default
! value in one row of the table weather:
UPDATE weather SET temp_lo = temp_lo+1, temp_hi = temp_lo+15, prcp = DEFAULT
--- 161,167 ----
Adjust temperature entries and reset precipitation to its default
! value in one row of the table weather:
UPDATE weather SET temp_lo = temp_lo+1, temp_hi = temp_lo+15, prcp = DEFAULT
***************
*** 156,168 ****
Compatibility
! This command conforms to the SQL standard. The
FROM clause is a
PostgreSQL extension.
--- 169,198 ----
+
+ Increment the sales count of the salesperson who manages the
+ account for Acme Corporation, using the FROM
+ clause syntax:
+
+ UPDATE employees SET sales_count = sales_count + 1 FROM accounts
+ WHERE accounts.name = 'Acme Corporation'
+ AND employees.id = accounts.sales_person;
+
+
+ Perform the same operation, using a sub-select in the
+ WHERE clause:
+
+ UPDATE employees SET sales_count = sales_count + 1 WHERE id =
+ (SELECT sales_person FROM accounts WHERE name = 'Acme Corporation');
+
+
Compatibility
! This command conforms to the SQL standard. The
FROM clause is a
PostgreSQL extension.
Re: minor doc improvements
От:
Peter Eisentraut <peter_e@gmx.net>
Дата:
Neil Conway wrote: > I've applied the attached patch to HEAD. It does the following: > > Add a few more cross-references where appropriate, add more text > about the FROM clause and an example to the UPDATE reference page, > and make a few other SGML tweaks. > > Suggestions for further improvement (for example, to the UPDATE ref > page) are welcome. ISTM that the linking changes you propose are stretching the semantics of DocBook. If you want to link, why not just use . By using plus endterm you're doing the same thing indirectly and you rely on the remote endterm having a sensible grammatical structure that fits into the local sentence.
Re: minor doc improvements
От:
Neil Conway <neilc@samurai.com>
Дата:
Peter Eisentraut wrote: > ISTM that the linking changes you propose are stretching the semantics > of DocBook. If you want to link, why not just use . By using > plus endterm you're doing the same thing indirectly and you rely > on the remote endterm having a sensible grammatical structure that fits > into the local sentence. I didn't know about the tag, thanks for the suggestion. (I won't claim to be a DocBook expert.) Can you suggest when should be used, and when is the right tag to use? (The fact that the endterm of the xref must fit into the grammatical structure of the local sentence doesn't seem like a major problem to me. If we change the endterm of *any* xref, couldn't that disturb the xref's local sentence? i.e. don't the existing uses of in the docs suffer from the same problem?) -Neil
Re: minor doc improvements
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Peter Eisentraut writes: > ISTM that the linking changes you propose are stretching the semantics > of DocBook. If you want to link, why not just use . By using > plus endterm you're doing the same thing indirectly and you rely > on the remote endterm having a sensible grammatical structure that fits > into the local sentence. I believe Neil was just copying the existing examples in our docs. What's this and how would you use it, exactly? regards, tom lane