Skip to content

Instantly share code, notes, and snippets.

@rkaneko
Last active December 26, 2019 13:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rkaneko/32ec0a93cc00e29a4cb181fc3a689369 to your computer and use it in GitHub Desktop.
Save rkaneko/32ec0a93cc00e29a4cb181fc3a689369 to your computer and use it in GitHub Desktop.
psql grant, logs configurations
# display privileges
SELECT grantee, privilege_type FROM information_schema.role_table_grants WHERE table_name='some_table_name';

  grantee  | privilege_type
-----------+----------------
 root      | INSERT
 root      | SELECT
 root      | UPDATE
 root      | DELETE
 root      | TRUNCATE
 root      | REFERENCES
 root      | TRIGGER
 
 
# add privileges for (select, insert, update, delete) of all tables to a user
GRANT select, insert, update, delete on all tables in schema public to some_user_name;

GRANT USAGE, SELECT ON ALL SEQUENCES IN SCHEMA public TO some_user_name;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment