Re: merging some features from plpgsql2 project

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Merlin Moncure <mmoncure(at)gmail(dot)com>
Cc: Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Marko Tiikkaja <marko(at)joh(dot)to>
Subject: Re: merging some features from plpgsql2 project
Date: 2017-01-04 16:07:06
Message-ID: CAFj8pRBn5FkWrXufgmZKPpT=cMcbxwge6UXTK-4w3Meag+M-Tg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2017-01-04 16:49 GMT+01:00 Merlin Moncure <mmoncure(at)gmail(dot)com>:

> On Tue, Jan 3, 2017 at 2:15 PM, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
> wrote:
> >
> >
> > 2017-01-03 20:54 GMT+01:00 Merlin Moncure <mmoncure(at)gmail(dot)com>:
> >>
> >> On Tue, Jan 3, 2017 at 9:58 AM, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
> >> wrote:
> >> > 2017-01-03 16:23 GMT+01:00 Merlin Moncure <mmoncure(at)gmail(dot)com>:
> >> >> *) Would also like to have a FINALLY block
> >> >
> >> > What you can do there?
> >>
> >> This is syntax sugar so you don't need second begin/end/exception
> >> block or duplicated code. It separates error handling from cleanup.
> >>
> >> BEGIN
> >> PERFORM dblink_connect(...
> >> <risky_stuff>
> >> EXCEPTION WHEN OTHERS THEN
> >> <log/handle error>
> >> FINALLY
> >> PERFORM dblink_disconnect(...
> >> END;
> >
> >
> > Does know somebody this pattern from Ada or PL/SQL?
>
> I guess probably not. It's a standard pattern in modern EH languages
> (for example, https://msdn.microsoft.com/en-us/library/dszsf989.aspx)
>
> >>
> >> >> *) Some user visible mechanic other than forcing SQL through EXECUTE
> >> >> to be able to control plan caching would be useful.
> >> >
> >> > fully agree.
> >> >
> >> > Have you some ideas?
> >> >
> >> > What about plpgsql option (function scope) -- WITHOUT-PLAN-CACHE - any
> >> > non
> >> > trivial plans will not be cached - and evaluated as parametrized query
> >> > only.
> >>
> >> I have slight preference for syntax marker for each query, similar to
> >> INTO. Maybe 'UNCACHED'?
> >
> >
> > I am not clean opinion - the statement level is nice, but what
> readability?
> >
> > SELECT UNCACHED t.a, t.b FROM INTO a,b;
>
> Yeah -- this is pretty ugly admittedly. Maybe control directive is
> ok, as long as you can set it mid function?
>

ADA uses for this purpose PRAGMA keyword - it is used for everything in ADA
- cycle iteration optimization, ...the scope can be statement, block,
procedure.

so something like

BEGIN
PRAGMA uncached_plans;
SELECT ...
..
END;

But it should be verified by some PL/SQL or Ada experts

Regards

>
> merlin
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2017-01-04 16:09:52 Re: merging some features from plpgsql2 project
Previous Message Dilip Kumar 2017-01-04 15:57:30 Re: Proposal : Parallel Merge Join