From: | Berend Tober <btober(at)broadstripe(dot)net> |
---|---|
To: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, Berend Tober <btober(at)broadstripe(dot)net>, Postgres General <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Can pg_restore produce create or replace commands |
Date: | 2015-01-17 21:25:49 |
Message-ID: | 54BAD35D.7040107@computer.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Thomas Kellerer | 2015-01-17 21:42:07 | Re: Can pg_restore produce create or replace commands |
Previous Message | Adrian Klaver | 2015-01-17 19:24:39 | Re: Can pg_restore produce create or replace commands |