Update array slice documentation to be clearer.
authorBruce Momjian
Tue, 20 Feb 2007 14:34:25 +0000 (14:34 +0000)
committerBruce Momjian
Tue, 20 Feb 2007 14:34:25 +0000 (14:34 +0000)
doc/src/sgml/array.sgml

index 3fe542446b88ec61e1da3f234f7487a3983ec599..246ca3828123c2ada809cd510f1a7aab79508dee 100644 (file)
@@ -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