Skip to content

Replaced one-to-many filter LEFT JOINs with EXISTS subqueries#428

Open
jenskm wants to merge 1 commit intomainfrom
GG-423
Open

Replaced one-to-many filter LEFT JOINs with EXISTS subqueries#428
jenskm wants to merge 1 commit intomainfrom
GG-423

Conversation

@jenskm
Copy link
Copy Markdown
Collaborator

@jenskm jenskm commented Mar 25, 2026

detects when a filter input creates a LEFT JOIN to a table where the FK originates from the target (one-to-many), removes the LEFT JOIN, and wraps the filter condition in DSL.exists

detects when a filter input creates a LEFT JOIN to a table
where the FK originates from the target (one-to-many),
removes the LEFT JOIN, and wraps the filter condition in
DSL.exists
@jenskm jenskm self-assigned this Mar 25, 2026
@jenskm jenskm added the bug fix Solves a bug. Causes PATCH release bump label Mar 25, 2026
@andreahn
Copy link
Copy Markdown
Collaborator

Jeg er usikker på hvordan dette blir når @reference har flere ledd i seg.

Sånn det ser ut har jo dette aldri fungert ordentlig, så forslår følgende:

  • Legg til denne fiksen
    • Vurder om vi også skal støtte at en-til-mange referansen har en condition på seg i tillegg
  • Si at vi kun støtter en-til-mange joins på input hvis referansen har ett ledd, og kast valideringsfeil som sier man må bruke @condition direktivet i stedet

Comment on lines +743 to +744
var oneToManyFilterJoin = findOneToManyFilterJoin(context, joinSetBefore, conditionListSizeBefore);
oneToManyFilterJoin.ifPresent(context.getJoinSet()::remove);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opplever denne logikken som suspekt. Så den er allerede opprettet, men nå skal den finnes fram igjen og slettes? Hva hvis det er flere? Kan vi ikke bare la være å lage de på stedet de blir laget?

"nodes": [
{
"id": "TGFuZ3VhZ2U6MQ",
"name": "English "
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hva er greien med de lange white-spacene i stringene her?

@andreahn
Copy link
Copy Markdown
Collaborator

Har du prøvd å fjerne den eksplisitte joinen? Kanskje jOOQ kan ta hånd om det for oss

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

Labels

bug fix Solves a bug. Causes PATCH release bump

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants