pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Anthony Sotolongo <asotolongo@gmail.com>
To: Rohit Dwivedi <dwivedir092@gmail.com>
To: pgsql-bugs@postgresql.org
Subject: Re: Regarding copy of function from one db to another db
Date: Thu, 15 Jun 2017 11:01:27 -0400
Message-ID: <a707aa42-6ea0-e32c-0b4c-baf397cb5c15@gmail.com> (raw)
In-Reply-To: <CAGh+9a-1vaNv_0Nvuh5JbFebTcxRxjdEys4hSA-wFUjDrMXHAQ@mail.gmail.com>
References: <CAGh+9a-1vaNv_0Nvuh5JbFebTcxRxjdEys4hSA-wFUjDrMXHAQ@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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,



-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (3+ messages)  latest in thread

Message-ID: <a707aa42-6ea0-e32c-0b4c-baf397cb5c15@gmail.com>
Permalink:  ../a707aa42-6ea0-e32c-0b4c-baf397cb5c15@gmail.com/
Also on:    postgresql.org/message-id/a707aa42-6ea0-e32c-0b4c-baf397cb5c15@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: asotolongo@gmail.com, dwivedir092@gmail.com
  Subject: Re: Regarding copy of function from one db to another db
  In-Reply-To: <a707aa42-6ea0-e32c-0b4c-baf397cb5c15@gmail.com>
  References: <CAGh+9a-1vaNv_0Nvuh5JbFebTcxRxjdEys4hSA-wFUjDrMXHAQ@mail.gmail.com> <a707aa42-6ea0-e32c-0b4c-baf397cb5c15@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox