On 09/23/2014 07:20 AM, Petr Jelinek wrote:
>>
>>
>> So, to me, DO vs CREATE FUNCTION has nothing to do with passing
>> arguments and/or returning data. It has to do with lifespan; single
>> call of the function body only, use DO, otherwise, create a function.
>>
>
> Actually same thing happened with the DO implementation itself -
> creating anonymous/hidden temporary functions in the background was also
> considered but was decided it's not acceptable (for similar reason temp
> tables were rejected for WITH).
>
> So we decided at least twice already that this kind of solution is bad,
> I don't know of any change that would invalidate the reasons for
> deciding that way so I don't see why they would suddenly become
> acceptable...
All good points. I was wrong to suggest just going for TEMPORARY
FUNCTION before, there's clearly a useful place for DO with parameters.
-- Craig Ringer http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training & Services