cockroachdb / cockroachdb/cockroach
sql: support COPY TO ... BINARY
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
See https://www.postgresql.org/docs/current/sql-copy.html
The binary format is described in detail there. We already support this for COPY FROM.
> The binary format option causes all data to be stored/read as binary format rather than as text. It is somewhat faster than the text and CSV formats, but a binary-format file is less portable across machine architectures and PostgreSQL versions. Also, the binary format is very data type specific; for example it will not work to output binary data from a smallint column and read it into an integer column, even though that would work fine in text format.
>
> The binary file format consists of a file header, zero or more tuples containing the row data, and a file trailer. Headers and data are in network byte order.
Jira issue: CRDB-24562
Epic CRDB-18320
Contributor guide
Research direction
Start by locating the existing binary-format implementation for COPY FROM and compare it with the PostgreSQL COPY documentation linked in the issue. Implement the corresponding COPY TO BINARY behavior, including the documented header, tuple data, trailer, and network byte order, and verify that its output matches the specified format.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, postgresql, sql
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100