Re: Return unknown resultset from a function

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Jan Meyland Andersen <jma(at)agile(dot)dk>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Return unknown resultset from a function
Date: 2012-03-04 19:57:13
Message-ID: CAFj8pRAz7Ad4RNF0L_NOWZE83Du4D5xUu7+74auSEpaeD3cXbw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello

2012/3/4 Jan Meyland Andersen <jma(at)agile(dot)dk>:
> How do I return an unknown resultset from a function
>
> My main problem is that I do not know how many columns or the data type of
> the columns before runtime.
> It this possible at all?
>

no, or it is not possible simply. PostgreSQL is strongly typed.

I know only one workaround - using refcursor

http://okbob.blogspot.com/2008/08/using-cursors-for-generating-cross.html

Regards

Pavel Stehule

> I also tried to return the data as a text array but I also have trouble with
> that.
>
> Regards
>
> Jan
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general

In response to

Browse pgsql-general by date

  From Date Subject
Next Message David Johnston 2012-03-04 20:00:24 Re: Return unknown resultset from a function
Previous Message Jan Meyland Andersen 2012-03-04 19:52:18 Return unknown resultset from a function