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
Database and version (PostgreSQL 9.4, MongoDB 3.2, etc.): Postgres 12
Ecto version (mix deps): 3.5.1
Database adapter and version (mix deps): Ecto SQL 3.5
Operating system: Xubuntu 20.04
Current behavior
We are working on an app that uses multi-tenancy.
At some point, deep in our function call tree, we're trying to preload stuff. The weirdest thing happens:
This works: c |> Repo.preload(:agent)
This works: c |> Repo.preload(:notifier)
This does not work: c |> Repo.preload(:agent, :notifier) - Ecto tries to find the notifier association back in the public prefix...
But then this works: c |> Repo.preload([:agent:, :notifier], prefix: "whatever")
And also this works: c |> Repo.preload(:agent) |> Repo.preload(:notifier)
Expected behavior
Ecto should stay on the prefix for the structure passed on the first argument of preload.
Notes
Our Repo.default_options looks in process storage to find which prefix to work on. We are wondering whether Repo.preload is trying to either bypass default_options past one preload, or spawn other processes (which won't inherit storage from current process, and therefore won't have the prefix set when calling Repo.default_options). Which one is it? :)
Also something worth mentioning, when the bug occurs all bindings from my IEX shell are lost.
The text was updated successfully, but these errors were encountered:
Environment
Current behavior
We are working on an app that uses multi-tenancy.
At some point, deep in our function call tree, we're trying to preload stuff. The weirdest thing happens:
c |> Repo.preload(:agent)
c |> Repo.preload(:notifier)
c |> Repo.preload(:agent, :notifier)
- Ecto tries to find the notifier association back in the public prefix...c |> Repo.preload([:agent:, :notifier], prefix: "whatever")
c |> Repo.preload(:agent) |> Repo.preload(:notifier)
Expected behavior
Ecto should stay on the prefix for the structure passed on the first argument of
preload
.Notes
Our
Repo.default_options
looks in process storage to find which prefix to work on. We are wondering whetherRepo.preload
is trying to either bypassdefault_options
past one preload, or spawn other processes (which won't inherit storage from current process, and therefore won't have theprefix
set when callingRepo.default_options
). Which one is it? :)Also something worth mentioning, when the bug occurs all bindings from my IEX shell are lost.
The text was updated successfully, but these errors were encountered: