Closed rndor closed 6 years ago
In your code, you're creating a parameter object with a string for the id:
var testWidget = new Widget { Id = "30f37a32-6ed5-42c2-bcb0-72469de9d66a", Name = "Updated Name" };
Have you tried making it a guid?
var testWidget = new Widget { Id = Guid.Parse("30f37a32-6ed5-42c2-bcb0-72469de9d66a"), Name = "Updated Name" };
Sorry, I apparently copied the wrong code in my example. That bit should be as you suggested:
var testWidget = new Widget { Id = Guid.Parse("30f37a32-6ed5-42c2-bcb0-72469de9d66a"), Name = "Updated Name" };
And this, unfortunately, raises the exception as mentioned above.
This was due to a typo in the parameter type detection on netstandard1.5/2.0. Now that npgsql 4.0 is out, we can use their built-in parameter detector.
This is fixed in v6.2.5 to be released next week.
This does not affect the .NET Framework versions of Insight, so using one of those versions is a workaround in the meantime.
6.2.5 is now available
Issue
Using a Postgres function like this one
FUNCTION test.update_widget(_id UUID, _name TEXT) RETURNS VOID
throws exception:Steps to reproduce
Database
Create table:
and plpgsql functions:
C# code
Along with the following C# code:
Run the following (i.e. in Startup()):
Expected behavior
The record should be updated by calling the update_widget function. It appears that Insight tries to look for the wrong function
function test.update_widget(_id => text, _name => text)
instead offunction test.update_widget(_id => uuid, _name => text)
.(This issue does not appear to occur if the
id
column (and corresponding function signature) are changed to an INT type.)