New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unexpected Result by REGEXP #49107
Labels
Comments
/label fuzz/sqlancer |
tidb:4003 [test]> select c0 from v0;
+------+
| c0 |
+------+
| 1 |
+------+
1 row in set (0.00 sec)
tidb:4003 [test]> desc select c0 from v0;
+-------------------------------+---------+-----------+---------------+-------------------------------------------------------------+
| id | estRows | task | access object | operator info |
+-------------------------------+---------+-----------+---------------+-------------------------------------------------------------+
| HashAgg_10 | 1.00 | root | | group by:test.t1.c0, funcs:firstrow(test.t0.c0)->test.t0.c0 |
| └─HashJoin_12 | 2.00 | root | | CARTESIAN inner join |
| ├─TableReader_14(Build) | 1.00 | root | | data:TableFullScan_13 |
| │ └─TableFullScan_13 | 1.00 | cop[tikv] | table:t1 | keep order:false, stats:pseudo |
| └─TableReader_16(Probe) | 2.00 | root | | data:TableFullScan_15 |
| └─TableFullScan_15 | 2.00 | cop[tikv] | table:t0 | keep order:false, stats:pseudo |
+-------------------------------+---------+-----------+---------------+-------------------------------------------------------------+
6 rows in set (0.00 sec)
tidb:4003 [test]> drop stats t0, t1;
Query OK, 0 rows affected (0.01 sec)
tidb:4003 [test]> select c0 from v0;
+------+
| c0 |
+------+
| 2 |
+------+
1 row in set (0.00 sec)
tidb:4003 [test]> desc select c0 from v0;
+-------------------------------+--------------+-----------+---------------+-------------------------------------------------------------+
| id | estRows | task | access object | operator info |
+-------------------------------+--------------+-----------+---------------+-------------------------------------------------------------+
| HashAgg_10 | 8000.00 | root | | group by:test.t1.c0, funcs:firstrow(test.t0.c0)->test.t0.c0 |
| └─HashJoin_11 | 100000000.00 | root | | CARTESIAN inner join |
| ├─TableReader_16(Build) | 10000.00 | root | | data:TableFullScan_15 |
| │ └─TableFullScan_15 | 10000.00 | cop[tikv] | table:t0 | keep order:false, stats:pseudo |
| └─TableReader_14(Probe) | 10000.00 | root | | data:TableFullScan_13 |
| └─TableFullScan_13 | 10000.00 | cop[tikv] | table:t1 | keep order:false, stats:pseudo |
+-------------------------------+--------------+-----------+---------------+-------------------------------------------------------------+
6 rows in set (0.00 sec) |
mysql> SELECT t0.c0, (false NOT REGEXP t1.c0) LIKE 0 FROM t1, t0 GROUP BY t1.c0;
ERROR 1055 (42000): Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'test.t0.c0' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by The definition of view breaks |
MySQL can raise the error when querying from the view, but tidb does not. mysql> SELECT v0.c0 FROM v0; -- {2}
ERROR 1055 (42000): Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'test.t0.c0' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
mysql> SELECT v0.c0 FROM v0 WHERE NOT v0.c1; -- {1}
ERROR 1055 (42000): Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'test.t0.c0' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
mysql> SELECT t0.c0, (false NOT REGEXP t1.c0) LIKE 0 FROM t1, t0 GROUP BY t1.c0;
ERROR 1055 (42000): Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'test.t0.c0' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by |
This was referenced May 10, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bug Report
I believe this is a bug as two queries return inconsistent results.
Although the view includes a
GROUP BY
, it does not break theonly_full_group_by
attribute.1. Minimal reproduce step (Required)
2. What did you expect to see? (Required)
The first query should return 2 rows because the second query returns a different result.
3. What did you see instead (Required)
The second query returns a different result as that of the first query.
4. What is your TiDB version? (Required)
The text was updated successfully, but these errors were encountered: