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

INFORMATION_SCHEMA.ROUTINES.ROUTINE_DEFINITION does not handle binary literals well

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 5.5, 10.0, 10.1, 10.2, 10.3, 10.4
    • 10.4
    • None
    • None

    Description

      • I run a terminal using koi8-r character set.
        In case of gnome-terminal, do "Terminal >Set Character Encoding>Cyrillic(KOI8-R)
      • Start mysql like this:

        LANG=ru_RU.koi8r mysql -uroot test

      • And create a stored function returning a binary string

        DROP FUNCTION IF EXISTS f1;
        CREATE FUNCTION f1() RETURNS BINARY RETURN (SELECT _binary'яп╠' AS я);
        SELECT ROUTINE_DEFINITION FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_NAME='f1';

      This SQL script returns:

      +----------------------------+
      | ROUTINE_DEFINITION         |
      +----------------------------+
      | RETURN (SELECT '???' AS я) |
      +----------------------------+

      Note, if I now run a new terminal using utf8 as a character set and run this query:

      SELECT ROUTINE_DEFINITION FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_NAME='f1';

      it returns

      +--------------------------------+
      | ROUTINE_DEFINITION             |
      +--------------------------------+
      | RETURN (SELECT 'Ñб' AS я)     |
      +--------------------------------+

      The expected result would be to replace the literal to X'HHHH' notation.

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:

              Git Integration

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