Fix tests on PostgreSQL (and probably other DBs)