Created
November 5, 2021 02:22
-
-
Save GeoffWilliams/64ad6e3d58aa8c39dc34070ea3209428 to your computer and use it in GitHub Desktop.
plpgsql create/alter user
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
DO | |
$$BEGIN | |
IF EXISTS (SELECT FROM pg_roles WHERE rolname = 'my_user') THEN | |
EXECUTE 'ALTER USER...'; | |
ELSE | |
EXECUTE 'CREATE USER...'; | |
END IF; | |
END$$; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment