Within a trigger function, how to get which fields are being updated

前端 未结 4 952
星月不相逢
星月不相逢 2020-12-09 01:47

Is this possible? I\'m interested in finding out which columns were specified in the UPDATE request regardless of the fact that the new value that is being sent

4条回答
  •  隐瞒了意图╮
    2020-12-09 02:26

    In plpgsql you could do something like this in your trigger function:

    IF NEW.column IS NULL THEN
      NEW.column = 'default value';
    END IF;
    

提交回复
热议问题