Update tvrage query for pgsql.