Search Postgresql Archives

Can pg_restore produce create or replace commands

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I often work with the output of pg_restore from a custom format dump file. For example a file produced by running

pg_restore -s -1 -L listfile dumpfile

where listfile has been edited to comment out most of the rows to leave only the data base objects I'm currently interested in.

Most often, I'm refactoring functions and so don't really want to drop the function but rather want to do a "create or replace function" operation to implement the changes. Consequently I have to frequently do a global search and replace along the lines of


sed -ie 's/CREATE FUNCTION/CREATE OR REPLACE FUNCTION/'


I am not seeing in the documentation an option to generate the script with anything but straight "create function" commands.

Is there a way for me to access this functionality (i.e., to generate "create or replace function" scripts) from the command line?

I suppose I could pipe the pg_restore output through the sed command just as a matter of standard operating procedure, but the capability must exist because that is the way the scripts appear in pgadmin. I generally do not use the GUI tool and so would like it to happen automatically when using the command line tools.

---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com



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



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux