Re: pl/pgsql array return - Mailing list pgsql-jdbc

From Tom Lane
Subject Re: pl/pgsql array return
Date
Msg-id 29080.1013617618@sss.pgh.pa.us
Whole thread Raw
In response to Re: pl/pgsql array return  ("Dave Cramer" <Dave@micro-automation.net>)
List pgsql-jdbc
> I hope someone can help me.  Is it possible to return an array of
> results from a query in a function in pl/pgsql and get this result via
> the jdbc.  Could someone send me an example of how this is done.

You can return an array value from plpgsql, no problem.  The problem is
that plpgsql is pretty weak on functionality for constructing an array
value on the fly.  I think the only way that would work is to build up
a textual representation of an array literal ('{foo,bar,baz}') and then
rely on runtime type conversion to do the right thing when you try to
RETURN the text string from a function declared as returning int[] or
whatever.

You might have better luck doing this in pltcl or plperl, either of
which have string-mashing facilities far superior to plpgsql.

            regards, tom lane

pgsql-jdbc by date:

Previous
From: "Peter V. Cooper"
Date:
Subject: Re: problem with storing BLOBs larger then 2MB
Next
From: "Nick Fankhauser"
Date:
Subject: Re: problem with storing BLOBs larger then 2MB