When updating a table with an array column, malformed sql is being created because the sourceType is passed in as the Array Element Type instead of the Array Type, but only when updating. When Inserting the proper type is being passed in in sourceType
public override Func<object, object> GetParameterConverter(DbCommand command, Type sourceType) {
if (sourceType == typeof(int[])) { //<-- this is int when updating should be int[] like when inserting.
return x => new NpgsqlParameter {
NpgsqlDbType = NpgsqlDbType.Array | NpgsqlDbType.Integer,
Value = (int[])x
};
}
See parameters 20 and 21 in the update. Sql is not valid.
Causes:
Npgsql.PostgresException (0x80004005): 42601: syntax error at or near "$22"
When updating a table with an array column, malformed sql is being created because the sourceType is passed in as the Array Element Type instead of the Array Type, but only when updating. When Inserting the proper type is being passed in in sourceType
See parameters 20 and 21 in the update. Sql is not valid. Causes: Npgsql.PostgresException (0x80004005): 42601: syntax error at or near "$22"