You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I select all the cursor fields as a map so that the paginate function will have access to them, but in the end I'll only be interested in the Product, so I keep that around under the product key.
** (Ecto.QueryError) deps/paginator/lib/paginator/ecto/query/desc_nulls_first.ex:51: field `total_purchased` in `where` does not exist in schema Product in query:
from p0 in Product,
left_join: p1 in ProductAnalytics,
on: p1.product_id == p0.id,
where: (p0.total_purchased == ^0 and
((p0.updated_at == ^~N[2025-01-02 19:11:13] and p0.id < ^798) or
p0.updated_at < ^~N[2025-01-02 19:11:13])) or p0.total_purchased < ^0,
order_by: [desc: coalesce(p1.total_purchased, 0), desc: p0.updated_at, desc: p0.id],
limit: ^10,
select: %{
id: p0.id,
updated_at: p0.updated_at,
total_purchased: coalesce(p1.total_purchased, 0),
product: p0
}
(elixir 1.14.3) lib/enum.ex:2468: Enum."-reduce/3-lists^foldl/2-0-"/3
(elixir 1.14.3) lib/enum.ex:1780: Enum."-map_reduce/3-lists^mapfoldl/2-0-"/3
(elixir 1.14.3) lib/enum.ex:1780: Enum."-map_reduce/3-lists^mapfoldl/2-0-"/3
(elixir 1.14.3) lib/enum.ex:2468: Enum."-reduce/3-lists^foldl/2-0-"/3
(ecto 3.9.4) lib/ecto/repo/queryable.ex:211: Ecto.Repo.Queryable.execute/4
(ecto 3.9.4) lib/ecto/repo/queryable.ex:19: Ecto.Repo.Queryable.all/3
(paginator 1.2.0) lib/paginator.ex:179: Paginator.paginate/4
iex:28: (file)
we can see that in the where clause Paginator is assuming that the cursor_fields are all coming from p0, but it needs to be selecting from p1.
is there a way to do this that I'm not aware of? what would it take to add this functionality? it seems like if cursor_fields allowed for specifying the join it was operating on, that could work?
The text was updated successfully, but these errors were encountered:
hi :)
I am trying to
paginate
over a query which contains a join.I
select
all the cursor fields as amap
so that thepaginate
function will have access to them, but in the end I'll only be interested in theProduct
, so I keep that around under theproduct
key.the
paginate
call:which works:
but if I try to get the next page:
it fails
we can see that in the
where
clausePaginator
is assuming that thecursor_fields
are all coming fromp0
, but it needs to be selecting fromp1
.is there a way to do this that I'm not aware of? what would it take to add this functionality? it seems like if
cursor_fields
allowed for specifying thejoin
it was operating on, that could work?The text was updated successfully, but these errors were encountered: