SQLite Forum

Bug: `GENERATED ALWAYS` constraint ends up in column type
Login
That's the way it gets parsed in SQLite.

When the GENERATED ALWAYS keywords were added in SQLite 3.31.0 (2020-01-22), we
needed to ensure that legacy SQLite database files that might use the words
"generated" or "always" as column or table names would continue to work.  For
that reason, "generated" and "always" can still be understood as identifiers
in addition to keywords.  Furthermore, the typename of a column is any sequence
of identifiers.  Hence "int generated always" ends up being parsed as the
typename for the column.

If the typename contains parenthesized arguments (ex: VARCHAR(32)), then
the parser knows that the typename ends at the close parenthesis.  In that
case the GENERATED ALWAYS keywords are understood as being part of the
computed column clause, not as part of the typename.

If sometimes seeing "GENERATED ALWAYS" in the typename is a problem for you,
you can simply leave those keywords out of your table definition.  "AS" is
the only keyword that is needed to make use of computed columns.  The
"GENERATED ALWAYS" prefix is just some filler words that are thrown into 
the SQL standard, perhaps to make SQL seem more like COBOL or something.
Those words are not required and do not
really accomplish anything, other than slowing down schema parsing a little.