cockroachdb / cockroachdb/cockroach
sql: qualifying column names in `UPDATE ... SET` list returns non-sensical unimplemented error
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
**Describe the problem**
Qualifying column names in the `SET` list of an `UPDATE` results in a non-sensical unimplemented error.
**To Reproduce**
On a single-node local cluster, run:
```
CREATE TABLE t (t1 INT);
CREATE TABLE u (u1 INT);
UPDATE t SET t.t1 = u.u1
FROM u;
```
The `UPDATE` statement results in the error:
```
invalid syntax: statement ignored: at or near "t1": syntax error: unimplemented: this syntax
SQLSTATE: 0A000
DETAIL: source SQL:
UPDATE t SET t.t1 = u.u1
^
HINT: You have attempted to use a feature that is not yet implemented.
See: https://go.crdb.dev/issue-v/27792/v23.1
```
If I go to https://go.crdb.dev/issue-v/27792/v23.1, I see an unrelated issue that is already closed.
**Expected behavior**
Postgres doesn't support qualifying names in the `SET` list either, so we should probably do the same (and just return a normal error -- not an unimplemented error). If we do want to support this feature for some reason, we should at least open an issue that describes the problem (and not reference some random unrelated issue that's already closed).
For reference, here's the error in Postgres:
```
postgres=# UPDATE t SET t.t1 = u.u1
postgres-# FROM u;
ERROR: column "t" of relation "t" does not exist
LINE 1: UPDATE t SET t.t1 = u.u1
```
**Environment:**
- CockroachDB version: master (i.e. 23.1 alpha)
- Server OS: MacOS Ventura (Apple M1 Pro)
- Client app: cockroach sql
Jira issue: CRDB-25429
Contributor guide
Assessment
This issue has not been assessed yet.