Skip to content

Inconsistency between documentation and actual ash_postgres_subquery type #459

Closed
@lusergit

Description

@lusergit

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()

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Soon

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions