mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-07 02:42:48 +03:00
Fix the OP_SeekGE, OP_SeekGT, OP_SeekLE, and OP_SeekLT opcodes so that they
preserve the datatype of the value in the register used as the key. Ticket [d9f584e936c7a8d0] FossilOrigin-Name: 81b9f0f55042777b37de78069f7089041a9ee21dd0a0c86b879053fb46e140b4
This commit is contained in:
16
manifest
16
manifest
@@ -1,5 +1,5 @@
|
||||
C Avoid\sassuming\sthat\s"column\sIS\s?",\swhere\scolumn\sis\sdeclared\sUNIQUE,\smatches\sonly\sa\ssingle\srow\s(as\s"?"\smight\sbe\sNULL).\sFix\sfor\s[b8689402].
|
||||
D 2019-08-21T14:54:50.917
|
||||
C Fix\sthe\sOP_SeekGE,\sOP_SeekGT,\sOP_SeekLE,\sand\sOP_SeekLT\sopcodes\sso\sthat\sthey\npreserve\sthe\sdatatype\sof\sthe\svalue\sin\sthe\sregister\sused\sas\sthe\skey.\nTicket\s[d9f584e936c7a8d0]
|
||||
D 2019-08-22T00:53:16.723
|
||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
|
||||
@@ -595,7 +595,7 @@ F src/upsert.c 0dd81b40206841814d46942a7337786932475f085716042d0cb2fc7791bf8ca4
|
||||
F src/utf.c 2f0fac345c7660d5c5bd3df9e9d8d33d4c27f366bcfb09e07443064d751a0507
|
||||
F src/util.c fffdfa627be74d69ef425f92db124e7148af449bb8a3286e79577c42bca84061
|
||||
F src/vacuum.c 82dcec9e7b1afa980288718ad11bc499651c722d7b9f32933c4d694d91cb6ebf
|
||||
F src/vdbe.c 1041610254502572bcc79ce6f61d9364fb93c154a4935fbaeaa7fd2e158e5205
|
||||
F src/vdbe.c 7cd09c6cc4d0e0053ced392ea4d04762e7ffd1470ff1b90ba3ebd2869c849ae8
|
||||
F src/vdbe.h 3f2b571e702e77e6bf031f0236e554aedfae643e991f69000320f481408455cf
|
||||
F src/vdbeInt.h e95de5129124d77f01439e6635012adfaf23c0017bff47296126143cf18bd0c6
|
||||
F src/vdbeapi.c 95001d0f84ee3cda344fed98ca0d7961deb4fc836b83495630d0af1f7cc4789e
|
||||
@@ -1670,7 +1670,7 @@ F test/walthread.test 14b20fcfa6ae152f5d8e12f5dc8a8a724b7ef189f5d8ef1e2ceab79f2a
|
||||
F test/walvfs.test f1accd66c876e3a0f6b4bef5b18d13411062d0ff0a0016e32bb41570474e99fc
|
||||
F test/wapp.tcl b440cd8cf57953d3a49e7ee81e6a18f18efdaf113b69f7d8482b0710a64566ec
|
||||
F test/wapptest.tcl 3090239c59379d41e1a0644feb6683082fdb86edfab0c668973f8003f22c0e5d x
|
||||
F test/where.test d640c16d33ae671c7583fd575d1a64fd55194dcc4393b877b3028db9ddba5a3b
|
||||
F test/where.test 19c709c9f0f6ed12c23f909f6592aa55fba34269d5a2898537aa27a22b9ce650
|
||||
F test/where2.test 478d2170637b9211f593120648858593bf2445a1
|
||||
F test/where3.test 2341a294e17193a6b1699ea7f192124a5286ca6acfcc3f4b06d16c931fbcda2c
|
||||
F test/where4.test 4a371bfcc607f41d233701bdec33ac2972908ba8
|
||||
@@ -1836,7 +1836,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
|
||||
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||
P 4c01e0170e113ad052b6c3980beb4be9f1dc03fb3cf34132b90e8b82b23f654e
|
||||
R ba43ef9ffea471302d6253c6ac41d4d7
|
||||
U dan
|
||||
Z 050be14a9fe83dd49b34a7e227f313e7
|
||||
P d02490a2f0cae047087130b4ad8f55f265845c2ffb3bde3b7d507edb54acea6d
|
||||
R 9a1f89de468f638cf6272be3b894c4f7
|
||||
U drh
|
||||
Z 8cbd654fcd7e359876e90cf539c4f92a
|
||||
|
@@ -1 +1 @@
|
||||
d02490a2f0cae047087130b4ad8f55f265845c2ffb3bde3b7d507edb54acea6d
|
||||
81b9f0f55042777b37de78069f7089041a9ee21dd0a0c86b879053fb46e140b4
|
14
src/vdbe.c
14
src/vdbe.c
@@ -4127,6 +4127,7 @@ case OP_SeekGT: { /* jump, in3, group */
|
||||
pC->deferredMoveto = 0;
|
||||
pC->cacheStatus = CACHE_STALE;
|
||||
if( pC->isTable ){
|
||||
u16 flags3, newType;
|
||||
/* The BTREE_SEEK_EQ flag is only set on index cursors */
|
||||
assert( sqlite3BtreeCursorHasHint(pC->uc.pCursor, BTREE_SEEK_EQ)==0
|
||||
|| CORRUPT_DB );
|
||||
@@ -4135,16 +4136,19 @@ case OP_SeekGT: { /* jump, in3, group */
|
||||
** blob, or NULL. But it needs to be an integer before we can do
|
||||
** the seek, so convert it. */
|
||||
pIn3 = &aMem[pOp->p3];
|
||||
if( (pIn3->flags & (MEM_Int|MEM_Real|MEM_IntReal|MEM_Str))==MEM_Str ){
|
||||
flags3 = pIn3->flags;
|
||||
if( (flags3 & (MEM_Int|MEM_Real|MEM_IntReal|MEM_Str))==MEM_Str ){
|
||||
applyNumericAffinity(pIn3, 0);
|
||||
}
|
||||
iKey = sqlite3VdbeIntValue(pIn3);
|
||||
iKey = sqlite3VdbeIntValue(pIn3); /* Get the integer key value */
|
||||
newType = pIn3->flags; /* Record the type after applying numeric affinity */
|
||||
pIn3->flags = flags3; /* But convert the type back to its original */
|
||||
|
||||
/* If the P3 value could not be converted into an integer without
|
||||
** loss of information, then special processing is required... */
|
||||
if( (pIn3->flags & (MEM_Int|MEM_IntReal))==0 ){
|
||||
if( (pIn3->flags & MEM_Real)==0 ){
|
||||
if( (pIn3->flags & MEM_Null) || oc>=OP_SeekGE ){
|
||||
if( (newType & (MEM_Int|MEM_IntReal))==0 ){
|
||||
if( (newType & MEM_Real)==0 ){
|
||||
if( (newType & MEM_Null) || oc>=OP_SeekGE ){
|
||||
VdbeBranchTaken(1,2);
|
||||
goto jump_to_p2;
|
||||
}else{
|
||||
|
@@ -1538,4 +1538,37 @@ do_catchsql_test where-25.5 {
|
||||
ON CONFLICT(c) DO UPDATE SET b=NULL
|
||||
} {1 {corrupt database}}
|
||||
|
||||
# 2019-08-21 Ticket https://www.sqlite.org/src/info/d9f584e936c7a8d0
|
||||
#
|
||||
db close
|
||||
sqlite3 db :memory:
|
||||
do_execsql_test where-26.1 {
|
||||
CREATE TABLE t0(c0 INTEGER PRIMARY KEY, c1 TEXT);
|
||||
INSERT INTO t0(c0, c1) VALUES (1, 'a');
|
||||
CREATE TABLE t1(c0 INT PRIMARY KEY, c1 TEXT);
|
||||
INSERT INTO t1(c0, c1) VALUES (1, 'a');
|
||||
SELECT * FROM t0 WHERE '-1' BETWEEN 0 AND t0.c0;
|
||||
} {1 a}
|
||||
do_execsql_test where-26.2 {
|
||||
SELECT * FROM t1 WHERE '-1' BETWEEN 0 AND t1.c0;
|
||||
} {1 a}
|
||||
do_execsql_test where-26.3 {
|
||||
SELECT * FROM t0 WHERE '-1'>=0 AND '-1'<=t0.c0;
|
||||
} {1 a}
|
||||
do_execsql_test where-26.4 {
|
||||
SELECT * FROM t1 WHERE '-1'>=0 AND '-1'<=t1.c0;
|
||||
} {1 a}
|
||||
do_execsql_test where-26.5 {
|
||||
SELECT '-1' BETWEEN 0 AND t0.c0 FROM t0;
|
||||
} {1}
|
||||
do_execsql_test where-26.6 {
|
||||
SELECT '-1' BETWEEN 0 AND t1.c0 FROM t1;
|
||||
} {1}
|
||||
do_execsql_test where-26.7 {
|
||||
SELECT '-1'>=0 AND '-1'<=t0.c0 FROM t0;
|
||||
} {1}
|
||||
do_execsql_test where-26.8 {
|
||||
SELECT '-1'>=0 AND '-1'<=t1.c0 FROM t1;
|
||||
} {1}
|
||||
|
||||
finish_test
|
||||
|
Reference in New Issue
Block a user