mirror of
https://github.com/sqlite/sqlite.git
synced 2025-12-24 14:17:58 +03:00
Allow deterministic functions in the WHERE clause of a partial index.
FossilOrigin-Name: c6e9b9421805c904b20900b711fa0e51773aef3e
This commit is contained in:
16
manifest
16
manifest
@@ -1,5 +1,5 @@
|
||||
C Size\sand\sperformance\soptimizations\son\sthe\ssqlite3ExprAssignVarNumber()\sroutine.
|
||||
D 2016-10-03T16:33:14.952
|
||||
C Allow\sdeterministic\sfunctions\sin\sthe\sWHERE\sclause\sof\sa\spartial\sindex.
|
||||
D 2016-10-03T18:13:23.577
|
||||
F Makefile.in 6fd48ffcf7c2deea7499062d1f3747f986c19678
|
||||
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
|
||||
F Makefile.msc 5151cc64c4c05f3455f4f692ad11410a810d937f
|
||||
@@ -384,7 +384,7 @@ F src/pragma.h 64c78a648751b9f4f297276c4eb7507b14b4628c
|
||||
F src/prepare.c b1140c3d0cf59bc85ace00ce363153041b424b7a
|
||||
F src/printf.c a5f0ca08ddede803c241266abb46356ec748ded1
|
||||
F src/random.c ba2679f80ec82c4190062d756f22d0c358180696
|
||||
F src/resolve.c 3c3cf0dc719cd2a32ab5c1e10c26481dd565492e
|
||||
F src/resolve.c e918c6434e315fc7f295863dcaa58da10d3a1e9c
|
||||
F src/rowset.c 7b7e7e479212e65b723bf40128c7b36dc5afdfac
|
||||
F src/select.c ea3af83e2d0f245fef81ea4cf04cb730ce67f722
|
||||
F src/shell.c b80396d2fadce4681397707e30078bf416e1dec2
|
||||
@@ -848,8 +848,8 @@ F test/index2.test f835d5e13ca163bd78c4459ca15fd2e4ed487407
|
||||
F test/index3.test 81bc47890b8abfb181bc35f8d10b56c069803386
|
||||
F test/index4.test ab92e736d5946840236cd61ac3191f91a7856bf6
|
||||
F test/index5.test 8621491915800ec274609e42e02a97d67e9b13e7
|
||||
F test/index6.test 43b4e29258b978fcdab84fc61df4f5212119dd09
|
||||
F test/index7.test 9c6765a74fc3fcde7aebc5b3bd40d98df14a527c
|
||||
F test/index6.test b4fc812290067a578b98bb2667b676db89e202a7
|
||||
F test/index7.test 7feababe16f2091b229c22aff2bcc1d4d6b9d2bb
|
||||
F test/index8.test bc2e3db70e8e62459aaa1bd7e4a9b39664f8f9d7
|
||||
F test/indexedby.test 9c4cd331224e57f79fbf411ae245e6272d415985
|
||||
F test/indexexpr1.test cb71b6586177b840e28110dd952178bb2bdfedc2
|
||||
@@ -1525,7 +1525,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 d15ae2e530cffea60263f203ac5f89b6790f4bd5
|
||||
R 02650575d610a64473014408e653c2e2
|
||||
P 109852e51e2cc2674940ba3e5097a92e66f88bb8
|
||||
R 570e98b0ce01791f7df81d2307617f83
|
||||
U drh
|
||||
Z 400dafa0c844d13dbe01d3e4d393d771
|
||||
Z 806f5071a81ad8307711df9ff707b7fc
|
||||
|
||||
@@ -1 +1 @@
|
||||
109852e51e2cc2674940ba3e5097a92e66f88bb8
|
||||
c6e9b9421805c904b20900b711fa0e51773aef3e
|
||||
@@ -623,7 +623,6 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){
|
||||
|
||||
/* if( pSrcList==0 ) break; */
|
||||
notValid(pParse, pNC, "the \".\" operator", NC_IdxExpr);
|
||||
/*notValid(pParse, pNC, "the \".\" operator", NC_PartIdx|NC_IsCheck, 1);*/
|
||||
pRight = pExpr->pRight;
|
||||
if( pRight->op==TK_ID ){
|
||||
zDb = 0;
|
||||
@@ -652,7 +651,7 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){
|
||||
u8 enc = ENC(pParse->db); /* The database encoding */
|
||||
|
||||
assert( !ExprHasProperty(pExpr, EP_xIsSelect) );
|
||||
notValid(pParse, pNC, "functions", NC_PartIdx);
|
||||
// notValid(pParse, pNC, "functions", NC_PartIdx);
|
||||
zId = pExpr->u.zToken;
|
||||
nId = sqlite3Strlen30(zId);
|
||||
pDef = sqlite3FindFunction(pParse->db, zId, n, enc, 0);
|
||||
@@ -712,7 +711,8 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){
|
||||
/* Date/time functions that use 'now', and other functions like
|
||||
** sqlite_version() that might change over time cannot be used
|
||||
** in an index. */
|
||||
notValid(pParse, pNC, "non-deterministic functions", NC_IdxExpr);
|
||||
notValid(pParse, pNC, "non-deterministic functions",
|
||||
NC_IdxExpr|NC_PartIdx);
|
||||
}
|
||||
}
|
||||
if( is_agg && (pNC->ncFlags & NC_AllowAgg)==0 ){
|
||||
|
||||
@@ -65,12 +65,15 @@ do_test index6-1.5 {
|
||||
catchsql {
|
||||
CREATE INDEX bad1 ON t1(a,b) WHERE a!=random();
|
||||
}
|
||||
} {1 {functions prohibited in partial index WHERE clauses}}
|
||||
} {1 {non-deterministic functions prohibited in partial index WHERE clauses}}
|
||||
do_test index6-1.6 {
|
||||
catchsql {
|
||||
CREATE INDEX bad1 ON t1(a,b) WHERE a NOT LIKE 'abc%';
|
||||
}
|
||||
} {1 {functions prohibited in partial index WHERE clauses}}
|
||||
} {0 {}}
|
||||
do_execsql_test index6-1.7 {
|
||||
DROP INDEX IF EXISTS bad1;
|
||||
}
|
||||
|
||||
do_test index6-1.10 {
|
||||
execsql {
|
||||
|
||||
@@ -99,12 +99,25 @@ do_test index7-1.5 {
|
||||
catchsql {
|
||||
CREATE INDEX bad1 ON t1(a,b) WHERE a!=random();
|
||||
}
|
||||
} {1 {functions prohibited in partial index WHERE clauses}}
|
||||
} {1 {non-deterministic functions prohibited in partial index WHERE clauses}}
|
||||
do_test index7-1.6 {
|
||||
catchsql {
|
||||
CREATE INDEX bad1 ON t1(a,b) WHERE a NOT LIKE 'abc%';
|
||||
}
|
||||
} {1 {functions prohibited in partial index WHERE clauses}}
|
||||
} {0 {}}
|
||||
do_execsql_test index7-1.7 {
|
||||
INSERT INTO t1(a,b,c)
|
||||
VALUES('abcde',1,101),('abdef',2,102),('xyz',3,103),('abcz',4,104);
|
||||
SELECT c FROM t1 WHERE a NOT LIKE 'abc%' AND a=7 ORDER BY +b;
|
||||
} {7}
|
||||
do_execsql_test index7-1.7eqp {
|
||||
EXPLAIN QUERY PLAN
|
||||
SELECT b FROM t1 WHERE a NOT LIKE 'abc%' AND a=7 ORDER BY +b;
|
||||
} {/SEARCH TABLE t1 USING COVERING INDEX bad1 /}
|
||||
do_execsql_test index7-1.8 {
|
||||
DELETE FROM t1 WHERE c>=101;
|
||||
DROP INDEX IF EXISTS bad1;
|
||||
} {}
|
||||
|
||||
do_test index7-1.10 {
|
||||
execsql {
|
||||
|
||||
Reference in New Issue
Block a user