Re: What Would You Like To Do?

From: Michael Nolan <htfoot(at)gmail(dot)com>
To: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: What Would You Like To Do?
Date: 2011-09-13 21:02:24
Message-ID: CAOzAquJJdDYKA65VX_P+sZo1DKC5ohPDKwcrsotH6zqycxQSgw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Sep 13, 2011 at 2:55 PM, Joshua D. Drake <jd(at)commandprompt(dot)com>wrote:

>
> On 09/13/2011 11:51 AM, Michael Nolan wrote:
>
>
>> The ability to restore a table from a backup file to a different
>> table
>> name in the same database and schema.
>>
>>
>> This can be done but agreed it is not intuitive.
>>
>>
>> Can you elaborate on tha a bit, please? The only way I've been able to
>> do it is to edit the dump file to change the table name. That's not
>> very practical with a several gigabyte dump file, even less so with one
>> that is much larger. If this capability already exists, is it documented?
>>
>
> You use the -Fc method, extract the TOC and edit just the TOC (so you don't
> have to edit a multi-gig file)
>
> That is, at best, a bit obscure. I've wondered at times if the -f tar
option would have any benefits here, though it appears to have significant
downsides.

A downside of either method may be that I can't predict in advance when I
will want to do a restore of a single table from a backup file,
so I'd have to always use that method of generating the file.

I did propose an extension to pg_restore a couple of months ago to add an
option to re-name a table as it is restored, but that seemed to have
generated no interest.

Maybe an external tool that reads a pg_dump file looking for a specific
table and writes that portion of the dump file to a separate file, changing
the table name would be easier? It'd probably have to handle most of or all
of the different pg_dump formats, but that doesn't sound like an
unachievable goal.
--
Mike Nolan

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Korotkov 2011-09-13 21:31:32 Re: What Would You Like To Do?
Previous Message Kevin Grittner 2011-09-13 20:12:27 Re: What Would You Like To Do?