Re: Update "usename" in pg_user

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

 



On Tue, Nov 14, 2023 at 7:57 AM Ron <ronljohnsonjr@xxxxxxxxx> wrote:

A one-liner, that might have to be modified for double-quote handling:
psql -c "SELECT format('ALTER ROLE %s RENAME TO \"%s@xxxxxxxxxxx\";', username, username) FROM pg_user WHERE username != 'postgres'\gexec"

The two username uses can be shrunk to one with appropriate use of %s modifiers that I don't remember off the top of my head.


Yeah, it's positional.  I think (motivated individuals can check the docs) %1$s

It would be nice to have an hstore and/or json variant of format so one can use names instead of positions.

format('%greeting$s, my name is %name$s', jsonb_build_object('name', 'Dave', 'greeting', 'Yo!')))

David J.


[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