From fa5ec51474af94713e90d85fa7b96c6989e8dc5e Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Thu, 7 Jun 2007 14:50:18 +0000 Subject: [PATCH] Fix array_dims() example to be consistent with the data previously shown. Christian Rossow --- doc/src/sgml/array.sgml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/doc/src/sgml/array.sgml b/doc/src/sgml/array.sgml index f434cf29af..15abda6dab 100644 --- a/doc/src/sgml/array.sgml +++ b/doc/src/sgml/array.sgml @@ -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.) @@ -261,6 +261,18 @@ SELECT schedule[1:2][2] FROM sal_emp WHERE name = 'Bill'; + + Fetching from outside the current bounds of an array yields a + SQL null value, not an error. For example, if schedule + currently has the dimensions [1:3][1:2] then referencing + 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. + + The current dimensions of any array value can be retrieved with the array_dims function: @@ -270,7 +282,7 @@ SELECT array_dims(schedule) FROM sal_emp WHERE name = 'Carol'; array_dims ------------ - [1:2][1:1] + [1:2][1:2] (1 row) -- 2.39.5