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.