Merge bug fix from trunk.
FossilOrigin-Name: a905d5e08de3f3c60b667d840b5995911372647d
This commit is contained in:
commit
dc7adf20bb
@ -1032,7 +1032,7 @@ FTS5_SRC = \
|
||||
fts5parse.c: $(TOP)/ext/fts5/fts5parse.y lemon
|
||||
cp $(TOP)/ext/fts5/fts5parse.y .
|
||||
rm -f fts5parse.h
|
||||
./lemon $(OPTS) fts5parse.y
|
||||
./lemon$(BEXE) $(OPTS) fts5parse.y
|
||||
|
||||
fts5parse.h: fts5parse.c
|
||||
|
||||
|
16
manifest
16
manifest
@ -1,6 +1,6 @@
|
||||
C Merge\sthe\stemporary\sdirectory\ssearch\salgorithm\sfix\sfrom\strunk.
|
||||
D 2016-04-23T21:16:55.627
|
||||
F Makefile.in eba680121821b8a60940a81454316f47a341487a
|
||||
C Merge\sbug\sfix\sfrom\strunk.
|
||||
D 2016-04-25T15:03:49.467
|
||||
F Makefile.in a905f3180accdafbd5a534bf26126ee5306d5056
|
||||
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
|
||||
F Makefile.msc 71b8b16cf9393f68e2e2035486ca104872558836
|
||||
F README.md 8ecc12493ff9f820cdea6520a9016001cb2e59b7
|
||||
@ -377,7 +377,7 @@ F src/printf.c 63e6fb12bbe702dd664dc3703776c090383a5a26
|
||||
F src/random.c ba2679f80ec82c4190062d756f22d0c358180696
|
||||
F src/resolve.c b8f7174e5f8c33c44ded3a25a973d0bb89228c20
|
||||
F src/rowset.c 9fe4b3ad7cc00944386bb600233d8f523de07a6e
|
||||
F src/select.c 30217121bdf6b587462150b8ee9e1467f7a6036b
|
||||
F src/select.c fd4a7ce2937497181063cfedb92058ac89491a5d
|
||||
F src/shell.c 14ff7f660530a52b117d110ba3390b7b2eb719b6
|
||||
F src/sqlite.h.in 9984129d86243424b765fcb3f147c697bd20bb54
|
||||
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
|
||||
@ -1026,7 +1026,7 @@ F test/securedel2.test 2d54c28e46eb1fd6902089958b20b1b056c6f1c5
|
||||
F test/select1.test be62204d2bd9a5a8a149e9974cfddce893d8f686
|
||||
F test/select2.test 352480e0e9c66eda9c3044e412abdf5be0215b56
|
||||
F test/select3.test 2ce595f8fb8e2ac10071d3b4e424cadd4634a054
|
||||
F test/select4.test d926792a5e4d88fef0ddcddeb45d27ce75f7296c
|
||||
F test/select4.test 5389d9895968d1196c457d59b3ee6515d771d328
|
||||
F test/select5.test e758b8ef94f69b111df4cb819008856655dcd535
|
||||
F test/select6.test 39eac4a5c03650b2b473c532882273283ee8b7a0
|
||||
F test/select7.test 95e370c42d47c3c52377d05e9ffc01ccff7c1f61
|
||||
@ -1486,7 +1486,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 84da122dd6e70ed603fea781dca204ae2f668c53 b38fe522cfc971b37ca04e7b63a92bbb6e0b01e1
|
||||
R 1c713059486f406d1d7b0495652a35d4
|
||||
P 9b8fec60d8e576cd09e1d075a59bfad1c6169d7a ec215f94ac9748c0acd82af0cc9e7a92249462f9
|
||||
R e941df834a8d6e2084dd43227adc9b5d
|
||||
U drh
|
||||
Z a4b2d03080ca1bec249054a4e309e0ee
|
||||
Z 530f6cc77507869285e9eb18ff03544a
|
||||
|
@ -1 +1 @@
|
||||
9b8fec60d8e576cd09e1d075a59bfad1c6169d7a
|
||||
a905d5e08de3f3c60b667d840b5995911372647d
|
14
src/select.c
14
src/select.c
@ -3785,14 +3785,18 @@ static int pushDownWhereTerms(
|
||||
){
|
||||
Expr *pNew;
|
||||
int nChng = 0;
|
||||
Select *pX; /* For looping over compound SELECTs in pSubq */
|
||||
if( pWhere==0 ) return 0;
|
||||
if( (pSubq->selFlags & (SF_Aggregate|SF_Recursive))!=0 ){
|
||||
testcase( pSubq->selFlags & SF_Aggregate );
|
||||
testcase( pSubq->selFlags & SF_Recursive );
|
||||
return 0; /* restrictions (1) and (2) */
|
||||
for(pX=pSubq; pX; pX=pX->pPrior){
|
||||
if( (pX->selFlags & (SF_Aggregate|SF_Recursive))!=0 ){
|
||||
testcase( pX->selFlags & SF_Aggregate );
|
||||
testcase( pX->selFlags & SF_Recursive );
|
||||
testcase( pX!=pSubq );
|
||||
return 0; /* restrictions (1) and (2) */
|
||||
}
|
||||
}
|
||||
if( pSubq->pLimit!=0 ){
|
||||
return 0; /* restriction (3) */
|
||||
return 0; /* restriction (3) */
|
||||
}
|
||||
while( pWhere->op==TK_AND ){
|
||||
nChng += pushDownWhereTerms(db, pSubq, pWhere->pRight, iCursor);
|
||||
|
@ -968,6 +968,42 @@ do_execsql_test select4-16.3 {
|
||||
ORDER BY t3.a;
|
||||
} {95 96 97 98 99}
|
||||
|
||||
# Ticket https://www.sqlite.org/src/tktview/f7f8c97e975978d45 on 2016-04-25
|
||||
#
|
||||
# The where push-down optimization from 2015-06-02 is suppose to disable
|
||||
# on aggregate subqueries. But if the subquery is a compound where the
|
||||
# last SELECT is non-aggregate but some other SELECT is an aggregate, the
|
||||
# test is incomplete and the optimization is not properly disabled.
|
||||
#
|
||||
# The following test cases verify that the fix works.
|
||||
#
|
||||
do_execsql_test select4-17.1 {
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1(a int, b int);
|
||||
INSERT INTO t1 VALUES(1,2),(1,18),(2,19);
|
||||
SELECT x, y FROM (
|
||||
SELECT 98 AS x, 99 AS y
|
||||
UNION
|
||||
SELECT a AS x, sum(b) AS y FROM t1 GROUP BY a
|
||||
) AS w WHERE y>=20
|
||||
ORDER BY +x;
|
||||
} {1 20 98 99}
|
||||
do_execsql_test select4-17.2 {
|
||||
SELECT x, y FROM (
|
||||
SELECT a AS x, sum(b) AS y FROM t1 GROUP BY a
|
||||
UNION
|
||||
SELECT 98 AS x, 99 AS y
|
||||
) AS w WHERE y>=20
|
||||
ORDER BY +x;
|
||||
} {1 20 98 99}
|
||||
do_catchsql_test select4-17.3 {
|
||||
SELECT x, y FROM (
|
||||
SELECT a AS x, sum(b) AS y FROM t1 GROUP BY a LIMIT 3
|
||||
UNION
|
||||
SELECT 98 AS x, 99 AS y
|
||||
) AS w WHERE y>=20
|
||||
ORDER BY +x;
|
||||
} {1 {LIMIT clause should come after UNION not before}}
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user