]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Add the EP_OptOnly flag on expressions for WHERE clause
authordrh <drh@noemail.net>
Fri, 8 Jul 2005 14:14:22 +0000 (14:14 +0000)
committerdrh <drh@noemail.net>
Fri, 8 Jul 2005 14:14:22 +0000 (14:14 +0000)
terms that are added by the optimizer but should not be coded. (CVS 2540)

FossilOrigin-Name: f4a66ed04dfd8714746b766b4859682ea18e328f

manifest
manifest.uuid
src/sqliteInt.h
src/where.c

index 7a6dc3b29782575c100527f0a13790baa606d0d8..c340befca10e4aa48548407d2e0595e754babc8a 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Add\sthe\sSQLITE_CASE_SENSITIVE_LIKE\scompile-time\soption.\s(CVS\s2539)
-D 2005-07-08T13:53:22
+C Add\sthe\sEP_OptOnly\sflag\son\sexpressions\sfor\sWHERE\sclause\nterms\sthat\sare\sadded\sby\sthe\soptimizer\sbut\sshould\snot\sbe\scoded.\s(CVS\s2540)
+D 2005-07-08T14:14:23
 F Makefile.in 3c10cd7bc3ecbd60fe4d5a5c0f59bfa7fb217a66
 F Makefile.linux-gcc 06be33b2a9ad4f005a5f42b22c4a19dab3cbb5c7
 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@@ -64,7 +64,7 @@ F src/random.c 90adff4e73a3b249eb4f1fc2a6ff9cf78c7233a4
 F src/select.c 28b752e58955c7920711fbdbfdcd369a2bd09448
 F src/shell.c 25b3217d7c64e6497225439d261a253a23efff26
 F src/sqlite.h.in e06d5774e9cfa5962376ae988300a9f114a3e3d7
-F src/sqliteInt.h a5ad4b51d99ada5e065808670f7cef87264606df
+F src/sqliteInt.h b7b2f7fc2c24bcfcedd2c0981a685860f16eb90b
 F src/table.c 25b3ff2b39b7d87e8d4a5da0713d68dfc06cbee9
 F src/tclsqlite.c cccaf6b78c290d824cf8ea089b8b27377e545830
 F src/test1.c 83ead44dead55033adff61ce69a1e2fc3e72935e
@@ -85,7 +85,7 @@ F src/vdbeapi.c 7f392f0792d1258c958083d7de9eae7c3530c9a6
 F src/vdbeaux.c 3732a86566a6be4da4c606e9334baf3fd98667af
 F src/vdbefifo.c b8805850afe13b43f1de78d58088cb5d66f88e1e
 F src/vdbemem.c da8e8d6f29dd1323f782f000d7cd120027c9ff03
-F src/where.c 97f356317024597e684b750658f2e8822cb15f10
+F src/where.c e9c0c19052742d74783bdc8dba07ab42609debb7
 F tclinstaller.tcl 046e3624671962dc50f0481d7c25b38ef803eb42
 F test/all.test 7f0988442ab811dfa41793b5b550f5828ce316f3
 F test/alter.test 9d6837a3d946b73df692b7cef2a7644d2e2f6bc6
@@ -285,7 +285,7 @@ F www/tclsqlite.tcl 425be741b8ae664f55cb1ef2371aab0a75109cf9
 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
 F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b
 F www/whentouse.tcl 528299b8316726dbcc5548e9aa0648c8b1bd055b
-P 94c120bb782fed53142317d1755e70c858930486
-R b0c32db552222c1fd1e02ca33b3a5bc8
+P b72bff81f9937378417a0af0610d8558279b67a7
+R c4fc77478fdb3a3d8e789b5f5aefe0b7
 U drh
-Z e8701805019a78e6817d706ed8df3c13
+Z bbe2b8533b9721f74ae254c674c04a75
index b7f5f9b4cd693b29638ce76fc3363550fb9ac9f4..53516219b5da4ccd54dae709ba923d8f5c6f4880 100644 (file)
@@ -1 +1 @@
-b72bff81f9937378417a0af0610d8558279b67a7
\ No newline at end of file
+f4a66ed04dfd8714746b766b4859682ea18e328f
\ No newline at end of file
index d7f304be975266cf6428cefed5e9d8a445520e0a..0b2c0ea9f0ba9726a3785e2aea475dec9cc4d074 100644 (file)
@@ -11,7 +11,7 @@
 *************************************************************************
 ** Internal interface definitions for SQLite.
 **
-** @(#) $Id: sqliteInt.h,v 1.390 2005/07/08 12:13:05 drh Exp $
+** @(#) $Id: sqliteInt.h,v 1.391 2005/07/08 14:14:23 drh Exp $
 */
 #ifndef _SQLITEINT_H_
 #define _SQLITEINT_H_
@@ -838,12 +838,13 @@ struct Expr {
 /*
 ** The following are the meanings of bits in the Expr.flags field.
 */
-#define EP_FromJoin     0x0001  /* Originated in ON or USING clause of a join */
-#define EP_Agg          0x0002  /* Contains one or more aggregate functions */
-#define EP_Resolved     0x0004  /* IDs have been resolved to COLUMNs */
-#define EP_Error        0x0008  /* Expression contains one or more errors */
-#define EP_Not          0x0010  /* Operator preceeded by NOT */
-#define EP_VarSelect    0x0020  /* pSelect is correlated, not constant */
+#define EP_FromJoin     0x01  /* Originated in ON or USING clause of a join */
+#define EP_Agg          0x02  /* Contains one or more aggregate functions */
+#define EP_Resolved     0x04  /* IDs have been resolved to COLUMNs */
+#define EP_Error        0x08  /* Expression contains one or more errors */
+#define EP_Not          0x10  /* Operator preceeded by NOT */
+#define EP_VarSelect    0x20  /* pSelect is correlated, not constant */
+#define EP_OptOnly      0x40  /* A constraint used by the optimizer only */
 
 /*
 ** These macros can be used to test, set, or clear bits in the 
index 1fd9ff3a4eacf0d4f1228b8c61304ff17c856c48..75cc412cea7ac6c2dea4e67c0cacd4e4bad5504d 100644 (file)
@@ -16,7 +16,7 @@
 ** so is applicable.  Because this module is responsible for selecting
 ** indices, you might also think of this module as the "query optimizer".
 **
-** $Id: where.c,v 1.140 2005/07/01 11:38:45 drh Exp $
+** $Id: where.c,v 1.141 2005/07/08 14:14:23 drh Exp $
 */
 #include "sqliteInt.h"
 
@@ -1309,12 +1309,13 @@ WhereInfo *sqlite3WhereBegin(
     ** computed using the current set of tables.
     */
     for(pTerm=aExpr, j=0; j<nExpr; j++, pTerm++){
-      if( pTerm->p==0 ) continue;
+      Expr *pE = pTerm->p;
+      if( pE==0 || ExprHasProperty(pE, EP_OptOnly) ) continue;
       if( (pTerm->prereqAll & loopMask)!=pTerm->prereqAll ) continue;
-      if( pLevel->iLeftJoin && !ExprHasProperty(pTerm->p,EP_FromJoin) ){
+      if( pLevel->iLeftJoin && !ExprHasProperty(pE, EP_FromJoin) ){
         continue;
       }
-      sqlite3ExprIfFalse(pParse, pTerm->p, cont, 1);
+      sqlite3ExprIfFalse(pParse, pE, cont, 1);
       pTerm->p = 0;
     }
     brk = cont;
@@ -1328,9 +1329,10 @@ WhereInfo *sqlite3WhereBegin(
       sqlite3VdbeAddOp(v, OP_MemStore, pLevel->iLeftJoin, 1);
       VdbeComment((v, "# record LEFT JOIN hit"));
       for(pTerm=aExpr, j=0; j<nExpr; j++, pTerm++){
-        if( pTerm->p==0 ) continue;
+        Expr *pE = pTerm->p;
+        if( pE==0 || ExprHasProperty(pE, EP_OptOnly) ) continue;
         if( (pTerm->prereqAll & loopMask)!=pTerm->prereqAll ) continue;
-        sqlite3ExprIfFalse(pParse, pTerm->p, cont, 1);
+        sqlite3ExprIfFalse(pParse, pE, cont, 1);
         pTerm->p = 0;
       }
     }