Обсуждение: deleting function from pg_catalog.pg_proc

Поиск
Список
Период
Сортировка

deleting function from pg_catalog.pg_proc

От
"Gevik Babakhani"
Дата:
Hello Folks,

I would like to know if deleting functions from pg_catalog.pg_proc with
the following SQL statement is advisable?

I would like a way of deleting my functions without using the DROP
FUNCTION statement.

------------------------------------------------------------------
delete from pg_catalog.pg_proc where oid in (select sp.oid from
    pg_catalog.pg_proc sp
    inner join pg_namespace ns on sp.pronamespace=ns.oid
where
    ns.nspname='public'
    and sp.proname like 'sys%')
------------------------------------------------------------------
Thank you.



Re: deleting function from pg_catalog.pg_proc

От
Martijn van Oosterhout
Дата:
On Tue, Mar 28, 2006 at 02:58:45PM +0200, Gevik Babakhani wrote:
> Hello Folks,
>
> I would like to know if deleting functions from pg_catalog.pg_proc with
> the following SQL statement is advisable?

Offhand I think you're going to run into problem like the dependancies
not being removed which could cause problems further down the line.

> I would like a way of deleting my functions without using the DROP
> FUNCTION statement.

That would be inadvisable. You could create a function to do the drops
for you. For example, if you cast the oid of the function to
'regprocedure' you should get a string that is the prototype of the
function.

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

Вложения