From c5ac112c911a22b0975de8f09998ce2af2781f9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Couturier?= Date: Sat, 20 Jul 2024 13:03:27 +0200 Subject: [PATCH] https://github.com/StephaneCouturier/Katalog/issues/541 --- src/device.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/device.cpp b/src/device.cpp index 36b2d064..57b76e40 100644 --- a/src/device.cpp +++ b/src/device.cpp @@ -121,11 +121,11 @@ void Device::loadSubDeviceList() WITH RECURSIVE hierarchy AS ( SELECT device_id FROM device - WHERE device_id = :device_id + WHERE device_id = :device_id AND EXISTS (SELECT 1 FROM device WHERE device_id = :device_parent_id) UNION ALL SELECT t.device_id FROM device t - JOIN hierarchy h ON t.device_parent_id = h.device_id + JOIN hierarchy h ON t.device_parent_id = h.device_id AND t.device_id != h.device_id ) SELECT device_id FROM hierarchy )