Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
5.5(EOL), 10.0(EOL), 10.1(EOL), 10.2(EOL)
-
all, tested with official docker images
-
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.