Re: PL/pgSQL 2

From: Hannu Krosing <hannu(at)2ndQuadrant(dot)com>
To: Andres Freund <andres(at)2ndquadrant(dot)com>, Marko Tiikkaja <marko(at)joh(dot)to>
Cc: Joel Jacobson <joel(at)trustly(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PL/pgSQL 2
Date: 2014-09-01 12:57:08
Message-ID: 54046D24.1040706@2ndQuadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 09/01/2014 12:55 PM, Andres Freund wrote:
> On 2014-09-01 12:49:22 +0200, Marko Tiikkaja wrote:
>> On 9/1/14 12:12 PM, Andres Freund wrote:
>>> On 2014-09-01 12:00:48 +0200, Marko Tiikkaja wrote:
>>>> On 9/1/14 11:53 AM, Hannu Krosing wrote:
>>>>>> You're going to have to find a more gradual way of doing this.
>>>>> Probably a better way (and there has been some talk of it) is
>>>>> having some kind of PRAGMA functionality, or pl/pgsql specific
>>>>> LOCAL SET to affect "just this function" and not spill to nested
>>>>> functions as is the case for SETs now.
>>>> I can't imagine how that would work for anyone who has thousands of
>>>> functions.
>>> How's that fundamentally different from changing languages? If we had a
>>> way to *add* such attributes to *existing* functions I don't see the
>>> fundamental problem?
>> Adding 5-10 of these for every function you create seems significantly more
>> painful than saying "this function uses plpgsql2".
You could package up these 5-10 SET LOCAL options as a separate language
handler (called plpgsql2) which really does nothing more than set the
local options and call the base handler :)

this will still leave you with flexibility of adding/removing features for
single functions

For extra convenience you could even create a "CREATE META LANGUAGE ..."
option for defining such language handlers.

>> Though perhaps what's
>> being suggested is a *single* option which changes everything at once? Then
>> there wouldn't be a huge difference.
> The likelihood of us now knowing all the things that we want to break
> rigth now seems about zero. There *will* be further ones. If we go with
> the approach of creating new language versions for all of them we'll end
> up with a completely unmaintainable mess. For PG devs, application dev
> and DBAs.
>
> Since what you seemingly want - sensibly so imo - is to set the default
> errors for *new* functions, but leave the old set of errors for
> preexisting ones, I suggest adding a GUC that defines the set of
> warnings/errors *new* functions get. There'd need to be some syntax to
> opt out for pg_dump and similar, but that sounds unproblematic.
>
> One question here imo is whether we design something for plpgsql or more
> generic...
I for one would like to have a generic "SET LOCAL" feature so it
could also be used for pl/pythonu or pl/v8

Cheers

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2014-09-01 12:58:06 Re: Better support of exported snapshots with pg_dump
Previous Message Michael Paquier 2014-09-01 12:54:24 Re: Better support of exported snapshots with pg_dump