COPY (query) TO file

From: "Mark Woodward" <pgsql(at)mohawksoft(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: COPY (query) TO file
Date: 2006-06-02 13:39:49
Message-ID: 17970.24.91.171.78.1149255589.squirrel@mail.mohawksoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom had posted a question about file compression with copy. I thought
about it, and I want to through this out and see if anyone things it is a
good idea.

Currently, the COPY command only copies a table, what if it could operate
with a query, as:

COPY (select * from mytable where foo='bar') as BAR TO stdout

I have no idea if it is doable, but I can see uses for replication

psql -h source mydb -c "COPY (select * from mytable where ID > xxxxx) as
mytable TO STDOUT" | psql -h target mydb -c "COPY mytable FROM stdin"

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Larry Rosenman 2006-06-02 13:40:49 Re: Going for 'all green' buildfarm results
Previous Message Tom Lane 2006-06-02 13:36:27 Re: Going for 'all green' buildfarm results