postgresql update table based on join