when calling stored procedure using DotConnect for Postgres, I have the following exception:
PgSqlException : could not determine data type of parameter $1
Test setup:
Prepare Model first Data Context that creates the following table:
Code: Select all
CREATE TABLE public."Tests" (
"Id" SERIAL NOT NULL,
"Status" INT4 NOT NULL,
"TestSuiteId" INT4 NOT NULL,
CONSTRAINT "PK_Tests" PRIMARY KEY ("Id"),
);
Code: Select all
INSERT INTO "Tests"("Id", "Status", "TestSuiteId") VALUES (1, 0, 1);
INSERT INTO "Tests"("Id", "Status", "TestSuiteId") VALUES (2, 0, 1);
INSERT INTO "Tests"("Id", "Status", "TestSuiteId") VALUES (3, 0, 1);
INSERT INTO "Tests"("Id", "Status", "TestSuiteId") VALUES (4, 0, 2);
INSERT INTO "Tests"("Id", "Status", "TestSuiteId") VALUES (5, 0, 2);
Code: Select all
create or replace function public."GetCreatedTestForTestSuiteAndMarkItAsRunning"(testSuiteId int)
returns int
as $$
declare
testId int;
updatedRows int;
begin
raise info 'selecting created test for test suite with id %', testSuiteId;
select "Id" into testId from public."Tests"
where "TestSuiteId" = testSuiteId
and "Status" = 0
fetch first 1 row only;
update public."Tests"
set "Status" = 1 --Running
where "Id" = testId and "Status" = 0; --Created
get diagnostics updatedRows = row_count;
raise info 'updatedRows: %', updatedRows;
if updatedRows = 1 then
return testId;
else
return -1;
end if;
end;
$$ language plpgsql;
It is possible to manually call the stored procedure by
Code: Select all
select * from public."GetCreatedTestForTestSuiteAndMarkItAsRunning"(1);
- return type System.Int32
- one input parameter named testSuiteId, System.Int32
When I call the method
Code: Select all
using (var ctx = new DataContext())
{
var result = ctx.GetCreatedTestForTestSuiteAndMarkItAsRunning(1);
}
Code: Select all
Devart.Data.Linq.LinqCommandExecutionException : Error on executing DbCommand.
----> Devart.Data.PostgreSql.PgSqlException : could not determine data type of parameter $1
Could you please help me?
Thank you.