Re: multiple function execute using (func()).* - Mailing list pgsql-hackers

From Jeff
Subject Re: multiple function execute using (func()).*
Date
Msg-id 3914E2A9-CA96-4447-8DB1-D91B0BB9BB2D@torgo.978.org
Whole thread Raw
In response to multiple function execute using (func()).*  ("Merlin Moncure" <mmoncure@gmail.com>)
List pgsql-hackers
On Dec 8, 2008, at 5:15 PM, Merlin Moncure wrote:

> Hello,
>
> I've been bit by this about a million times:
>
> select (func()).* executes the function once per each field in the
> returned tuple.  See the example below:
>

I ran into this exact problem a week or two ago.

I didn't dig too far into it but I figured (func()).* was being  
expanded by the parser into func().a, func().b and friends. marking it  
stable didn't help.

It can be quite surprising, especially if func() is expensive (as was  
my case) or has side effects.

--
Jeff Trout <jeff@jefftrout.com>
http://www.stuarthamm.net/
http://www.dellsmartexitin.com/





pgsql-hackers by date:

Previous
From: "Pavel Stehule"
Date:
Subject: Re: WIP: default values for function parameters
Next
From: Gregory Stark
Date:
Subject: posix_fadvise v22