Skip to content

Unexpected Result by MERGE_JOIN #47345

Open
@bajinsheng

Description

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

CREATE TABLE t0(c0 INT, c1 INT, c2 INT, PRIMARY KEY(c1));
CREATE TABLE t1 LIKE t0;
INSERT INTO t0 VALUES (1, 2, 3);
CREATE VIEW v0(c0, c1, c2) AS SELECT 4, 5, 6 FROM t1;
INSERT INTO t1 VALUES (7, 8, 9);

SELECT t0.c1 FROM t1, t0 NATURAL RIGHT JOIN v0 WHERE t0.c2 = t1.c2 NOT REGEXP 1; -- {NULL}
SELECT /*+ MERGE_JOIN(t0, t1, v0)*/t0.c1 FROM t1, t0 NATURAL RIGHT JOIN v0 WHERE t0.c2 = t1.c2 NOT REGEXP 1; -- empty set

2. What did you expect to see? (Required)

Both queries should return the same result, but not.

3. What did you see instead (Required)

4. What is your TiDB version? (Required)

| Release Version: v7.4.0-alpha
Edition: Community
Git Commit Hash: 32540a4a77984744dc0309d9287b05c8e9593252
Git Branch: heads/refs/tags/v7.4.0-alpha
UTC Build Time: 2023-09-27 14:33:24
GoVersion: go1.21.1
Race Enabled: false
Check Table Before Drop: false
Store: tikv |

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Labels

affects-6.5This bug affects the 6.5.x(LTS) versions.affects-7.1This bug affects the 7.1.x(LTS) versions.affects-7.5This bug affects the 7.5.x(LTS) versions.affects-8.1This bug affects the 8.1.x(LTS) versions.affects-8.5This bug affects the 8.5.x(LTS) versions.fuzz/sqlancermay-affects-5.3This bug maybe affects 5.3.x versions.may-affects-5.4This bug maybe affects 5.4.x versions.may-affects-6.1severity/majorsig/plannerSIG: Plannertype/bugThe issue is confirmed as a bug.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions