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

"Incorrect database name" error by SHOW FUNCTION STATUS in PAD_CHAR_TO_FULL_LENGTH mode

    XMLWordPrintable

Details

    • 10.2.10

    Description

      If sql-mode PAD_CHAR_TO_FULL_LENGTH is active, show function not work returns

      ERROR 1102 (42000): Incorrect database name 'aa '

      To Reproduce:

      Preparation:

      CREATE DATABASE `aa`;
       
      DELIMITER $$
       
      CREATE DEFINER=`root`@`%` FUNCTION `testfunction`()
      RETURNS varchar(10) CHARSET latin1
      LANGUAGE SQL
      NOT DETERMINISTIC
      NO SQL
      SQL SECURITY DEFINER
      COMMENT ''
      BEGIN
       
      RETURN "test";
       
      END
       
       
      $$
       
       
      DELIMITER ;
       
      use aa;
      
      

      Show function in with default sql_mode works well:

      mysql> SHOW FUNCTION STATUS WHERE `Db`='aa';
      +----+--------------+----------+---------+---------------------+---------------------+---------------+---------+----------------------+----------------------+--------------------+
      | Db | Name         | Type     | Definer | Modified            | Created             | Security_type | Comment | character_set_client | collation_connection | Database Collation |
      +----+--------------+----------+---------+---------------------+---------------------+---------------+---------+----------------------+----------------------+--------------------+
      | aa | testfunction | FUNCTION | root@%  | 2017-06-22 08:26:05 | 2017-06-22 08:26:05 | DEFINER       |         | latin1               | latin1_swedish_ci    | latin1_swedish_ci  |
      +----+--------------+----------+---------+---------------------+---------------------+---------------+---------+----------------------+----------------------+--------------------+
      1 row in set (0.00 sec
      

      Set SQL_mode PAD_CHAR_TO_FULL_LENGTH

      set sql_mode = 'PAD_CHAR_TO_FULL_LENGTH';
      

      Show Function throws an error. Search query is filled with spaces up to 64 chars.

      mysql> SHOW FUNCTION STATUS WHERE `Db`='aa';    
      ERROR 1102 (42000): Incorrect database name 'aa                                                              '
      

      It looks like, that the root cause is the column db in the table mysql.proc.
      Columntype is CHAR(64)

      Perhaps the sql mode 'PAD_CHAR_TO_FULL_LENGTH' should be ignored
      for all SHOW xxxx commands.

      Attachments

        Activity

          People

            pentve Vesa Pentti (Inactive)
            Richard Richard Stracke
            Votes:
            0 Vote for this issue
            Watchers:
            5 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.