Can pg_restore produce create or replace commands

Поиск
Список
Период
Сортировка
От Berend Tober
Тема Can pg_restore produce create or replace commands
Дата
Msg-id 54BAA471.1020409@computer.org
обсуждение исходный текст
Ответы Re: Can pg_restore produce create or replace commands  (Adrian Klaver <adrian.klaver@aklaver.com>)
Re: Can pg_restore produce create or replace commands  (Adrian Klaver <adrian.klaver@aklaver.com>)
Re: Can pg_restore produce create or replace commands  (Thomas Kellerer <spam_eater@gmx.net>)
Список pgsql-general
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



В списке pgsql-general по дате отправления:

Предыдущее
От: Kouhei Sutou
Дата:
Сообщение: WAL supported extension
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: Can pg_restore produce create or replace commands