aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2019-12-20 20:45:02 +0000
committerdrh <drh@noemail.net>2019-12-20 20:45:02 +0000
commit67b9ba1732c7ed1c561ed124b4eaaaa0b7081c2e (patch)
tree89a65fd4de3bdb8ed755fc2220083a43b144c777 /src
parenta513e591ae72d296d68a8d84eec80d72bc2f2bd9 (diff)
downloadsqlite-67b9ba1732c7ed1c561ed124b4eaaaa0b7081c2e.tar.gz
sqlite-67b9ba1732c7ed1c561ed124b4eaaaa0b7081c2e.zip
Apply real affinity to generated columns of type REAL that are extract from
an index. Ticket [e0a8120553f4b082] FossilOrigin-Name: 728ad39e3bd07a2503a95c68ed5bbc3f28fd97551d59f12a5fab25dc68227e99
Diffstat (limited to 'src')
-rw-r--r--src/expr.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/expr.c b/src/expr.c
index 6ea8ff73f..e1efeba2b 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -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);