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 1uZipC-0077vh-IC for pgsql-hackers@arkaria.postgresql.org; Thu, 10 Jul 2025 04:23:58 +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 1uZipA-007ms3-3n for pgsql-hackers@arkaria.postgresql.org; Thu, 10 Jul 2025 04:23:56 +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 1uZip9-007mrv-QO for pgsql-hackers@lists.postgresql.org; Thu, 10 Jul 2025 04:23:56 +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 1uZip7-006mMe-2t for pgsql-hackers@postgresql.org; Thu, 10 Jul 2025 04:23:56 +0000 Received: from [192.168.11.2] (p1696134-ipoe.ipoe.ocn.ne.jp [118.0.93.133]) by oss.nttdata.com (Postfix) with ESMTPSA id 96FA760A1A; Thu, 10 Jul 2025 13:23:48 +0900 (JST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at oss.nttdata.com Message-ID: <610c7506-3cd2-41c6-8346-581d120cf841@oss.nttdata.com> Date: Thu, 10 Jul 2025 13:23:47 +0900 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Extend ALTER DEFAULT PRIVILEGES for large objects Content-Language: en-US To: Yugo Nagata Cc: Laurenz Albe , Nathan Bossart , Tom Lane , pgsql-hackers@postgresql.org References: <20240424115242.236b499b2bed5b7a27f7a418@sraoss.co.jp> <3602391.1713930458@sss.pgh.pa.us> <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> From: Fujii Masao In-Reply-To: <20250710103041.f93be994017e4ab61b9b9c35@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 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