Re: Reset Postgresql users password

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Gurjeet Singh <gurjeet(at)singh(dot)im>
Cc: Mateusz Henicz <mateuszhenicz(at)gmail(dot)com>, Gianni Ceccarelli <dakkar(at)thenautilus(dot)net>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Reset Postgresql users password
Date: 2023-07-12 20:35:42
Message-ID: CAKFQuwbc_zyc2Q6o95kn--z9TNJzSbHUU0YvEX4AkgMLDygVRA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Jul 12, 2023 at 1:17 PM Gurjeet Singh <gurjeet(at)singh(dot)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.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Lorusso Domenico 2023-07-12 20:45:40 Re: How to add function schema in search_path in option definitio
Previous Message Johnathan Tiamoh 2023-07-12 20:25:11 Re: Reset Postgresql users password