DapperLib / DapperLib/Dapper

Select in with uuid array not working in Postgresql

Open
#315 8 comments 0 reactions 1 assignee View on GitHub

@NickCraver is already working on this.

Since Nov 28, 2015.

db:postgresql needs-investigation
Dominant language
C#
Stars
18.4k
Forks
3.7k
Avg merge
5h 8m
Merged PRs (30d)
1

Description

I'm running a query similar to the following:

string sql = @"select * from table where table.token in (@tokens)";

using (var connection = connection_factory.OpenDbConnection())
{
    return connection
      .Query<Dto>(sql, new { tokens = new[] { Guid.Parse("d767cfb5-ad1f-4402-8147-db884873e9fe") });
}

It produces this sql:

select * from table
where table.token in ((('{"d767cfb5-ad1f-4402-8147-db884873e9fe"}')::uuid[]))

Which throws this error:

ERROR:  operator does not exist: uuid = uuid[] at character 164
HINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts.

Am I doing something explicitly wrong? Is there a workaround for in statements containing uuids?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.