-
Notifications
You must be signed in to change notification settings - Fork 294
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
5.2.0 broke DATETIMEOFFSET(1..4) in TVPs #2423
Comments
This reverts commit 9e38107. Avoids upstream bug: dotnet/SqlClient#2423
Thank you, we'll check it out. |
@cmeeren. Just needed to clarify the repro. You mentioned in the repro that "Running this as-is requires a database TvpRepro with the following TVP:" CREATE TYPE dbo.DateTimeOffsetList AS TABLE However, in the command text "SELECT * FROM @params " it seems it is querying a user defined table type and not an actual instance of a table. Do you actually intend to query an actual instance of a table using dbo.DateTimeOffsetList type? |
Not sure what you mean by "instance of a table". I don't mention a table anywhere in my post. If you are referring to the name Was that clarifying? |
@cmeeren. Using version 5.1 displayed the parameter value without issues. let conn = new SqlConnection("Data Source=.;Initial Catalog=TvpRepro;Integrated Security=True;Encrypt=False")
conn.Open()
let cmd = conn.CreateCommand()
cmd.CommandText <- "SELECT * FROM @params"
cmd.Parameters.Add(param) |> ignore
let result = cmd.ExecuteScalar()
printfn "%A" result
1/1/2000 12:00:00 AM +00:00 The root cause of regression is being investigated. |
The issue was introduced in enhancement #2170. @saitama951, do you have a unit test for the above enhancement you can share? If not, would you mind testing locally when the fix on this issue is done to ensure the enhancement is not affected by the change? |
@arellegue I didn't have a specific unit test for this enhancement. apparently, I tested this against the manual and functional test cases present in SqlClient (to see nothing breaks with x86 and s390x). Sure I will test it out. |
I think there are different lengths for SqlDbType and probably the extra bytes written to the stream might be the cause ( in some cases)?
|
From 5.2.0, an exception is thrown when using
DATETIMEOFFSET(n)
in a TVP ifn
is1
,2
,3
, or4
.Repro code:
Running this as-is requires a database
TvpRepro
with the following TVP:When run, it produces this exception:
Strictly speaking, this only happens if the scale set in
SqlMetaData
is1
,2
,3
, or4
. It seems to be unrelated to the number used in the SQL type definition (though I assume they should always match).This error does not occur before 5.2.0.
Further technical details
Microsoft.Data.SqlClient 5.2.0
.NET 8
SQL Server Developer 15.0.2104.1
Windows 11
The text was updated successfully, but these errors were encountered: