Fwd: [nhusers] Many unit tests failing with fractional second precision exceeds scaled specified. What is the appropriate resolution?

41 views
Skip to first unread message

Oskar Berggren

unread,
Aug 3, 2016, 7:42:32 PM8/3/16
to nhibernate-...@googlegroups.com
Well, my first PR didn't go quite as hoped but I've pushed some revisions now. Still at https://github.com/nhibernate/nhibernate-core/pull/490

Opinions are welcome, especially to my solution on https://nhibernate.jira.com/browse/NH-3895 which involves introducing a setting for DbType.Datetime scale on the OdbcDriver. See further notes in Jira. If I'm missing an easy solution to detect it automatically, please let me know. Otherwise I think this solution is as good as it will get for now. Feels like a corner case in an unusual scenario so I don't want to spend much time on it.


Anyway, the PR takes the number of failing tests from 213 down to 45.

Only 4 of those are tests that used to work, the rest I think have basically never worked in this scenario. Strange thing is, those 4 tests do work on my local system. Hmm... and they seem to be flaky in Teamcity. They all involve entities with a timestamp version, so may be related to precision also. Don't know what to do about them.

/Oskar




---------- Forwarded message ----------
From: Oskar Berggren <oskar.b...@gmail.com>
Date: 2016-08-03 16:13 GMT+01:00
Subject: Re: [nhusers] Many unit tests failing with fractional second precision exceeds scaled specified. What is the appropriate resolution?
To: nhu...@googlegroups.com


I believe the fail count on MSSQL ODBC should drop from 213 to a bit over 70.

Possibly there will be some new test failures because the change of dialect may activate some tests that were previously ignored.

/Oskar


2016-08-03 14:44 GMT+01:00 Oskar Berggren <oskar.b...@gmail.com>:
I'm looking into it.

My take is that if we're using (modern) MSSQL over ODBC we should set dbParam.Scale = 3 if the DbType is DateTime and nothing else have bee specified

For the lack of real bug reports showing issues on other environments, I'm consider doing a somewhat hacky solution. It seems like it's more about how the tests are written and executed, than a bug in NHibernate itself. But we don't really want to change a massive amount of tests because then maybe they wouldn't test what they were supposed to test anymore. Besides all the work required.

/Oskar


2016-07-28 17:38 GMT+01:00 'Nathan Brown' via nhusers <nhu...@googlegroups.com>:
A large number of unit tests are failing because of the following error:

System.Data.Odbc.OdbcException : ERROR [22008] [Microsoft][SQL Server Native Client 11.0]Datetime field overflow. Fractional second precision exceeds the scale specified in the parameter binding.

What is the approach the team wants to take to resolve this?  Should the NHibernate SQL Server mappings automatically truncate these datetime fields?  Should the unit tests truncate?  Should the schema be updated to use datetime2 so it can handle the full precision?

Any other options available?

Above all, I think the unit tests should have a path to passing on all servers, especially MS SQL Server.

Thanks,
Nathan Brown

--
You received this message because you are subscribed to the Google Groups "nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nhusers+u...@googlegroups.com.
To post to this group, send email to nhu...@googlegroups.com.
Visit this group at https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.



Reply all
Reply to author
Forward
0 new messages