From 9765d58277275ab9d8fb46ea94c06abe2f5eb56a Mon Sep 17 00:00:00 2001 From: Zach Daniel Date: Wed, 27 May 2020 23:56:46 -0400 Subject: [PATCH] fix: use destination fields for joins --- lib/ash_postgres.ex | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/ash_postgres.ex b/lib/ash_postgres.ex index 1b5b5c6..287dd31 100644 --- a/lib/ash_postgres.ex +++ b/lib/ash_postgres.ex @@ -309,7 +309,9 @@ defmodule AshPostgres do new_query = from(row in query, join: destination in ^relationship_destination, - on: field(row, ^relationship.source_field) == field(row, ^relationship.destination_field) + on: + field(row, ^relationship.source_field) == + field(destination, ^relationship.destination_field) ) new_query @@ -355,7 +357,9 @@ defmodule AshPostgres do new_query = from(row in query, left_join: destination in ^relationship_destination, - on: field(row, ^relationship.source_field) == field(row, ^relationship.destination_field) + on: + field(row, ^relationship.source_field) == + field(destination, ^relationship.destination_field) ) new_query