Skip to content

Commit 9469d08

Browse files
committed
Improve documentation for odd array slice behavior.
1 parent c22de39 commit 9469d08

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

doc/src/sgml/array.sgml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/array.sgml,v 1.62 2007/06/07 14:49:56 tgl Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/array.sgml,v 1.63 2008/03/26 14:43:20 momjian Exp $ -->
22

33
<sect1 id="arrays">
44
<title>Arrays</title>
@@ -258,6 +258,9 @@ SELECT schedule[1:2][2] FROM sal_emp WHERE name = 'Bill';
258258
{{meeting,lunch},{training,presentation}}
259259
(1 row)
260260
</programlisting>
261+
262+
To avoid confusion with slices, use slice syntax for all dimmension
263+
references, e.g. <literal>[1:2][1:1]</>, not <literal>[2][1:1]</>.
261264
</para>
262265

263266
<para>
@@ -275,7 +278,8 @@ SELECT schedule[1:2][2] FROM sal_emp WHERE name = 'Bill';
275278
any of the subscript expressions are null. However, in other corner
276279
cases such as selecting an array slice that
277280
is completely outside the current array bounds, a slice expression
278-
yields an empty (zero-dimensional) array instead of null.
281+
yields an empty (zero-dimensional) array instead of null. (This
282+
does not match non-slice behavior and is done for historical reasons.)
279283
If the requested slice partially overlaps the array bounds, then it
280284
is silently reduced to just the overlapping region.
281285
</para>

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy