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 1uZTCP-0041Cj-8L for pgsql-hackers@arkaria.postgresql.org; Wed, 09 Jul 2025 11:42:53 +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 1uZTCN-00Fk65-7j for pgsql-hackers@arkaria.postgresql.org; Wed, 09 Jul 2025 11:42:51 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uZTCM-00Fk5u-UH for pgsql-hackers@lists.postgresql.org; Wed, 09 Jul 2025 11:42:51 +0000 Received: from oss.nttdata.com ([49.212.34.109]) by makus.postgresql.org with smtp (Exim 4.96) (envelope-from ) id 1uZTCK-006OEy-1R for pgsql-hackers@postgresql.org; Wed, 09 Jul 2025 11:42:50 +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 83D4A61C0B; Wed, 9 Jul 2025 20:42:43 +0900 (JST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at oss.nttdata.com Message-ID: Date: Wed, 9 Jul 2025 20:42:42 +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> <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> Content-Language: en-US From: Fujii Masao In-Reply-To: <20250611135737.bb7d3135141248819704ebca@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/06/11 13:57, Yugo Nagata wrote: > On Wed, 11 Jun 2025 13:33:07 +0900 > Fujii Masao wrote: > >> >> >> On 2025/06/11 11:49, Yugo Nagata wrote: >>> While looking at the thread [1], I've remembered this thread. >>> The patches in this thread are partially v18-related, but include >>> enhancement or fixes for existing feature, so should they be postponed >>> to v19, or should be separated properly to v18 part and other? >>> >>> [1] https://www.postgresql.org/message-id/70372bdd-4399-4d5b-ab4f-6d4487a4911a%40oss.nttdata.com >> >> I see these patches more as enhancements to psql tab-completion, >> rather than fixes for clear oversights in the original commit. >> >> For example, if tab-completion for ALTER DEFAULT PRIVILEGES had >> completely missed LARGE OBJECTS, that would be an obvious oversight. >> But these patches go beyond that kind of issue. >> >> That said, if others think it's appropriate to include them in v18 >> for consistency or completeness, I'm fine with that. >> >> Regarding the 0002 patch: >> >> - 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)) >> + { >> + if (TailMatches("FOREIGN", "SERVER")) >> + COMPLETE_WITH_QUERY(Query_for_list_of_servers); >> + else if (!TailMatches("LARGE", "OBJECT")) >> + { >> + if (Matches("GRANT", MatchAnyN, "ON", MatchAny, MatchAny)) >> + COMPLETE_WITH("TO"); >> + else >> + COMPLETE_WITH("FROM"); >> + } >> + } >> >> Wouldn't this change break the case where "GRANT ... ON TABLE ... " >> is supposed to complete with "TO"? > > Sorry, I made a stupid mistake. > >> + else if (Matches("GRANT/REVOKE", MatchAnyN, "ON", MatchAny, MatchAny)) > > This should be "GRANT|REVOKE". > > I've attached update patches. (There is no change on 0001.) Thanks for updating the patch! At first I've pushed the 0001 patch. As for the 0002 patch: + if (TailMatches("FOREIGN", "SERVER")) + COMPLETE_WITH_QUERY(Query_for_list_of_servers); This part seems not needed, since we already have the following tab-completion code: /* FOREIGN SERVER */ else if (TailMatches("FOREIGN", "SERVER")) COMPLETE_WITH_QUERY(Query_for_list_of_servers); Thought? Regards, -- Fujii Masao NTT DATA Japan Corporation