Trying to get count of childs rows
You need to first retrieve the whole tree of comments using a recursive common table expression. Then you can count the number of children for each root node:

with recursive all_comments as (
   select id, parent_id, id as root_id
   from comment
   where parent_id is null
   union all
   select c.id, c.parent_id, p.root_id
   from comment c
     join all_comments p on c.parent_id = p.id
)
select root_id, count(*) as comment_count
from all_comments
group by root_id;


SQLFiddle: http://sqlfiddle.com/#!15/158ea/15

If you don't want to get the count per "thread" but for each node, you can use something like this:

with recursive all_comments as (
   select id, parent_id, id as root_id, 1 as level
   from comment
   where parent_id is null
   union all
   select c.id, c.parent_id, p.root_id, p.level + 1
   from comment c
     join all_comments p on c.parent_id = p.id
)
select ac.id, 
       ac.parent_id,
       ac.root_id,
       count(*) over (partition by ac.root_id) - count(*) over (partition by ac.root_id order by level) as child_count
from all_comments ac
order by ac.id;


SQLFiddle: http://sqlfiddle.com/#!15/158ea/17

The above is using window functions to calculate the total number or nodes for a root node and the number of nodes in each level:

count(*) over (partition by ac.root_id) counts the number of children (including the root) for each root node. 

count(*) over (partition by ac.root_id order by level) counts the number of nodes up to the current's node level. The difference between the total count and the ones "till now" is the number of child nodes. 



Btw: comment is a SQL keyword, you shouldn't use it as a table name.