Updates fail if a column name starts with 'Names'

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for MySQL
Post Reply
SquishyZA
Posts: 6
Joined: Tue 30 Jun 2020 15:34

Updates fail if a column name starts with 'Names'

Post by SquishyZA » Wed 28 Jul 2021 17:52

Reproduced using Devart.Data.MySql.EFCore 8.8.1759 and interestingly enough dbForge Studio 2020 for MySQL 9.0.636.

Any Column that has a name that start with 'Names' can reproduce this issue.

It is easier to reproduce in dbForge so I will first provide steps for that:

1. Create a schema test
2. Create a table

Code: Select all

CREATE TABLE test.test (
  Id int UNSIGNED NOT NULL AUTO_INCREMENT,
  Names2 bit(1) DEFAULT NULL,
  PRIMARY KEY (Id)
)
ENGINE = INNODB,
AUTO_INCREMENT = 2,
CHARACTER SET utf8mb4,
COLLATE utf8mb4_0900_ai_ci;
3. Insert a row with an Id of 1 and any value for Names2
4. Run the following query (This query was extracted from the Entity Framework debugging message) :

Code: Select all

UPDATE test.test set Names2 = 0 
 WHERE Id = 1;
5. It fails with an error message of "Character set '2 = 0
where id = 1' is not supported"

The same can be reproduced in Entity Framework in .NET Core 3.1 using the mentioned Devart.Data.MySql.EFCore. That is how I found this issue initially and when I tried to reproduce it in dbForge saw the same issue there. That query works in Workbench.

In Core it would be something like:

Code: Select all

var item = dbCtx.Test.FirstOrDefault();
item.Names2 = 0;
dbCtx.SaveChanges();
The SaveChanges generates the same error message as dbForge.

Interesting enough in dbForge if you quote the name you can work around it. I have not seen a similar option for Entity Framework.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Updates fail if a column name starts with 'Names'

Post by Shalex » Mon 02 Aug 2021 19:18

Thank you for your report. We have reproduced the issue and will notify you when it is fixed.

Post Reply