Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.12.10, 6.2, 6.5, 6.6
-
None
Description
When using QSqlTableModel (or QSqlRelationalTableModel) with a table in SQLite that contains GENERATED columns, those columns will not appear in the result set.
My best guess is, that PRAGMA table_info is used internally to get the columns of the table, and that function will not show GENERATED columns. If PRAGMA table_xinfo was used instead, the GENERATED columns would be visible.
Edit:
QSQLiteDriverPrivate::getTableInfo in src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp uses
query.exec("PRAGMA "_L1 + schema + "table_info ("_L1 + table + u')');
table_xinfo should be used there in my opinion.
There is one thing to keep in mind: the GENERATED columns should not be included in INSERT or UPDATE statements.