diff options
author | drh <drh@noemail.net> | 2019-10-17 13:15:40 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2019-10-17 13:15:40 +0000 |
commit | ab3c5f26ab72222c4ab0fdcee559b3e3a7c0d53b (patch) | |
tree | 45e559099a52180065a7995feb974696feef9be3 /src | |
parent | ab45fc041389b937cf82c20bec231905105f829d (diff) | |
download | sqlite-ab3c5f26ab72222c4ab0fdcee559b3e3a7c0d53b.tar.gz sqlite-ab3c5f26ab72222c4ab0fdcee559b3e3a7c0d53b.zip |
Fix the table_info and table_xinfo pragmas so that they work with virtual
columns. Table_info omits virtual columns. Table_xinfo gives them a
"hidden" flag of 2, and 3 for STORED columns.
FossilOrigin-Name: 069351b85f9a706f60d3e98fbc8aaf40c374356b967c0464aede30ead3d9d18b
Diffstat (limited to 'src')
-rw-r--r-- | src/pragma.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/pragma.c b/src/pragma.c index 652810eae..551cc7aa0 100644 --- a/src/pragma.c +++ b/src/pragma.c @@ -1100,10 +1100,17 @@ void sqlite3Pragma( sqlite3CodeVerifySchema(pParse, iTabDb); sqlite3ViewGetColumnNames(pParse, pTab); for(i=0, pCol=pTab->aCol; i<pTab->nCol; i++, pCol++){ - int isHidden = IsHiddenColumn(pCol); - if( isHidden && pPragma->iArg==0 ){ + int isHidden = 0; + if( pCol->colFlags & COLFLAG_NOINSERT ){ nHidden++; - continue; + if( pPragma->iArg==0 ) continue; + if( pCol->colFlags & COLFLAG_VIRTUAL ){ + isHidden = 2; /* GENERATED ALWAYS AS ... VIRTUAL */ + }else if( pCol->colFlags & COLFLAG_VIRTUAL ){ + isHidden = 3; /* GENERATED ALWAYS AS ... STORED */ + }else{ + isHidden = 1; /* HIDDEN */ + } } if( (pCol->colFlags & COLFLAG_PRIMKEY)==0 ){ k = 0; @@ -1112,13 +1119,13 @@ void sqlite3Pragma( }else{ for(k=1; k<=pTab->nCol && pPk->aiColumn[k-1]!=i; k++){} } - assert( pCol->pDflt==0 || pCol->pDflt->op==TK_SPAN ); + assert( pCol->pDflt==0 || pCol->pDflt->op==TK_SPAN || isHidden>=2 ); sqlite3VdbeMultiLoad(v, 1, pPragma->iArg ? "issisii" : "issisi", i-nHidden, pCol->zName, sqlite3ColumnType(pCol,""), pCol->notNull ? 1 : 0, - pCol->pDflt ? pCol->pDflt->u.zToken : 0, + pCol->pDflt && isHidden<2 ? pCol->pDflt->u.zToken : 0, k, isHidden); } |