Re: Restore 1 Table from pg_dumpall?

From: Ondrej Ivanič <ondrej(dot)ivanic(at)gmail(dot)com>
To: Rich Shepard <rshepard(at)appl-ecosys(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org general" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Restore 1 Table from pg_dumpall?
Date: 2013-01-27 14:45:31
Message-ID: CAM6mieJ2ge0=wOU+MYaJ7owd9kxgtWZgYTMtVutXX074FCeMAg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

On 23 January 2013 04:57, Rich Shepard <rshepard(at)appl-ecosys(dot)com> wrote:
> Is there a way I can extract a single table's schema and data from the
> full backup? If so, I can then drop the fubar'd table and do it correctly
> this time.

You should grep for:
- CREATE TABLE
- COPY

statements and then note line numbers (fgrep -n). Finally, used `sed`
to get the right part(s) of a file (schema + data):
sed -n 'startline,endlinep' dump.sql > out.sql (ie. sed -n '10,1000p')

--
Ondrej

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2013-01-27 16:05:48 Re: Postfresql 8.4 Problem
Previous Message Rich Shepard 2013-01-27 14:30:02 Re: seeking SQL book recommendation