[MDEV-14538] FOUND_ROWS() returns 1 when no results were found in previous query Created: 2017-11-29 Updated: 2018-01-27 Resolved: 2018-01-27 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Server, Storage Engine - InnoDB |
| Affects Version/s: | 5.5.56-galera |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Major |
| Reporter: | Ryan Griggs | Assignee: | Unassigned |
| Resolution: | Incomplete | Votes: | 0 |
| Labels: | found_rows, galera, need_feedback, sql_calc_found_rows | ||
| Environment: |
Centos 7..4.1708 x64 |
||
| Description |
|
After executing a query which includes SQL_CALC_FOUND_ROWS directive, if the query returns zero results, the FOUND_ROWS() function returns '1'. Example: SELECT FOUND_ROWS() as count_of_rows; returns count_of_rows = 1 Version 5.5.56 is the latest version available in my distro's packages. Is this bug fixed with newer versions? |
| Comments |
| Comment by Elena Stepanova [ 2017-11-29 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Please provide the table definition, the actual query and the config file. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Ryan Griggs [ 2017-11-29 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Here is the table structure: ALTER TABLE `field_groups` ALTER TABLE `field_groups` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Ryan Griggs [ 2017-11-29 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Here is the query: SELECT SQL_CALC_FOUND_ROWS * FROM field_groups WHERE field_name = 'some value that is not in the table'; The second query returns "1" instead of "0" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Ryan Griggs [ 2017-11-29 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Here is "/etc/my.cnf" [mysqld] symbolic-links=0 [mysqld_safe] !includedir /etc/my.cnf.d | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2017-11-29 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
You've set the "affects version" as 5.5.56-galera, and also labeled the report as 'galera', but there is nothing in the config above that suggests you are using the cluster. So, which version do you actually use? I've tried both 5.5.56 and 5.5.56-galera, and so far I haven't got the problem on either of them, neither with the empty table nor with some contents:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2017-12-28 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
ryangriggs, could you please clarify the question of version? |