postgresql update from subquery