ALTER_USER(7pg18)

πŸ“¦ version 18.6, in opensuse-leap 16.0

πŸ’– 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