aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2005-02-06 20:59:37 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2005-02-06 20:59:37 +0000
commitc31570ed436eac374beeb03e6864be56914c3c04 (patch)
tree2b0009571b2b487291c55f040faddc9447076059
parent0aeb7d8008473231c01ba5dc835c5de145905320 (diff)
downloadpostgresql-c31570ed436eac374beeb03e6864be56914c3c04.tar.gz
postgresql-c31570ed436eac374beeb03e6864be56914c3c04.zip
Document array behavior for out-of-range subscripts.
-rw-r--r--doc/src/sgml/array.sgml16
1 files changed, 14 insertions, 2 deletions
diff --git a/doc/src/sgml/array.sgml b/doc/src/sgml/array.sgml
index 94a1b8aacce..9832dbebcb2 100644
--- a/doc/src/sgml/array.sgml
+++ b/doc/src/sgml/array.sgml
@@ -1,4 +1,4 @@
-<!-- $PostgreSQL: pgsql/doc/src/sgml/array.sgml,v 1.42 2004/12/23 05:37:39 tgl Exp $ -->
+<!-- $PostgreSQL: pgsql/doc/src/sgml/array.sgml,v 1.42.4.1 2005/02/06 20:59:37 tgl Exp $ -->
<sect1 id="arrays">
<title>Arrays</title>
@@ -149,7 +149,7 @@ INSERT INTO sal_emp
A limitation of the present array implementation is that individual
elements of an array cannot be SQL null values. The entire array
can be set to null, but you can't have an array with some elements
- null and some not.
+ null and some not. (This is likely to change in the future.)
</para>
<para>
@@ -262,6 +262,18 @@ SELECT schedule[1:2][2] FROM sal_emp WHERE name = 'Bill';
</para>
<para>
+ Fetching from outside the current bounds of an array yields a
+ SQL null value, not an error. For example, if <literal>schedule</>
+ currently has the dimensions <literal>[1:3][1:2]</> then referencing
+ <literal>schedule[3][3]</> yields NULL. Similarly, an array reference
+ with the wrong number of subscripts yields a null rather than an error.
+ Fetching an array slice that
+ is completely outside the current bounds likewise yields a null array;
+ but if the requested slice partially overlaps the array bounds, then it
+ is silently reduced to just the overlapping region.
+ </para>
+
+ <para>
The current dimensions of any array value can be retrieved with the
<function>array_dims</function> function: