Re: [GENERAL] pl/pgsql and arrays[]

2011-12-05 Thread Pavel Stehule
2011/12/5 Tom Lane : > Pavel Stehule writes: >> return next in function that returns composite type needs a composite >> variable. Other cases are not supported there. > > Plain "return" has the same limitation, but this really ought to be > fixed sometime.  Composite types have been getting close

Re: [GENERAL] pl/pgsql and arrays[]

2011-12-05 Thread Tom Lane
Pavel Stehule writes: > return next in function that returns composite type needs a composite > variable. Other cases are not supported there. Plain "return" has the same limitation, but this really ought to be fixed sometime. Composite types have been getting closer and closer to first-class st

Re: [GENERAL] pl/pgsql and arrays[]

2011-12-04 Thread Pavel Stehule
2011/12/5 Maxim Boguk : > > > On Mon, Dec 5, 2011 at 3:53 PM, Pavel Stehule > wrote: >> >> 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 ne

Re: [GENERAL] pl/pgsql and arrays[]

2011-12-04 Thread Maxim Boguk
On Mon, Dec 5, 2011 at 3:53 PM, Pavel Stehule wrote: > 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$ > post

Re: [GENERAL] pl/pgsql and arrays[]

2011-12-04 Thread Pavel Stehule
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 Maxi

[GENERAL] pl/pgsql and arrays[]

2011-12-04 Thread Maxim Boguk
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 Postgres