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
E
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 authentication
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.
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
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 ''newpassword'';
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 t
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 way
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 -
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