public void TestBug1006158OutputParameters()
{
using (var conn = OpenConnection())
{
const string createFunction =
@"CREATE OR REPLACE FUNCTION pg_temp.more_params(OUT a integer, OUT b boolean) AS
$BODY$DECLARE
BEGIN
a := 3;
b := true;
END;$BODY$
LANGUAGE 'plpgsql' VOLATILE;";
var command = new NpgsqlCommand(createFunction, conn);
command.ExecuteNonQuery();
command = new NpgsqlCommand("pg_temp.more_params", conn);
command.CommandType = CommandType.StoredProcedure;
command.Parameters.Add(new NpgsqlParameter("a", DbType.Int32));
command.Parameters[0].Direction = ParameterDirection.Output;
command.Parameters.Add(new NpgsqlParameter("b", DbType.Boolean));
command.Parameters[1].Direction = ParameterDirection.Output;
var result = command.ExecuteScalar();
Assert.AreEqual(3, command.Parameters[0].Value);
Assert.AreEqual(true, command.Parameters[1].Value);
}
}