copy to program with format binary

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

copy to program with format binary

От:
Scott Ribe <scott_ribe@elevated-dev.com>
Дата:
Are the "to program" and binary format not compatible?

copy msgs (msg) to program 'bzip2 > /...' with format binary

gives me a syntax error at "format"

Trying older-style syntax without "with" does the same thing.

--
Scott Ribe
scott_ribe@elevated-dev.com
https://www.linkedin.com/in/scottribe/





Re: copy to program with format binary

От:
Laurenz Albe <laurenz.albe@cybertec.at>
Дата:
On Mon, 2021-09-27 at 08:24 -0600, Scott Ribe wrote:
> Are the "to program" and binary format not compatible?
> 
> copy msgs (msg) to program 'bzip2 > /...' with format binary
> 
> gives me a syntax error at "format"
> 
> Trying older-style syntax without "with" does the same thing.

The correct syntax is:

COPY msgs (msg) TO PROGRAM 'bzip2 > /...' WITH (FORMAT 'binary');

Yours,
Laurenz Albe
-- 
Cybertec | https://www.cybertec-postgresql.com



Re: copy to program with format binary

От:
Scott Ribe <scott_ribe@elevated-dev.com>
Дата:
Thank you!

I was staring at the docs and just totally missing the '('...

Small oddity though, I tried the 'encoding' option same as I tried format, without the parens, and it worked--which really threw me off.

--
Scott Ribe
scott_ribe@elevated-dev.com
https://www.linkedin.com/in/scottribe/



> On Sep 27, 2021, at 8:33 AM, Laurenz Albe  wrote:
> 
> On Mon, 2021-09-27 at 08:24 -0600, Scott Ribe wrote:
>> Are the "to program" and binary format not compatible?
>> 
>> copy msgs (msg) to program 'bzip2 > /...' with format binary
>> 
>> gives me a syntax error at "format"
>> 
>> Trying older-style syntax without "with" does the same thing.
> 
> The correct syntax is:
> 
> COPY msgs (msg) TO PROGRAM 'bzip2 > /...' WITH (FORMAT 'binary');
> 
> Yours,
> Laurenz Albe
> -- 
> Cybertec | https://www.cybertec-postgresql.com
> 
> 
> 



FAQ