From 97aab860ac91242d9c474120b1e581a101b45162 Mon Sep 17 00:00:00 2001 From: Tim Diekmann Date: Tue, 10 Dec 2024 11:45:43 +0100 Subject: [PATCH] Fix including data type children will not emit anything if no children exist --- .../src/store/postgres/ontology/entity_type.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/libs/@local/graph/postgres-store/src/store/postgres/ontology/entity_type.rs b/libs/@local/graph/postgres-store/src/store/postgres/ontology/entity_type.rs index 8067d91be01..8bb03f7783a 100644 --- a/libs/@local/graph/postgres-store/src/store/postgres/ontology/entity_type.rs +++ b/libs/@local/graph/postgres-store/src/store/postgres/ontology/entity_type.rs @@ -217,12 +217,14 @@ where let query = if include_data_type_children { " - SELECT DISTINCT ON (ontology_id) schema, closed_schema - FROM data_type_inherits_from - JOIN data_types - ON ontology_id = source_data_type_ontology_id - OR ontology_id = target_data_type_ontology_id - WHERE target_data_type_ontology_id = ANY($1); + SELECT schema, closed_schema + FROM data_types + WHERE ontology_id = ANY($1) + OR ontology_id IN ( + SELECT source_data_type_ontology_id + FROM data_type_inherits_from + WHERE target_data_type_ontology_id = ANY($1) + ); " } else { "