Fix handling for PostgreSQL and Oracle