ALTER_USER(7pg13)

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

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