Hi,

First of all thanks for your effort creating this database engine.

I've encountered a problem adapting an ORM library to use with SQLite. The
good news is that is easily reproducible with the command line client.

The problem is when I use double parentheses in a expression with "IN"
clause like this:

SELECT * FROM tableA WHERE id IN ((SELECT foreignId FROM tableB));

The above query return always only one row even if there are more rows that
satisfy the clause.

The steps to reproduce the problem are:

sqlite> CREATE TABLE tableA (`id` INTEGER);
sqlite> CREATE TABLE tableB (`id` INTEGER, `foreignId` INTEGER);
sqlite> INSERT INTO tableA VALUES(1);
sqlite> INSERT INTO tableA VALUES(2);
sqlite> INSERT INTO tableA VALUES(3);
sqlite> INSERT INTO tableA VALUES(4);
sqlite> INSERT INTO tableA VALUES(5);
sqlite> INSERT INTO tableB VALUES(1, 1);
sqlite> INSERT INTO tableB VALUES(2, 2);
sqlite> INSERT INTO tableB VALUES(3, 3);
sqlite> SELECT * FROM tableA WHERE id IN (SELECT foreignId FROM tableB);
1
2
3
sqlite> SELECT * FROM tableA WHERE id IN ((SELECT foreignId FROM tableB));
1
sqlite>

A solution could be not putting this double parentheses but I'm using an
ORM library and I can't change it. On the other hand others database
engines doesn't have this behaviour and the tests pass successfully.

Hope this helps to identify the problem.

Best

-- 
Fede Fern?ndez

Reply via email to