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

Missing escaping in SELECT ROUTINE_BODY FROM I_S.ROUTINES

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Won't Fix
    • 5.5.36-galera, 5.3.12, 10.0.12
    • N/A
    • OTHER
    • None

    Description

      SHOW CREATE FUNCTION displays correctly escaped double quotes and backslashes in string literals.

      I_S.ROUTINES.ROUTINE_BODY displays unescaped values, which looks wrong.

      This SQL script demonstrates the problem:

      DROP FUNCTION IF EXISTS f1;
      CREATE FUNCTION f1() RETURNS VARCHAR(1) RETURN 'a\x\t\\t''t';
      SHOW CREATE FUNCTION f1;
      SELECT ROUTINE_DEFINITION FROM INFORMATION_SCHEMA.ROUTINES
      WHERE ROUTINE_NAME='f1';

      The output from SHOW is:

      +----------+----------+----------------------------------------------------------------------------------------------------------+----------------------+----------------------+--------------------+
      | Function | sql_mode | Create Function                                                                                          | character_set_client | collation_connection | Database Collation |
      +----------+----------+----------------------------------------------------------------------------------------------------------+----------------------+----------------------+--------------------+
      | f1       |          | CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS varchar(1) CHARSET latin1
      RETURN 'a\x\t\\t''t' | utf8                 | utf8_general_ci      | latin1_swedish_ci  |
      +----------+----------+----------------------------------------------------------------------------------------------------------+----------------------+----------------------+--------------------+

      The output from SELECT is:

      +--------------------+
      | ROUTINE_DEFINITION |
      +--------------------+
      | RETURN 'ax	\t't'   |
      +--------------------+

      ROUTINE_DEFINITION should also display escaped values.

      Attachments

        Activity

          People

            bar Alexander Barkov
            bar Alexander Barkov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.