]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Rename sqlite3IsTableConstraint() to sqlite3IsSingleTableConstraint() and
authordrh <>
Wed, 10 May 2023 11:05:59 +0000 (11:05 +0000)
committerdrh <>
Wed, 10 May 2023 11:05:59 +0000 (11:05 +0000)
improve its header comment, in an attempt to make the code easier to reason
about.  No functional changes - should generate identical machine code.

FossilOrigin-Name: 5dae897431a0a9dbb354c4a8a48f935ea7438035d96f90b83dd81eae434c8277

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

index 0b2a3a39e2562082bea297811818301cf8c82397..beece745b5ffa772f83b8f4f1eb4ced576875bc8 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Add\sa\smissing\scomma\sto\sthe\sdocumentation\sfor\sthe\sOP_Jump\sopcode.\s\sNo\schanges\nto\scode.
-D 2023-05-10T10:03:28.780
+C Rename\ssqlite3IsTableConstraint()\sto\ssqlite3IsSingleTableConstraint()\sand\nimprove\sits\sheader\scomment,\sin\san\sattempt\sto\smake\sthe\scode\seasier\sto\sreason\nabout.\s\sNo\sfunctional\schanges\s-\sshould\sgenerate\sidentical\smachine\scode.
+D 2023-05-10T11:05:59.149
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -585,7 +585,7 @@ F src/date.c aca9e0c08b400b21238b609aea7c09585396cd770985cf8f475560f69222dad3
 F src/dbpage.c f3eea5f7ec47e09ee7da40f42b25092ecbe961fc59566b8e5f705f34335b2387
 F src/dbstat.c ec92074baa61d883de58c945162d9e666c13cd7cf3a23bc38b4d1c4d0b2c2bef
 F src/delete.c a9c6d3f51c0a31e9b831e0a0580a98d702904b42d216fee530940e40dec34873
-F src/expr.c 871cfd80c516ee39d90414b2d3da2b5bc9c9e21fe87b7eb787ea7ae4b6461758
+F src/expr.c 6b04cccecd6f3342673fafd56033c7e40a3ff1531a6550d0a0af36bac8e824a7
 F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007
 F src/fkey.c 03c134cc8bffe54835f742ddea0b72ebfc8f6b32773d175c71b8afeea6cb5c83
 F src/func.c 03e6b501f3056d0ba398bda17df938b2b566aa0b3ca7e1942a3cd1925d04ec36
@@ -635,12 +635,12 @@ F src/printf.c b9320cdbeca0b336c3f139fd36dd121e4167dd62b35fbe9ccaa9bab44c0af38d
 F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c
 F src/resolve.c 3e53e02ce87c9582bd7e7d22f13f4094a271678d9dc72820fa257a2abb5e4032
 F src/rowset.c ba9515a922af32abe1f7d39406b9d35730ed65efab9443dc5702693b60854c92
-F src/select.c 74cc112615f42f6dac0ecb4f4b7d2d33f89703c6b63a2a2cc88d4fba138e53f3
+F src/select.c 46ff52b69d3a85cb71663e48ca2ce6fb8ca35708cb80dda0e4abc4225f2c1d88
 F src/shell.c.in 8cfc51a5711df05ea0e8a4fbbe20117eb629233f0e92ebea21c2e7dc717ec3d9
 F src/sqlite.h.in 27ca1d4b2eda8feee468af5735182390e8fe4696522751eec0136d17323201ad
 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
 F src/sqlite3ext.h da473ce2b3d0ae407a6300c4a164589b9a6bfdbec9462688a8593ff16f3bb6e4
-F src/sqliteInt.h 91303fb4ee858b85ae1a8a48cc8f723339b81ba7138b42ee5c000083bfff0934
+F src/sqliteInt.h 6e08039aa944e874d3878c4f12bbd78cea797c988dad147adc9ffb1c2b179402
 F src/sqliteLimit.h d7323ffea5208c6af2734574bae933ca8ed2ab728083caa117c9738581a31657
 F src/status.c 160c445d7d28c984a0eae38c144f6419311ed3eace59b44ac6dafc20db4af749
 F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1
@@ -720,7 +720,7 @@ F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9
 F src/wal.c 7a65f64bfe4a783c5e2df73ffb0efc383dec934dee9e3ac706b2eeb3631d17ac
 F src/wal.h c3aa7825bfa2fe0d85bef2db94655f99870a285778baa36307c0a16da32b226a
 F src/walker.c f890a3298418d7cba3b69b8803594fdc484ea241206a8dfa99db6dd36f8cbb3b
-F src/where.c f69d94f34e1c523cd9b66041e4afe015cad29888617f3c09a2a5bc36018917d0
+F src/where.c 324445b046167c86c6fb4c94d4be816edcbbbf6df17fd94f1def2c3dd27520d5
 F src/whereInt.h e25203e5bfee149f5f1225ae0166cfb4f1e65490c998a024249e98bb0647377c
 F src/wherecode.c b300db0bcd84ad6c2642bf3f509f92fad7b7d697b9856b64dd66d692d184d054
 F src/whereexpr.c 22cf19b0ececeaf838daed1039c5231a8778784eba5ad67b991442a23473fd3f
@@ -2068,8 +2068,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P da3fba18742b6e0bd5290bee9d86a2d5cb1ff2de25d737ef93060d7c1143273f
-R c041941eeb7c445508464d8ad51f88f3
+P 7e2c2b1cee760af68cf303ce9ec1babbaf607fe54e043893c046d2d37cd0ab46
+R 2a126fc6537ab2e89822c6a7f6e0e7f6
 U drh
-Z 30a99f1cd999b043032a00ec42ab456b
+Z fcf39436102b8d866db8404789c74929
 # Remove this line to create a well-formed Fossil manifest.
index badf097c2d0500202fcee96a3fe9ed670068ec7e..1f17c5cde020333059c9141e58900e7972ee5f0c 100644 (file)
@@ -1 +1 @@
-7e2c2b1cee760af68cf303ce9ec1babbaf607fe54e043893c046d2d37cd0ab46
\ No newline at end of file
+5dae897431a0a9dbb354c4a8a48f935ea7438035d96f90b83dd81eae434c8277
\ No newline at end of file
index 9ffc3baded5168f521332701d47bffc680c51609..acd86ac1c89472eedf8c4fb42262de490761de1a 100644 (file)
@@ -2378,12 +2378,16 @@ int sqlite3ExprIsTableConstant(Expr *p, int iCur){
 }
 
 /*
-** Check pExpr to see if it is an invariant constraint on data source pSrc.
+** Check pExpr to see if it is an constraint on the single data source pSrc.
+** In other words, check to see if pExpr constrains pSrc but does not depend
+** on any other tables or data sources anywhere else in the query.  Return
+** true (non-zero) if pExpr is a constraint on pSrc only.
+**
 ** This is an optimization.  False negatives will perhaps cause slower
 ** queries, but false positives will yield incorrect answers.  So when in
 ** doubt, return 0.
 **
-** To be an invariant constraint, the following must be true:
+** To be an single-source constraint, the following must be true:
 **
 **   (1)  pExpr cannot refer to any table other than pSrc->iCursor.
 **
@@ -2400,7 +2404,7 @@ int sqlite3ExprIsTableConstant(Expr *p, int iCur){
 **        operand of a RIGHT JOIN, then pExpr must be from the WHERE
 **        clause, not an ON clause.
 */
-int sqlite3ExprIsTableConstraint(Expr *pExpr, const SrcItem *pSrc){
+int sqlite3ExprIsSingleTableConstraint(Expr *pExpr, const SrcItem *pSrc){
   if( pSrc->fg.jointype & JT_LTORJ ){
     return 0;  /* rule (3) */
   }
index 079158b4dd5ef67531047a88dd7b4da6502aa059..43dec7d2085b85be1be46f3c9bdbf91d58020a35 100644 (file)
@@ -5222,7 +5222,7 @@ static int pushDownWhereTerms(
     }
   }
 
-#if 0  /* Legacy code. Checks now done by sqlite3ExprIsTableConstraint() */
+#if 0 /* These checks now done by sqlite3ExprIsSingleTableConstraint() */
   if( isLeftJoin
    && (ExprHasProperty(pWhere,EP_OuterON)==0
          || pWhere->w.iJoin!=iCursor)
@@ -5236,7 +5236,7 @@ static int pushDownWhereTerms(
   }
 #endif
 
-  if( sqlite3ExprIsTableConstraint(pWhere, pSrc) ){
+  if( sqlite3ExprIsSingleTableConstraint(pWhere, pSrc) ){
     nChng++;
     pSubq->selFlags |= SF_PushDown;
     while( pSubq ){
index ea12116caf66cab299613df94c9a624a871f0a76..935d03805a0e5929391775ba267522d387567ec5 100644 (file)
@@ -4906,7 +4906,7 @@ int sqlite3ExprIsConstantNotJoin(Expr*);
 int sqlite3ExprIsConstantOrFunction(Expr*, u8);
 int sqlite3ExprIsConstantOrGroupBy(Parse*, Expr*, ExprList*);
 int sqlite3ExprIsTableConstant(Expr*,int);
-int sqlite3ExprIsTableConstraint(Expr*,const SrcItem*);
+int sqlite3ExprIsSingleTableConstraint(Expr*,const SrcItem*);
 #ifdef SQLITE_ENABLE_CURSOR_HINTS
 int sqlite3ExprContainsSubquery(Expr*);
 #endif
index f517150e124e25c9210cc005bb79fc323b683d10..527e1a3a67548b5ed4d7a964a9661dd588b4a48f 100644 (file)
@@ -922,7 +922,7 @@ static SQLITE_NOINLINE void constructAutomaticIndex(
     ** WHERE clause (or the ON clause of a LEFT join) that constrain which
     ** rows of the target table (pSrc) that can be used. */
     if( (pTerm->wtFlags & TERM_VIRTUAL)==0
-     && sqlite3ExprIsTableConstraint(pExpr, pSrc)
+     && sqlite3ExprIsSingleTableConstraint(pExpr, pSrc)
     ){
       pPartial = sqlite3ExprAnd(pParse, pPartial,
                                 sqlite3ExprDup(pParse->db, pExpr, 0));
@@ -1183,7 +1183,7 @@ static SQLITE_NOINLINE void sqlite3ConstructBloomFilter(
     for(pTerm=pWInfo->sWC.a; pTerm<pWCEnd; pTerm++){
       Expr *pExpr = pTerm->pExpr;
       if( (pTerm->wtFlags & TERM_VIRTUAL)==0
-       && sqlite3ExprIsTableConstraint(pExpr, pItem)
+       && sqlite3ExprIsSingleTableConstraint(pExpr, pItem)
       ){
         sqlite3ExprIfFalse(pParse, pTerm->pExpr, addrCont, SQLITE_JUMPIFNULL);
       }