Bug #81816 | Invalid select query result on FIRST time | ||
---|---|---|---|
Submitted: | 11 Jun 2016 19:53 | Modified: | 19 Dec 2019 22:47 |
Reporter: | Kamil Michalak | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: DML | Severity: | S2 (Serious) |
Version: | 5.6.31 | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[11 Jun 2016 19:53]
Kamil Michalak
[11 Jun 2016 20:14]
Kamil Michalak
mysql> Select SQL_NO_CACHE * From (bug_fs806_01, LigaKategorieTbl) Where LigaKategorieTbl.KategorieId=HCategoryId And MeczId = '1519726'; Empty set (0.00 sec) mysql> Select SQL_NO_CACHE * From (bug_fs806_01, LigaKategorieTbl) Where LigaKategorieTbl.KategorieId=HCategoryId And MeczId = '1519726'; Empty set (0.00 sec) Fix query: mysql> Select * From bug_fs806_01 left join LigaKategorieTbl on (LigaKategorieTbl.KategorieId=HCategoryId) Where MeczId = '1519726'; And now requery with first query mysql> Select SQL_NO_CACHE * From (bug_fs806_01, LigaKategorieTbl) Where LigaKategorieTbl.KategorieId=HCategoryId And MeczId = '1519726'; +---------+-------------+-------------+----------------+ | MeczId | HCategoryId | KategorieId | KategorieNazwa | +---------+-------------+-------------+----------------+ | 1519726 | 228 | 228 | United States | +---------+-------------+-------------+----------------+ 1 row in set (0.00 sec) And now when i restart mysql the result is wrong again until run "fix query"
[12 Jun 2016 9:00]
Peter Laursen
reproducible for me like this -- populate tablesand view as in test case posted -- server restarted -- q1 SELECT * FROM (bug_fs806_01, LigaKategorieTbl) WHERE LigaKategorieTbl.KategorieId=HCategoryId AND MeczId = '1519726'; -- empty set -- q1 SELECT * FROM (bug_fs806_01, LigaKategorieTbl) WHERE LigaKategorieTbl.KategorieId=HCategoryId AND MeczId = '1519726'; -- still empty set -- q2 SELECT * FROM bug_fs806_01 LEFT JOIN LigaKategorieTbl ON (LigaKategorieTbl.KategorieId=HCategoryId) WHERE MeczId = '1519726'; - expected result -- q1 SELECT * FROM (bug_fs806_01, LigaKategorieTbl) WHERE LigaKategorieTbl.KategorieId=HCategoryId AND MeczId = '1519726'; -- now result same as previous query with JOIN -- Peter -- not a MySQL Oracle person
[12 Jun 2016 11:50]
Peter Laursen
@Hartmut. This report is not about a crash at a all. I don't see how the two are related. It is about inconsistent/non-deterministci SELECT query results. Was it the right one you linked to? If so please explain!
[12 Jun 2016 11:51]
Peter Laursen
OK .. I also thought so!
[12 Jun 2016 18:12]
MySQL Verification Team
Thank you for the bug report. Only 5.6 affected. mysql 5.6 > create or replace view bug_fs806_01 as -> Select -> m.MeczId, -> z1._KategorieId as HCategoryId -> From -> ( -> MeczTbl as m, LigaTbl -> ) -> Left Join ZespolTbl as z1 on (m.HostID=z1.ZespolId) -> Where -> m._LigaId=LigaTbl.LigaId -> ; Query OK, 0 rows affected (0.06 sec) mysql 5.6 > SELECT * FROM (bug_fs806_01, LigaKategorieTbl) WHERE LigaKategorieTbl.KategorieId=HCategoryId AND MeczId = '1519726'; +---------+-------------+-------------+----------------+ | MeczId | HCategoryId | KategorieId | KategorieNazwa | +---------+-------------+-------------+----------------+ | 1519726 | 228 | 228 | United States | +---------+-------------+-------------+----------------+ 1 row in set (0.00 sec) mysql 5.6 > exit Bye C:\dbs>net stop mysqld56 The MySQLD56 service is stopping. The MySQLD56 service was stopped successfully. C:\dbs>net start mysqld56 The MySQLD56 service is starting. The MySQLD56 service was started successfully. C:\dbs>56 C:\dbs>c:\dbs\5.6\bin\mysql -uroot --port=3560 -p --prompt="mysql 5.6 > " Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 Server version: 5.6.32 Source distribution PULL: 2016-MAY-09 Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql 5.6 > use fs806; Database changed mysql 5.6 > SELECT * FROM (bug_fs806_01, LigaKategorieTbl) WHERE LigaKategorieTbl.KategorieId=HCategoryId AND MeczId = '1519726'; Empty set (0.02 sec)
[19 Dec 2019 22:47]
Roy Lyseng
Posted by developer: Fixed in 5.7.29