demetrixbio / FSharp.Data.Npgsql

F# type providers to support statically typed access to input parameters and result set of sql statement in idiomatic F# way. Data modifications via statically typed tables.
Apache License 2.0
128 stars 15 forks source link

Too many result sets #66

Closed kerams closed 2 years ago

kerams commented 4 years ago
use cmd = Db.CreateCommand<"begin;
    update section set ord = ord + 1 where deck_id = @deck_id and ord >= @order;
    update section set ord = @order where id = @sectionId;
    commit;">(cs)

Npgsql supposedly reports there are 4 statements in this command, but neither begin nor end should have a result set of their own even though there is no problem at runtime.

https://github.com/npgsql/npgsql/issues/2873

daz10000 commented 4 years ago

Hmm well there are 4 statements, but only 3 queries :(

Von meinem iPhone gesendet

Am 27.02.2020 um 7:53 AM schrieb kerams notifications@github.com:

 use cmd = Db.CreateCommand<"begin; update section set ord = ord + 1 where deck_id = @deck_id and ord >= @order; update section set ord = @order where id = @sectionId; commit;">(cs) Npgsql supposedly reports there are 4 statements in this command, but neither begin nor end should have a result set of their own even though there is no problem at runtime.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

kerams commented 4 years ago

I did some digging in the bowels of Npgsql and it looks like Postgres gives no indication about the type of individual statements when getting schema. So while this issue is mildly annoying, I don't see a solution that would be worth the trouble...

kerams commented 4 years ago

Actually, there is one dirty thing we could do - use a simple regex to filter out 'control' statements and such.

daz10000 commented 4 years ago

The path of writing a quick and dirty sql parser Leads straight to hell. Might give feedback to the nice npgsql folks. They have been helpful in past when we’ve raised things that would be useful to have

Von meinem iPhone gesendet

Am 29.02.2020 um 9:09 AM schrieb kerams notifications@github.com:

 Actually, there is one dirty thing we could do - use a simple regex to filter out 'control' statements and such.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

kerams commented 4 years ago

Unfortunately, this is a limitation of Postgres itself :/. More in the comments https://github.com/npgsql/npgsql/issues/2873