Re: Drop all overloads of a function without knowing parameter types - Mailing list pgsql-general

From Tom Lane
Subject Re: Drop all overloads of a function without knowing parameter types
Date
Msg-id 1684.1391450961@sss.pgh.pa.us
Whole thread Raw
In response to Drop all overloads of a function without knowing parameter types  (Evan Martin <postgresql@realityexists.net>)
Responses Re: Drop all overloads of a function without knowing parameter types  (Evan Martin <postgresql@realityexists.net>)
Re: Drop all overloads of a function without knowing parameter types  (Sergey Konoplev <gray.ru@gmail.com>)
List pgsql-general
Evan Martin <postgresql@realityexists.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


pgsql-general by date:

Previous
From: Evan Martin
Date:
Subject: Drop all overloads of a function without knowing parameter types
Next
From: Susan Cassidy
Date:
Subject: way to custom sort column by fixed strings, then by field's content