Re: pl/pgsql and arrays[]

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Maxim Boguk <maxim(dot)boguk(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: pl/pgsql and arrays[]
Date: 2011-12-05 04:53:25
Message-ID: CAFj8pRB2Kp_2SdXJ2-8KgEx46=6aJW5Nk1TMCT8ht5DEXCHdKA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(dot)boguk(at)gmail(dot)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.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Maxim Boguk 2011-12-05 05:11:53 Re: pl/pgsql and arrays[]
Previous Message Maxim Boguk 2011-12-05 04:35:12 Re: WITH and WITH RECURSIVE in single query