Re: "COPY foo FROM STDOUT" and ecpg

Поиск
Список
Период
Сортировка
От Greg Stark
Тема Re: "COPY foo FROM STDOUT" and ecpg
Дата
Msg-id CAM-w4HOimm1PSm0QzLygzV4+Xs=M2_mBFS=dGAMT2XbOjpHrFA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: "COPY foo FROM STDOUT" and ecpg  (Heikki Linnakangas <hlinnakangas@vmware.com>)
Список pgsql-hackers
On Tue, Feb 26, 2013 at 4:34 PM, Heikki Linnakangas
<hlinnakangas@vmware.com> wrote:
> No. All four combinations of FROM/TO and STDIN/STDOUT are accepted:
...
> postgres=# copy foo to stdin;
> foo
> bar
> postgres=# copy foo to stdout;
> foo
> bar

Hm, so STDIN/STDOUT are just noise words and psql uses stdin for input
and stdout for output regardless of what's specified? That seems a bit
odd. I would have expected to be able to do something like

cat > script.sql
copy foo to stdin;
copy bar to stdout;
^D
psql -f script.sql 0>/tmp/foo.data 1>/tmp/bar.data

But then I haven't heard any clamoring of demand for such a feature.
And if there was it would make sense to implement "copy foo to fd X"
and then make stdin an alias for "fd 0" rather than only support two
file descriptors. It wouldn't make sense to expend all that effort
just to support writing to just stdin.

-- 
greg



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: pg_xlogdump
Следующее
От: Dimitri Fontaine
Дата:
Сообщение: Re: pg_xlogdump