Fix pgsql 9.1 issue