Re: Anonymous code block with parameters
Craig Ringer <craig@2ndquadrant.com>
From: Craig Ringer <craig@2ndquadrant.com>
To: Pavel Stehule <pavel.stehule@gmail.com>,
Heikki Linnakangas <hlinnakangas@vmware.com>
Cc: Kalyanov Dmitry <kalyanov.dmitry@gmail.com>,
PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2014-09-16T07:57:49Z
Lists: pgsql-hackers
On 09/16/2014 03:15 PM, Pavel Stehule wrote: > Why we don't introduce a temporary functions instead? I think that'd be a lot cleaner and simpler. It's something I've frequently wanted, and as Hekki points out it's already possible by creating the function in pg_temp, there just isn't the syntax sugar for "CREATE TEMPORARY FUNCTION". So why not just add "CREATE TEMPORARY FUNCTION"? It means two steps: CREATE TEMPORARY FUNCTION ... $$ $$; SELECT my_temp_function(blah); but I'm not personally convinced that a parameterised DO block is much easier, and the idea just rings wrong to me. I agree with Pavel that the natural way to parameterise DO blocks, down the track, will be to allow them to get (and set?) SQL-typed session variables. Of course, we'd need to support them first ;-) -- Craig Ringer http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services