Re: DROP FUNCTION of multiple functions

From: Fabrízio de Royes Mello <fabriziomello(at)gmail(dot)com>
To: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: DROP FUNCTION of multiple functions
Date: 2016-11-01 18:42:50
Message-ID: CAFcNs+qN9UoRT9TDnKYvjR+532DR1c1jxPNUwPsh3uCKRon+wA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Nov 1, 2016 at 2:55 AM, Peter Eisentraut <
peter(dot)eisentraut(at)2ndquadrant(dot)com> wrote:
>
> Here is a patch series that implements several changes in the internal
> grammar and node representation of function signatures. They are not
> necessarily meant to be applied separately, but they explain the
> progression of the changes nicely, so I left them like that for review.
>
> The end goal is to make some user-visible changes in DROP FUNCTION and
> possibly other commands that refer to functions.
>
> With these patches, it is now possible to use DROP FUNCTION to drop
> multiple functions at once: DROP FUNCTION func1(), func2(), func3().
> Other DROP commands already supported that, but DROP FUNCTION didn't
> because the internal representation was complicated and couldn't handle
it.
>
> The next step after this would be to allow referring to functions
> without having to supply the arguments, if the name is unique. This is
> an SQL-standard feature and would be very useful for dealing "business
> logic" functions with 10+ arguments. The details of that are to be
> worked out, but with the help of the present changes, this would be a
> quite localized change, because the grammar representation is well
> encapsulated.
>

Really nice... just a little about 006, can't we reduce the code bellow?

@@ -823,8 +823,7 @@ get_object_address(ObjectType objtype, List *objname,
List *objargs,
{
FuncWithArgs *fwa = (FuncWithArgs *) linitial(objname);
address.classId = ProcedureRelationId;
- address.objectId =
- LookupAggNameTypeNames(fwa->funcname,
fwa->funcargs, missing_ok);
+ address.objectId = LookupAggWithArgs(fwa, missing_ok);
address.objectSubId = 0;
break;
}
@@ -832,8 +831,7 @@ get_object_address(ObjectType objtype, List *objname,
List *objargs,
{
FuncWithArgs *fwa = (FuncWithArgs *) linitial(objname);
address.classId = ProcedureRelationId;
- address.objectId =
- LookupFuncNameTypeNames(fwa->funcname,
fwa->funcargs, missing_ok);
+ address.objectId = LookupFuncWithArgs(fwa, missing_ok);
address.objectSubId = 0;
break;
}

Regards,

--
Fabrízio de Royes Mello
Consultoria/Coaching PostgreSQL
>> Timbira: http://www.timbira.com.br
>> Blog: http://fabriziomello.github.io
>> Linkedin: http://br.linkedin.com/in/fabriziomello
>> Twitter: http://twitter.com/fabriziomello
>> Github: http://github.com/fabriziomello

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2016-11-01 19:13:16 Re: Speed up Clog Access by increasing CLOG buffers
Previous Message Corey Huinker 2016-11-01 18:36:39 Re: Declarative partitioning - another take