Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ubcZN-0038LU-6d for pgsql-hackers@arkaria.postgresql.org; Tue, 15 Jul 2025 10:07:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1ubcZL-000pRQ-3W for pgsql-hackers@arkaria.postgresql.org; Tue, 15 Jul 2025 10:07:27 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ubcZK-000pRI-QB for pgsql-hackers@lists.postgresql.org; Tue, 15 Jul 2025 10:07:27 +0000 Received: from oss.nttdata.com ([49.212.34.109]) by magus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1ubcZI-007r92-0l for pgsql-hackers@postgresql.org; Tue, 15 Jul 2025 10:07:27 +0000 Received: from [192.168.11.3] (p1696134-ipoe.ipoe.ocn.ne.jp [118.0.93.133]) by oss.nttdata.com (Postfix) with ESMTPSA id 69EB9606AA; Tue, 15 Jul 2025 19:07:17 +0900 (JST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at oss.nttdata.com Message-ID: <4e7a71b5-1c7e-48bf-909a-aee5a413fa97@oss.nttdata.com> Date: Tue, 15 Jul 2025 19:07:16 +0900 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Extend ALTER DEFAULT PRIVILEGES for large objects To: Yugo Nagata Cc: Laurenz Albe , Nathan Bossart , Tom Lane , pgsql-hackers@postgresql.org References: <20240424115242.236b499b2bed5b7a27f7a418@sraoss.co.jp> <20240424210839.GA863220@nathanxps13> <20240426175406.13e47ea3904de814afbfe496@sraoss.co.jp> <20240913161801.b1e60534d77fa9df447b775f@sraoss.co.jp> <9c0c4d7881d2450baf70edb0ae95415a81ac8cb1.camel@cybertec.at> <20250123192220.9bad2b9aec110bf335521276@sraoss.co.jp> <20250403230418.f41b23d155f6c6cb3cebcd92@sraoss.co.jp> <20250408122857.b2b06dde4e6a08290af02336@sraoss.co.jp> <20250611114937.b067c542192f8e5e740a2a4a@sraoss.co.jp> <20250611135737.bb7d3135141248819704ebca@sraoss.co.jp> <20250710103041.f93be994017e4ab61b9b9c35@sraoss.co.jp> <610c7506-3cd2-41c6-8346-581d120cf841@oss.nttdata.com> <20250710141129.94cb58f465e706fa37c1b9d2@sraoss.co.jp> Content-Language: en-US From: Fujii Masao In-Reply-To: <20250710141129.94cb58f465e706fa37c1b9d2@sraoss.co.jp> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2025/07/10 14:11, Yugo Nagata wrote: > On Thu, 10 Jul 2025 13:23:47 +0900 > Fujii Masao 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