postgresql update switch case