pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mark Woodward <pgsql@mohawksoft.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-hackers@postgresql.org
Subject: Re: Possible TODO item: copy to/from pipe
Date: Thu, 1 Jun 2006 08:52:59 -0400 (EDT)
Message-ID: <18397.24.91.171.78.1149166379.squirrel@mail.mohawksoft.com> (raw)
In-Reply-To: <12436.1149087794@sss.pgh.pa.us>
References: <12436.1149087794@sss.pgh.pa.us>

> 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?


To be honest, I don't see much benefit in it. You can already accomplish
what you want to accomplish easily enough.

If you want to muck with COPY, I'd like to see it accept a query as:

psql -c "COPY select * from mytable where foo='bar' TO stdout" mydb | gzip
...






view thread (36+ messages)  latest in thread

Message-ID: <18397.24.91.171.78.1149166379.squirrel@mail.mohawksoft.com>
Permalink:  ../18397.24.91.171.78.1149166379.squirrel@mail.mohawksoft.com/
Also on:    postgresql.org/message-id/18397.24.91.171.78.1149166379.squirrel@mail.mohawksoft.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: pgsql@mohawksoft.com, tgl@sss.pgh.pa.us
  Subject: Re: Possible TODO item: copy to/from pipe
  In-Reply-To: <18397.24.91.171.78.1149166379.squirrel@mail.mohawksoft.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox