This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- first create a new user if not exists for your app | |
-- this user will have access only to DML queries (select, update, insert, delete) | |
DO | |
$do$ | |
BEGIN | |
IF NOT EXISTS ( | |
SELECT FROM pg_catalog.pg_roles | |
WHERE rolname = 'app_user') THEN | |
CREATE ROLE app_user LOGIN PASSWORD 'PASS'; | |
END IF; |
OlderNewer