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
?
2
Answers
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."
The
REVOKE
is pointless, because the default permissions on a new schema only allow the owner (the user that ranCREATE SCHEMA
) to use it. See the documentation:I can only assume that the
REVOKE
is a safety measure, in case the user who runsCREATE SCHEMA
has changed the default privileges as follows: