-C Enhance\sthe\sdo_test\sproc\sin\sthe\stest\ssuite\sso\sthat\sif\sthe\sexpected\sresult\nis\sof\sthe\sform\s"/.../"\sor\s"~/.../"\sthen\sregular\sexpression\smatching\sis\sdone\nbetween\sresult\sand\sthe\s"..."\spart\sof\sthe\sexpectation.\s\sIn\sthe\s~/.../\scase,\nwe\sexpect\sthere\sto\sbe\sno\smatch.
-D 2012-04-27T01:08:02.413
+C Enhance\sthe\sprocessing\sof\sORDER\sBY\sclauses\son\scompound\squeries\sto\sbetter\nmatch\sterms\sof\sthe\sorder\sby\sagainst\sexpressions\sin\sthe\sresult\sset,\sin\sorder\nto\senable\sbetter\squery\soptimization.
+D 2012-04-27T01:09:06.388
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 2f37e468503dbe79d35c9f6dffcf3fae1ae9ec20
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
F src/prepare.c ec4989f7f480544bdc4192fe663470d2a2d7d61e
F src/printf.c 7ffb4ebb8b341f67e049695ba031da717b3d2699
F src/random.c cd4a67b3953b88019f8cd4ccd81394a8ddfaba50
-F src/resolve.c 969ec2bc52db1b068054ecf5ddc74f244102a71d
+F src/resolve.c 748e75299faff345f34f0e5bd02a2bac8aa69fcd
F src/rowset.c f6a49f3e9579428024662f6e2931832511f831a1
F src/select.c d7b9018b7dd2e821183d69477ab55c39b8272335
F src/shell.c 04399b2f9942bd02ed5ffee3b84bcdb39c52a1e6
F test/select6.test cc25a8650cf9a4d4f74e586c45a75f9836516b18
F test/select7.test dad6f00f0d49728a879d6eb6451d4752db0b0abe
F test/select8.test 391de11bdd52339c30580dabbbbe97e3e9a3c79d
-F test/select9.test 74c0fb2c6eecb0219cbed0cbe3df136f8fbf9343
+F test/select9.test c0ca3cd87a8ebb04de2cb1402c77df55d911a0ea
F test/selectA.test 06d1032fa9009314c95394f2ca2e60d9f7ae8532
F test/selectB.test 954e4e49cf1f896d61794e440669e03a27ceea25
F test/selectC.test 871fb55d884d3de5943c4057ebd22c2459e71977
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
F tool/warnings-clang.sh a8a0a3babda96dfb1ff51adda3cbbf3dfb7266c2
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
-P 696a5a40bb28c4a54c9951f877b67015dc00bf55
-R cec8a879e3e3cce3faf837e46a46ad14
+P c9a734406c016329e80d887f7438206e41c52ce7
+R 726c49ce225b59d324679d0a91302d23
U drh
-Z 3ce2501ea7e4d58e039b2073955afa3e
+Z fb90c7a1a92b2c585d3a7791f60ba9a6
ExprList *pOrderBy, /* An ORDER BY or GROUP BY clause to resolve */
const char *zType /* Either "ORDER" or "GROUP", as appropriate */
){
- int i; /* Loop counter */
+ int i, j; /* Loop counters */
int iCol; /* Column number */
struct ExprList_item *pItem; /* A term of the ORDER BY clause */
Parse *pParse; /* Parsing context */
if( sqlite3ResolveExprNames(pNC, pE) ){
return 1;
}
+ for(j=0; j<pSelect->pEList->nExpr; j++){
+ if( sqlite3ExprCompare(pE, pSelect->pEList->a[j].pExpr)==0 ){
+ pItem->iOrderByCol = j+1;
+ }
+ }
}
return sqlite3ResolveOrderGroupBy(pParse, pSelect, pOrderBy, zType);
}
}
} {}
+# Testing to make sure that queries involving a view of a compound select
+# are planned efficiently. This detects a problem reported on the mailing
+# list on 2012-04-26. See
+#
+# http://www.mail-archive.com/sqlite-users%40sqlite.org/msg69746.html
+#
+# For additional information.
+#
+do_test select9-5.1 {
+ db eval {
+ CREATE TABLE t51(x, y);
+ CREATE TABLE t52(x, y);
+ CREATE VIEW v5 as
+ SELECT x, y FROM t51
+ UNION ALL
+ SELECT x, y FROM t52;
+ CREATE INDEX t51x ON t51(x);
+ CREATE INDEX t52x ON t52(x);
+ EXPLAIN QUERY PLAN
+ SELECT * FROM v5 WHERE x='12345' ORDER BY y;
+ }
+} {~/SCAN TABLE/} ;# Uses indices with "*"
+do_test select9-5.2 {
+ db eval {
+ EXPLAIN QUERY PLAN
+ SELECT x, y FROM v5 WHERE x='12345' ORDER BY y;
+ }
+} {~/SCAN TABLE/} ;# Uses indices with "x, y"
+do_test select9-5.3 {
+ db eval {
+ EXPLAIN QUERY PLAN
+ SELECT x, y FROM v5 WHERE +x='12345' ORDER BY y;
+ }
+} {/SCAN TABLE/} ;# Full table scan if the "+x" prevents index usage.
+
finish_test