Skip to content

Support array containment and overlap checks #1135

@byrneciaran

Description

@byrneciaran

I have a simple Tasks table with a users text[] column. I'm looking to query if an existing set of users is contained in the users column.

string[] existingUsers = { "joe" };
var tasks = _db.Tasks.Where(x => existingUsers.Any(y => x.Users.Contains(y))).ToList();

which I thought translated to

WHERE x.Users <@ existingUsers

but is throwing the error

The LINQ expression 'DbSet<Task>
    .Where(h => __existingUsers_0
        .Any(y => h.Users
            .Contains(y)))' could not be translated

Are the <@ or @> operators supported?

I had been following here #431

EF Core 3.1.0-preview3.19554.8
Npgsql.EntityFrameworkCore.PostgreSQL 3.1.0-preview3

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions