Skip to content

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

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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