Bug #102825 mysqld selects an unexpected function
Submitted: 5 Mar 11:34 Modified: 6 Mar 11:43
Reporter: lyp tennyson Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Stored Routines Severity:S3 (Non-critical)
Version:8.0.23, 5.7.23 OS:Any
Assigned to: CPU Architecture:Any

[5 Mar 11:34] lyp tennyson
Description:
 mysqld selects an unexpected function.

How to repeat:

my.cnf:

lower_case_table_names = 0

mysql> set global log_bin_trust_function_creators = 1;
Query OK, 0 rows affected (0.00 sec)

mysql> create database test;
Query OK, 1 row affected (0.00 sec)
mysql> create database TEST;
Query OK, 1 row affected (0.00 sec)

mysql> use test
Database changed
mysql> delimiter $$
mysql> create function foo() returns int begin return 10; end $$
Query OK, 0 rows affected (0.00 sec)
mysql> use TEST$$
Database changed
mysql> create function foo() returns int begin return 20; end $$
Query OK, 0 rows affected (0.00 sec)

mysql> delimiter ;
mysql> select test.foo();
+------------+
| test.foo() |
+------------+
|         10 |
+------------+
1 row in set (0.00 sec)

### It is OK.

mysql> select TEST.foo();
+------------+
| TEST.foo() |
+------------+
|         10 |
+------------+
1 row in set (0.00 sec)

### 'foo' in schema 'TEST' should be executed and 20 is returned.

mysql> select Test.foo();
+------------+
| Test.foo() |
+------------+
|         10 |
+------------+
1 row in set (0.00 sec)

### There is no schema  named 'Test',  it should not run successfully ?
[6 Mar 11:43] MySQL Verification Team
Hello lyp tennyson,

Thank you for the report and test case.
Verified as described.

regards,
Umesh