dolt
dolt copied to clipboard
Incorrect result for some cases of 'explicit join tree syntax for joins'
Syntax is supported for this issue, but some cases returns incorrect result.
The query returning incorrect result:
select a.* from one_pk_two_idx a LEFT JOIN (one_pk_two_idx i JOIN one_pk_three_idx j on i.pk = j.v3) on a.pk = i.pk LEFT JOIN (one_pk_two_idx k JOIN one_pk_three_idx l on k.v2 = l.v3) on a.v1 = l.v2;
With this data:
CREATE TABLE `one_pk_three_idx` (
`pk` bigint NOT NULL,
`v1` bigint DEFAULT NULL,
`v2` bigint DEFAULT NULL,
`v3` bigint DEFAULT NULL,
PRIMARY KEY (`pk`)
);
INSERT INTO `one_pk_three_idx` VALUES (0,0,0,0),(1,0,0,1),(2,0,1,0),(3,0,2,2),(4,1,0,0),(5,2,0,3),(6,3,3,0),(7,4,4,4);
CREATE TABLE `one_pk_two_idx` (
`pk` bigint NOT NULL,
`v1` bigint DEFAULT NULL,
`v2` bigint DEFAULT NULL,
PRIMARY KEY (`pk`)
);
INSERT INTO `one_pk_two_idx` VALUES (0,0,0),(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),(6,6,6),(7,7,7);