From 5ef7b953c1a432757479f1fb1135f545b3ba1303 Mon Sep 17 00:00:00 2001 From: drh Date: Mon, 24 Mar 2014 12:33:23 +0000 Subject: [PATCH] Cancel column-cache entries that are involved in a comparison operator since the comparison might have forced an affinity change. Fix for ticket [a8a0d2996a]. FossilOrigin-Name: 0b95b7a8748df19a24491c814462a9f21e43dbda --- manifest | 15 ++++++++------- manifest.uuid | 2 +- src/expr.c | 4 ++++ test/affinity01.test | 25 +++++++++++++++++++++++++ 4 files changed, 38 insertions(+), 8 deletions(-) create mode 100644 test/affinity01.test diff --git a/manifest b/manifest index 3c6309f95b..3e9bc1c61d 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Avoid\sattempting\sto\smmap\smemory\sfrom\san\soffset\sthat\sis\snot\sa\smultiple\sof\sthe\ssystem\spage\ssize\son\ssystems\swith\spage\ssizes\slarger\sthan\s32KB. -D 2014-03-24T11:23:17.736 +C Cancel\scolumn-cache\sentries\sthat\sare\sinvolved\sin\sa\scomparison\soperator\ssince\nthe\scomparison\smight\shave\sforced\san\saffinity\schange.\nFix\sfor\sticket\s[a8a0d2996a]. +D 2014-03-24T12:33:23.935 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 2ef13430cd359f7b361bb863504e227b25cc7f81 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -173,7 +173,7 @@ F src/complete.c dc1d136c0feee03c2f7550bafc0d29075e36deac F src/ctime.c 0231df905e2c4abba4483ee18ffc05adc321df2a F src/date.c 593c744b2623971e45affd0bde347631bdfa4625 F src/delete.c cdd57149543bb28304d8f717c243f2a86b1fc280 -F src/expr.c da2b3cb41081af6b56e95e7c9e95949564ce2e21 +F src/expr.c 671a2a43c17a0cfe4bc2c762e56d0f8b0cffb058 F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb F src/fkey.c 5269ef07b100763134f71b889327c333bd0989cf F src/func.c 2945bb2c4cdc0ac43733046285a4434310be1811 @@ -294,6 +294,7 @@ F src/walker.c 11edb74d587bc87b33ca96a5173e3ec1b8389e45 F src/where.c da8ec216f14af617505799b0b4e52c73dda7a5ca F src/whereInt.h 2564055b440e44ebec8b47f237bbccae6719b7af F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2 +F test/affinity01.test 3a843e95b958e25a2e52e2a212c8f9564843beac F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2 F test/aggnested.test 45c0201e28045ad38a530b5a144b73cd4aa2cfd6 F test/alias.test 4529fbc152f190268a15f9384a5651bbbabc9d87 @@ -1158,7 +1159,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01 F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff -P 641408a1395bfc911ca619ef9e5f073b913d856b e3d2be3ba47cdaafd26347620ae3bc2813203f16 -R aadeef09c98319ee1e1acbdf39605080 -U dan -Z a7c50b19ab534dd04ee960894cca4791 +P db7d62c8d58eb1e8654a762c9b199ae4e2759038 +R 2003e46e292bd0cd1a415a45223aecb4 +U drh +Z b8d19870788550507c35c44977ea8cb7 diff --git a/manifest.uuid b/manifest.uuid index 3a41778163..577b5ae021 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -db7d62c8d58eb1e8654a762c9b199ae4e2759038 \ No newline at end of file +0b95b7a8748df19a24491c814462a9f21e43dbda \ No newline at end of file diff --git a/src/expr.c b/src/expr.c index b070621ebd..0e1b5d74ee 100644 --- a/src/expr.c +++ b/src/expr.c @@ -291,6 +291,10 @@ static int codeCompare( addr = sqlite3VdbeAddOp4(pParse->pVdbe, opcode, in2, dest, in1, (void*)p4, P4_COLLSEQ); sqlite3VdbeChangeP5(pParse->pVdbe, (u8)p5); + if( p5!=SQLITE_AFF_NONE ){ + sqlite3ExprCacheAffinityChange(pParse, in1, 1); + sqlite3ExprCacheAffinityChange(pParse, in2, 1); + } return addr; } diff --git a/test/affinity01.test b/test/affinity01.test new file mode 100644 index 0000000000..c0a36c9a5a --- /dev/null +++ b/test/affinity01.test @@ -0,0 +1,25 @@ +# 2014-03-24 +# +# The author disclaims copyright to this source code. In place of +# a legal notice, here is a blessing: +# +# May you do good and not evil. +# May you find forgiveness for yourself and forgive others. +# May you share freely, never taking more than you give. +# +#*********************************************************************** +# +# Various tests for register affinity conversions. +# + +set testdir [file dirname $argv0] +source $testdir/tester.tcl +set testprefix affinity01 + +do_execsql_test 1.0 { + CREATE TABLE t(x); + INSERT INTO t VALUES('1'); + SELECT typeof(x) FROM t WHERE x=x+0; +} {text} + +finish_test -- 2.47.2