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 12:37:26
Message-ID: CAFj8pRBkHpPt6cO0HxgWHzThEqm09WSbAMC++=stfby0v+OWog@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2014-09-18 13:59 GMT+02:00 Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>:

>
>
> 2014-09-18 13:53 GMT+02:00 Andres Freund <andres(at)2ndquadrant(dot)com>:
>
>> On 2014-09-18 13:51:56 +0200, Pavel Stehule wrote:
>> > 2014-09-18 13:48 GMT+02:00 Andres Freund <andres(at)2ndquadrant(dot)com>:
>> >
>> > > On 2014-09-18 13:44:47 +0200, Pavel Stehule wrote:
>> > > Isn't being able to do this on a standby a fundamental enough
>> advantage?
>> > > Being significantly cheaper? Needing fewer roundtrips?
>> > >
>> >
>> > no, I don't need more. My opinion is, so this proposal has no real
>> benefit,
>> > but will do implement redundant functionality.
>>
>> FFS: What's redundant about being able to do this on a standby?
>>
>
> Is it solution for standby? It is necessary? You can have a functions on
> master.
>
> Is not higher missfeature temporary tables on stanby?
>
> again: I am not against to DO paramaterization. I am against to implement
> DO with complexity like functions. If we have a problem with standby, then
> we have to fix it correctly. There is a issue with temp tables, temp
> sequences, temp functions.
>

if we would to need a "single use" function, then we should to implement
it, and we should not to rape some different objects. Some, what has behave
like function should be function.

After some thinking, probably CTE design can be only one frame, where we
can do it

WITH
FUNCTION f1(a int) RETURNS int AS $$ .. $$ LANGUAGE plpgsql,
FUNCTION f2(a int) RETURNS SETOF int AS $$ .. $$ LANGUAGE plpgsql,
SELECT f1(x) FROM f2(z) LATERAL ....

We can generalize WITH clause, so there SEQENCES, VIEWS, .. can be defined
for "single usage"

Regards

Pavel

>
> Pavel
>
>
>
>>
>> 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 Dev Kumkar 2014-09-18 12:50:59 Re: [GENERAL] pg_multixact issues
Previous Message Pavel Stehule 2014-09-18 11:59:20 Re: Anonymous code block with parameters