Re: calling a function over several rows

From: Adam Rich <adam(dot)r(at)sbcglobal(dot)net>
To: Merlin Moncure <mmoncure(at)gmail(dot)com>
Cc: postgresql Forums <pgsql-general(at)postgresql(dot)org>
Subject: Re: calling a function over several rows
Date: 2009-11-17 06:35:01
Message-ID: 4B024415.8040500@sbcglobal.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Merlin Moncure wrote:
> On Tue, Nov 17, 2009 at 1:02 AM, Adam Rich <adam(dot)r(at)sbcglobal(dot)net> wrote:
>> Hello,
>> There is an existing function which takes an integer and returns a record.
>> I need to call this function with every integer in a table. Is there a
>> simple shortcut for doing this?
>>
>> I'm looking for something like:
>>
>> select f.*
>> from function(t.value) f, table t
>
> select (f).* from (select function(t.value) as f from table t) q;
>
> merlin
>

Thanks, that's perfect, and much faster than the one I came up with in
the interim:

select (f(t.value)).* from table t;

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Nick 2009-11-17 08:13:57 Re: Can anyone help setting up pgbouncer?
Previous Message Nathan Jahnke 2009-11-17 06:34:01 plperl: spi_query_prepared/spi_fetchrow versus spi_exec_prepared: memory?