Re: pg_dump with select command

From: Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Cc: Adarsh Sharma <adarsh(dot)sharma(at)orkash(dot)com>
Subject: Re: pg_dump with select command
Date: 2011-09-15 14:03:28
Message-ID: 201109150703.29304.adrian.klaver@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wednesday, September 14, 2011 9:48:40 pm Adarsh Sharma wrote:
> I am sorry Sir, but Still I am not able to solve the issue.
>
> I followed the below steps & they are :-
>
> 1. Create table from the main tables by *create table as select* command.
> 2. Then I take the backup of that tables and restore on the remote machine.
> 3. After this I have to change the table names to the original ones in
> the remote server.

The easier way was already provided in this message:

http://archives.postgresql.org/pgsql-general/2011-09/msg00277.php

Specifically:

psql -h <host1> ... -c 'copy (select ... from <tablename> where ...)
to stdout' | psql -h <host2> ... -c 'copy <tablename> from stdin'

(where '...' are other psql's options like user, db, ...)

>
> Where as , In mysql we have -X option to specify a query while taking
> backups & then restore them. But I think Postgresql doesnot support this.
>
>
> Thanks

--
Adrian Klaver
adrian(dot)klaver(at)gmail(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Harald Fuchs 2011-09-15 14:14:59 Re: Bit datatype performance?
Previous Message Adrian Klaver 2011-09-15 13:57:45 Re: Cryptic Error Message Importing Table Dump