'Npgsql >3.0 call function with null param without explicit cast

In npgsql 2 I could call function with null param and it actually worked.

select * from testfn(@test1);
AddWithValue("@test1", DBNull.Value)

Now in Npgsql 6 I got exception that there is no function with unknown parameter.

I don't want to rewrite all code to set type of params explicitly. Is there any workaround?



Solution 1:[1]

No, there is no workaround - null is not a valid way to specify database nulls in ADO.NET (that's what DBNull.Value is for). Npgsql 2 is an ancient version, and many behavioral things have been fixed since then, including some breaking changes.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Shay Rojansky