Skip to content

Clauses involving one-to-many relations in a filter require separate jointures or a subqueries #708

@arteymix

Description

@arteymix

They currently result in contradictions where clauses such as: c.id = 1 and c.id= 2 are generated.

This could be resolved in two different ways:

Multiple jointures (one per clause)

join c as c1 join c as c2 where c1.id = 1 and c2.id = 2

The disadvantage is that we do not control the process that produces the jointures when generating the restriction clause, so it will require significant changes.

Subqueries

where id in (select id from Entity e join e.c where e.c.id = 1) and id in (...)

Advantage: clauses are contained and likely easier to generate.

Drawback: the context to refer to aliases in the root query is not available.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions