Drop all functions from Postgres database

后端 未结 2 1414
长情又很酷
长情又很酷 2021-02-12 10:46

I have a database with an old broken version of PostGIS installed in it. I would like to easily drop all functions in the database (they\'re all from PostGIS). Is there a simple

2条回答
  •  北恋
    北恋 (楼主)
    2021-02-12 11:41

    A fine answer to this question can be found here:

    SELECT 'DROP FUNCTION ' || ns.nspname || '.' || proname 
           || '(' || oidvectortypes(proargtypes) || ');'
    FROM pg_proc INNER JOIN pg_namespace ns ON (pg_proc.pronamespace = ns.oid)
    WHERE ns.nspname = 'my_messed_up_schema'  order by proname;
    

提交回复
热议问题