I am running SQLite 3.6.22 (debugging code enabled) with extensive use of
virtual tables that behave as if their structures were as follows (unused
fields have been omitted):
CREATE TABLE one (
aunsigned,
bunsigned,
cunsigned,
dunsigned,
stext);
CREATE INDEX one_pk ON one (a, b, c, d);
CREATE TABLE two (
one_rowidunsigned,
bunsigned,
eunsigned,
funsigned,
gunsigned);
CREATE INDEX two_pk ON two (one_rowid);
CREATE TABLE three (
aunsigned,
bunsigned,
eunsigned,
hunsigned);
CREATE INDEX three_pk ON three (a, b, e, h);
When I attempt to perform a certain join (shown below), the disableTerm
function fails in the ALWAYS assertion, because the wtFlags field already has
the TERM_CODED bit set. As far as I can tell, it is looking at the first
constraint in the ON clause of the LEFT JOIN, possibly for the second time.
The problem goes away on any of the following conditions:
- native tables are used as opposed to virtual tables
- the first constraint of the WHERE clause (one.a = 3) is omitted
- the constant from the WHERE clause is repeated in the ON clause
(three.a = 3)
I suspect there is a subtle difference in parsing and/or code generation
between native and virtual tables the leads to this effect
SELECT
one.s,
two.b,
two.e,
two.f
FROM one
join two ON two.one_rowid = one.rowid
left join three ON three.a = one.a and
three.b = two.b and
three.e = two.e and
three.h = two.f
where one.a = 3 and
two.g = 1;
Gunter Hick
Software Engineer
Scientific Games International GmbH
Klitschgasse 2 - 4, A - 1130 Vienna, Austria
FN 157284 a, HG Wien
Tel: +43 1 80100 0
E-Mail: h...@scigames.at
This e-mail is confidential and may well also be legally privileged. If you
have received it in error, you are on notice as to its status and accordingly
please notify us immediately by reply e-mail and then delete this message from
your system. Please do not copy it or use it for any purposes, or disclose its
contents to any person as to do so could be a breach of confidence. Thank you
for your cooperation.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users