pingcap / tidb

TiDB - the open-source, cloud-native, distributed SQL database designed for modern applications.
https://pingcap.com
Apache License 2.0
37.42k stars 5.85k forks source link

set sql_mode=1 process is different with mysql #35278

Open seiya-annie opened 2 years ago

seiya-annie commented 2 years ago

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

SET sql_mode = 1;

2. What did you expect to see? (Required)

in Mysql 8.0.29

mysql> set sql_mode=1;
Query OK, 0 rows affected (0.00 sec)

mysql> show variables like 'sql_mode';
+---------------+---------------+
| Variable_name | Value         |
+---------------+---------------+
| sql_mode      | REAL_AS_FLOAT |
+---------------+---------------+
1 row in set (0.01 sec)

3. What did you see instead (Required)

in tidb v6.1.0

mysql> SET sql_mode = 1;
ERROR 1105 (HY000): ERROR 1231 (42000): Variable 'sql_mode' can't be set to the value of '1'

4. What is your TiDB version? (Required)

Git Commit Hash: 1a89decdb192cbdce6a7b0020d71128bc964d30f Git Branch: heads/refs/tags/v6.1.0 UTC Build Time: 2022-06-05 05:15:11

seiya-annie commented 2 years ago

and error code "ERROR 1105 (HY000): ERROR 1231 (42000): " is weird, why report two error code: 1105 and 1231

morgo commented 2 years ago

I think accepting an integer/offset value is only a minor compatibility issue - I've not seen any apps depend on it, and I don't believe it's documented.

But the double error code issue is worth fixing, I agree it's weird.