Revert "queryer: don't emit a parent type-bound for reified-relationship properties"
This reverts commit c97e5d75b3.
This commit is contained in:
@ -430,19 +430,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"single.person": {
|
||||
"type": "person",
|
||||
"properties": {
|
||||
"primary_contact": {
|
||||
"type": "contact",
|
||||
"properties": {
|
||||
"target": {
|
||||
"type": "email_address"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"full.person": {
|
||||
"type": "person",
|
||||
"properties": {
|
||||
@ -2538,65 +2525,6 @@
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "Single reified-relationship property (person.primary_contact, type=contact): discriminator + source correlation live INSIDE the subquery; the parent WHERE must NOT get a spurious entity.type bound (regression: reverse reified edges previously emitted entity_1.type = 'contact', excluding every parent)",
|
||||
"action": "query",
|
||||
"schema_id": "single.person",
|
||||
"expect": {
|
||||
"success": true,
|
||||
"sql": [
|
||||
[
|
||||
"((SELECT jsonb_strip_nulls((",
|
||||
" SELECT jsonb_build_object(",
|
||||
" 'id', entity_1.id,",
|
||||
" 'type', entity_1.type,",
|
||||
" 'archived', entity_1.archived,",
|
||||
" 'created_at', entity_1.created_at,",
|
||||
" 'name', organization_2.name,",
|
||||
" 'first_name', person_3.first_name,",
|
||||
" 'last_name', person_3.last_name,",
|
||||
" 'age', person_3.age,",
|
||||
" 'primary_contact', (",
|
||||
" SELECT jsonb_build_object(",
|
||||
" 'id', entity_4.id,",
|
||||
" 'type', entity_4.type,",
|
||||
" 'archived', entity_4.archived,",
|
||||
" 'created_at', entity_4.created_at,",
|
||||
" 'is_primary', contact_6.is_primary,",
|
||||
" 'target', (",
|
||||
" SELECT jsonb_build_object(",
|
||||
" 'id', entity_7.id,",
|
||||
" 'type', entity_7.type,",
|
||||
" 'archived', entity_7.archived,",
|
||||
" 'created_at', entity_7.created_at,",
|
||||
" 'address', email_address_8.address",
|
||||
" )",
|
||||
" FROM agreego.entity entity_7",
|
||||
" JOIN agreego.email_address email_address_8 ON email_address_8.id = entity_7.id",
|
||||
" WHERE",
|
||||
" NOT entity_7.archived",
|
||||
" AND relationship_5.target_id = entity_7.id",
|
||||
" )",
|
||||
" )",
|
||||
" FROM agreego.entity entity_4",
|
||||
" JOIN agreego.relationship relationship_5 ON relationship_5.id = entity_4.id",
|
||||
" JOIN agreego.contact contact_6 ON contact_6.id = relationship_5.id",
|
||||
" WHERE",
|
||||
" NOT entity_4.archived",
|
||||
" AND relationship_5.target_type = 'email_address'",
|
||||
" AND relationship_5.source_id = entity_1.id",
|
||||
" )",
|
||||
" )",
|
||||
" FROM agreego.entity entity_1",
|
||||
" JOIN agreego.organization organization_2 ON organization_2.id = entity_1.id",
|
||||
" JOIN agreego.person person_3 ON person_3.id = organization_2.id",
|
||||
" WHERE",
|
||||
" NOT entity_1.archived",
|
||||
"))))"
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user