tmsmith / Dapper-Extensions

Dapper Extensions is a small library that complements Dapper by adding basic CRUD operations (Get, Insert, Update, Delete) for your POCOs. For more advanced querying scenarios, Dapper Extensions provides a predicate system. The goal of this library is to keep your POCOs pure by not requiring any attributes or base class inheritance.
1.79k stars 585 forks source link

42883: operator does not exist: text[] = text #230

Open rgustavsson opened 4 years ago

rgustavsson commented 4 years ago

I'm using Postgresql and DapperExtensions 1.6.3.

This issue is all about storing a string array and querying on that array.

I have a class with the following property:

public string[] StringArray { get; set; }

and I have a postgres database column like this:

StringArray TEXT[]

and my predicates looks like this:

pg = new PredicateGroup { Operator = GroupOperator.And, Predicates = new List<IPredicate>() };
pg.Predicates.Add(Predicates.Field<AppCalendarEvent>(f => f.TenantId, Operator.Eq, tenantId));
pg.Predicates.Add(Predicates.Field<AppCalendarEvent>(f => f.StringArray, Operator.Eq, new List<string>() { userId } ));

And the result of a GetPage (or GetList) is:

Npgsql.PostgresException: '42883: operator does not exist: text[] = text'

Anyone experienced something similiar?

valfrid-ly commented 2 years ago

Did you try version 1.7.0?