Repository navigation
Conversation
DuckDBParameter.Value replaced DbType with the type inferred from the new value every time it was set, so
"parameter.DbType = DbType.Time; parameter.Value = timeSpan" lost the Time. The converter then saw a TimeSpan with no
DbType and bound it as an INTERVAL (the behavior added for a bare "?"), which DuckDB cannot cast to TIME where it has no
target column to infer from, such as a MERGE source:
MERGE INTO t USING (SELECT $1 AS id, $2 AS v) s ON t.id = s.id ... INSERT (id, v) VALUES (s.id, s.v)
-- Conversion Error: Unimplemented type for cast (INTERVAL -> TIME) when casting from source column v
The same applied to every explicit DbType followed by a Value assignment, which is the usual order for a provider-neutral
caller (CreateParameter, set DbType, set Value).
A DbType that was assigned now stays; until one is assigned, and after ResetDbType, the type still follows the value, as
it does for SqlParameter and NpgsqlParameter. The constructors that take a value without a type still infer it, and the
ones that take a DbType keep it.
Found while testing for a release of https://github.com/pengdows/pengdows.crud
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Coverage Report for CI Build 39136404700Coverage decreased (-0.03%) to 92.52%Details
Uncovered ChangesNo uncovered changes found. Coverage Regressions2 previously-covered lines in 1 file lost coverage.
Coverage Stats💛 - Coveralls |
This branch is waiting to be deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
DuckDBParameter.ValuereplacedDbTypewith the type inferred from the new value on every assignment, so an explicitDbTypefollowed by aValueassignment was lost:Why it matters. #360 binds a
TimeSpanwith no inferred type as anINTERVAL, except whenDbType.Timesays it is a time of day. Because theTimewas lost, aTimeSpanfor aTIMEcolumn inside aMERGEsource (where DuckDB has no target column to infer from) is bound as anINTERVAL, and DuckDB cannot cast that toTIME:It worked with 1.5.6 (the value was sent as text) and fails with 1.5.6.1. The same applies to any explicit
DbTypeset beforeValue, which is the usual order for a provider-neutral caller (CreateParameter(), setDbType, setValue).Fix. A
DbTypethat was assigned now stays. Until one is assigned, and afterResetDbType(), the type still follows the value, as it does forSqlParameterandNpgsqlParameter. The constructors that take a value without a type still infer it; the ones that take aDbTypekeep it.Tests (
Parameters/ParameterDbTypeTests):DbTypeset before and after the value is kept; inference when none was set and afterResetDbType(); the constructors; theMERGEcase above, which fails without the change; and a bareTimeSpanis still bound as an interval. The new tests pass 5 of 5 runs, and the suite (everything except the VARINT and connection stress tests) passes: 1285 tests on net8.0.Found while testing for a release of https://github.com/pengdows/pengdows.crud