1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-12 13:01:09 +03:00

Add a missing test that prevented double LEFT JOINs with transitive

constraints from working correctly.  Fix for ticket [868145d012].

FossilOrigin-Name: 72919ec34f0d663d551c1070285ad93b932bcb74
This commit is contained in:
drh
2013-07-01 17:27:19 +00:00
parent 9443342ee9
commit cdc2e43d8e
4 changed files with 73 additions and 7 deletions

View File

@@ -1,5 +1,5 @@
C Further\sminor\scomment\scorrections\sand\senhancements\sin\swhere.c.
D 2013-07-01T11:05:50.653
C Add\sa\smissing\stest\sthat\sprevented\sdouble\sLEFT\sJOINs\swith\stransitive\nconstraints\sfrom\sworking\scorrectly.\s\sFix\sfor\sticket\s[868145d012].
D 2013-07-01T17:27:19.953
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 5e41da95d92656a5004b03d3576e8b226858a28e
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -290,7 +290,7 @@ F src/vtab.c b05e5f1f4902461ba9f5fc49bb7eb7c3a0741a83
F src/wal.c 7dc3966ef98b74422267e7e6e46e07ff6c6eb1b4
F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4
F src/walker.c 4fa43583d0a84b48f93b1e88f11adf2065be4e73
F src/where.c 3ea606b1282032b9cc00ee7b1bb9c1d3683f7ea1
F src/where.c b546b95b7096f153666c63bb4f76c1a0299d83d6
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
F test/aggnested.test 45c0201e28045ad38a530b5a144b73cd4aa2cfd6
@@ -848,6 +848,7 @@ F test/tkt-7bbfb7d442.test 7b2cd79c7a17ae6750e75ec1a7846712a69c9d18
F test/tkt-80ba201079.test 105a721e6aad0ae3c5946d7615d1e4d03f6145b8
F test/tkt-80e031a00f.test 9a154173461a4dbe2de49cda73963e04842d52f7
F test/tkt-8454a207b9.test c583a9f814a82a2b5ba95207f55001c9f0cd816c
F test/tkt-868145d012.test a5f941107ece6a64410ca4755c6329b7eb57a356
F test/tkt-91e2e8ba6f.test 08c4f94ae07696b05c9b822da0b4e5337a2f54c5
F test/tkt-94c04eaadb.test fa9c71192f7e2ea2d51bf078bc34e8da6088bf71
F test/tkt-9d68c883.test 458f7d82a523d7644b54b497c986378a7d8c8b67
@@ -1098,7 +1099,7 @@ F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
F tool/wherecosttest.c f407dc4c79786982a475261866a161cd007947ae
F tool/win/sqlite.vsix 97894c2790eda7b5bce3cc79cb2a8ec2fde9b3ac
P 0ffaab3b9c97f4dba0f0ca6e146c8dc2775f7b1c
R 73899855654d4162ca36e6c20fb7ad55
P 0d68d4d018e73dcbbc08786071aac6228fca1a8c
R e2cf3085b0661bbba83fb076c8deb507
U drh
Z 9148660e3c1a93ae29b1da887b939490
Z 7f1cae3d935cfbd38a2ed50893b4a0df

View File

@@ -1 +1 @@
0d68d4d018e73dcbbc08786071aac6228fca1a8c
72919ec34f0d663d551c1070285ad93b932bcb74

View File

@@ -3887,6 +3887,7 @@ static Bitmask codeOneLoopStart(
if( pTerm->wtFlags & (TERM_VIRTUAL|TERM_CODED) ) continue;
if( pTerm->eOperator!=(WO_EQUIV|WO_EQ) ) continue;
if( pTerm->leftCursor!=iCur ) continue;
if( pLevel->iLeftJoin ) continue;
pE = pTerm->pExpr;
assert( !ExprHasProperty(pE, EP_FromJoin) );
assert( (pTerm->prereqRight & newNotReady)!=0 );

64
test/tkt-868145d012.test Normal file
View File

@@ -0,0 +1,64 @@
# 2013 March 05
#
# The author disclaims copyright to this source code. In place of
# a legal notice, here is a blessing:
#
# May you do good and not evil.
# May you find forgiveness for yourself and forgive others.
# May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library. Specifically,
# it tests that ticket [868145d012a1] is fixed.
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
do_execsql_test tkt-868145d012.100 {
CREATE TABLE p (
id INTEGER PRIMARY KEY,
uid VARCHAR(36),
t INTEGER
);
CREATE TABLE pa (
id INTEGER PRIMARY KEY,
a_uid VARCHAR(36)
);
CREATE TABLE a (
id INTEGER PRIMARY KEY,
uid VARCHAR(36),
t INTEGER
);
INSERT INTO pa VALUES(1,'1234');
INSERT INTO pa VALUES(2,'2345');
INSERT INTO p VALUES(3,'1234',97);
INSERT INTO p VALUES(4,'1234',98);
INSERT INTO a VALUES(5,'1234',98);
INSERT INTO a VALUES(6,'1234',99);
} {}
do_execsql_test tkt-868145d012.110 {
SELECT DISTINCT pa.id, p.id, a.id
FROM
pa
LEFT JOIN p ON p.uid='1234'
LEFT JOIN a ON a.uid=pa.a_uid
WHERE
a.t=p.t
;
} {1 4 5}
do_execsql_test tkt-868145d012.120 {
SELECT DISTINCT pa.id, p.id, a.id
FROM
pa
LEFT JOIN p ON p.uid='1234'
LEFT JOIN a ON a.uid=pa.a_uid AND a.t=p.t
ORDER BY 1, 2, 3
;
} {1 3 {} 1 4 5 2 3 {} 2 4 {}}
finish_test