Details
-
Task
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Duplicate
Description
STATEMENT_DIGEST_TEXT is a very handy function in MySQL 8 which can be used programmatically and quickly check thousands of SQL statements for validity, without actually executing them, and returning an error on CLI-only statements:
MS 10.8 (Debug) |
8.0.26-dbg>SELECT STATEMENT_DIGEST_TEXT('SELECT 1')G
|
|
*************************** 1. row ***************************
|
STATEMENT_DIGEST_TEXT('SELECT 1'): SELECT ?
|
1 row in set (0.00 sec)
|
|
8.0.26-dbg>SELECT STATEMENT_DIGEST_TEXT('INCORRECT QUERY')G
|
ERROR 3676 (HY000): Could not parse argument to digest function: "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 'INCORRECT QUERY' at line 1".
|
8.0.26-dbg>SELECT STATEMENT_DIGEST_TEXT('HELP')G
|
ERROR 3676 (HY000): Could not parse argument to digest function: "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 '' at line 1".
|
The same function does not exist in MariaDB:
MD 10.7.0 d552e092c9f3e20da078d1b62b976f629f73d3a4 (Debug) |
10.7.0-dbg>SELECT STATEMENT_DIGEST_TEXT('SELECT 1');
|
ERROR 1305 (42000): FUNCTION test.STATEMENT_DIGEST_TEXT does not exist
|
So whilst the MySQL 8 function can be used to check SQL statements for validity (via yes/no error), MariaDB specific syntax will not be recognized and thus using MySQL 8 for SQL verification is not very helpful.
Implementing the same would help for testing.
Attachments
Issue Links
- is blocked by
-
MDEV-19569 Assertion `table_list->table' failed in find_field_in_table_ref and Assertion `table_ref->table || table_ref->view' in Field_iterator_table_ref::set_field_iterator
- Closed
- is duplicated by
-
MDEV-26259 P_S functions STATEMENT_DIGEST_TEXT and STATEMENT_DIGEST are missing
- Stalled
- relates to
-
MDEV-8943 Syntax check for SQL files or SQL queries
- Open
-
MDEV-28906 MySQL 8.0 desired compatibility
- Open
-
MDEV-4680 PARSER - new sql function
- Open
-
MDEV-6882 TOKENIZE query
- Open
- links to