Fixes for PostgreSQL