From: | Evan Martin <postgresql(at)realityexists(dot)net> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Drop all overloads of a function without knowing parameter types |
Date: | 2014-02-03 18:59:44 |
Message-ID: | 52EFE720.6070509@realityexists.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Thanks for that "oid::regprocedure" trick! A query like this is fairly
simple once you know it, but completely non-obvious when you don't.
I'm not sure what conditions others want to search on (couldn't find it
in the list archives), but "by qualified function name" seems like the
obvious one. If you don't wish to add that to the core, how about a
system function that does this and is mentioned in the documentation for
DROP FUNCTION? That way, if people have other criteria they can find the
function, look at its source and adapt it to their needs. If you don't
want to add a function, either, it would be good to at least document
this (on the DROP FUNCTION page). Something like "Note: DROP FUNCTION
does not allow you to drop a function without knowing its argument
types, but you can use the following script to drop all overloads of a
given function name..."
Regards,
Evan
On 03/02/2014 19:09, Tom Lane wrote:
> Evan Martin <postgresql(at)realityexists(dot)net> writes:
>> Is there any easy way to drop a function (all overloads of it) without
>> knowing the parameter types?
> Something along the lines of
>
> do $$
> declare fname text;
> begin
> for fname in select oid::regprocedure from pg_proc where proname = 'foo' loop
> execute 'drop function ' || fname;
> end loop;
> end$$;
>
> Adjust WHERE condition to taste.
>
>> If not, it would be good to see it added.
> People periodically ask for extensions flavored more or less like this,
> but I'm suspicious of building any such thing into the core. There's too
> little commonality in the exact conditions they want to search on.
> Leaving it at the level of a scripting problem, as above, allows arbitrary
> customization of the search condition.
>
> regards, tom lane
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Adrian Klaver | 2014-02-03 19:14:11 | Re: way to custom sort column by fixed strings, then by field's content |
Previous Message | Susan Cassidy | 2014-02-03 18:53:01 | way to custom sort column by fixed strings, then by field's content |