X Tutup
Skip to content

Cannot use IEnumberable<T> parameters #222

@danzel

Description

@danzel

We're looking at upgrading from a custom built 2.0.11 version of Npgsql to the latest and greatest and we ran in to this issue:

var comm = conn.CreateCommand();
comm.CommandText = "SELECT :something";
comm.Parameters.AddWithValue("something", new[] { 1, 2, 3 }.Select(x => x)); //Parameter is an IEnumerable<int>
var res = comm.ExecuteScalar();

Previously this would work, now it generates invalid SQL for the parameter.

Bad (IEnumerable):
SELECT (('[1,2,3]')::int4[])

Good (Using an Array):
SELECT (('{1,2,3}')::int4[])

I might take a quick look through to see if I can fix this, no promises however :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      X Tutup