fix compatibility issue in PG 9.1/9.3 in Queries