Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitff0bcb2

Browse files
committed
psql: Fix tab-completion after GRANT/REVOKE on LARGE OBJECT and FOREIGN SERVER.
Previously, when pressing Tab after GRANT or REVOKE ... ON LARGE OBJECTor ON FOREIGN SERVER, TO or FROM was incorrectly suggested by psql'stab-completion. This was not appropriate, as those clauses are not validat that point.This commit fixes the issue by preventing TO and FROM from being offeredimmediately after those specific GRANT/REVOKE statements.Author: Yugo Nagata <nagata@sraoss.co.jp>Reviewed-by: Fujii Masao <masao.fujii@gmail.com>Discussion:https://postgr.es/m/20250408122857.b2b06dde4e6a08290af02336@sraoss.co.jp
1 parent006fc97 commitff0bcb2

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

‎src/bin/psql/tab-complete.in.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4619,10 +4619,14 @@ match_previous_words(int pattern_id,
46194619
elseif (Matches("ALTER","DEFAULT","PRIVILEGES",MatchAnyN,"TO",MatchAny))
46204620
COMPLETE_WITH("WITH GRANT OPTION");
46214621
/* Complete "GRANT/REVOKE ... ON * *" with TO/FROM */
4622-
elseif (Matches("GRANT",MatchAnyN,"ON",MatchAny,MatchAny))
4623-
COMPLETE_WITH("TO");
4624-
elseif (Matches("REVOKE",MatchAnyN,"ON",MatchAny,MatchAny))
4625-
COMPLETE_WITH("FROM");
4622+
elseif (Matches("GRANT|REVOKE",MatchAnyN,"ON",MatchAny,MatchAny)&&
4623+
!TailMatches("FOREIGN","SERVER")&& !TailMatches("LARGE","OBJECT"))
4624+
{
4625+
if (Matches("GRANT",MatchAnyN,"ON",MatchAny,MatchAny))
4626+
COMPLETE_WITH("TO");
4627+
else
4628+
COMPLETE_WITH("FROM");
4629+
}
46264630

46274631
/* Complete "GRANT/REVOKE * ON ALL * IN SCHEMA *" with TO/FROM */
46284632
elseif (TailMatches("GRANT|REVOKE",MatchAny,"ON","ALL",MatchAny,"IN","SCHEMA",MatchAny)||

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp