Postgresql, Restrict update on specific columns (Read Only)

前端 未结 2 787
野趣味
野趣味 2021-01-07 19:23

Is it possible to have postresql restrict/prevent an update on a specific record if the update includes changes to specific columns?

How would this be implemented. A

2条回答
  •  被撕碎了的回忆
    2021-01-07 20:01

    The easiest way is to create BEFORE UPDATE trigger that will compare OLD and NEW row and RAISE EXCEPTION if the change to the row is forbidden.

提交回复
热议问题