Whereas How to drop a table based on IF condition in postgres? solves the problem of conditionally dropping a table, it doesn't work for dropping a database because:
ERROR: DROP DATABASE cannot be executed from a function
I want to drop a database but only if it is has no user tables.
How can I execute any kind of IF
if I can't do it from function?