Mysql Connector LEFT JOIN Bug
Posted by: René Kühne
Date: May 30, 2020 04:29AM

Hello,

I can't believe what I am just facing. After many hours of research I ask you guys for help:

If you left join on console, phpmyadmin, heidisql or whatever you get a different result set than with mysql connector. I checked on different windows machines with different mysql versions and different connector versions, even the latest one.

Reproduce

CREATE TABLE `test1` (
`test1_ID` INT(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`test1_ID`) USING BTREE
)
COLLATE='utf8mb4_general_ci'
ENGINE=MyISAM

INSERT INTO `test1` (`test1_ID`) VALUES ('1');
INSERT INTO `test1` (`test1_ID`) VALUES ('2');
INSERT INTO `test1` (`test1_ID`) VALUES ('3');

CREATE TABLE `test2` (
`test2_test1_ID` INT(11) NOT NULL,
`test2_test` VARCHAR(50) NOT NULL DEFAULT '' COLLATE 'utf8mb4_general_ci'
)
COLLATE='utf8mb4_general_ci'
ENGINE=MyISAM

INSERT INTO `test2` (`test2_test1_ID`, `test2_test`) VALUES ('1', 'a');
INSERT INTO `test2` (`test2_test1_ID`, `test2_test`) VALUES ('1', 'b');

Now run:
select test1_ID, test2_test from test1
left join test2 on test1_ID = test2_test1_ID

you will always receive 4 entries but with mysqlconnector there are only 3 rows in the resultset.

I kindly ask you for your help as I can't rely on correct results anymore.

Options: ReplyQuote




Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.