Re: Reset Postgresql users password

2023-07-17 Thread Chris Travers
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

Re: Reset Postgresql users password

2023-07-17 Thread Wen Yi
I think maybe you can check the pg_hba.conf, change the method to the 'trust'. (Allow the connection unconditionally. This method allows anyone that can connect to the PostgreSQL database server to login as any PostgreSQL user they wish, without the need for a password or any other

Re: Reset Postgresql users password

2023-07-16 Thread Ron
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.

Re: Reset Postgresql users password

2023-07-12 Thread David G. Johnston
On Wed, Jul 12, 2023 at 1:17 PM Gurjeet Singh 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

Re: Reset Postgresql users password

2023-07-12 Thread Johnathan Tiamoh
Thank you all very much. I really appreciate !! On Wed, Jul 12, 2023 at 4:17 PM Gurjeet Singh wrote: > On Wed, Jul 12, 2023 at 12:42 PM Mateusz Henicz > wrote: > > > > You can also just write an sql and execute it, like: > > > > select 'alter user '|| usename ||' with password

Re: Reset Postgresql users password

2023-07-12 Thread Gurjeet Singh
On Wed, Jul 12, 2023 at 12:42 PM Mateusz Henicz wrote: > > You can also just write an sql and execute it, like: > > select 'alter user '|| usename ||' with password ''newpassword'';' from > pg_user; > \gexec Note that the above assumes you're using psql. For tools other than psql, you'd have

Re: Reset Postgresql users password

2023-07-12 Thread Mateusz Henicz
You can also just write an sql and execute it, like: select 'alter user '|| usename ||' with password ''newpassword'';' from pg_user; \gexec Cheers, Mateusz śr., 12 lip 2023 o 21:35 Gianni Ceccarelli napisał(a): > On 2023-07-12 Johnathan Tiamoh wrote: > > I wish to find out if there is a

Re: Reset Postgresql users password

2023-07-12 Thread Gianni Ceccarelli
On 2023-07-12 Johnathan Tiamoh wrote: > I wish to find out if there is a way to reset all users in Postgresql > password to the same password at once. I guess you could update the `pg_catalog.pg_authid` table, see https://www.postgresql.org/docs/15/catalog-pg-authid.html -- Dakkar -

Reset Postgresql users password

2023-07-12 Thread Johnathan Tiamoh
Hello, I wish to find out if there is a way to reset all users in Postgresql password to the same password at once. Thank you Tiamoh J