| From: | Japin Li <japinli(at)hotmail(dot)com> |
|---|---|
| To: | Mario González Troncoso <gonzalemario(at)gmail(dot)com> |
| Cc: | li carol <carol(dot)li2025(at)outlook(dot)com>, Bryan Green <dbryan(dot)green(at)gmail(dot)com>, Quan Zongliang <quanzongliang(at)yeah(dot)net>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: [PATCH] Add pg_get_role_ddl() functions for role recreation |
| Date: | 2026-01-08 01:40:37 |
| Message-ID: | MEAPR01MB303141267BDD23928A6FEEE8B685A@MEAPR01MB3031.ausprd01.prod.outlook.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Wed, 07 Jan 2026 at 16:28, Mario González Troncoso <gonzalemario(at)gmail(dot)com> wrote:
> On Tue, 6 Jan 2026 at 03:27, Japin Li <japinli(at)hotmail(dot)com> wrote:
>>
> [...]
>>
>> Thanks for updating the patch. Some comments on v4
>>
>> 1.
>>
>> + const char *separator = " ";
>> +
>> ...
>> + appendStringInfo(&buf, "%s%s", separator,
>> + roleform->rolcanlogin ? "LOGIN" : "NOLOGIN");
>> +
>>
>> The separator is never changed in pg_get_role_ddl_internal(), so we can remove
>> the variable and hard-code it in appendStringInfo().
>>
>
> Is that what you mean by "remove the variable and hard-code"?
>
> @@ -578,7 +578,6 @@ pg_get_role_ddl_internal(Oid roleid)
> - const char *separator = " ";
>
> tuple = SearchSysCache1(AUTHOID, ObjectIdGetDatum(roleid));
> if (!HeapTupleIsValid(tuple))
> @@ -605,34 +604,34 @@ pg_get_role_ddl_internal(Oid roleid)
> * you'd typically write them in a CREATE ROLE command, though any order
> * is actually acceptable to the parser.
> */
>
>
> - appendStringInfo(&buf, "%s%s", separator,
> - roleform->rolcanlogin ? "LOGIN" : "NOLOGIN");
> -
> - appendStringInfo(&buf, "%s%s", separator,
> + appendStringInfo(&buf, " %s",
>
> The lines above are a snippet of the latest commit `WIP: removing
> "separator"` on https://cirrus-ci.com/build/4621719253549056
> Would you be able to see the whole change over there? If that's what
> you mean, I'll squash afterwards and attach a new patch version to
> this thread.
>
Yeah, you read my mind.
--
Regards,
Japin Li
ChengDu WenWu Information Technology Co., Ltd.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Michael Paquier | 2026-01-08 01:41:42 | Re: Fix for consume_xids advancing XIDs incorrectly |
| Previous Message | Jacob Jackson | 2026-01-08 01:38:49 | Re: Proposal: Add a UNIQUE NOT ENFORCED constraint |