Satya c97e5d75b3 queryer: don't emit a parent type-bound for reified-relationship properties
A SINGLE reified-relationship property (e.g. invoice.counterparty,
person.primary_contact — a property whose type is a relationship
subtype) 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.

For such a property the resolved edge is a REVERSE traversal
(forward = false) over a generic relationship FK
(fk_relationship_source_entity, destination = entity). compile_
polymorphic_bounds then took the `!edge.forward` branch with
poly_col = destination_columns[1] = "type" and
table_to_alias = "entity", which resolves to the PARENT's entity alias
— emitting a bound like `entity_1.type = 'counterparty'` into the
parent WHERE. No parent row has that type, so EVERY parent was dropped
(e.g. get_invoice returned null for an existing invoice whose
counterparty edge was absent).

Array reified traversals (contacts, occupancies) never hit this: an
array property has no bound_type_name. Only the single form did, and it
was previously unexercised.

Fix: in compile_polymorphic_bounds, skip the bound when the property's
resolved type is itself a relationship (type_def.relationship) — there
is no parent-row discriminator column to bound.

Test: new queryer case (person.primary_contact, type=contact) asserts
the parent WHERE has no spurious entity.type bound while the subquery
keeps its discriminator + source_id correlation. Full suite green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-19 11:03:13 -04:00
2026-04-03 19:24:21 -04:00
2026-03-18 22:04:29 -04:00
2026-03-17 18:00:36 -04:00
2026-05-06 21:14:29 -04:00
2026-04-20 09:56:46 -04:00
2025-04-14 16:11:44 -04:00
2025-11-18 16:08:43 -05:00
2026-04-13 22:44:18 -04:00
2026-02-17 17:41:54 -05:00
2026-03-27 19:19:27 -04:00
2026-03-11 17:26:45 -04:00
2026-05-14 03:21:12 -04:00
2026-02-24 18:00:20 -05:00
2026-06-18 20:31:49 -04:00

JSPG - JSON Schema Validation for PostgreSQL

Description
No description provided
Readme 32 MiB
Languages
Rust 99.2%
Shell 0.8%