Skip to main content
The COPY command allows you to export query results from RisingWave to standard output (STDOUT) in tab-separated values (TSV) format. This is useful for integrating RisingWave with external systems that can consume PostgreSQL-compatible COPY output, such as ClickHouse’s PostgreSQL table engine.

Syntax

Parameters

Output format

The COPY TO STDOUT command outputs data in TSV format with the following characteristics:
  • Fields are separated by tab characters (\t)
  • Rows are separated by newline characters (\n)
  • NULL values are represented as empty fields
  • Special characters are escaped:
    • Tab characters in data are escaped as \t
    • Newline characters in data are escaped as \n
    • Carriage return characters in data are escaped as \r
    • Backslash characters in data are escaped as \\

Examples

Export results from a simple query:
Basic example
This outputs data in TSV format:
When data contains special characters, they are properly escaped:
Example with special characters
The output is:

Integration with ClickHouse

The COPY TO STDOUT command enables ClickHouse to query RisingWave data using the PostgreSQL table engine. ClickHouse uses this syntax internally when loading data from PostgreSQL-compatible databases. Example ClickHouse configuration:
ClickHouse will automatically use COPY () TO STDOUT to efficiently load data from RisingWave.