|
1 |
| -<!-- $PostgreSQL: pgsql/doc/src/sgml/array.sgml,v 1.64 2008/03/26 16:34:47 tgl Exp $ --> |
| 1 | +<!-- $PostgreSQL: pgsql/doc/src/sgml/array.sgml,v 1.65 2008/04/27 04:33:27 alvherre Exp $ --> |
2 | 2 |
|
3 | 3 | <sect1 id="arrays">
|
4 | 4 | <title>Arrays</title>
|
|
15 | 15 | Arrays of domains are not yet supported.
|
16 | 16 | </para>
|
17 | 17 |
|
18 |
| - <sect2> |
| 18 | + <sect2 id="arrays-declaration"> |
19 | 19 | <title>Declaration of Array Types</title>
|
20 | 20 |
|
| 21 | + <indexterm> |
| 22 | + <primary>array</primary> |
| 23 | + <secondary>declaration</secondary> |
| 24 | + </indexterm> |
| 25 | + |
21 | 26 | <para>
|
22 | 27 | To illustrate the use of array types, we create this table:
|
23 | 28 | <programlisting>
|
@@ -77,7 +82,7 @@ CREATE TABLE tictactoe (
|
77 | 82 | </para>
|
78 | 83 | </sect2>
|
79 | 84 |
|
80 |
| - <sect2> |
| 85 | + <sect2 id="arrays-input"> |
81 | 86 | <title>Array Value Input</title>
|
82 | 87 |
|
83 | 88 | <indexterm>
|
@@ -189,9 +194,14 @@ ERROR: multidimensional arrays must have array expressions with matching dimens
|
189 | 194 | </para>
|
190 | 195 | </sect2>
|
191 | 196 |
|
192 |
| - <sect2> |
| 197 | + <sect2 id="arrays-accessing"> |
193 | 198 | <title>Accessing Arrays</title>
|
194 | 199 |
|
| 200 | + <indexterm> |
| 201 | + <primary>array</primary> |
| 202 | + <secondary>accessing</secondary> |
| 203 | + </indexterm> |
| 204 | + |
195 | 205 | <para>
|
196 | 206 | Now, we can run some queries on the table.
|
197 | 207 | First, we show how to access a single element of an array at a time.
|
@@ -315,9 +325,14 @@ SELECT array_upper(schedule, 1) FROM sal_emp WHERE name = 'Carol';
|
315 | 325 | </para>
|
316 | 326 | </sect2>
|
317 | 327 |
|
318 |
| - <sect2> |
| 328 | + <sect2 id="arrays-modifying"> |
319 | 329 | <title>Modifying Arrays</title>
|
320 | 330 |
|
| 331 | + <indexterm> |
| 332 | + <primary>array</primary> |
| 333 | + <secondary>modifying</secondary> |
| 334 | + </indexterm> |
| 335 | + |
321 | 336 | <para>
|
322 | 337 | An array value can be replaced completely:
|
323 | 338 |
|
@@ -489,9 +504,14 @@ SELECT array_cat(ARRAY[5,6], ARRAY[[1,2],[3,4]]);
|
489 | 504 | </para>
|
490 | 505 | </sect2>
|
491 | 506 |
|
492 |
| - <sect2> |
| 507 | + <sect2 id="arrays-searching"> |
493 | 508 | <title>Searching in Arrays</title>
|
494 | 509 |
|
| 510 | + <indexterm> |
| 511 | + <primary>array</primary> |
| 512 | + <secondary>searching</secondary> |
| 513 | + </indexterm> |
| 514 | + |
495 | 515 | <para>
|
496 | 516 | To search for a value in an array, you must check each value of the
|
497 | 517 | array. This can be done by hand, if you know the size of the array.
|
@@ -533,9 +553,14 @@ SELECT * FROM sal_emp WHERE 10000 = ALL (pay_by_quarter);
|
533 | 553 | </tip>
|
534 | 554 | </sect2>
|
535 | 555 |
|
536 |
| - <sect2> |
| 556 | + <sect2 id="arrays-io"> |
537 | 557 | <title>Array Input and Output Syntax</title>
|
538 | 558 |
|
| 559 | + <indexterm> |
| 560 | + <primary>array</primary> |
| 561 | + <secondary>I/O</secondary> |
| 562 | + </indexterm> |
| 563 | + |
539 | 564 | <para>
|
540 | 565 | The external text representation of an array value consists of items that
|
541 | 566 | are interpreted according to the I/O conversion rules for the array's
|
|
0 commit comments