Re: Shell script to extract a table from a plain text dump

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: Shell script to extract a table from a plain text dump
Дата
Msg-id 20051007093622.GA11321@svana.org
обсуждение исходный текст
Ответ на Shell script to extract a table from a plain text dump  (Christopher Kings-Lynne <chriskl@familyhealth.com.au>)
Ответы Re: [HACKERS] Shell script to extract a table from a plain text dump  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
Re: Shell script to extract a table from a plain text dump  (Christopher Kings-Lynne <chriskl@familyhealth.com.au>)
Список pgsql-general
On Fri, Oct 07, 2005 at 04:46:12PM +0800, Christopher Kings-Lynne wrote:
> If you have huge plain text dumps, and just want to restore one table
> it's usually painful.  Attached is a small shell script that can take a
> plain text dump and extract a single table's COPY data commands from it.
>
> If people think it's interesting and should be developed, I can pop it
> on pgfoundry or something.

Hmm, what I usually use is:

bzcat $file | sed -ne "/^COPY \"$table\" /,/^\\\.\$/p"

However, error checking and wrapping it into a script is a good idea.
If it got given a couple of switches to control the output, maybe we
can have a pg_restore for text dumps :)

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

Вложения

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

Предыдущее
От: "Ilja Golshtein"
Дата:
Сообщение: SELECT FOR SHARE and FOR UPDATE
Следующее
От: "CN"
Дата:
Сообщение: Re: pg_restore --disable-triggers does not stop triggers