SQLite Forum

A question about the "type" field in the result of PRAGMA table_xinfo for the generated column.
Login
An example for SQLite version 3.32.2:

If a table "Test"'s structure is

`CREATE TABLE Test (
    a INTEGER,
    b INTEGER GENERATED ALWAYS AS (a),
    c INTEGER GENERATED ALWAYS AS (a) NOT NULL,
    d INTEGER NOT NULL GENERATED ALWAYS AS (a),
    e INTEGER AS (a)
);`

The result of `PRAGMA table_xinfo(Test);` will be:

`cid,name,type,notnull,dflt_value,pk,hidden
0,a,INTEGER,0,,0,0
1,b,INTEGER GENERATED ALWAYS,0,,0,2
2,d,INTEGER GENERATED ALWAYS,1,,0,2
3,e,INTEGER,1,,0,2
4,c,INTEGER,0,,0,2
`

So the question is, since from the document(https://sqlite.org/gencol.html), we know that the "GENERATED ALWAYS" is a column constraint, and it's not a column type, is it proper to appears in the "type" field of the result of PRAGMA table_xinfo?

And if this is a designed behavior, then why do the column "d" and "e" which are also generated column just display a type name "INTEGER" without "GENERATED ALWAYS" appended to the right?

Thank you for seeing my question.