Changed SQL function call ifnull() to coalesce().

The SQL function ifnull() is not recognised by PostgreSQL and
causes an error when Enki is used with PostgreSQL as the backend
data store. Changing the call to coalesce() seems to work for
both MySQL and PostgreSQL.