-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MERGE INTO on temporal table fails with Attempting to set a non-NULL-able column's value to NULL #22852
Comments
Have you tried with:
|
I tried this option and it is working with that. But to be honest, this can only be a temporal workaround not a solution to this problem. Settings this option (especially to 1) increase the used commands/connections dramatically. Is there another way to configure EF to not using MERGE statements at all? |
@IT-CASADO In EF Core 5.0, we have changed the default max batch size to 42--see #9270. In addition, this issue should go away entirely once we start using the new ADO.NET batching API--see #18990. We are considering this for EF Core 6.0. Closing as a duplicate of #18990. |
Any update on this? I see closed as not planned so does that mean there is no switch planned to utilise the new batching api? |
@dazinator This is closed because it is a duplicate issue. |
File a bug
Foreword:
I think this is an SQL Server issue with MERGE statement.
But because of EF Core (as an abstraction layer) is using MERGE instead of a simple INSERT INTO I decided to report this here too.
(BTW: EF Core and SQL Server are living in the same house)
I have a very simple EF use case. One table with SQL SYSTEM-VERSIONED TEMPORAL TABLE enabled. The temporal has an non-clustered index!
EF Core shouldn't see anything about TEMPORAL feature.
But because of this bug https://feedback.azure.com/d365community/idea/6716844a-5b25-ec11-b6e6-000d3a4f0da0 (broken link: https://feedback.azure.com/forums/908035-sql-server/suggestions/35519209-merge-not-working-when-index-created-on-temporal-t) i cannot insert multiple records (> 330 records) to my database.
Unfortunately this bug is reported in 2018 and not fixed by SQL Server Team until today :(
I created a small SQL fiddle that shows the error only with SQL Server involved.
For my model EF generates something like this above:
Include your code
You can find a working repro here: https://github.com/IT-CASADO/ef-core-3-non-null-able-bug
Please run the only unit test!
Include stack traces
Include provider and version information
EF Core version: 3.1.8
Database provider: (Microsoft.EntityFrameworkCore.SqlServer)
Target framework: (.NET 3.1)
Operating system: WIndows
IDE: (Visual Studio 2019 16.6.3)
The text was updated successfully, but these errors were encountered: