On Tue, 2023-11-14 at 13:20 +0000, Bernd Lentes wrote:
> >
> > ALTER USER <username> RENAME TO <new_username> is what you want
>
> thanks. Can I do this for all users in one turn ?
You can use the psql client and run
SELECT format('ALTER ROLE %I rename to %I',
usename,
usename || 'helmholtz-munich.de')
FROM pg_user
WHERE usename <> 'postgres' \gexec
\gexec will automatically execute each result line as an SQL statement.
Yours,
Laurenz Albe