From: | Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com> |
---|---|
To: | Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp> |
Cc: | Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, Nathan Bossart <nathandbossart(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Extend ALTER DEFAULT PRIVILEGES for large objects |
Date: | 2025-07-15 10:07:16 |
Message-ID: | 4e7a71b5-1c7e-48bf-909a-aee5a413fa97@oss.nttdata.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 2025/07/10 14:11, Yugo Nagata wrote:
> On Thu, 10 Jul 2025 13:23:47 +0900
> Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com> wrote:
>
>>
>>
>> On 2025/07/10 10:30, Yugo Nagata wrote:
>>> You're right. I must have overlooked something. I think I saw "TO" being
>>> suggested after "FOREIGN SERVER" when no foreign servers were defined.
>>>
>>> The attached patch still prevents "TO/FROM" from being suggested after
>>> "FOREIGN SERVER" in such cases.
>
>>
>> Based on your patch, I'm thinking of simplifying the code like this:
>>
>> - else if (Matches("GRANT", MatchAnyN, "ON", MatchAny, MatchAny))
>> - COMPLETE_WITH("TO");
>> - else if (Matches("REVOKE", MatchAnyN, "ON", MatchAny, MatchAny))
>> - COMPLETE_WITH("FROM");
>> + else if (Matches("GRANT|REVOKE", MatchAnyN, "ON", MatchAny, MatchAny) &&
>> + !TailMatches("FOREIGN", "SERVER") && !TailMatches("LARGE", "OBJECT"))
>> + {
>> + if (Matches("GRANT", MatchAnyN, "ON", MatchAny, MatchAny))
>> + COMPLETE_WITH("TO");
>> + else
>> + COMPLETE_WITH("FROM");
>> + }
>
> Thank you for your review!
> I agree with your suggestion and have updated the patch accordingly.
I've pushed the patch. Thanks!
>>> But perhaps this corner case doesn't really
>>> need to be handled?
>>
>> Probably I failed to get your point here. Could you clarify what you meant?
>
> I'm sorry for not explaining it clearly.
>
> Currently, TO or FROM could be suggested immediately after FOREIGN SERVER, but
> only when no foreign servers are defined. When foreign servers do exist,
> their names are correctly suggested instead, as expected.
>
> The patch fixed the behavior so that TO or FROM are not suggested after FOREIGN SERVER,
> even when no foreign servers are defined. However, I've started to wonder if it's worth
> fixing such a corner case. What do you think?
I think it's worth doing. This issue can lead to unexpected behavior
and is something users might run into. If the fix were overly complex
for a minor issue, it might not be justified. But that's not the case here.
Regards,
--
Fujii Masao
NTT DATA Japan Corporation
From | Date | Subject | |
---|---|---|---|
Next Message | Japin Li | 2025-07-15 10:07:56 | Re: Requested WAL segment xxx has already been removed |
Previous Message | Jehan-Guillaume de Rorthais | 2025-07-15 10:04:12 | Re: Disable parallel query by default |