Re: PL/pgSQL: How to return two columns and multiple rows

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Sven Geggus <lists(at)fuchsschwanzdomain(dot)de>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: PL/pgSQL: How to return two columns and multiple rows
Date: 2015-06-18 15:49:42
Message-ID: 20150618154942.GH133018@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Sven Geggus wrote:

> Using your suggestion the desired two columns are generated, but I consider
> this a little bit ugly:
>
> mydb=> WITH exec_func AS ( select myfunc(col1,col2) from mytable )
> SELECT (exec_func.myfunc).* FROM exec_func;
> HINWEIS: called with parms foo,bar: text1 value1
> HINWEIS: called with parms foo,bar: text2 value2

What's wrong with a plain subselect?

select (myfunc).* from (select myfunc(col1,col2) from mytable) f;

--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Sven Geggus 2015-06-18 16:00:00 Re: PL/pgSQL: How to return two columns and multiple rows
Previous Message David G. Johnston 2015-06-18 14:49:26 Re: PL/pgSQL: How to return two columns and multiple rows