Update array slice documentation to be clearer.
This commit is contained in:
parent
265124e7e0
commit
1b52359d90
@ -1,4 +1,4 @@
|
||||
<!-- $PostgreSQL: pgsql/doc/src/sgml/array.sgml,v 1.56 2007/02/01 00:28:16 momjian Exp $ -->
|
||||
<!-- $PostgreSQL: pgsql/doc/src/sgml/array.sgml,v 1.57 2007/02/20 14:34:25 momjian Exp $ -->
|
||||
|
||||
<sect1 id="arrays">
|
||||
<title>Arrays</title>
|
||||
@ -243,18 +243,14 @@ SELECT schedule[1:2][1:1] FROM sal_emp WHERE name = 'Bill';
|
||||
(1 row)
|
||||
</programlisting>
|
||||
|
||||
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 <literal>[1:1]</>. If a dimmension has only a single
|
||||
number (no colon), that dimmension is treated as being from <literal>1</>
|
||||
to the number specified. For example, <literal>[2]</> is treated as
|
||||
<literal>[1:2], as in this example:
|
||||
|
||||
<programlisting>
|
||||
SELECT schedule[1:2][1] FROM sal_emp WHERE name = 'Bill';
|
||||
</programlisting>
|
||||
|
||||
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
|
||||
<literal><replaceable>lower</replaceable>:<replaceable>upper</replaceable></literal>.
|
||||
A lower bound of 1 is assumed for any subscript where only one value
|
||||
is specified, as in this example:
|
||||
<programlisting>
|
||||
SELECT schedule[1:2][2] FROM sal_emp WHERE name = 'Bill';
|
||||
|
||||
schedule
|
||||
|
Loading…
x
Reference in New Issue
Block a user