How can I use a default value in a Select query in PostgreSQL?
SELECT coalesce(MAX(post_id),0) AS max_id FROM my_table WHERE org_id = 3


or

SELECT case count(*) when 0 then 0 else MAX(post_id) end AS max_id
FROM my_table 
WHERE org_id = 3;


if you want max(post_id) to be null when there is 1 row but post_id is null

dbfiddle