driver.Value
interface is ignored when uninitialized typed map is passed as an argument to conn.Exec
#1888
Labels
driver.Value
interface is ignored when uninitialized typed map is passed as an argument to conn.Exec
#1888
Describe the bug
Given:
not null default '{}'
)driver.Valuer
interfaceWhen the value is passed as an argument in some scenarios the value doesn't respect the
driver.Valuer
implementation.To Reproduce
Runnable example showing the issue:
Expected behavior
The code shouldn't fail on the second update call and the column had to be updated with the
'{}'
.Actual behavior
ERROR: null value in column "overrides" violates not-null constraint (SQLSTATE 23502)
error is returned insteadVersion
Additional
While debugging it I've found this line https://github.com/jackc/pgx/blob/v5.5.2/extended_query_builder.go#L26 which converts all typed nils into untyped ones. This seems to be causing the issue and the
Value()
in never called in second scenario.The text was updated successfully, but these errors were encountered: