I have a problem where my customers are complaining that records get deleted even though I see all id's are correct in that table, just to make sure everything is like it should be, is there a way to disable delete statement for one certain table in postgres?

2 Answers 2

REVOKE DELETE ON someTable FROM roleOfCustomers;

One possible way could be using RULES.

For example:

CREATE RULE someTable_do_not_delete AS ON DELETE TO someTable DO INSTEAD NOTHING;

Note. When using ON DELETE DO INSTEAD NOTHING the code which is executing DELETE will not get notified that nothing happened ,as per the client side the DELETE will be successful.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.