Postgres compatibility fixes