COPY TO

COPY TO sends rows using the Postgres COPY protocol.

Syntax

COPY ( query ) TO STDOUT WITH ( field val , )
Field Use
query The SELECT or SUBSCRIBE query to send
field The name of the option you want to set.
val The value for the option.

WITH options

Name Value type Default value Description
FORMAT TEXT,BINARY TEXT Sets the output formatting method.

Example

Copying a view

COPY (SELECT * FROM some_view) TO STDOUT;

Subscribing to a view with binary output

COPY (SUBSCRIBE some_view) TO STDOUT WITH (FORMAT binary);
Back to top ↑