COPY BINARY to STDOUT

Поиск
Список
Период
Сортировка
Искать

COPY BINARY to STDOUT

От:
SAKAIDA Masaaki <sakaida@psn.co.jp>
Дата:
Hi,
 When the next COPY command is specified, psql seems to stop 
proceeding. Nothing can be operated.

prompt> psql
postgres=# \h copy
Command:     COPY
Description: Copies data between files and tables
Syntax:
..(snip)..
COPY [ BINARY ] table [ WITH OIDS ]   TO { 'filename' | stdout }   [ [USING] DELIMITERS 'delimiter' ]   [ WITH NULL AS 'null string' ]

postgres=# copy test to stdout;
1       sakaida                 kobe
2       haru                    tokyo
3       nobu                    osaka

postgres=# copy binary test to '/tmp/test.dat';
COPY
postgres=# copy binary test to stdout;  <====== error???
....Nothing can be operated.....

 Of course, it isn't right to specify such a COPY command. 
However, an appropriate treatment seems to be necessary.

--
Regards,
SAKAIDA Masaaki  -- Osaka, Japan



Re: COPY BINARY to STDOUT

От:
Bruce Momjian <pgman@candle.pha.pa.us>
Дата:
Any comments on this?


> SAKAIDA Masaaki  writes:
> > postgres=# copy binary test to stdout;  <====== error???
> > [ psql gets confused ]
> 
> Yes, I see it too.  The COPY data protocol is fundamentally textual,
> so there's no way of making this work without rewriting all our frontend
> interface libraries.  Not worth it.  I suggest that the backend should
> reject COPY BINARY commands that are either FROM STDIN or TO STDOUT.
> Anybody see a better way?
> 
> 			regards, tom lane
> 


--  Bruce Momjian                        |  http://www.op.net/~candle pgman@candle.pha.pa.us               |  (610) 853-3000 +  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Re: COPY BINARY to STDOUT

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Bruce Momjian  writes:
> Any comments on this?

There is a test in there now to reject COPY BINARY TO STDOUT/FROM STDIN.
If anyone figures out how to support it, the test can be removed...
		regards, tom lane

>> SAKAIDA Masaaki  writes:
>>>> postgres=# copy binary test to stdout;  <====== error???
>>>> [ psql gets confused ]
>> 
>> Yes, I see it too.  The COPY data protocol is fundamentally textual,
>> so there's no way of making this work without rewriting all our frontend
>> interface libraries.  Not worth it.  I suggest that the backend should
>> reject COPY BINARY commands that are either FROM STDIN or TO STDOUT.
>> Anybody see a better way?

FAQ