diff --git a/src/main/resources/sql/functions/comment/find_comments_by_target.sql b/src/main/resources/sql/functions/comment/find_comments_by_target.sql index 5204157..3c0b5ed 100644 --- a/src/main/resources/sql/functions/comment/find_comments_by_target.sql +++ b/src/main/resources/sql/functions/comment/find_comments_by_target.sql @@ -12,7 +12,7 @@ begin from ( select com.*, - (select count(*) from "comment" c2 where c2.parents_ids @> array[com.id]) as children_count, + (select count(c2) from "comment" c2 where c2.parent_comment_id = com.id) as children_count, find_reference_by_id(com.target_id, com.target_reference) as target, find_citizen_by_id(com.created_by_id) as created_by, count_vote(com.id) as votes