port fix into pgsql