sql-parser-cst icon indicating copy to clipboard operation
sql-parser-cst copied to clipboard

Parse error in `SET column[index] = value` at PostgreSQL `UPDATE` statement

Open nene opened this issue 3 months ago • 0 comments

The following fails to parse:

UPDATE my_table SET my_col[2] = 3.0760;

From PostgreSQL docs:

The column name can be qualified with a subfield name or array subscript, if needed.

There's also more syntax which we don't support:

SET col[1:2] =
SET col.field1.field2 =
SET col.* =

See PostgreSQL grammar.

Need to check if these all are actually supported in SET. The PostgreSQL parser might parses these, but the construct might get rejected.

The same syntax is also possible in INSERT columns, like:

INSERT INTO foo (col[1], col[2], col[3]) VALUES (5, 4, 3);

nene avatar Nov 19 '25 08:11 nene