Skip to content
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

Corrupt warnings and compatibility issues with FORMAT and CTE #56193

Closed
dveeden opened this issue Sep 20, 2024 · 2 comments · Fixed by #56198
Closed

Corrupt warnings and compatibility issues with FORMAT and CTE #56193

dveeden opened this issue Sep 20, 2024 · 2 comments · Fixed by #56198
Assignees
Labels
affects-6.1 This bug affects the 6.1.x(LTS) versions. affects-8.3 compatibility-mysql8 This is a compatibility issue with MySQL 8.0(but NOT 5.7) may-affects-6.5 may-affects-7.1 may-affects-7.5 may-affects-8.1 severity/moderate sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug. type/compatibility

Comments

@dveeden
Copy link
Contributor

dveeden commented Sep 20, 2024

Bug Report

1. Minimal reproduce step (Required)

WITH RECURSIVE cte(n) AS (
  SELECT 1 n
  UNION ALL
  SELECT 100+n FROM cte WHERE n<1000
)
SELECT FORMAT(n+RAND(),3,'en_UK') FROM cte;

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

With MySQL 9.0.1:

mysql-9.0.1> WITH RECURSIVE cte(n) AS (SELECT 1 n UNION ALL SELECT 100+n FROM cte WHERE n<1000) SELECT FORMAT(n+RAND(),3,'en_UK') FROM cte;
+----------------------------+
| FORMAT(n+RAND(),3,'en_UK') |
+----------------------------+
| 1.207                      |
| 101.688                    |
| 201.819                    |
| 301.030                    |
| 401.691                    |
| 501.368                    |
| 601.767                    |
| 701.731                    |
| 801.355                    |
| 901.582                    |
| 1,001.845                  |
+----------------------------+
11 rows in set, 1 warning (0.00 sec)

Warning (Code 1649): Unknown locale: 'en_UK'
  1. Only one warning for the statement.
  2. Warning text is correct

3. What did you see instead (Required)

mysql-8.0.11-TiDB-v8.4.0-alpha-207-gfb9b8a194f> WITH RECURSIVE cte(n) AS (SELECT 1 n UNION ALL SELECT 100+n FROM cte WHERE n<1000) SELECT FORMAT(n+RAND(),3,'en_UK') FROM cte;
+----------------------------+
| FORMAT(n+RAND(),3,'en_UK') |
+----------------------------+
| 1.613                      |
| 101.927                    |
| 201.795                    |
| 301.193                    |
| 401.579                    |
| 501.318                    |
| 601.854                    |
| 701.313                    |
| 801.006                    |
| 901.092                    |
| 1,001.439                  |
+----------------------------+
11 rows in set, 11 warnings (0.00 sec)

Warning (Code 1649): Unknown locale: '
                                      .P��'
Warning (Code 1649): Unknown locale: 'en_UK'
Warning (Code 1649): Unknown locale: '
Warning (Code 1649): Unknown locale: '
                                      .P��'
Warning (Code 1649): Unknown locale: 'en_UK'
Warning (Code 1649): Unknown locale: '
Warning (Code 1649): Unknown locale: '
                                      .P��'
Warning (Code 1649): Unknown locale: 'en_UK'
Warning (Code 1649): Unknown locale: '
Warning (Code 1649): Unknown locale: '
                                      .P��'
Warning (Code 1649): Unknown locale: 'en_UK'
  1. Multiple warnings instead of one.
  2. Text is sometimes correct and sometimes corrupt

4. What is your TiDB version? (Required)

mysql-8.0.11-TiDB-v8.4.0-alpha-207-gfb9b8a194f> SELECT TIDB_VERSION()\G
*************************** 1. row ***************************
TIDB_VERSION(): Release Version: v8.4.0-alpha-207-gfb9b8a194f
Edition: Community
Git Commit Hash: fb9b8a194f8716beaee035cd0c285c30e29a9d64
Git Branch: master
UTC Build Time: 2024-09-20 09:07:51
GoVersion: go1.22.7
Race Enabled: false
Check Table Before Drop: false
Store: unistore
1 row in set (0.00 sec)

Also happens with v8.3.0

@dveeden dveeden added type/bug The issue is confirmed as a bug. type/compatibility severity/moderate compatibility-mysql8 This is a compatibility issue with MySQL 8.0(but NOT 5.7) labels Sep 20, 2024
@dveeden
Copy link
Contributor Author

dveeden commented Sep 20, 2024

Found this while working on #56167 / #56168

@jebter jebter added the sig/sql-infra SIG: SQL Infra label Sep 23, 2024
@YangKeao YangKeao self-assigned this Sep 24, 2024
@kennytm
Copy link
Contributor

kennytm commented Sep 24, 2024

Reproduced on v6.1.7. I believe everything in between is also vulnerable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-6.1 This bug affects the 6.1.x(LTS) versions. affects-8.3 compatibility-mysql8 This is a compatibility issue with MySQL 8.0(but NOT 5.7) may-affects-6.5 may-affects-7.1 may-affects-7.5 may-affects-8.1 severity/moderate sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug. type/compatibility
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants