diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index a9962987a3..79e97840fb 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -17926,7 +17926,8 @@ SELECT NULLIF(value, '(none)') ...
setof anyelement
- Expands an array to a set of rows.
+ Expands an array into a set of rows.
+ The array's elements are read out in storage order.
unnest(ARRAY[1,2])
@@ -17934,6 +17935,16 @@ SELECT NULLIF(value, '(none)') ...
1
2
+
+
+
+ unnest(ARRAY[['foo','bar'],['baz','quux']])
+
+
+ foo
+ bar
+ baz
+ quux
@@ -17944,10 +17955,10 @@ SELECT NULLIF(value, '(none)') ...
setof anyelement, anyelement [, ... ]
- Expands multiple arrays (possibly of different data types) to a set of
+ Expands multiple arrays (possibly of different data types) into a set of
rows. If the arrays are not all the same length then the shorter ones
- are padded with NULLs. This is only allowed in a
- query's FROM clause; see .
+ are padded with NULLs. This form is only allowed
+ in a query's FROM clause; see .
select * from unnest(ARRAY[1,2], ARRAY['foo','bar','baz']) as x(a,b)
diff --git a/doc/src/sgml/ref/select.sgml b/doc/src/sgml/ref/select.sgml
index 94889b66b4..982835d53e 100644
--- a/doc/src/sgml/ref/select.sgml
+++ b/doc/src/sgml/ref/select.sgml
@@ -476,9 +476,17 @@ TABLE [ ONLY ] table_name [ * ]
result sets, but any function can be used.) This acts as
though the function's output were created as a temporary table for the
duration of this single SELECT command.
- When the optional WITH ORDINALITY clause is
- added to the function call, a new column is appended after
- all the function's output columns with numbering for each row.
+ If the function's result type is composite (including the case of a
+ function with multiple OUT parameters), each
+ attribute becomes a separate column in the implicit table.
+
+
+
+ When the optional WITH ORDINALITY clause is added
+ to the function call, an additional column of type bigint
+ will be appended to the function's result column(s). This column
+ numbers the rows of the function's result set, starting from 1.
+ By default, this column is named ordinality.
@@ -486,8 +494,7 @@ TABLE [ ONLY ] table_name [ * ]
If an alias is written, a column
alias list can also be written to provide substitute names for
one or more attributes of the function's composite return
- type, including the column added by ORDINALITY
- if present.
+ type, including the ordinality column if present.