Skip to content

Support array element assignments in UPDATE statements #3597

@lukaseder

Description

@lukaseder

This works in PostgreSQL as intuitively expected:

create table t (i int array);
insert into t values (array[1, 2]);
update t set i[2] = 3;

H2 rejects the statement with this error:

SQL Error [42001] [42001]: Syntax error in SQL statement "update t set i[*][2] = 3"; expected "., ="; SQL statement: update t set i[2] = 3 [42001-212]

I think this would be a useful addition, given that array element reference is already available?
https://www.h2database.com/html/grammar.html?highlight=arrayElementReference&search=array#array_element_reference

I can't find anything specific about this in the SQL standard ISO/IEC 9075-2:2016(E) 9.2 Store assignment or 14.15 <set clause list>, so I'm not sure if it is specified like that...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions