mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-18 10:21:03 +03:00
Fix the transitive constraint processing to only allow transitivity if the
operands of the == or IS operator have compatible affinities. FossilOrigin-Name: a46a247fbcfe6e63b12cef31353835295a650c9b
This commit is contained in:
15
manifest
15
manifest
@@ -1,5 +1,5 @@
|
|||||||
C Fix\sa\stypo\sin\sa\scomment.\s\sNo\schanges\sto\scode.
|
C Fix\sthe\stransitive\sconstraint\sprocessing\sto\sonly\sallow\stransitivity\sif\sthe\noperands\sof\sthe\s==\sor\sIS\soperator\shave\scompatible\saffinities.
|
||||||
D 2015-05-16T18:31:44.355
|
D 2015-05-16T19:17:17.907
|
||||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||||
F Makefile.in edfc69769e613a6359c42c06ea1d42c3bece1736
|
F Makefile.in edfc69769e613a6359c42c06ea1d42c3bece1736
|
||||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||||
@@ -307,7 +307,7 @@ F src/vxworks.h c18586c8edc1bddbc15c004fa16aeb1e1342b4fb
|
|||||||
F src/wal.c ce2cb2d06faab54d1bce3e739bec79e063dd9113
|
F src/wal.c ce2cb2d06faab54d1bce3e739bec79e063dd9113
|
||||||
F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4
|
F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4
|
||||||
F src/walker.c c253b95b4ee44b21c406e2a1052636c31ea27804
|
F src/walker.c c253b95b4ee44b21c406e2a1052636c31ea27804
|
||||||
F src/where.c 430ae75d8850ea9e3c7ceba8e05adb105300ddb4
|
F src/where.c 58c0161b81ec25bf7d221baf445d871ab98d9cce
|
||||||
F src/whereInt.h a6f5a762bc1b4b1c76e1cea79976b437ac35a435
|
F src/whereInt.h a6f5a762bc1b4b1c76e1cea79976b437ac35a435
|
||||||
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
|
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
|
||||||
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
|
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
|
||||||
@@ -1258,7 +1258,10 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
|
|||||||
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
||||||
F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
|
F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
|
||||||
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
|
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
|
||||||
P 2c1039d454e359b0eec3db2d4201b4ba7e543052
|
P ee4b74250ad7a4061421d44b490cb79f649b3720
|
||||||
R c540749c837ccfa9e646ed2d9c9c0493
|
R 1beebe1e9084926919d5e75f3ab331f9
|
||||||
|
T *branch * transitive-constraints
|
||||||
|
T *sym-transitive-constraints *
|
||||||
|
T -sym-trunk *
|
||||||
U drh
|
U drh
|
||||||
Z 98006a9bc56782e174c039d9f287e37a
|
Z 9dd679bea28da23301e6184e5fdbcc54
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
ee4b74250ad7a4061421d44b490cb79f649b3720
|
a46a247fbcfe6e63b12cef31353835295a650c9b
|
||||||
21
src/where.c
21
src/where.c
@@ -1276,16 +1276,31 @@ static void exprAnalyze(
|
|||||||
if( idxNew==0 ) return;
|
if( idxNew==0 ) return;
|
||||||
pNew = &pWC->a[idxNew];
|
pNew = &pWC->a[idxNew];
|
||||||
markTermAsChild(pWC, idxNew, idxTerm);
|
markTermAsChild(pWC, idxNew, idxTerm);
|
||||||
|
if( op==TK_IS ) pNew->wtFlags |= TERM_IS;
|
||||||
pTerm = &pWC->a[idxTerm];
|
pTerm = &pWC->a[idxTerm];
|
||||||
pTerm->wtFlags |= TERM_COPIED;
|
pTerm->wtFlags |= TERM_COPIED;
|
||||||
|
|
||||||
|
/* Expressions of the form "A==B" or "A IS B" might be candidates
|
||||||
|
** for propagating constraints via the transitive property. In other
|
||||||
|
** words: "A==B AND B==$xyz" implies "A==$xyz". If this term
|
||||||
|
** qualifies, mark it with WO_EQUIV. Necessary preconditions:
|
||||||
|
** 1. The term is not in the ON clause of a LEFT JOIN
|
||||||
|
** 2. The affinities of A and B must be compatible
|
||||||
|
** 3. The SQLITE_Transitive optimization must be enabled
|
||||||
|
*/
|
||||||
if( (op==TK_EQ || op==TK_IS)
|
if( (op==TK_EQ || op==TK_IS)
|
||||||
&& !ExprHasProperty(pExpr, EP_FromJoin)
|
&& !ExprHasProperty(pExpr, EP_FromJoin)
|
||||||
&& OptimizationEnabled(db, SQLITE_Transitive)
|
&& OptimizationEnabled(db, SQLITE_Transitive)
|
||||||
){
|
){
|
||||||
pTerm->eOperator |= WO_EQUIV;
|
char aff1 = sqlite3ExprAffinity(pDup->pLeft);
|
||||||
eExtraOp = WO_EQUIV;
|
char aff2 = sqlite3ExprAffinity(pDup->pRight);
|
||||||
|
if( aff1==aff2
|
||||||
|
|| (sqlite3IsNumericAffinity(aff1) && sqlite3IsNumericAffinity(aff2))
|
||||||
|
){
|
||||||
|
pTerm->eOperator |= WO_EQUIV;
|
||||||
|
eExtraOp = WO_EQUIV;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if( op==TK_IS ) pNew->wtFlags |= TERM_IS;
|
|
||||||
}else{
|
}else{
|
||||||
pDup = pExpr;
|
pDup = pExpr;
|
||||||
pNew = pTerm;
|
pNew = pTerm;
|
||||||
|
|||||||
Reference in New Issue
Block a user