Bug #101294 | Invalid query generated for new entity without any values results in exception | ||
---|---|---|---|
Submitted: | 23 Oct 2020 16:54 | Modified: | 24 Oct 2020 14:39 |
Reporter: | Foo Bar | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | Connector / NET | Severity: | S3 (Non-critical) |
Version: | 8.0.22, 8.0.23 | OS: | Linux (Gentoo) |
Assigned to: | CPU Architecture: | Other (x64) |
[23 Oct 2020 16:54]
Foo Bar
[24 Oct 2020 14:39]
MySQL Verification Team
Hello! Thank you for the report and feedback. regards, Umesh
[25 Mar 2021 13:18]
MySQL Verification Team
Bug #103049 marked as duplicate of this one.
[19 May 2023 20:28]
Søren Nielsen
Can be worked around by using a DbCommandInterceptor: -------------------------------------------------------- using Microsoft.EntityFrameworkCore.Diagnostics; using System.Data.Common; public class MySqlDefaultValuesInterceptor : DbCommandInterceptor { public override InterceptionResult<DbDataReader> ReaderExecuting(DbCommand command, CommandEventData eventData, InterceptionResult<DbDataReader> result) { if (command.CommandText.Contains("DEFAULT VALUES()")) { command.CommandText = command.CommandText.Replace("DEFAULT VALUES()", "VALUES()"); } return result; } } -------------------------------------------------------- And then in your DbContext: -------------------------------------------------------- protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { optionsBuilder.AddInterceptors(new MySqlDefaultValuesInterceptor()); base.OnConfiguring(optionsBuilder); } --------------------------------------------------------