Skip to content
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

UpdateMatchedAndConditionNames in BulkOperation are ignored for PostgreSql #103

Closed
nothings-more opened this issue Jan 5, 2022 · 3 comments
Assignees

Comments

@nothings-more
Copy link

nothings-more commented Jan 5, 2022

Hello,

I'm trying to extend bulk update operation using UpdateMatchedAndConditionNames , but looks like this setting is not affect resulting SQL generated for PostgreSql provider, while it works for SqlServer provider as expected.

For example, consider having an entity with 2 properties: Id (key) and Version. Following code

connection.UseBulkOptions(bulkOperation =>
            {
                bulkOperation .UpdateMatchedAndConditionNames = new List<string> { "Version" };
            }).BulkUpdate(new[] { entity });

produces MERGE statement for SqlServer provider, with expected additional condition for "Version", i.e. in SqlServer bulk update will be performed only for those rows in DB where "Id" and "Version" are equal to corresponding properties of entity to update.

For PostgreSql provider, though, the same C# code produces UPDATE with only "Id" comparison included in WHERE clause, i.e. comparison of "Version" is ignored.

I've sent a sample project with ability to test both providers to info@zzzprojects.com

Also, looks like there is a similar issue for MergeMatchedAndConditionNames property for bulk operations

Please let me know if you need any additional info on the issue.

Thanks in advance,
Alex

@JonathanMagnan JonathanMagnan self-assigned this Jan 6, 2022
@JonathanMagnan
Copy link
Member

Helloo @nothings-more ,

The v4.0.21 has been released.

Could you try it and confirm us that everything is now working for the option UpdateMatchedAndConditionNames?

Best Regards,

Jon

@nothings-more
Copy link
Author

@JonathanMagnan , yes, looks like the issue is fixed in 4.0.21
Thank you

@nothings-more
Copy link
Author

nothings-more commented Jan 13, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants