cockroachdb / cockroachdb/cockroach
Support postgres 9.0's `COPY FROM ... DELIMITER AS ... NULL AS ...` syntax
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
**Is your feature request related to a problem? Please describe.**
We're in the process of migrating to cockroachdb. The lack of support for this means that we'll need to change how we use COPY FROM. In particular [psycopg2 hardcodes this syntax](https://github.com/psycopg/psycopg2/blob/c2b6a8aaeae71b30a96403bf5d6e7eafc21afaef/psycopg/cursor_type.c#L1407) so switching to the new syntax isn't trivial.
**Describe the solution you'd like**
Cockroachdb also supports the [old syntax for copy from](https://www.postgresql.org/docs/current/sql-copy.html#:~:text=Compatibility).
**Describe alternatives you've considered**
I'll attempt to work around this by using the [`copy_expert`](https://www.psycopg.org/docs/cursor.html#cursor.copy_expert) function instead.
**Misc**
Psycopg3 doesn't seem like it will have this issue since in it you always [write the copy statement directly](https://github.com/psycopg/psycopg/blob/7671556413ca4b94911ef2032d5f1be6140c28e1/docs/basic/copy.rst#using-copy-to-and-copy-from).
Epic CRDB-18320
Jira issue: CRDB-53288
Contributor guide
Research direction
Start by locating the SQL entry point for COPY FROM and the existing handling of DELIMITER and NULL options. Compare the supported syntax with PostgreSQL 9.0 and CockroachDB's old COPY FROM form. Done means statements using DELIMITER AS and NULL AS are accepted with the expected import behavior, with coverage added where the existing COPY FROM behavior is tested.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- postgres, sql
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100