I got strange result with NpgsqlParameter in C++/CLI project.
NpgsqlParameter^ status = wCMD->Parameters->Add(gcnew NpgsqlParameter("param1", NpgsqlDbType::Array | NpgsqlDbType::Smallint));
status->Direction = System::Data::ParameterDirection::InputOutput;
status->Value = DBNull::Value;
status->Size = 20;
CALL MySchema.MyProcedure(:param1);
In MyProcedure, I assign a array of null and 0 to param1:
CREATE OR REPLACE PROCEDURE MySchema.MyProcedure(
INOUT param1 smallint[])
LANGUAGE 'plpgsql'
AS $BODY$
BEGIN
param1 := array[null, 0];
raise notice 'param1: %', param1;
$BODY$;
Then I got the following strange result in C++/CLI project: NpgsqlValue with arrays of shorts is [0, 0]
Could somebody help me to explain why NpgsqlParameter received arrays of zeros instead of null and 0?
Maybe NULL in C++ is 0? Or array cannot receive NULL?
How could I receive correct returned result from postgres? Example: NpgsqlValue with arrays of shorts is [NULL, 0]
I am using npgsql 4.1.12, postgresql 14.
Thanks a lot.