Re: Update "usename" in pg_user

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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






[Index of Archives]     [Postgresql Home]     [Postgresql General]     [Postgresql Performance]     [Postgresql PHP]     [Postgresql Jobs]     [PHP Users]     [PHP Databases]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Yosemite Forum]

  Powered by Linux