Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit e507399

Browse files
committed
Document array behavior for out-of-range subscripts.
1 parent 2a6c032 commit e507399

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

doc/src/sgml/array.sgml

Lines changed: 14 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.42 2004/12/23 05:37:39 tgl Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/array.sgml,v 1.43 2005/02/06 20:59:30 tgl Exp $ -->
22

33
<sect1 id="arrays">
44
<title>Arrays</title>
@@ -149,7 +149,7 @@ INSERT INTO sal_emp
149149
A limitation of the present array implementation is that individual
150150
elements of an array cannot be SQL null values. The entire array
151151
can be set to null, but you can't have an array with some elements
152-
null and some not.
152+
null and some not. (This is likely to change in the future.)
153153
</para>
154154

155155
<para>
@@ -261,6 +261,18 @@ SELECT schedule[1:2][2] FROM sal_emp WHERE name = 'Bill';
261261
</programlisting>
262262
</para>
263263

264+
<para>
265+
Fetching from outside the current bounds of an array yields a
266+
SQL null value, not an error. For example, if <literal>schedule</>
267+
currently has the dimensions <literal>[1:3][1:2]</> then referencing
268+
<literal>schedule[3][3]</> yields NULL. Similarly, an array reference
269+
with the wrong number of subscripts yields a null rather than an error.
270+
Fetching an array slice that
271+
is completely outside the current bounds likewise yields a null array;
272+
but if the requested slice partially overlaps the array bounds, then it
273+
is silently reduced to just the overlapping region.
274+
</para>
275+
264276
<para>
265277
The current dimensions of any array value can be retrieved with the
266278
<function>array_dims</function> function:

0 commit comments

Comments
 (0)