Disable DELETE on table in PostgreSQL?

后端 未结 1 1798
北恋
北恋 2020-12-29 05:23

For a security sensitive design, I\'d like to disable DELETEs on certain tables.

The DELETE should merely set a deleted flag o

相关标签:
1条回答
  • 2020-12-29 06:02

    As I understand a rule would generate additional queries - so a rule could not suppress the original query.

    Not really - it could be an INSTEAD rule:

     CREATE RULE shoe_del_protect AS ON DELETE TO shoe DO INSTEAD NOTHING;
    

    (an example on that same page of the manual).

    Another way is to REVOKE delete privileges on the table in question and to create stored procedure(s) for deleting... and updating and inserting also probably.

    0 讨论(0)
提交回复
热议问题