|
1 |
| -<!-- $PostgreSQL: pgsql/doc/src/sgml/array.sgml,v 1.56 2007/02/01 00:28:16 momjian Exp $ --> |
| 1 | +<!-- $PostgreSQL: pgsql/doc/src/sgml/array.sgml,v 1.57 2007/02/20 14:34:25 momjian Exp $ --> |
2 | 2 |
|
3 | 3 | <sect1 id="arrays">
|
4 | 4 | <title>Arrays</title>
|
@@ -243,18 +243,14 @@ SELECT schedule[1:2][1:1] FROM sal_emp WHERE name = 'Bill';
|
243 | 243 | (1 row)
|
244 | 244 | </programlisting>
|
245 | 245 |
|
246 |
| - We could also have written: |
| 246 | + If any dimmension is written as a slice, i.e contains a colon, then all |
| 247 | + dimmensions are treated as slices. If a dimmension is missing, it is |
| 248 | + assumed to be <literal>[1:1]</>. If a dimmension has only a single |
| 249 | + number (no colon), that dimmension is treated as being from <literal>1</> |
| 250 | + to the number specified. For example, <literal>[2]</> is treated as |
| 251 | + <literal>[1:2], as in this example: |
247 | 252 |
|
248 | 253 | <programlisting>
|
249 |
| -SELECT schedule[1:2][1] FROM sal_emp WHERE name = 'Bill'; |
250 |
| -</programlisting> |
251 |
| - |
252 |
| - with the same result. An array subscripting operation is always taken to |
253 |
| - represent an array slice if any of the subscripts are written in the form |
254 |
| - <literal><replaceable>lower</replaceable>:<replaceable>upper</replaceable></literal>. |
255 |
| - A lower bound of 1 is assumed for any subscript where only one value |
256 |
| - is specified, as in this example: |
257 |
| -<programlisting> |
258 | 254 | SELECT schedule[1:2][2] FROM sal_emp WHERE name = 'Bill';
|
259 | 255 |
|
260 | 256 | schedule
|
|