Re: Reset Postgresql users password - Mailing list pgsql-general

From David G. Johnston
Subject Re: Reset Postgresql users password
Date
Msg-id CAKFQuwbc_zyc2Q6o95kn--z9TNJzSbHUU0YvEX4AkgMLDygVRA@mail.gmail.com
Whole thread Raw
In response to Re: Reset Postgresql users password  (Gurjeet Singh <gurjeet@singh.im>)
List pgsql-general
On Wed, Jul 12, 2023 at 1:17 PM Gurjeet Singh <gurjeet@singh.im> wrote:
        for rec in select
                    'alter user '|| quote_ident(usename)
                    ||' with password '|| quote_literal('newpassword')


Which is more clearly written using the format function:
...
for rec in select
        format('alter user %I with password %L', usename, 'newpassword')
    from pg_user
loop
...

David J.

pgsql-general by date:

Previous
From: Johnathan Tiamoh
Date:
Subject: Re: Reset Postgresql users password
Next
From: Lorusso Domenico
Date:
Subject: Re: How to add function schema in search_path in option definitio