Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-26634

Feature request: add STATEMENT_DIGEST_TEXT

    XMLWordPrintable

    Details

      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

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            Roel Roel Van de Paar
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:

                Git Integration