mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-12 13:01:09 +03:00
Fix the sqlite3_column_decltype() interface to return the correct datatype
when the value comes through a CTE. FossilOrigin-Name: 966438bd259ade3a2d4a6ec9587ce79c81a21b942248bffb389995b9132b53e3
This commit is contained in:
11
src/select.c
11
src/select.c
@@ -1449,12 +1449,12 @@ static const char *columnTypeImpl(
|
||||
sNC.pParse = pNC->pParse;
|
||||
zType = columnType(&sNC, p,&zOrigDb,&zOrigTab,&zOrigCol);
|
||||
}
|
||||
}else if( pTab->pSchema ){
|
||||
/* A real table */
|
||||
}else{
|
||||
/* A real table or a CTE table */
|
||||
assert( !pS );
|
||||
if( iCol<0 ) iCol = pTab->iPKey;
|
||||
assert( iCol==-1 || (iCol>=0 && iCol<pTab->nCol) );
|
||||
#ifdef SQLITE_ENABLE_COLUMN_METADATA
|
||||
if( iCol<0 ) iCol = pTab->iPKey;
|
||||
assert( iCol==XN_ROWID || (iCol>=0 && iCol<pTab->nCol) );
|
||||
if( iCol<0 ){
|
||||
zType = "INTEGER";
|
||||
zOrigCol = "rowid";
|
||||
@@ -1463,11 +1463,12 @@ static const char *columnTypeImpl(
|
||||
zType = sqlite3ColumnType(&pTab->aCol[iCol],0);
|
||||
}
|
||||
zOrigTab = pTab->zName;
|
||||
if( pNC->pParse ){
|
||||
if( pNC->pParse && pTab->pSchema ){
|
||||
int iDb = sqlite3SchemaToIndex(pNC->pParse->db, pTab->pSchema);
|
||||
zOrigDb = pNC->pParse->db->aDb[iDb].zDbSName;
|
||||
}
|
||||
#else
|
||||
assert( iCol==XN_ROWID || (iCol>=0 && iCol<pTab->nCol) );
|
||||
if( iCol<0 ){
|
||||
zType = "INTEGER";
|
||||
}else{
|
||||
|
||||
Reference in New Issue
Block a user