X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 07C959FA5F0 for ; Wed, 31 May 2006 12:03:22 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 46393-06 for ; Wed, 31 May 2006 12:03:16 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 2F3779FA5DD for ; Wed, 31 May 2006 12:03:15 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k4VF3EBL012437 for ; Wed, 31 May 2006 11:03:14 -0400 (EDT) To: pgsql-hackers@postgreSQL.org Subject: Possible TODO item: copy to/from pipe Date: Wed, 31 May 2006 11:03:14 -0400 Message-ID: <12436.1149087794@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200605/1325 X-Sequence-Number: 84190 After re-reading what I just wrote to Andreas about how compression of COPY data would be better done outside the backend than inside, it struck me that we are missing a feature that's fairly common in Unix programs. Perhaps COPY ought to have the ability to pipe its output to a shell command, or read input from a shell command. Maybe something like COPY mytable TO '| gzip >/home/tgl/mytable.dump.gz'; (I'm not wedded to the above syntax, it's just an off-the-cuff thought.) Of course psql would need the same capability, since the server-side copy would still be restricted to superusers. You can accomplish COPY piping now through psql, but it's a bit awkward: psql -c "COPY mytable TO stdout" mydb | gzip ... Thoughts? Is this worth doing, or is the psql -c approach good enough? regards, tom lane