Skip to content

Support array based parameters in Postgresql #53

Description

@d-p-y

Hi,
At this moment it is not possible to use Postgresql's ANY() operator to pass arrays as sql input parameters.

When trying code such as

        public class SomeEntity
        {
            public int Id {get; set; }
        }

        public Task<List<SomeEntity>> AcceptRejectRule (AsyncPoco.Database dbConn) {            
            object ids = new [] { 1, 2, 3, 4 };
            return dbConn.FetchAsync<SomeEntity>("where id = ANY(@0)", ids);
        }

It fails because it generates:
sql query: select id from SomeEntity where id = ANY(@0, @1, @2, @3)
query parameters: SqlParameter(@0, 1), SqlParameter(@1, 2),SqlParameter(@2, 3),SqlParameter(@3, 4)

Implementation proposal as PR will follow shortly.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions