SQLite Forum

Generated columns and pragma table_info()
Login

Generated columns and pragma table_info()

(1.1) By Even Rouault (rouault) on 2021-04-30 18:21:41 edited from 1.0 [source]

Hello,

It seems that pragma table_info() doesn't report generated columns, whereas pragma table_xinfo() does. I couldn't find anything in the documentation of generated columns or table_info()/table_xinfo() regarding that, so I'm not sure if it is a intented behaviour that lacks documentation, or a bug

Demo:
$ ~/install-sqlite-3.35.5/bin/sqlite3

sqlite> create table t(id integer, c integer as (1));

sqlite> pragma table_info(t);
0|id|integer|0||0

sqlite> pragma table_xinfo(t);
0|id|integer|0||0|0
1|c|integer|0||0|2