-
Notifications
You must be signed in to change notification settings - Fork 25
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
Support Npgsql 6.0+ #216
base: master
Are you sure you want to change the base?
Support Npgsql 6.0+ #216
Conversation
A lot of tests are failed. At least DateTime and DateTimeOffset support is broken for all the test instances from v9.6 up to v13, basic INSERTs are broken. I cannot merge this PR. |
Yes, new version of Npgsql driver throw exception if you try save DateTime without KindType.Utc to DB column with support timezone info. Offical Postgres doc (https://www.npgsql.org/doc/types/datetime.html) contains information about this and suggest several solutions:
Currently all test use DateTime with KindType.Unspecified. After enable options for support legacy behavior all test successful. I sugest change KindType for DateTime property on UTC when parsing of test data from XML and for others instance of DateTime , it's ok for you? |
It worked fine before so having another option to turn on to not screw application work is bad idea.
Imagine you had For To do so take a look at TypeMapper.cs which is in all of SQL drivers. For each supported .Net type it a has trinity of methods:
You need to change or override If you have any questions, please ask. By the way, what was the problem with |
Ok, thanks, I will do it. |
@alex-kulakov fixed mapping for DateTimeOffset and DateTime. All tests passed in master branch same way passed with new driver version in current branch IsTransactionCompleted() use private field IsCompleted for get transaction state in early versions of npgsql driver it field was be public. Now Npgsql checks what the transaction completed internally in methods Commit() and Rollback() |
@PopovKS , that's weird that you fixed You don't need to override all three Map, Read, Bind methods, As I understand from my quick investigation something like this
works for all
Got it. |
There is another thing that should be investigated - DateTime.Min and DateTime.Max replacing with Infinity. Maybe there are more things they wanted to break compatibility. |
Added support Npgsql 6.0+ driver