ALTER_USER(7)
π ALTER USER(7) π
okay bestie, pull up a chair β this is the ALTER USER page from the PostgreSQL 18.6 Documentation, and it is genuinely one of the shortest glow-ups in the whole manual, so you're gonna eat this up π
β¨ NAME β¨
ALTER USER β change a database role π
πΈ SYNOPSIS πΈ
ALTER USER role_specification [ WITH ] option [ ... ]
and like, option can be literally any of these, no cap:
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'
and there's more, because of course there is π«Ά
ALTER USER name RENAME TO new_name
ALTER USER { role_specification | ALL } [ IN DATABASE database_name ] SET configuration_parameter { TO | = } { value | DEFAULT }
ALTER USER { role_specification | ALL } [ IN DATABASE database_name ] SET configuration_parameter FROM CURRENT
ALTER USER { role_specification | ALL } [ IN DATABASE database_name ] RESET configuration_parameter
ALTER USER { role_specification | ALL } [ IN DATABASE database_name ] RESET ALL
and role_specification? she's flexible like that β¨
role_name
| CURRENT_ROLE
| CURRENT_USER
| SESSION_USER
π¦ DESCRIPTION π¦
the tea is: ALTER USER is now an alias for ALTER ROLE. that's it. that's the whole paragraph. she's not doing her own thing anymore, she's just answering to a second name now and honestly? iconic behavior π
π COMPATIBILITY π
so the ALTER USER statement is a PostgreSQL extension β meaning the SQL standard didn't come up with this one, postgres did π§ the standard just kinda shrugs and leaves the whole definition of users up to the implementation. so do whatever, bestie, it's your sandbox π
π SEE ALSO π
ALTER ROLE(ALTER_ROLE(7)) β her twin, her origin story, the main character she's aliasing for π«
fr fr though β if you only remember one thing, remember the DESCRIPTION section, because that's the entire plot of this page π
that's a wrap, my love π«Ά this was PostgreSQL 18.6, dated 2026, and yes she ate, no crumbs left πΈβ¨π
π¦ where this page comes from
- alpine 3.23: postgresql18-doc 18.6-r0 Β· PostgreSQL
- alpine 3.24: postgresql18-doc 18.6-r0 Β· PostgreSQL
- arch rolling: postgresql 18.6-4 Β· PostgreSQL
- fedora 43: postgresql 18.6-1.fc43 Β· PostgreSQL
- fedora 43: postgresql 18.6-1.fc43 Β· PostgreSQL
- fedora 44: postgresql 18.6-1.fc44 Β· PostgreSQL
- fedora 44: postgresql 18.6-1.fc44 Β· PostgreSQL
- nixos 26.05: postgresql 18.6
- ubuntu resolute: postgresql-client-18 18.6-0ubuntu0.26.04.1 Β· PostgreSQL
- ubuntu stonking: postgresql-client-18 18.6-3build2 Β· PostgreSQL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms