Re: [DOCS] [HACKERS] switching documentation build to XSLT

2016-11-19 Thread Tom Lane
Peter Eisentraut  writes:
> If you find any changes in the output that bother you, let pgsql-docs know.

I notice that whereas  used to generate text like

Section 4.1.2.7

now you get

Section 4.1.2.7, “Constants of Other Types”

This is probably an improvement in most places, but there may be some
places where the text now reads awkwardly and we need to rephrase or
re-punctuate to make it non-confusing.  Keep an eye out for that ...

regards, tom lane


-- 
Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs


[DOCS] WIP docs patch about composite-type behavior

2016-11-19 Thread Tom Lane
There have been a couple of recent threads bemoaning our lack of clarity
about how references to composite values work, eg
https://www.postgresql.org/message-id/flat/20161029121906.15993.79158%40wrigleys.postgresql.org
https://www.postgresql.org/message-id/flat/CAGwx4BnDQZyJJpzom-UU15wh7s3DQE%3DChEdEDQ2%2Brd5S7S2UNA%40mail.gmail.com
(same instigator but distinct threads)

I suggested that we ought to try to consolidate information about this
in one place, and attached is a WIP patch to that end.  Some notes:

* I'm not completely sold on either the new section's title or its
location; but I cannot find a better location.

* Some of the text is borrowed from section 36.4.3 "SQL Functions on
Composite Types", which should probably now be shortened in favor of
linking to this section, but I didn't do that yet.  There may be more
places that should get merged in.

* I noticed that there is noplace in Part II that describes RETURNING
clauses as such; there's some material in 7.8.2 "Data-Modifying Statements
in WITH", but that really is assuming that you know what RETURNING does
already, and in any case it fails to explain the clause's use in
standalone statements.  This seems like an, um, oversight.

Comments, objections, better ideas?  Should this get back-patched?

regards, tom lane

diff --git a/doc/src/sgml/queries.sgml b/doc/src/sgml/queries.sgml
index 718262f..30d487f 100644
*** a/doc/src/sgml/queries.sgml
--- b/doc/src/sgml/queries.sgml
*** SELECT tbl1.a, tbl2.a, tbl1.b FROM ...
*** 1457,1463 
  
  SELECT tbl1.*, tbl2.a FROM ...
  
! (See also .)
 
  
 
--- 1457,1464 
  
  SELECT tbl1.*, tbl2.a FROM ...
  
! See  for more about the *
! notation.
 
  
 
diff --git a/doc/src/sgml/rowtypes.sgml b/doc/src/sgml/rowtypes.sgml
index 605dc71..23600a3 100644
*** a/doc/src/sgml/rowtypes.sgml
--- b/doc/src/sgml/rowtypes.sgml
***
*** 19,25 
column of a table can be declared to be of a composite type.
   
  
!  
Declaration of Composite Types
  
   
--- 19,25 
column of a table can be declared to be of a composite type.
   
  
!  
Declaration of Composite Types
  
   
*** CREATE TABLE inventory_item (
*** 90,96 
   
  
   
!   Composite Value Input
  

 composite type
--- 90,96 
   
  
   
!   Constructing Composite Values
  

 composite type
*** CREATE TABLE inventory_item (
*** 101,108 
 To write a composite value as a literal constant, enclose the field
 values within parentheses and separate them by commas.  You can put double
 quotes around any field value, and must do so if it contains commas or
!parentheses.  (More details appear below.)  Thus, the general format of a
!composite constant is the following:
  
  '( val1 , val2 , ... )'
  
--- 101,109 
 To write a composite value as a literal constant, enclose the field
 values within parentheses and separate them by commas.  You can put double
 quotes around any field value, and must do so if it contains commas or
!parentheses.  (More details appear below.)  Thus, the general format of
!a composite constant is the following:
  
  '( val1 , val2 , ... )'
  
*** CREATE TABLE inventory_item (
*** 129,135 
 the generic type constants discussed in .  The constant is initially
 treated as a string and passed to the composite-type input conversion
!routine.  An explicit type specification might be necessary.)

  
   
--- 130,137 
 the generic type constants discussed in .  The constant is initially
 treated as a string and passed to the composite-type input conversion
!routine.  An explicit type specification might be necessary to tell
!which type to convert the constant to.)

  
   
*** ROW('fuzzy dice', 42, 1.99)
*** 143,149 
  ROW('', 42, NULL)
  
The ROW keyword is actually optional as long as you have more than one
!   field in the expression, so these can simplify to:
  
  ('fuzzy dice', 42, 1.99)
  ('', 42, NULL)
--- 145,151 
  ROW('', 42, NULL)
  
The ROW keyword is actually optional as long as you have more than one
!   field in the expression, so these can be simplified to:
  
  ('fuzzy dice', 42, 1.99)
  ('', 42, NULL)
*** ROW('', 42, NULL)
*** 153,159 
   
   
  
!  
Accessing Composite Types
  
   
--- 155,161 
   
   
  
!  
Accessing Composite Types
  
   
*** SELECT (my_func(...)).field FROM ...
*** 198,203 
--- 200,210 
  
Without the extra parentheses, this will generate a syntax error.
   
+ 
+  
+   The special field name * means all
+   fields, as further explained in .
+  
   
  
   
*** INSERT INTO mytab (complex_col.r, comple
*** 243,248 
--- 250,447 
   
   
  
+  
+   Using Composite Types in Queries
+ 
+   
+There are various special syntax rules and behaviors associated with
+comp