Re: Drop all overloads of a function without knowing parameter types
От | Evan Martin |
---|---|
Тема | Re: Drop all overloads of a function without knowing parameter types |
Дата | |
Msg-id | 52EFE720.6070509@realityexists.net обсуждение исходный текст |
Ответ на | Re: Drop all overloads of a function without knowing parameter types (Tom Lane <tgl@sss.pgh.pa.us>) |
Ответы |
Re: Drop all overloads of a function without knowing
parameter types
|
Список | 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@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 по дате отправления: