-
Notifications
You must be signed in to change notification settings - Fork 256
Description
It appears that a query with a list that should generate an In or Any statement is failing. I am using redshift but I don;t even think it hits the server. It is failing inside the compiler. The error I get is : '22P03: invalid array flags'
Example EF IQueryable statement:
public async Task<List<Domain.Entities.Security>> GetSecuritiesByCodes(List<int> securityIds)
{
var securityModels = await _context.Securities
.Where(w => w.IsDeleted == false && securityIds.Contains(w.Id))
.ToListAsync();
return securityModels;
}
SQL generated by EF IQueryable statement
SELECT s."Id", s."Code", s."IsDeleted", s."Name", s."PrimaryBenchmarkProductId", s."SecurityTypeId"
FROM performance."Securities" AS s
WHERE NOT (s."IsDeleted") AND s."Id" = ANY ($1)
I can't determine what $1 gets compiled as but it doesn't seem to hit the server. If you substitute $1 with '{1,2,3,4,5,6,7,8,9,10,11}' then the query works fine and return the right results.
Here is a snapshot of the params.

Redshift Table Definition
CREATE TABLE performance.securities (
id int4 NOT NULL,
code varchar(256) NOT NULL,
"name" varchar(256) NULL,
securitytypeid int4 NULL,
primarybenchmarkproductid int4 NULL,
isdeleted bool NOT NULL DEFAULT 0
)
Connection String
"Host=.ap-southeast-2.redshift.amazonaws.com;Port=5439;Database=dev;Username=awsuser;Password=;Server Compatibility Mode=Redshift;",
I am using EF core 5.0.2
and Npgssql 5.0.2