Skip to content

Instantly share code, notes, and snippets.

@dineshsprabu
Created September 18, 2017 05:23
Show Gist options
  • Save dineshsprabu/0e912280f6160d388fdefe08246c4dcb to your computer and use it in GitHub Desktop.
Save dineshsprabu/0e912280f6160d388fdefe08246c4dcb to your computer and use it in GitHub Desktop.
[POSTGRES][SQL] Useful Postgres Commands

Useful Postgres Commands

Listing users

\du

Creating new user(ROLE)

CREATE ROLE dineshprabu WITH LOGIN PASSWORD 'xxxxyyyyy';

Assigning privileges to the user. Possible roles can be found on \du.

ALTER ROLE dineshprabu CREATEDB;

Checking current user

select current_user;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment