Re: Can pg_restore produce create or replace commands
От | Berend Tober |
---|---|
Тема | Re: Can pg_restore produce create or replace commands |
Дата | |
Msg-id | 54BAD35D.7040107@computer.org обсуждение исходный текст |
Ответ на | Re: Can pg_restore produce create or replace commands (Adrian Klaver <adrian.klaver@aklaver.com>) |
Список | pgsql-general |
Adrian Klaver wrote: > On 01/17/2015 10:05 AM, Berend Tober wrote: >> I often work with the output of pg_restore from a custom format dump >> file. ... >> >> 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"... > > Not sure how pgAdmin does it. Just remembered something though, > pg_get_functiondef(), available in 8.4+:... > > test=# SELECT pg_get_functiondef('ean_substr'::regproc); > ... That has potential. However, in some instances the object I'm refactoring will end up having dependencies, for instance for the case of views oftentimes I will have to do the drop/create for it and all dependent objects. In those situations, generating scripts from the pg_restore output is very convenient, since it tells me all the dependencies and I can adjust the listfile contents to get them all and in the correct order. At this point I'm thinking to wrap the pg_restore invocation in a script that includes piping through sed to transform the create statements. I would have thought that the functionality in PgAdmin and the command line utilities would rely on the same underlying source code and so support the same functionality. Alas. --- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com
В списке pgsql-general по дате отправления: