Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistency between documentation and actual ash_postgres_subquery type #459

Open
lusergit opened this issue Jan 13, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@lusergit
Copy link

When talking about manual relationships in the HexDocs and in the behavior reference manual the return type of ash_postgres_subquery is said to be of the type {:ok, Ecto.Query.t()} | {:error, error}, when in reality when used in the library its implicit type is just Ecto.Query.t()

ash_postgres/lib/data_layer.ex

Lines 1032 to 1058 in 8e59757

base_query =
cond do
Map.get(relationship, :manual) ->
{module, opts} = relationship.manual
module.ash_postgres_subquery(
opts,
0,
0,
base_query
)
Map.get(relationship, :no_attributes?) ->
base_query
true ->
from(destination in base_query,
where:
field(destination, ^destination_attribute) ==
field(parent_as(^0), ^source_attribute)
)
end
subquery =
base_query
|> set_subquery_prefix(source_query, relationship.destination)
|> subquery()

@lusergit lusergit added bug Something isn't working needs review labels Jan 13, 2025
@zachdaniel
Copy link
Contributor

Ah, right you are. Would you like to Pr a correction?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Development

No branches or pull requests

2 participants