Fix a virtual table problem that can occur when the vtab is on the RHS of a

LEFT JOIN and there is a MATCH constraint in the ON clause, or when the vtab
is in a sub-query that is the RHS of a LEFT JOIN and there is a MATCH
constraint in the WHERE clause of the sub-query.

FossilOrigin-Name: 87b381663398f029f52cb5598aadd069b03034b6f833ce80ba762b406075a44e
This commit is contained in:
dan
2017-06-27 16:39:01 +00:00
parent af38cdbc08
commit 210ec4c855
5 changed files with 78 additions and 9 deletions
+20
View File
@@ -61,4 +61,24 @@ do_catchsql_test 2.5 {
SELECT * FROM ft3, ft2 WHERE y MATCH x AND x MATCH y;
} {1 {unable to use function MATCH in the requested context}}
do_execsql_test 3.0 {
CREATE VIRTUAL TABLE vt USING fts3(x);
INSERT INTO vt VALUES('abc');
INSERT INTO vt VALUES('xyz');
CREATE TABLE tt(a INTEGER PRIMARY KEY);
INSERT INTO tt VALUES(1), (2);
}
do_execsql_test 3.1 {
SELECT * FROM tt LEFT JOIN (
SELECT rowid AS rrr, * FROM vt WHERE vt MATCH 'abc'
) ON tt.a = rrr
} {1 1 abc 2 {} {}}
do_execsql_test 3.2 {
SELECT * FROM tt LEFT JOIN vt ON (vt MATCH 'abc')
} {1 abc 2 abc}
finish_test