A better approach
WITH RECURSIVE
comment_tree (comment_id, level, path) AS (
SELECT comment_id, 0, array[-score, comment_id]
FROM comment
WHERE thread_id = 2
AND parent_comment_id IS NULL
UNION
SELECT
c.comment_id, level + 1,
ct.path || -c.score || c.comment_id
FROM comment c, comment_tree ct
WHERE c.parent_comment_id = ct.comment_id
)
SELECT
c.comment_id, c.parent_comment_id AS parent, c.score,
lpad('', 4 * ct.level, ' ') || c.text AS text
FROM comment_tree ct
JOIN comment c USING (comment_id)
WHERE c.thread_id = 2
ORDER BY ct.path;