Bug #50341 No native function warning on 5.X server for SHOW FUNCTION STATUS
Submitted: 14 Jan 2010 17:24 Modified: 10 Mar 2010 19:42
Reporter: Chuck Bell Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: Errors Severity:S3 (Non-critical)
Version:5.6.0 OS:Any
Assigned to: Jon Olav Hauglid CPU Architecture:Any
Triage: Needs Triage: D3 (Medium) / R6 (Needs Assessment) / E6 (Needs Assessment)

[14 Jan 2010 17:24] Chuck Bell
Description:
The SHOW FUNCTION STATUS command does not return a warning on the 5.X code (e.g. mysql-next-4284) when a function is created that has the same name as a native function. However, the 6.0 code does produce the warning.

Here is a test case:

use test;
create function y(i int) returns int return i * 2;
show warnings;
show function status \G
show warnings;

When run on 6.0 code (e.g. mysql-6.0-backup) you get this:

mysql> use test;
Database changed
mysql> create function y(i int) returns int return i * 2;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> show warnings;
+-------+------+----------------------------------------------------------+
| Level | Code | Message                                                  |
+-------+------+----------------------------------------------------------+
| Note  | 1585 | This function 'y' has the same name as a native function |
+-------+------+----------------------------------------------------------+
1 row in set (0.00 sec)

mysql> show function status \G
*************************** 1. row ***************************
                  Db: test
                Name: y
                Type: FUNCTION
             Definer: root@localhost
            Modified: 2010-01-14 20:19:26
             Created: 2010-01-14 20:19:26
       Security_type: DEFINER
             Comment: 
character_set_client: utf8
collation_connection: utf8_general_ci
  Database Collation: latin1_swedish_ci
1 row in set, 1 warning (0.00 sec)

mysql> show warnings;
+-------+------+----------------------------------------------------------+
| Level | Code | Message                                                  |
+-------+------+----------------------------------------------------------+
| Note  | 1585 | This function 'y' has the same name as a native function |
+-------+------+----------------------------------------------------------+
1 row in set (0.00 sec)

mysql>

However, when run on the 5.x code (e.g. mysql-next-4284) you get this:

mysql> use test;
Database changed
mysql> create function y(i int) returns int return i * 2;
Query OK, 0 rows affected, 1 warning (0.01 sec)

mysql> show warnings;
+-------+------+----------------------------------------------------------+
| Level | Code | Message                                                  |
+-------+------+----------------------------------------------------------+
| Note  | 1585 | This function 'y' has the same name as a native function |
+-------+------+----------------------------------------------------------+
1 row in set (0.00 sec)

mysql> show function status \G
*************************** 1. row ***************************
                  Db: test
                Name: y
                Type: FUNCTION
             Definer: root@localhost
            Modified: 2010-01-14 20:21:02
             Created: 2010-01-14 20:21:02
       Security_type: DEFINER
             Comment: 
character_set_client: utf8
collation_connection: utf8_general_ci
  Database Collation: latin1_swedish_ci
1 row in set (0.00 sec)

mysql> show warnings;
Empty set (0.00 sec)

EEEK! Where did the warning go? :P

How to repeat:
Run test case above.

Suggested fix:
Unknown

Note: The code that generates the warning in sql_yacc.yy is the same in 5.X and 6.0 so the problem lies elsewhere. Also, this code came into the 5.X tree as a manual merge so there is no obvious ancestor worklog or bug.

Note: The result file for test backup_functions has been changed to match the 5.X behavior. When this bug is fixed, the result file will have to be corrected.
[15 Jan 2010 10:59] Sveta Smirnova
Thank you for the report.

Verified as described.
[10 Mar 2010 14:44] Jon Olav Hauglid
I tried to reproduce this bug and got the following results:
5.1-bugteam - no warning
mysql-trunk - warning
mysql-next-mr-bugfixing - warning
mysql-next-4284 - warning

So it seems to me that 5.5+ now produces a warning for SHOW FUNCTION STATUS.
[10 Mar 2010 19:42] Sveta Smirnova
I can't repeat it with today update of mysql-next-4284