Re: [PATCH] Add pg_get_role_ddl() functions for role recreation

From: Quan Zongliang <quanzongliang(at)yeah(dot)net>
To: Bryan Green <dbryan(dot)green(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: [PATCH] Add pg_get_role_ddl() functions for role recreation
Date: 2025-11-07 03:36:33
Message-ID: e8241421-7adb-4b72-96bd-5bc68b3e70e4@yeah.net
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 11/7/25 12:20 AM, Bryan Green wrote:

>>
> The rebased patch is attached.
>
> Thanks,
>
Currently, we have the "CREATE USER" command. Should we consider
outputting users with the "LOGIN" attribute as "CREATE USER"?
Otherwise, it might look a little strange.

postgres=# CREATE USER testuser;
CREATE ROLE
postgres=# SELECT pg_get_role_ddl('testuser');
pg_get_role_ddl
---------------------------------------------------------------------------------------------------
CREATE ROLE testuser LOGIN NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT
NOREPLICATION NOBYPASSRLS;
(1 row)

The drawback of doing this is that the command "CREATE ROLE xxx LOGIN"
will be converted to "CREATE USER". But I still think this is better.

Regards,

--
Quan Zongliang

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Smith 2025-11-07 03:41:24 Re: Skipping schema changes in publication
Previous Message Michael Paquier 2025-11-07 03:32:21 Re: [Patch] Windows relation extension failure at 2GB and 4GB