Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support array based parameters in Postgresql #53

Open
d-p-y opened this issue Jul 20, 2018 · 0 comments
Open

Support array based parameters in Postgresql #53

d-p-y opened this issue Jul 20, 2018 · 0 comments

Comments

@d-p-y
Copy link

d-p-y commented Jul 20, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant