Skip to content

Commit 69e610b

Browse files
authored
fix: ash postgres subquery usage (#524)
1 parent 21347dc commit 69e610b

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

lib/data_layer.ex

+11-8
Original file line numberDiff line numberDiff line change
@@ -1041,12 +1041,16 @@ defmodule AshPostgres.DataLayer do
10411041
Map.get(relationship, :manual) ->
10421042
{module, opts} = relationship.manual
10431043

1044-
module.ash_postgres_subquery(
1045-
opts,
1046-
0,
1047-
0,
1048-
base_query
1049-
)
1044+
case module.ash_postgres_subquery(opts, 0, 0, base_query) do
1045+
{:ok, subquery} ->
1046+
subquery
1047+
1048+
{:error, error} ->
1049+
{:error, error}
1050+
1051+
subquery ->
1052+
subquery
1053+
end
10501054

10511055
Map.get(relationship, :no_attributes?) ->
10521056
base_query
@@ -1234,8 +1238,7 @@ defmodule AshPostgres.DataLayer do
12341238
subquery(
12351239
from(
12361240
destination in query,
1237-
join:
1238-
through in ^through_query,
1241+
join: through in ^through_query,
12391242
as: ^through_binding,
12401243
on:
12411244
field(through, ^destination_attribute_on_join_resource) ==

0 commit comments

Comments
 (0)