cockroachdb / cockroachdb/cockroach

QA: sql: copy to stdout doesn't require returning clause for insert

Open
#100,493 0 comments 0 reactions 0 assignees View on GitHub
C-bug O-qa T-sql-queries
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

**Describe the problem**

From the postgres docs for Copy:
>For INSERT, UPDATE and DELETE queries a RETURNING clause must be provided...

In CRDB `COPY TO STDOUT` does not require mutations to have a RETURNING clause as expected, and instead will silently return no results for a mutation without RETURNING.

**To Reproduce**

```
CREATE TABLE xy (x INT, y INT);
COPY (INSERT INTO xy VALUES (1, 1), (2, 2), (3, 3)) TO STDOUT (DELIMITER '|');
```
Expected:
```
ERROR: COPY query must have a RETURNING clause
```
Actual (empty result):
```
```

Jira issue: CRDB-26465

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.