I try add audit trigger for table in BD. I find example on GitHub. But I dont understand why author use this construction after create schema and table
CREATE SCHEMA audit;
REVOKE ALL ON SCHEMA audit FROM public;
And for table:
REVOKE ALL ON audit.logged_actions FROM public;
What the aim of using REVOKE
?
CodePudding user response:
Revoke removes access permissions to an object.
it means only specific users that you will grant permission to them can access the audit scheme / logged_actions table.
"The key word PUBLIC refers to the implicitly defined group of all roles."
CodePudding user response:
As set out in the documentation postgresql grants certain privileges to public
when an object is created, most relevantly the CONNECT
privilege. It is therefore quite usual to revoke all such default privileges immediately following object creation.