Closed
Description
SQLite allows some ways of defining a generated column which sqlparser currently rejects.
First, the GENERATED ALWAYS
keywords are optional:
Parser::parse_sql(&SQLiteDialect {},
"CREATE TABLE t1(a INT, b INT AS (a * 2) STORED);")?;
Error: sql parser error: Expected ',' or ')' after column definition, found: AS at Line: 1, Column 30
Second, the clause can have a VIRTUAL
keyword stuck on the end (instead of STORED
). This is the default behaviour anyway, just made explicit.
Parser::parse_sql(&SQLiteDialect {},
"CREATE TABLE t1(a INT, b INT GENERATED ALWAYS AS (a * 2) VIRTUAL);")?;
Error: sql parser error: Expected ',' or ')' after column definition, found: VIRTUAL at Line: 1, Column 58
I think the distinction of stored-or-not is also not exposed in the AST at present.
I can have a go at fixing one or both of these, but I wanted to record the issue clearly first.
Metadata
Metadata
Assignees
Labels
No labels