[MDEV-29634] Wrong Results from query Created: 2022-09-26 Updated: 2022-09-26 Resolved: 2022-09-26 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Parser |
| Affects Version/s: | 10.5.7, 10.5.9 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Major |
| Reporter: | Venkat | Assignee: | Unassigned |
| Resolution: | Not a Bug | Votes: | 0 |
| Labels: | sql, wrong_result | ||
| Environment: |
Centos7, MariaDB standalone |
||
| Attachments: |
|
| Description |
|
Hi I came across this behavior in 10.5.7 (and also verified with 10.5.9) and am wondering if it's a BUG or if it has to do with any parameter configuration.
(This issue happens with and without primary key)
Now whatever values I provide in the WHERE condition along with the ID, it returns the row that matches the first column (ID) in the query
|
| Comments |
| Comment by Marko Mäkelä [ 2022-09-26 ] | |||||||||||||||
|
Did you check the output of SHOW WARNINGS? Does it warn something about converting a string to integer? Did you try after the following?
| |||||||||||||||
| Comment by Venkat [ 2022-09-26 ] | |||||||||||||||
|
Hi Marko That warning you see in the result is from this error (from a SQL with a typo) {{MariaDB [test]> select * from test where id='1 Thomas Edison'); MariaDB [test]> show global variables like 'SQL_MODE';
--------------
-------------- | |||||||||||||||
| Comment by Venkat [ 2022-09-26 ] | |||||||||||||||
|
I am getting the same wrong results even with strict SQL_MODE MariaDB [test]> SET SQL_MODE=STRICT_ALL_TABLES; MariaDB [test]> select * from test where id='3whoever';
-----
----- MariaDB [test]> show warnings;
--------
-------- | |||||||||||||||
| Comment by Venkat [ 2022-09-26 ] | |||||||||||||||
|
By the way, as far as I can see, this issue (or the bug) seems to happen only when the first column of the table is in the WHERE clause | |||||||||||||||
| Comment by Sergei Golubchik [ 2022-09-26 ] | |||||||||||||||
|
https://mariadb.com/kb/en/type-conversion/#rules-for-conversion-on-comparison |