Open kennytm opened 5 years ago
Let me fix it please :smile:
Hey, I wanna fix this issue. I read the discussion, and wondering:
SELECT @@autocommit limit 1; -- @@autocommit:1 or `@@autocommit limit 1`:1?
select 1 where true group by 1 having 1>0; -- Throw an error? Or just return 1:1?
If there is a clear conclusion, I'll be happy to fix it if I can. Otherwise maybe I can go out and see other cases ^_^.
PS: I also read doc in mysql (https://dev.mysql.com/doc/refman/8.0/en/select.html), no clear conclusion found.
Follow MySQL's behavior on doubt.
mysql> SELECT @@autocommit limit 1;
+--------------+
| @@autocommit |
+--------------+
| 1 |
+--------------+
1 row in set (0.00 sec)
mysql> select 1 where true group by 1 having 1>0;
+---+
| 1 |
+---+
| 1 |
+---+
1 row in set (0.01 sec)
These SQLs:
All return one row with the value 1 on MySQL 8.0 (also tested on PostgreSQL 9.6 and SQLite 3.24 with the same behavior), but failed to parse on TiDB 2.1.1 and master:
Table-less queries which are correctly accepted by TiDB: