Open mishun opened 10 months ago
That's a great bug report. I'd love to take a stab at fixing this, but I can't currently build SQLProvider on my installation of Fedora. I have SDK version 6.0.132 installed, I don't think I can install 6.0.403 through the Fedora package manager, and I don't see that version on the MS downloads page. All attempts to target a different version of the SDK than 6.0.132 failed. @Thorium if you have any ideas how I can get this to build, please share.
For the original issue:
Typically SQL provider works in a way that you fetch the full entity, then you update the columns you want. And then you submit updates. This is safest way, to not conflict with column values: If your code would work, it would be unclear which of the partially created entity update nulls are intentional and which are just not set properties. So exactly the typical issue with NULL breaking single responsibility principle.
I recommend using transactions instead of onconflict. However I expect this issue is nothing to do with onconflict.
Yes there is the hack to do partial updates that does about this, but I don't recommend doing that: https://github.com/fsprojects/SQLProvider/issues/561#issuecomment-404956768
What comes to .Net version, your best shot is to modify globals.json content. I've sent F# FAKE a few PRs which I help with these in the future, but those are not merged and released yet. When they are, I will update FAKE build, so there is a hope for a better future.
Hi!
Describe the bug If I create following simple key-value pairs Postgresql database:
and run following code:
I'd expect
Value
in the first row to be changed toNULL
, but in fact nothing happens. Same goes forNullableColumnType.VALUE_OPTION
andValueNone
. Something likeupdate 0 (Some 69)
andupdate 2 None
work as expected.Tested with
SQLProvider
1.3.23 from nuget package.Additional context
fsproj
anddocker-compose.yaml
for reproduction:Complete example can be found here.