mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-05 15:55:57 +03:00
Reinstate the optimization of converting "a IN (C)" into "a=C" but only
if C is a constant. If the RHS is a table column, the complications of managing affinity and collations become too involved to mess with. FossilOrigin-Name: 8ac26a23d7f0ef29c5eb007c7467181f8b96102c8600ea8a5b15cc7584af27bd
This commit is contained in:
16
manifest
16
manifest
@@ -1,5 +1,5 @@
|
||||
C Fix\sa\s4\sbyte\sOOB\sread\sin\stest_multiplex.c.
|
||||
D 2020-01-28T16:55:32.945
|
||||
C Reinstate\sthe\soptimization\sof\sconverting\s"a\sIN\s(C)"\sinto\s"a=C"\sbut\sonly\nif\sC\sis\sa\sconstant.\s\sIf\sthe\sRHS\sis\sa\stable\scolumn,\sthe\scomplications\sof\nmanaging\saffinity\sand\scollations\sbecome\stoo\sinvolved\sto\smess\swith.
|
||||
D 2020-01-28T18:09:53.557
|
||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
|
||||
@@ -520,7 +520,7 @@ F src/os_win.c 035a813cbd17f355bdcad7ab894af214a9c13a1db8aeac902365350b98cd45a7
|
||||
F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a
|
||||
F src/pager.c c0bca72aa3f7b1cf521a9f350fcf8e5975ebf98da7dbb03492be876b0f053781
|
||||
F src/pager.h 71fe1d5016ec54d0cc5d344cd474e563450b438c59f535e8c1ec8a13b1373f14
|
||||
F src/parse.y c8d2de64db469fd56e0fa24da46cd8ec8523eb98626567d2708df371b47fdc3f
|
||||
F src/parse.y 61ae75b1764c86f56fdfe384d736e4ba9b0d54015a5ca61925d8cb6b94943d4c
|
||||
F src/pcache.c 385ff064bca69789d199a98e2169445dc16e4291fa807babd61d4890c3b34177
|
||||
F src/pcache.h 4f87acd914cef5016fae3030343540d75f5b85a1877eed1a2a19b9f284248586
|
||||
F src/pcache1.c 6596e10baf3d8f84cc1585d226cf1ab26564a5f5caf85a15757a281ff977d51a
|
||||
@@ -1036,7 +1036,7 @@ F test/hook2.test b9ff3b8c6519fb67f33192f1afe86e7782ee4ac8
|
||||
F test/icu.test 41aa8847745a879b897a7febea0f8f9efc8e67fe8bf680589b6e07c7b0a1569a
|
||||
F test/ieee754.test 806fc0ce7f305f57e3331eaceeddcfec9339e607
|
||||
F test/imposter1.test c3f1db2d3db2c24611a6596a3fc0ffc14f1466c8
|
||||
F test/in.test 3e9bd58597a444123a40a9ac94cae0fec8897e17e9f519b02fc370bcf5ba5175
|
||||
F test/in.test ae4ba0fe3232fdd84ef1090a68c5cd6ccd93f1f8774d5c967dd0c1b301492eed
|
||||
F test/in2.test 5d4c61d17493c832f7d2d32bef785119e87bde75
|
||||
F test/in3.test 3cbf58c87f4052cee3a58b37b6389777505aa0c0
|
||||
F test/in4.test 65460600d48933adba4283c6ebd089aae173d16136ab9d01f74c89089090c5a5
|
||||
@@ -1857,7 +1857,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 04885763c4cd00cbca26d048f2b19316bfc93e8edebeceaa171ebfc6c563d53e
|
||||
R ccb36e16e1c74a951841058837b1c319
|
||||
U dan
|
||||
Z 9b9a621d5ad2b7401767a9771b41836a
|
||||
P 912148913c11d98e48119a2c1fa7a0e52f318af36e7e2491d968ffde286c949f
|
||||
R 99ef17928f7f30256c747cec3d49b4aa
|
||||
U drh
|
||||
Z 321bb0b388d63502da00c0fc216615f8
|
||||
|
@@ -1 +1 @@
|
||||
912148913c11d98e48119a2c1fa7a0e52f318af36e7e2491d968ffde286c949f
|
||||
8ac26a23d7f0ef29c5eb007c7467181f8b96102c8600ea8a5b15cc7584af27bd
|
@@ -1193,6 +1193,12 @@ expr(A) ::= expr(A) between_op(N) expr(X) AND expr(Y). [BETWEEN] {
|
||||
*/
|
||||
sqlite3ExprUnmapAndDelete(pParse, A);
|
||||
A = sqlite3Expr(pParse->db, TK_INTEGER, N ? "1" : "0");
|
||||
}else if( 0 && Y->nExpr==1 && sqlite3ExprIsConstant(Y->a[0].pExpr) ){
|
||||
Expr *pRHS = Y->a[0].pExpr;
|
||||
Y->a[0].pExpr = 0;
|
||||
sqlite3ExprListDelete(pParse->db, Y);
|
||||
A = sqlite3PExpr(pParse, TK_EQ, A, pRHS);
|
||||
if( N ) A = sqlite3PExpr(pParse, TK_NOT, A, 0);
|
||||
}else{
|
||||
A = sqlite3PExpr(pParse, TK_IN, A, 0);
|
||||
if( A ){
|
||||
|
22
test/in.test
22
test/in.test
@@ -765,19 +765,25 @@ do_execsql_test in-18.1 {
|
||||
#
|
||||
# Also ticket https://sqlite.org/src/info/29f635e0af71234b
|
||||
#
|
||||
do_execsql_test in-19.1 {
|
||||
do_execsql_test in-19.10 {
|
||||
DROP TABLE IF EXISTS t0;
|
||||
CREATE TABLE t0(c0 REAL UNIQUE);
|
||||
INSERT INTO t0(c0) VALUES(2.07093491255203046E18);
|
||||
SELECT 1 FROM t0 WHERE c0 IN ('2070934912552030444');
|
||||
INSERT INTO t0(c0) VALUES(2.0625E00);
|
||||
SELECT 1 FROM t0 WHERE c0 IN ('2.0625');
|
||||
} {1}
|
||||
do_execsql_test in-19.2 {
|
||||
SELECT c0 IN ('2070934912552030444') FROM t0;
|
||||
do_execsql_test in-19.20 {
|
||||
SELECT c0 IN ('2.0625') FROM t0;
|
||||
} {1}
|
||||
do_execsql_test in-19.3 {
|
||||
SELECT c0 IN ('2070934912552030444',2,3) FROM t0;
|
||||
do_execsql_test in-19.21 {
|
||||
SELECT c0 = ('2.0625') FROM t0;
|
||||
} {1}
|
||||
do_execsql_test in-19.4 {
|
||||
do_execsql_test in-19.22 {
|
||||
SELECT c0 = ('0.20625e+01') FROM t0;
|
||||
} {1}
|
||||
do_execsql_test in-19.30 {
|
||||
SELECT c0 IN ('2.0625',2,3) FROM t0;
|
||||
} {1}
|
||||
do_execsql_test in-19.40 {
|
||||
DROP TABLE t0;
|
||||
CREATE TABLE t0(c0 TEXT, c1 REAL, c2, PRIMARY KEY(c2, c0, c1));
|
||||
CREATE INDEX i0 ON t0(c1 IN (c0));
|
||||
|
Reference in New Issue
Block a user