Pg_dump Query

Started by Rebecca Clarkeover 14 years ago2 messagesgeneral
Jump to latest
#1Rebecca Clarke
rebecca@clarke.net.nz

Hi

I want to pg_dump only a select amount of rows from a table and restore them
to a table on another server.

Is there away to do this? I thought of using a view but how would I upload
that into a specific table. Copy? or is there something I can do with
pg_restore.

Rebecca

#2Scott Marlowe
scott.marlowe@gmail.com
In reply to: Rebecca Clarke (#1)
Re: Pg_dump Query

On Mon, Aug 15, 2011 at 6:10 AM, Rebecca Clarke <rebecca@clarke.net.nz> wrote:

Hi
I want to pg_dump only a select amount of rows from a table and restore them
to a table on another server.
Is there away to do this? I thought of using a view but how would I upload
that into a specific table.  Copy? or is there something I can do with
pg_restore.

You want to combine copy and select like so:

copy (select * from table where ...) to stdout;