1
0
mirror of https://github.com/sqlite/sqlite.git synced 2026-10-23 21:49:02 +03:00

A join constraint is not an equivalence unless both operands have the

same collation.
[bugs:/info/2026-05-21T03:39:28Z|Bug 2026-05-21T03:39:28Z].
Error goes back to version 3.7.17, 13 years ago.

FossilOrigin-Name: 20c2f8ce9242c3dbb8054f01c6c7338763c830b7c1491a99c8e1de98ce8f0a5b
This commit is contained in:
drh
2026-05-21 13:03:18 +00:00
parent 6ae9949399
commit ecd9748590
4 changed files with 22 additions and 14 deletions

View File

@@ -1,5 +1,5 @@
C Enhance\sthe\sxfer-optimization\sto\sverify\saccess\sto\sthe\ssource\stable\susing\nthe\sauthorizer,\sif\san\sauthorizer\sis\sregistered.\n[bugs:/info/2026-05-21T03:31:22Z|Bug\s2026-05-21T03:31:22Z].
D 2026-05-21T12:04:20.183
C A\sjoin\sconstraint\sis\snot\san\sequivalence\sunless\sboth\soperands\shave\sthe\nsame\scollation.\n[bugs:/info/2026-05-21T03:39:28Z|Bug\s2026-05-21T03:39:28Z].\nError\sgoes\sback\sto\sversion\s3.7.17,\s13\syears\sago.
D 2026-05-21T13:03:18.737
F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
@@ -821,7 +821,7 @@ F src/walker.c d5006d6b005e4ea7302ad390957a8d41ed83faa177e412f89bc5600a7462a014
F src/where.c 33e4a6558ee69f33d6a4e7069e3a40a55959d14e5653a9a83926e70305d471f3
F src/whereInt.h 8d94cb116c9e06205c3d5ac87af065fc044f8cf08bfdccd94b6ea1c1308e65da
F src/wherecode.c 4d573077652f79780d6b50840ab8cbb72053dbb4eb230780dd2a146ab034475d
F src/whereexpr.c b6eb736dac5969c05bc1c4df624a23bd5b6b5ba267599c48924648744ac482bc
F src/whereexpr.c 95d97d148794a4afd751b899816da7286caa81ccda5840b6efdd9aed8218a804
F src/window.c c0a38cd32473e8e8e7bc435039f914a36ca42465506dc491c65870c01ddac9fb
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
F test/affinity2.test 4d7a34d328e58ca2a2d78fd76c27614a41ca7ddf4312ded9c68c04f430b3b47d
@@ -1891,7 +1891,7 @@ F test/trace3.test 2deeac66359c9f007f0fc9fb6336994a5d68fc1a65129f322a9e9546fd537
F test/trans.test 45f6f9ab6f66a7b5744f1caac06b558f95da62501916906cf55586a896f9f439
F test/trans2.test 62bd045bfc7a1c14c5ba83ba64d21ade31583f76
F test/trans3.test 91a100e5412b488e22a655fe423a14c26403ab94
F test/transitive1.test f8ee983600b33d167da1885657f064aec404e1c0d0bc8765fdf163f4c749237a
F test/transitive1.test 342b398e4c68deee65a940c5af22a95f44c3090b6539c7a19175afb48ac3fb93
F test/trigger1.test 141bd2bbfa82fa91aed7391f50517373c9823ff8f55af35e56313dbc75112ca1
F test/trigger2.test 30fcb3a6aa6782020d47968735ee6086ed795f73a7affa9406c8d5a36e7b5265
F test/trigger3.test aa640bb2bbb03edd5ff69c055117ea088f121945
@@ -2205,8 +2205,8 @@ F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee
F tool/warnings.sh a554d13f6e5cf3760f041b87939e3d616ec6961859c3245e8ef701d1eafc2ca2
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
F tool/winmain.c 00c8fb88e365c9017db14c73d3c78af62194d9644feaf60e220ab0f411f3604c
P b734b76af3f732e0db8a002781bae57aa7a01c4a7f5151605144a6aeef993a21
R 16e182253f4ed39a9e324a0b8b991bbc
P d1cdb817cafd03a4081b254a71672ba07e5b637994d3f2f925532f17af0a67dc
R ad8443b68590c7f2ab10f686bd913efb
U drh
Z 0545298a4cb19b3751644db37cc2eebd
Z 628fa49fd402e371d6ae83ee7a44c0df
# Remove this line to create a well-formed Fossil manifest.

View File

@@ -1 +1 @@
d1cdb817cafd03a4081b254a71672ba07e5b637994d3f2f925532f17af0a67dc
20c2f8ce9242c3dbb8054f01c6c7338763c830b7c1491a99c8e1de98ce8f0a5b

View File

@@ -954,8 +954,7 @@ static void exprAnalyzeOrTerm(
** 3. Not originating in the ON clause of an OUTER JOIN
** 4. The operator is not IS or else the query does not contain RIGHT JOIN
** 5. The affinities of A and B must be compatible
** 6a. Both operands use the same collating sequence OR
** 6b. The overall collating sequence is BINARY
** 6. Both operands use the same collating sequence
** If this routine returns TRUE, that means that the RHS can be substituted
** for the LHS anyplace else in the WHERE clause where the LHS column occurs.
** This is an optimization. No harm comes from returning 0. But if 1 is
@@ -982,9 +981,7 @@ static int termIsEquivalence(Parse *pParse, Expr *pExpr, SrcList *pSrc){
return 0; /* (5) */
}
pColl = sqlite3ExprCompareCollSeq(pParse, pExpr);
if( !sqlite3IsBinary(pColl)
&& !sqlite3ExprCollSeqMatch(pParse, pExpr->pLeft, pExpr->pRight)
){
if( !sqlite3ExprCollSeqMatch(pParse, pExpr->pLeft, pExpr->pRight) ){
return 0; /* (6) */
}
return 1;

View File

@@ -351,7 +351,7 @@ do_execsql_test transitive1-570 {
do_execsql_test transitive1-570eqp {
EXPLAIN QUERY PLAN
SELECT * FROM c1 WHERE x=y AND z=y AND z='abc';
} {/SEARCH c1 USING INDEX c1x/}
} {/SCAN c1/}
# 2021-05-04 forum https://sqlite.org/forum/forumpost/eb8613976a
reset_db
@@ -426,4 +426,15 @@ do_execsql_test transitive1-813 {
SELECT * FROM t3 WHERE a=b AND a='5x';
} {}
# Bug 2026-05-21T03:39:28Z
#
reset_db
do_execsql_test transitive1-900 {
CREATE TABLE t1(a TEXT);
CREATE TABLE t2(b TEXT COLLATE NOCASE);
INSERT INTO t1 VALUES('abc');
INSERT INTO t2 VALUES('abc');
SELECT * FROM t1 CROSS JOIN t2 WHERE a=b AND b='ABC';
} {abc abc}
finish_test