mirror of
https://github.com/postgres/postgres.git
synced 2026-10-23 13:29:09 +03:00
psql: Improve tab completion for GRANT/REVOKE CREATE
Complete GRANT CREATE, REVOKE CREATE, and REVOKE GRANT OPTION FOR CREATE with ON. Previously, the generic CREATE completion rule took precedence and suggested object types such as TABLE. Exclude these cases from the CREATE completion rule so that the existing GRANT/REVOKE rules can handle them. Author: Haruna Miwa <miwa@sraoss.co.jp> Reviewed-by: Sho Ito <i.sho.0628@gmail.com> Reviewed-by: Fujii Masao <masao.fujii@gmail.com> Discussion: https://postgr.es/m/OSOP286MB78539E88C47403451BFFF140F18A2@OSOP286MB7853.JPNP286.PROD.OUTLOOK.COM
This commit is contained in:
@@ -2185,8 +2185,14 @@ match_previous_words(int pattern_id,
|
||||
/* BEGIN GEN_TABCOMPLETE */
|
||||
|
||||
/* CREATE */
|
||||
/* complete with something you can create */
|
||||
else if (TailMatches("CREATE"))
|
||||
|
||||
/*
|
||||
* Complete with something you can create. If CREATE is a privilege name,
|
||||
* leave it to the GRANT/REVOKE rules below.
|
||||
*/
|
||||
else if (TailMatches("CREATE") &&
|
||||
!TailMatches("GRANT|REVOKE", "CREATE") &&
|
||||
!TailMatches("REVOKE", "GRANT", "OPTION", "FOR", "CREATE"))
|
||||
{
|
||||
/* only some object types can be created as part of CREATE SCHEMA */
|
||||
if (HeadMatches("CREATE", "SCHEMA"))
|
||||
|
||||
Reference in New Issue
Block a user