Bug #18239 Possible to overload internal functions with stored functions
Submitted: 14 Mar 2006 23:48 Modified: 21 Dec 2006 20:37
Reporter: Kai Voigt Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0/5.1.8BK OS:Any (ALL)
Assigned to: Marc Alff CPU Architecture:Any

[14 Mar 2006 23:48] Kai Voigt
Description:
You can create stored functions with the same name of internal functions. The behaviour is confusing.

How to repeat:
root@localhost [test]> CREATE FUNCTION now () RETURNS CHAR(10) RETURN("foo");
Query OK, 0 rows affected (0.48 sec)

root@localhost [test]> SELECT NOW();
+---------------------+
| NOW()               |
+---------------------+
| 2006-03-14 15:43:25 |
+---------------------+
1 row in set (0.08 sec)

root@localhost [test]> SELECT NOW ();
+--------+
| NOW () |
+--------+
| foo    |
+--------+
1 row in set (0.07 sec)

Suggested fix:
Read the SQL standards about it and fix it
[14 Mar 2006 23:54] Miguel Solorzano
Thank you for the bug report.
[28 Sep 2006 1:53] Marc Alff
There are two separate issues :

- now() an now () can resolve to different functions,
in cases where sql_mode is not set to IGNORE_SPACE.
See related Bug#21114

- SQL defines the PATH syntax to direct name resolution for stored functions.
This SQL feature is not currently available with MySQL.
[6 Nov 2006 17:47] Marc Alff
For practical reasons, the following bugs are all fixed by the same change set:
- Bug#18239
- Bug#21025
- Bug#22619

Changing to patch pending, the patch is attached in Bug#22619
[30 Nov 2006 1:37] Konstantin Osipov
This patch was applied to 5.1 only. Pushed into 5.1.13
[21 Dec 2006 20:37] Paul Dubois
Noted in 5.1.14 changelog.