Re: Regarding copy of function from one db to another db

From: Anthony Sotolongo <asotolongo(at)gmail(dot)com>
To: Rohit Dwivedi <dwivedir092(at)gmail(dot)com>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: Regarding copy of function from one db to another db
Date: 2017-06-15 15:01:27
Message-ID: a707aa42-6ea0-e32c-0b4c-baf397cb5c15@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

HI, i think that is not a bug, try to execute that query, this return
the code of
functions of specific schema (schema_name)

select 'CREATE OR REPLACE FUNCTION '||
nsp.nspname||'.'||proname||'('||pg_get_function_identity_arguments(p.oid)||')
RETURNS ' ||

case
when proretset='t' THEN ' SETOF '
else ''
end || typname || ' AS $BODY$ ' ||prosrc || ' $BODY$ LANGUAGE ' ||
l.lanname ||';' from pg_proc p join pg_namespace nsp ON
p.pronamespace = nsp.oid join pg_type t
ON p.prorettype = t.oid join pg_language l ON p.prolang = l.oid where
nsp.nspname = 'schema_name'

Greetings

PD: maybe use copy to export result and load in the other place

On 15/06/17 06:43, Rohit Dwivedi wrote:
> Hello sir,
> if we need to copy all the functions of database to
> another database then how we can implement it other then copy paste
> and run it...Because there are total 153 functions in our database.
>
> Please Reply Us.
>
> Thank u sir,

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message David G. Johnston 2017-06-15 15:42:16 Re: Regarding copy of function from one db to another db
Previous Message Tom Lane 2017-06-15 13:20:35 Re: BUG #14706: Dependencies not recorded properly for base types