Insert parameter Array

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
chif
Posts: 2
Joined: Mon 15 Aug 2016 03:30

Insert parameter Array

Post by chif » Mon 15 Aug 2016 04:34

Hello.
I'm having problems with passing parameters (array of bigint).

Code: Select all

pgConnection.Open();
using (var cmd = pgConnection.CreateCommand())
{
     var par = new PgSqlParameter("id", PgSqlType.Array);
     par.Value = new PgSqlArray(new object[] {0, 1, 2}, PgSqlType.BigInt, 1, 3);
     cmd.Parameters.Add(par);
     cmd.CommandText = "INSERT INTO tbl1 (clmn1) VALUES (unnest($1))";
     cmd.ExecuteNonQuery();
}
pgConnection.Close();
Error:
Error: 42804: could not determine polymorphic type because input has type "unknown"
dotConnect for PostgreSQL 7.6 Express
Devart.Data.PostgreSql 7.6.714.0

Thanks

chif
Posts: 2
Joined: Mon 15 Aug 2016 03:30

Re: Insert parameter Array

Post by chif » Tue 16 Aug 2016 06:06

Ok, just fixed:
cmd.CommandText = "INSERT INTO tbl1 (clmn1) VALUES (unnest($1::bigint[]))";

Post Reply