pg_query fix