From: Bruce Momjian Date: Tue, 20 Feb 2007 14:34:25 +0000 (+0000) Subject: Update array slice documentation to be clearer. X-Git-Tag: REL8_3_BETA1~1155 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1b52359d90d4830dd687d473089a4bfdecba9684;p=postgresql Update array slice documentation to be clearer. --- diff --git a/doc/src/sgml/array.sgml b/doc/src/sgml/array.sgml index 3fe542446b..246ca38281 100644 --- a/doc/src/sgml/array.sgml +++ b/doc/src/sgml/array.sgml @@ -1,4 +1,4 @@ - + Arrays @@ -243,18 +243,14 @@ SELECT schedule[1:2][1:1] FROM sal_emp WHERE name = 'Bill'; (1 row) - We could also have written: + If any dimmension is written as a slice, i.e contains a colon, then all + dimmensions are treated as slices. If a dimmension is missing, it is + assumed to be [1:1]. If a dimmension has only a single + number (no colon), that dimmension is treated as being from 1 + to the number specified. For example, [2] is treated as + [1:2], as in this example: -SELECT schedule[1:2][1] FROM sal_emp WHERE name = 'Bill'; - - - with the same result. An array subscripting operation is always taken to - represent an array slice if any of the subscripts are written in the form - lower:upper. - A lower bound of 1 is assumed for any subscript where only one value - is specified, as in this example: - SELECT schedule[1:2][2] FROM sal_emp WHERE name = 'Bill'; schedule