ALTER_USER(7pg13)
π ALTER USER π
ok so this is the ALTER USER(7) page from the PostgreSQL 13.23 Documentation, bestie β and it's giving "short and sweet but somehow still legendary." buckle up, it's literally a two-minute read π
πΈ NAME πΈ
ALTER_USER β change a database role β¨
π¦ SYNOPSIS π¦
ok so here's the whole shape of it, no cap:
ALTER USER role_specification [ WITH ] option [ ... ]
and option can be any of these icons π:
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'
then there's the rename era π«:
ALTER USER name RENAME TO new_name
and the config-parameter block, which comes in four flavors (very main character of it) π₯:
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_USER
| SESSION_USER
β¨ DESCRIPTION β¨
okay so here's the tea π: ALTER USER is now an alias for ALTER ROLE (ALTER_ROLE(7)).
that's it. that's the description. she's a rebrand, an icon, a whole alias. no notes π
π COMPATIBILITY π
the ALTER USER statement is a PostgreSQL extension π§ β meaning the SQL standard doesn't define it, it's very much our thing.
and the SQL standard's whole take on users? it literally just leaves the definition of users to the implementation. so likeβ¦ do whatever, i guess π periodt.
π«Ά SEE ALSO π«Ά
ALTER ROLE(ALTER_ROLE(7)) β the actual one, the source material, the blueprint π
β¨ and that's the whole page, bestie β¨
this iconic little doc comes to you courtesy of PostgreSQL 13.23, dated 2025 β ALTER USER(7), signing off ππ
π¦ where this page comes from
- opensuse-leap 16.0: postgresql13 13.23-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql13 13.23-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql13 13.23-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql13 13.23-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