| From: | Chris Travers <chris(dot)travers(at)gmail(dot)com> |
|---|---|
| To: | Ron <ronljohnsonjr(at)gmail(dot)com> |
| Cc: | pgsql-general(at)lists(dot)postgresql(dot)org |
| Subject: | Re: Reset Postgresql users password |
| Date: | 2023-07-17 07:52:16 |
| Message-ID: | CAKt_Zft9gjbQB003MgMSHR3-JXei2ccvMB+BRuK6KUXUhPLR+Q@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
You can use a DO block or write a function do to this.
It takes some practice (and you need to use EXECUTE FORMAT())
If users need to be able to change their own users, something like this
works:
CREATE FUNCTION change_my_password(in_password, text)
returns void language plpgsql as
$$
begin
EXECUTE FORMAT($F$ALTER USER $I WITH PASSWORD %L$F$, session_user,
in_password);
end;
$$ SECURITY DEFINER;
On Mon, Jul 17, 2023 at 9:28 AM Ron <ronljohnsonjr(at)gmail(dot)com> wrote:
> On 7/12/23 14:28, Johnathan Tiamoh wrote:
> > Hello,
> >
> > I wish to find out if there is a way to reset all users in Postgresql
> > password to the same password at once.
>
> To the same value??
>
> --
> Born in Arizona, moved to Babylonia.
>
>
>
--
Best Wishes,
Chris Travers
Efficito: Hosted Accounting and ERP. Robust and Flexible. No vendor
lock-in.
http://www.efficito.com/learn_more
| From | Date | Subject | |
|---|---|---|---|
| Next Message | basti | 2023-07-17 09:13:23 | Query take a long time and use no index |
| Previous Message | Bogdan Siara | 2023-07-17 05:40:19 | Postgrsql blocked for more than 120 s |