diff --git a/Services/Tree/classes/class.ilMaterializedPathTree.php b/Services/Tree/classes/class.ilMaterializedPathTree.php index a0ee268187f6..e3c00f63fe0f 100644 --- a/Services/Tree/classes/class.ilMaterializedPathTree.php +++ b/Services/Tree/classes/class.ilMaterializedPathTree.php @@ -583,7 +583,7 @@ public function getSubtreeInfo(int $a_endnode_id): array */ public function validateParentRelations(): array { - $query = 'select child from ' . $this->getTree()->getTreeTable() . ' child where not exists ' . + $query = 'select ' . $this->getTree()->getTreePk() .', child from ' . $this->getTree()->getTreeTable() . ' child where not exists ' . '( ' . 'select child from ' . $this->getTree()->getTreeTable() . ' parent where child.parent = parent.child and ' . '(child.path BETWEEN parent.path AND CONCAT(parent.path,' . $this->db->quote('Z', 'text') . ') )' . ')' . diff --git a/Services/Tree/classes/class.ilNestedSetTree.php b/Services/Tree/classes/class.ilNestedSetTree.php index 5d40b8f1c966..c9b42161834c 100644 --- a/Services/Tree/classes/class.ilNestedSetTree.php +++ b/Services/Tree/classes/class.ilNestedSetTree.php @@ -955,7 +955,7 @@ public function getSubtreeInfo(int $a_endnode_id): array */ public function validateParentRelations(): array { - $query = 'select child from ' . $this->getTree()->getTreeTable() . ' child where not exists ' . + $query = 'select ' . $this->getTree()->getTreePk() .', child from ' . $this->getTree()->getTreeTable() . ' child where not exists ' . '( ' . 'select child from ' . $this->getTree()->getTreeTable() . ' parent where child.parent = parent.child and (parent.lft < child.lft) and (parent.rgt > child.rgt) ' . ')' .