CREATE_USER(7pg15)
π CREATE_USER (7) β the PostgreSQL 15.19 manual, bestie edition
okay so you're reading the CREATE USER page from the PostgreSQL 15.19 Documentation and honestly? it's a short one, we love a low-effort icon. let's get into it β¨
π NAME π
CREATE_USER β define a new database role π«Ά
β¨ SYNOPSIS β¨
CREATE USER name [ [ WITH ] option [ ... ] ]
where option can be:
SUPERUSER | NOSUPERUSER
| CREATEDB | NOCREATEDB
| CREATEROLE | NOCREATEROLE
| INHERIT | NOINHERIT
| LOGIN | NOLOGIN
| REPLICATION | NOREPLICATION
| BYPASSRLS | NOBYPASSRLS
| CONNECTION LIMIT connlimit
| [ ENCRYPTED ] PASSWORD 'password' | PASSWORD NULL
| VALID UNTIL 'timestamp'
| IN ROLE role_name [, ...]
| IN GROUP role_name [, ...]
| ROLE role_name [, ...]
| ADMIN role_name [, ...]
| USER role_name [, ...]
| SYSID uid
so you give it a name, then optionally say WITH (literally optional, the brackets said so πββοΈ) and then yeet in as many options as you want β¨
πΈ the option menu, itemized πΈ
SUPERUSER|NOSUPERUSERβ god mode on / god mode off πCREATEDB|NOCREATEDBβ may this role birth new databases or nahCREATEROLE|NOCREATEROLEβ can it make other roles? main character energy or spectatorINHERIT|NOINHERITβ inherit privileges or don't, your callLOGIN|NOLOGINβ can it actually log in (this one matters, keep reading π)REPLICATION|NOREPLICATIONβ replication powers, yes or noBYPASSRLS|NOBYPASSRLSβ bypass row-level security, yes or noCONNECTION LIMIT connlimitβ cap how many connections it gets,connlimitstyle[ ENCRYPTED ] PASSWORD 'password'|PASSWORD NULLβ set a password (theENCRYPTEDpart is optional), or straight upNULLit π«₯VALID UNTIL 'timestamp'β password expires at'timestamp', Cinderella rules πIN ROLE role_name [, ...]β drop it into these rolesIN GROUP role_name [, ...]β same vibe,GROUPspellingROLE role_name [, ...]β make it a member of these rolesADMIN role_name [, ...]β give itADMINon these rolesUSER role_name [, ...]β another role-listing form, list awaySYSID uidβ takes auid, that's the tea
π DESCRIPTION π
okay so here's the plot twist that makes this page so short: CREATE USER is now an alias for CREATE ROLE. that's it. that's the whole difference-adjacent situation.
the only difference β and this is the part you need to remember for the quiz π β is that when the command is spelled CREATE USER, LOGIN is assumed by default. meanwhile, NOLOGIN is assumed when the command is spelled CREATE ROLE.
so likeβ¦ same command, different default. it's giving twins with different personalities. periodt π
π COMPATIBILITY π
the CREATE USER statement is a PostgreSQL extension π¦ β it's not standard SQL, it's our thing.
the SQL standard leaves the definition of users to the implementation, which is honestly the standard saying "not my problem, figure it out" π
π₯ SEE ALSO π₯
CREATE ROLE(CREATE_ROLE(7)) β go read this one too, it's the whole personality this page is cloning β¨
and that's the page, bestie!! π this was PostgreSQL 15.19, dated 2026 β signed, sealed, and delivered from the CREATE USER(7) page itself. no cap, you're now an expert ππ«Ά
π¦ where this page comes from
- opensuse-leap 16.0: postgresql15 15.19-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql15 15.19-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql15 15.19-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql15 15.19-160000.1.1 Β· PostgreSQL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms