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
invalid reference to FROM-clause entry for table "parent"
select
"Parent"."id" as "Parent_id",
"Parent__Parent_child"."id" as "Parent__Parent_child_id",
"Parent__Parent_child"."parent_id" as "Parent__Parent_child_parent_id",
"Parent__Parent_child"."sub_child_name" as "Parent__Parent_child_sub_child_name"
from
"parent" "Parent"
left join "child" "Parent__Parent_child" on
"Parent__Parent_child"."parent_id" = Parent.parentId
where
("Parent"."id" = $1)
Problematic part is Parent.parentId in "Parent__Parent_child"."parent_id" = Parent.parentId
Replacing it with "Parent"."id" returns valid result
Hi, seems like third entity is required to reproduce this, I have updated original comment with SubChild entity and generated migrations. If this is still not enough I will provide requested files. I am using PostgreSQL 15.5
Issue description
OneToOne relation creates invalid query
Expected Behavior
Returning Parent with Child
Actual Behavior
Typeorm creates invalid query that throws error:
Problematic part is
Parent.parentId
in"Parent__Parent_child"."parent_id" = Parent.parentId
Replacing it with
"Parent"."id"
returns valid resultSteps to reproduce
This produces migration
My Environment
Additional Context
PostgreSQL 15.5
Relevant Database Driver(s)
Are you willing to resolve this issue by submitting a Pull Request?
No, I don’t have the time and I’m okay to wait for the community / maintainers to resolve this issue.
The text was updated successfully, but these errors were encountered: