Bug #91123 Incorect case handling when calling stored procedure.
Submitted: 4 Jun 2018 9:05 Modified: 4 Jun 2018 13:36
Reporter: Roman Kvasov Email Updates:
Status: Verified Impact on me:
None 
Category:Connector / NET Severity:S3 (Non-critical)
Version:8.0.11, 5.7 OS:Windows
Assigned to: CPU Architecture:Any

[4 Jun 2018 9:05] Roman Kvasov
Description:
If you create mysql server on windows it handles database name as case insensitive, but driver in CommandType.StoredProcedure mode handle database name as case sensitive. Sql "call" operator works correctly.

Follow code is broken in 8.0.11 but works in 6.9.8.
Github repository with test case https://github.com/radiy/mysql-bug.

Unhandled Exception: MySql.Data.MySqlClient.MySqlException: Procedure or function '`Test`' cannot be found in database '`MySqlBug`'.
   at MySql.Data.MySqlClient.ProcedureCache.GetProcData(MySqlConnection connection, String spName)
   at MySql.Data.MySqlClient.ProcedureCache.AddNew(MySqlConnection connection, String spName)
   at MySql.Data.MySqlClient.ProcedureCache.GetProcedure(MySqlConnection conn, String spName, String cacheKey)
   at MySql.Data.MySqlClient.StoredProcedure.CheckParameters(String spName)
   at MySql.Data.MySqlClient.StoredProcedure.Resolve(Boolean preparing)
   at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior)
   at MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQuery()
   at mysql_bug.Program.Main(String[] args) in C:\Cygwin\home\kvasov\mysql-bug\Program.cs:line 36

How to repeat:
using (var connection = new MySqlConnection("server=localhost;SslMode=none;user=root")) {
	connection.Open();

	var setup = @"

drop database if exists mysqlbug;
create database mysqlbug;
use mysqlbug;

CREATE PROCEDURE Test ()
BEGIN
SELECT 1;
END
";

	var cmd = new MySqlCommand();
	cmd.Connection = connection;
	cmd.CommandText = setup;
	cmd.ExecuteNonQuery();

	cmd.CommandText = "Mysqlbug.Test";
	cmd.CommandType = CommandType.StoredProcedure;
	cmd.ExecuteNonQuery();
}
[4 Jun 2018 12:42] Chiranjeevi Battula
Hello Roman Kvasov,

Thank you for the bug report.
I could not repeat the issue at our end using with Visual Studio 2017 and Connector/NET 8.0.11 version.
Could you please provide repeatable test case (exact steps/sample project, screenshot etc. - please make it as private if you prefer) to confirm this issue at our end?

Thanks,
Chiranjeevi.
[4 Jun 2018 12:43] Chiranjeevi Battula
Screenshot

Attachment: Bug_91123.PNG (image/png, text), 55.21 KiB.

[4 Jun 2018 13:21] Roman Kvasov
Step by step
* Download mysql
wget 'https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.18-winx64.zip'
* unzip
unzip mysql-5.7.18-winx64.zip
* init
./mysql-5.7.18-winx64/bin/mysqld.exe --initialize-insecure --console
* start
./mysql-5.7.18-winx64/bin/mysqld.exe --console
* test
dotnet run

I included script into repository. Script assums that it runs under cygwin.
[4 Jun 2018 13:31] Roman Kvasov
output from test script

Attachment: log.zip (application/x-zip-compressed, text), 42.33 KiB.

[4 Jun 2018 13:36] Chiranjeevi Battula
Hello Roman Kvasov,

Thank you for the feedback.
Verified this behavior on Visual Studio 2017 and Connector/NET 8.0.11 with MySQL 5.7 version.

Thanks,
Chiranjeevi.
[4 Jun 2018 13:37] Chiranjeevi Battula
Screenshot

Attachment: Bug_91123.PNG (image/png, text), 104.33 KiB.