You are using integer division (more precisely
bigint) which yields not fractional values. You need to cast one value to numeric in order to get what you want:
select (select COUNT(*)
where can_piecesre_sucbattery = 'pr'
and gaf_start_date > '2019-11-13 01:01:01.754'
where gaf_start_date > '2019-11-13 01:01:01.754'
Additionally, please note that with the help of a
FILTER clause you can calculate the result without subqueries, since the same table is used in both subqueries, and one of the conditions is also the same. You just need to move the other condition to the
FILTER clause, like this:
SELECT COUNT(*) FILTER (WHERE can_piecesre_sucbattery = 'pr')::numeric
WHERE gaf_start_date > '2019-11-13 01:01:01.754';