Bug #92898 Error MY-013235 Error in parsing View during upgrade with MySQL 8.0.13
Submitted: 23 Oct 2018 13:08 Modified: 23 Oct 2018 19:37
Reporter: Georgi Sotirov Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: DML Severity:S2 (Serious)
Version:8.0.13 OS:Linux (Slackware64 current)
Assigned to: CPU Architecture:x86

[23 Oct 2018 13:08] Georgi Sotirov
Description:
I'm trying to upgrade from MySQL 8.0.12 to 8.0.13 on Slackware Linux, but I'm having errors in the error log about parsing views like this:

2018-10-23T12:47:49.627732Z 1 [ERROR] [MY-013235] [Server] Error in parsing View 'aDB'.'aView' during upgrade. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'desc' at line 1
2018-10-23T12:47:49.627897Z 1 [ERROR] [MY-013235] [Server] Error in parsing View 'aDB'.'anoterView' during upgrade. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'desc,month(aDate) desc' at line 1

I'm quite surprised, because these views were existing before and their source hasn't changed since many years. The only distinction I could make for now compared to other views for which there is no problem is that the one that fail upgrade use GROUP BY func(arg) DESC (i.e. a function and DESC).

How to repeat:
I'm not able to provide reproducible scenario right now, because I'm still trying to understand more about the issue.

Suggested fix:
View upgrade shouldn't file like in 8.0.11 and 8.0.12 before.
[23 Oct 2018 13:44] MySQL Verification Team
Thank you for the bug report. To process this bug report is necessary a repeatable test case, please re-open when you are able to provide the test case. Thanks in advance.
[23 Oct 2018 14:15] Georgi Sotirov
I'm really not sure how to provide a repeatable test case for this problem, because it's the server trying to upgrade a database that was previously ran by MySQL 8.0.12. The problematic view is as simple as:

CREATE VIEW AvrgByMonth AS
    SELECT 
        YEAR(`table`.`date`) AS `Year`,
        (COUNT(0) / 12) AS `Average`
    FROM
        `table`
    GROUP BY YEAR(`table`.`date`) DESC;

I.t. it just counts the average number of rows in table per month for a given year. Can you please, indicate what's the problem with this syntax in MySQL 8.0.13?
[23 Oct 2018 16:24] MySQL Verification Team
Thank you for the feedback. Please see the link:

https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-13.html#mysqld-8-0-13-sql-syntax

"Incompatible Change: .....
......
Queries and stored program definitions from MySQL 8.0.12 or lower that use ASC or DESC qualifiers for GROUP BY clauses should be amended. Otherwise, ...."
[23 Oct 2018 16:27] MySQL Verification Team
Sorry I removed the initial quoiting note:
"SQL Syntax Notes

    Incompatible Change: The deprecated ASC or DESC qualifiers for GROUP BY clauses have been removed. ...."
[23 Oct 2018 19:37] Georgi Sotirov
Thank you very much Miguel for uncovering the reason for my problem. I'm pretty sure I've read about ASC and DESC on GROUP BY being deprecated and I'm really not sure why I used this syntax in the past, but apparently I have to update those old view's definitions.

However, for this I'l have to revert to 8.0.12 and then upgrade back to 8.0.13, right?