Re: pl/pgsql and arrays[] - Mailing list pgsql-general

From Pavel Stehule
Subject Re: pl/pgsql and arrays[]
Date
Msg-id CAFj8pRB2Kp_2SdXJ2-8KgEx46=6aJW5Nk1TMCT8ht5DEXCHdKA@mail.gmail.com
Whole thread Raw
In response to pl/pgsql and arrays[]  (Maxim Boguk <maxim.boguk@gmail.com>)
Responses Re: pl/pgsql and arrays[]
List pgsql-general
Hello

it work on my pc

postgres=# \sf fx
CREATE OR REPLACE FUNCTION public.fx()
 RETURNS SETOF integer
 LANGUAGE plpgsql
AS $function$ declare g int[] = '{20}';
begin
  return next g[1];
  return;
end;
$function$
postgres=# select fx();
 fx
----
 20
(1 row)

regards

Pavel Stehule

2011/12/5 Maxim Boguk <maxim.boguk@gmail.com>:
> Some quetions about pl/pgsql and arrays[].
>
> Is such constructions as:
>
> RETURN NEXT array[1];
>
> OR
>
> SELECT val INTO array[1] FROM ...;
>
> Should not work?
>
> At least documentation about RETURN NEXT  says:
> "RETURN NEXT expression;"
>
> I think array[1] is a valid expression.
>
> --
> Maxim Boguk
> Senior Postgresql DBA.

pgsql-general by date:

Previous
From: Maxim Boguk
Date:
Subject: Re: WITH and WITH RECURSIVE in single query
Next
From: Maxim Boguk
Date:
Subject: Re: pl/pgsql and arrays[]