Re: Anonymous code block with parameters

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Andres Freund <andres(at)2ndquadrant(dot)com>
Cc: Vik Fearing <vik(dot)fearing(at)dalibo(dot)com>, Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>, Craig Ringer <craig(at)2ndquadrant(dot)com>, Kalyanov Dmitry <kalyanov(dot)dmitry(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Anonymous code block with parameters
Date: 2014-09-18 11:44:47
Message-ID: CAFj8pRChWtJpw-+ZvL9Z1hyeqPDtvNjOPj3v436tn=Y8UKpspw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2014-09-18 13:40 GMT+02:00 Andres Freund <andres(at)2ndquadrant(dot)com>:

> On 2014-09-17 22:17:22 +0200, Pavel Stehule wrote:
> > 2014-09-17 22:07 GMT+02:00 Vik Fearing <vik(dot)fearing(at)dalibo(dot)com>:
> >
> > > On 09/16/2014 10:09 AM, Heikki Linnakangas wrote:
> > > > On 09/16/2014 10:57 AM, Craig Ringer wrote:
> > > >> 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"?
> > > >
> > > > Sure, why not.
> > >
> > > Because you still have to do
> > >
> > > SELECT pg_temp.my_temp_function(blah);
> > >
> > > to execute it.
> > >
> >
> > this problem should be solvable. I can to use a temporary tables without
> > using pg_temp schema.
>
> I fail to see why that is so much preferrable for you to passing
> parameter to DO?

> 1) You need to think about unique names for functions
> 2) Doesn't work on HOT STANDBYs
> 3) Causes noticeable amount of catalog bloat
> 4) Is about a magnitude or two more expensive
>

1. I am not against simple DO, what doesn't substitute functions

2. When DO have to substitute functions, then I don't see a benefits

Show me real use case please?

Pavel

>
> So yes, TEMPORARY FUNCTION would be helpful. But it's simply a different
> feature.
>
> Greetings,
>
> Andres Freund
>
> --
> Andres Freund http://www.2ndQuadrant.com/
> PostgreSQL Development, 24x7 Support, Training & Services
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Martijn van Oosterhout 2014-09-18 11:46:49 Re: Collations and Replication; Next Steps
Previous Message Andres Freund 2014-09-18 11:40:39 Re: Anonymous code block with parameters