c# - Unnest Npgsql bulk query for integer array element - Stack Overflow

I have a integer[] slots in my PostgreSQL table and would like to use unnest to fill it in bulk.cmd.Com

I have a integer[] slots in my PostgreSQL table and would like to use unnest to fill it in bulk.

 cmd.CommandText = "INSERT INTO inventory (slots) " +
                "SELECT t.slots " +
                      "FROM UNNEST(@slots) AS t(slots) " +
                      "RETURNING inventory_id";

cmd.Parameters.AddWithValue("@slots", new int[10][]);0

When I try this approach (just to test 10 entries with empty array of ints), I'm getting the following error:

Error: The CRL array type System.Int32[][] isn't supported by Npgsql or your PostgreSQL. If you wish to map it to an PostgreSQL composite type array you need to register it before usage.

Is there a simple solution to it?

I tried to add "NpgsqlDbType.Array | NpgsqlDbType.Integer", but to no avail.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742417560a4440037.html

相关推荐

  • c# - Unnest Npgsql bulk query for integer array element - Stack Overflow

    I have a integer[] slots in my PostgreSQL table and would like to use unnest to fill it in bulk.cmd.Com

    8小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信