Skip to content

Commit 376b96e

Browse files
author
hackorum
committed
Apply array-docs-multidimension-clarifications.diff
1 parent b597835 commit 376b96e

1 file changed

Lines changed: 26 additions & 1 deletion

File tree

doc/src/sgml/array.sgml

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@
1414
or domain can be created.
1515
</para>
1616

17+
<note>
18+
A multi-dimensional array is not the same as an array-of-arrays. In
19+
particular it is not useful to access a two-dimensional array with
20+
a single dimension - you will be given null instead of an array
21+
containing the elements of the specified row.
22+
</note>
1723
<sect2 id="arrays-declaration">
1824
<title>Declaration of Array Types</title>
1925

@@ -115,7 +121,7 @@ CREATE TABLE tictactoe (
115121
'{{1,2,3},{4,5,6},{7,8,9}}'
116122
</programlisting>
117123
This constant is a two-dimensional, 3-by-3 array consisting of
118-
three subarrays of integers.
124+
nine integers.
119125
</para>
120126

121127
<para>
@@ -373,6 +379,25 @@ SELECT cardinality(schedule) FROM sal_emp WHERE name = 'Carol';
373379
-------------
374380
4
375381
(1 row)
382+
</programlisting>
383+
</para>
384+
385+
<para>
386+
<function>unnest</function>, and other iteration access of arrays, is performed
387+
depth-first, for each lower dimension all higher dimension cells are returned
388+
before the next lower bound index. For a two-dimensional array this is termed
389+
row-first.
390+
391+
<programlisting>
392+
SELECT unnest(schedule) FROM sal_emp WHERE name = 'Bill';
393+
394+
unnest
395+
--------------
396+
meeting
397+
lunch
398+
training
399+
presentation
400+
(4 rows)
376401
</programlisting>
377402
</para>
378403
</sect2>

0 commit comments

Comments
 (0)