Skip to content

Unable to use an array as a parameter in WhereRaw #162

@jonjomckay

Description

@jonjomckay

I'm trying to compare a JSON property in PostgreSQL against a list of values, but the values I'm passing seem to always be flattened into individual parameters instead of the array I'm giving.

A paraphrasing of my code is:

var ids = persistenceQuery.Where
                .Where(where => where.ColumnName.EqualsIgnoreCase("typeElementId"))
                .Select(where => Guid.Parse(where.Value))
                .ToArray();

query.WhereRaw("(json->'typeElementId'->>'guid')::uuid = ANY(?)", ids);

I've also tried this, but it seems to still be flattening the nested array:

query.WhereRaw("(json->'typeElementId'->>'guid')::uuid = ANY(?)", new object[] { new object[] { ids } });

I think this would be solved if I could disable the quoting of column names inside WhereIn also, as PostgreSQL doesn't seem the JSON column I'm querying as an actual column.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions