Re: Acccessing individual array elements form plpgsql - Mailing list pgsql-novice

From Tom Lane
Subject Re: Acccessing individual array elements form plpgsql
Date
Msg-id 5984.1110581209@sss.pgh.pa.us
Whole thread Raw
In response to Acccessing individual array elements form plpgsql  ("Celia McInnis" <celia@drmath.ca>)
Responses Re: Acccessing individual array elements form plpgsql
List pgsql-novice
"Celia McInnis" <celia@drmath.ca> writes:
> but how do I access members of this array individually??? I'd love it if
> direction[1] would pull out the 2nd or 1st element so that I could use it in
> the selects which my procedure is forming, but I get syntax errors when I try
> to reference the array element in such a way. For example:

>  RAISE NOTICE '%',direction[1];
>  ERROR:  syntax error at or near "[" at character ####

The RAISE statement is pretty limited: it won't take a general
expression as an argument, only a bare variable name.  But you should be
able to subscript direction in other contexts.  If you really need to
put out a notice using this value, assign it to a temporary variable ...

            regards, tom lane

pgsql-novice by date:

Previous
From: "Celia McInnis"
Date:
Subject: Acccessing individual array elements form plpgsql
Next
From: "Celia McInnis"
Date:
Subject: Re: Acccessing individual array elements form plpgsql