Re: Anonymous code block with parameters

From: Hannu Krosing <hannu(at)2ndQuadrant(dot)com>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, 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 20:16:30
Message-ID: 541B3D9E.4090803@2ndQuadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 09/18/2014 02:37 PM, Pavel Stehule wrote:
>
> 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"
+2

I just proposed the same thing in another branch of this discussion
before reading this :)

I guess it proves (a little) that WITH is the right place to do these
kind of things ...

Cheers

--
Hannu Krosing
PostgreSQL Consultant
Performance, Scalability and High Availability
2ndQuadrant Nordic OÜ

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Josh Berkus 2014-09-18 20:23:31 Re: Anonymous code block with parameters
Previous Message Hannu Krosing 2014-09-18 20:10:16 Re: Anonymous code block with parameters