Re: Extend ALTER DEFAULT PRIVILEGES for large objects

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-10 04:23:47
Message-ID: 610c7506-3cd2-41c6-8346-581d120cf841@oss.nttdata.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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.

Thanks for updating the patch!

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");
+ }

> 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?

Regards,

--
Fujii Masao
NTT DATA Japan Corporation

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dilip Kumar 2025-07-10 04:25:37 Re: CHECKPOINT unlogged data
Previous Message Dilip Kumar 2025-07-10 04:13:20 Re: A recent message added to pg_upgade