I would like to use a default value for a column that should be used if no rows is returned. Is that possible in PostgreSQL? How can I do it? Or is there any other way I can solve this?
E.g. something like this:
SELECT MAX(post_id) AS max_id DEFAULT 0 FROM my_table WHERE org_id = 3
And if there is no rows with org_id = 3
in the table I want to return 0
.