Revert "queryer: don't emit a parent type-bound for reified-relationship properties"
This reverts commit c97e5d75b3.
This commit is contained in:
@ -604,17 +604,6 @@ impl<'a> Compiler<'a> {
|
||||
if let Some(type_name) = bound_type_name {
|
||||
// Ensure this type actually exists
|
||||
if let Some(type_def) = self.db.types.get(&type_name) {
|
||||
// A reified-relationship property (e.g. invoice.counterparty, person.primary_contact)
|
||||
// is hydrated by a correlated subquery that joins the relationship table and correlates
|
||||
// source_id/target_id = parent.id; its discriminators (the relationship subtype and the
|
||||
// target's type CASE) are constrained INSIDE that subquery. There is no parent-row column
|
||||
// to bound here — emitting one wrongly constrains the PARENT entity's own `type` column
|
||||
// (e.g. `entity_1.type = 'counterparty'`), which no parent row satisfies, dropping every
|
||||
// parent. (Array reified traversals never reach this code: an array prop has no
|
||||
// bound_type_name.) So skip the bound entirely for relationship-typed properties.
|
||||
if type_def.relationship {
|
||||
continue;
|
||||
}
|
||||
if let Some(relation) = self.db.relations.get(&edge.constraint) {
|
||||
let mut poly_col = None;
|
||||
let mut table_to_alias = "";
|
||||
|
||||
Reference in New Issue
Block a user