fix pgsql scripts