Skip to content

Add MySQL/InnoDB CAST(... AS ... ARRAY) support to sqlparser #1581

@mvzink

Description

@mvzink

There is an InnoDB-specific syntax for multi-valued indices coming from JSON expressions:

mysql> create table t (x json);
Query OK, 0 rows affected (0.09 sec)

mysql> insert into t values ('{"foo": [42, 45]}');
Query OK, 1 row affected (0.01 sec)

mysql> alter table t add index ((cast(x->>'$.foo' as signed array)));
Query OK, 0 rows affected (0.05 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql> select cast(x->>'$.foo' as signed array) from t;
ERROR 1235 (42000): This version of MySQL doesn't yet support 'Use of CAST( .. AS .. ARRAY) outside of functional index in CREATE(non-SELECT)/ALTER TABLE or in general expressions'

This is not supported by either nom-sql or sqlparser. It will need an upstream fix.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions