According to Postgres documentation it should be possible to update individual subfields of composite types using a dot syntax, but this gives a syntax error on v23.1.0-beta.3:
CREATE TYPE p AS (x INT, y INT);
CREATE TABLE ab (a INT PRIMARY KEY, b p);
INSERT INTO ab VALUES (0, (1, 2));
-- we can update the entire composite type
UPDATE ab SET b = (2, 3) WHERE a = 0;
-- but not an individual subfield
UPDATE ab SET b.y = 4 WHERE a = 0;
The error references #27792 which is now closed:
demo@127.0.0.1:26257/demoapp/defaultdb> UPDATE ab SET b.y = 4 WHERE a = 0;
invalid syntax: statement ignored: at or near "y": syntax error: unimplemented: this syntax
SQLSTATE: 0A000
DETAIL: source SQL:
UPDATE ab SET b.y = 4 WHERE a = 0
^
HINT: You have attempted to use a feature that is not yet implemented.
See: https://go.crdb.dev/issue-v/27792/v23.1
At the very least we should update this error message.
According to Postgres documentation it should be possible to update individual subfields of composite types using a dot syntax, but this gives a syntax error on
v23.1.0-beta.3
:The error references #27792 which is now closed:
At the very least we should update this error message.
Jira issue: CRDB-27770