- publishing free software manuals
The PostgreSQL 9.0 Reference Manual - Volume 1A - SQL Language Reference
by The PostgreSQL Global Development Group
Paperback (6"x9"), 454 pages
ISBN 9781906966041
RRP £14.95 ($19.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 can 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.14 Arrays for more about arrays.

ISBN 9781906966041The PostgreSQL 9.0 Reference Manual - Volume 1A - SQL Language ReferenceSee the print edition