Bug #97067 Aggregate functions on BIT(n) columns return wrong result
Submitted: 30 Sep 17:56 Modified: 1 Oct 7:49
Reporter: Bradley Grainger (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:Connector / NET Severity:S2 (Serious)
Version:8.0.17 OS:Microsoft Windows (10)
Assigned to: CPU Architecture:Other (x64)

[30 Sep 17:56] Bradley Grainger
Description:
When an aggregate function (e.g., MIN, MAX) is applied to a BIT(n) column, Connector/NET returns incorrect results.

How to repeat:
Execute the following SQL to create a table and insert values:

	CREATE TABLE test(Bit32 BIT(32) NOT NULL);
	INSERT INTO test(Bit32) VALUES (0),(65535);");

Run the following C# code:

using (var connection = new MySqlConnection("..."))
{
	connection.Open();
	var result = connection.ExecuteScalar(@"SELECT MIN(Bit32) FROM test;");
	Console.WriteLine(result); // prints 48, should print 0
	result = connection.ExecuteScalar(@"SELECT MAX(Bit32) FROM test;");
	Console.WriteLine(result); // prints 232820912949, should print 65535
}
[1 Oct 7:49] Umesh Shastry
Hello Bradley,

Thank you for the report and test case.

regards,
Umesh