[MDEV-26605] Creating table with primary key constraint name fails when using C# connector Created: 2021-09-14  Updated: 2021-09-15

Status: Open
Project: MariaDB Server
Component/s: Data Definition - Create Table
Affects Version/s: 10.6.0, 10.6.1, 10.6.2, 10.6.3, 10.6.4
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Andreas Lennartz Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: regression-10.6
Environment:

Current MySql Connector (8.0.26)


Attachments: Text File Program.cs    
Issue Links:
Problem/Incident
is caused by MDEV-8334 Rename utf8 to utf8mb3 Closed
Relates
relates to MDEV-26607 Information schema not accessable in ... Open
relates to MDEV-26105 MariaDB 10.6 cannot be used from C# c... Closed

 Description   

I am using C# (.NET 5.0) and ADO.NET to execute statements on MariaDb. For this, I am using the MySql connector (current version: 8.0.26) to run statements on the database.
I am trying to execute the following statement to create a table that has a primary key. The primary key has a constraint name.

string sql = $@"CREATE TABLE `test` (
`id` INT NOT NULL
, CONSTRAINT `pk1` PRIMARY KEY (`id`)
)";
MySqlCommand cmd = new MySqlCommand(sql, conn);
cmd.ExecuteNonQuery();

Though the table is created, this code throws an exception with MariaDb 10.6.4:
System.NotSupportedException: 'Character set 'utf8mb3' is not supported by .Net Framework.'

It worked fine on MariaDb 10.5.12. When I create named unique and foreign key constraints I don't get an exception.

I am guessing it is related to the switch to utf8mb4 as default collation introduced with 10.6.

See attached file for the full example code in C#.


Generated at Thu Feb 08 09:46:34 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.