pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
copy to program with format binary
3+ messages / 2 participants
[nested] [flat]

* copy to program with format binary
@ 2021-09-27 14:24  Scott Ribe <scott_ribe@elevated-dev.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Scott Ribe @ 2021-09-27 14:24 UTC (permalink / raw)
  To: pgsql-admin <pgsql-admin@lists.postgresql.org>

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/








^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: copy to program with format binary
@ 2021-09-27 14:33  Laurenz Albe <laurenz.albe@cybertec.at>
  parent: Scott Ribe <scott_ribe@elevated-dev.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Laurenz Albe @ 2021-09-27 14:33 UTC (permalink / raw)
  To: Scott Ribe <scott_ribe@elevated-dev.com>; pgsql-admin <pgsql-admin@lists.postgresql.org>

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






^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: copy to program with format binary
@ 2021-09-27 14:39  Scott Ribe <scott_ribe@elevated-dev.com>
  parent: Laurenz Albe <laurenz.albe@cybertec.at>
  0 siblings, 0 replies; 3+ messages in thread

From: Scott Ribe @ 2021-09-27 14:39 UTC (permalink / raw)
  To: Laurenz Albe <laurenz.albe@cybertec.at>; +Cc: pgsql-admin <pgsql-admin@lists.postgresql.org>

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 <laurenz.albe@cybertec.at> 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
> 
> 
> 






^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2021-09-27 14:39 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-09-27 14:24 copy to program with format binary Scott Ribe <scott_ribe@elevated-dev.com>
2021-09-27 14:33 ` Laurenz Albe <laurenz.albe@cybertec.at>
2021-09-27 14:39   ` Scott Ribe <scott_ribe@elevated-dev.com>

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