- publishing free software manuals
PostgreSQL Reference Manual - Volume 1 - SQL Language Reference
by The PostgreSQL Global Development Group
Paperback (6"x9"), 716 pages
ISBN 0954612027
RRP £32.00 ($49.95)

Sales of this book support the PostgreSQL project! Get a printed copy>>>

2.2.3 Subscripts

If an expression yields a value of an array type, then a specific element of the array value can be extracted by writing


or multiple adjacent elements (an “array slice”) can be extracted by writing


(Here, the brackets [ ] are meant to appear literally.) Each subscript is itself an expression, which must yield an integer value.

In general the array expression must be parenthesized, but the parentheses may be omitted when the expression to be subscripted is just a column reference or positional parameter. Also, multiple subscripts can be concatenated when the original array is multidimensional. For example,


The parentheses in the last example are required. See section 6.10 Arrays for more about arrays.

ISBN 0954612027PostgreSQL Reference Manual - Volume 1 - SQL Language ReferenceSee the print edition