1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-12 13:01:09 +03:00

Apply real affinity to generated columns of type REAL that are extract from

an index.  Ticket [e0a8120553f4b082]

FossilOrigin-Name: 728ad39e3bd07a2503a95c68ed5bbc3f28fd97551d59f12a5fab25dc68227e99
This commit is contained in:
drh
2019-12-20 20:45:02 +00:00
parent a513e591ae
commit 67b9ba1732
4 changed files with 33 additions and 10 deletions

View File

@@ -3609,6 +3609,7 @@ expr_code_doover:
}
case TK_COLUMN: {
int iTab = pExpr->iTable;
int iReg;
if( ExprHasProperty(pExpr, EP_FixedCol) ){
/* This COLUMN expression is really a constant due to WHERE clause
** constraints, and that constant is coded by the pExpr->pLeft
@@ -3616,8 +3617,8 @@ expr_code_doover:
** datatype by applying the Affinity of the table column to the
** constant.
*/
int iReg = sqlite3ExprCodeTarget(pParse, pExpr->pLeft,target);
int aff;
iReg = sqlite3ExprCodeTarget(pParse, pExpr->pLeft,target);
if( pExpr->y.pTab ){
aff = sqlite3TableColumnAffinity(pExpr->y.pTab, pExpr->iColumn);
}else{
@@ -3685,9 +3686,13 @@ expr_code_doover:
iTab = pParse->iSelfTab - 1;
}
}
return sqlite3ExprCodeGetColumn(pParse, pExpr->y.pTab,
iReg = sqlite3ExprCodeGetColumn(pParse, pExpr->y.pTab,
pExpr->iColumn, iTab, target,
pExpr->op2);
if( pExpr->y.pTab==0 && pExpr->affExpr==SQLITE_AFF_REAL ){
sqlite3VdbeAddOp1(v, OP_RealAffinity, iReg);
}
return iReg;
}
case TK_INTEGER: {
codeInteger(pParse, pExpr, 0, target);