SQLite User Forum

Unexpected Result by WHERE/RIGHT JOIN
Login

Unexpected Result by WHERE/RIGHT JOIN

(1) By Jinsheng Ba (bajinsheng) on 2022-05-25 07:24:36 [source]

A similar issue again. In a specific multi-table join scenario, the query with the WHERE clause returns more results than the same query without WHERE.

CREATE TABLE t0(c0, c1, c2);
CREATE TABLE t1(c0);
INSERT INTO t1 VALUES('1');
CREATE VIEW v0 AS SELECT 0;
SELECT * FROM v0 RIGHT OUTER JOIN t1 ON t1.c0 INNER JOIN t0 ON t0.c2;
-- Empty result
SELECT * FROM v0 RIGHT OUTER JOIN t1 ON t1.c0 INNER JOIN t0 ON t0.c2 WHERE c1 ISNULL;
-- |1|||

Environment:

Version: 3.39.0

Commit ID: 2b6ebba2

OS: Ubuntu 20.04

Configuration Options: ./configure --enable-all

Compiler: gcc-9

Client: CLI

(2) By Richard Hipp (drh) on 2022-05-25 12:50:18 in reply to 1 [link] [source]

Should now be fixed on trunk.

(3) By Jinsheng Ba (bajinsheng) on 2022-05-26 01:00:50 in reply to 2 [link] [source]

Thanks.