Skip to content

Bug: base-query with join generates improper sql #96

@chevinbrown

Description

@chevinbrown

I need to layer the turbo-ecto query with a base-query:

def list_paginated_reviews(params, user) do
    Review
    |> with_friends(user)
    |> preload(...)
    |> Turbo.Ecto.turbo(params)
end
  
def with_friends(review, user) do
  review
  |> join(:inner, [r], uf in UserFriend, on: uf.user_id == ^user.id)
  ...

Trying to filter by category-name:

from r0 in Review,
 join: u1 in UserFriend,
 on: u1.user_id == ^2,
 join: c2 in Category,
 on: c2.id == r0.category_id,
 where: u1.name == ^"Cool stuff",
 order_by: [desc: r0.inserted_at],
 ...

Am I doing something wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions