From: | "Mark Woodward" <pgsql(at)mohawksoft(dot)com> |
---|---|
To: | "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Possible TODO item: copy to/from pipe |
Date: | 2006-06-01 12:52:59 |
Message-ID: | 18397.24.91.171.78.1149166379.squirrel@mail.mohawksoft.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
> 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
...
From | Date | Subject | |
---|---|---|---|
Next Message | Martijn van Oosterhout | 2006-06-01 13:30:08 | Re: CTID issues and a soc student in need of help |
Previous Message | Tzahi Fadida | 2006-06-01 12:33:50 | CTID issues and a soc student in need of help |