Hi,

I hit something that looks like a bug when working with aliases in parentheses:

CREATE TABLE t1 (k);
CREATE TABLE t2 (k);

This works as expected:

SELECT * FROM (t1 AS a) JOIN (t2 AS b) USING(k) WHERE a.k = 1;

But chaging the a to b in the WHERE clause causes the following query to error 
(Error: no such column: b.k):

SELECT * FROM (t1 AS a) JOIN (t2 AS b) USING(k) WHERE b.k = 1;

Stripping this down a bit, the same problem appears in

SELECT * FROM t1 JOIN (t2 AS b) USING(k) WHERE b.k = 1;

but not when dropping the parantheses:

SELECT * FROM t1 JOIN t2 AS b USING(k) WHERE b.k = 1;

Looks like this is due to some problem with resolving the alias in the 
parantheses. Now, as far as I understand SQL this should just work since the () 
don't introduce a new scope.

I also found a previous reference to this problem: 
http://readlist.com/lists/sqlite.org/sqlite-users/12/62259.html

Is this a bug? If so, anybody up for fixing it, or giving me a hint where to 
start in the source?

Best,
Luke

_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to