Re: [PATCH] psql: Add tab-complete for optional view parameters

Поиск
Список
Период
Сортировка
От David Zhang
Тема Re: [PATCH] psql: Add tab-complete for optional view parameters
Дата
Msg-id 0e527af2-6b4e-25f3-59d0-f1b581ee48be@highgo.ca
обсуждение исходный текст
Ответ на Re: [PATCH] psql: Add tab-complete for optional view parameters  (Christoph Heiss <christoph@c8h4.io>)
Ответы Re: [PATCH] psql: Add tab-complete for optional view parameters  (Christoph Heiss <christoph@c8h4.io>)
Список pgsql-hackers
Applied v3 patch to master and verified it with below commands,

#Alter view

postgres=# alter view v <tab>
ALTER COLUMN  OWNER TO      RENAME        RESET (       SET

postgres=# alter view v set <tab>
(       SCHEMA

postgres=# alter view v set ( <tab>
CHECK_OPTION      SECURITY_BARRIER  SECURITY_INVOKER

postgres=# alter view v reset ( <tab>
CHECK_OPTION      SECURITY_BARRIER  SECURITY_INVOKER

postgres=# alter view v set ( check_option = <tab>
CASCADED  LOCAL

postgres=# alter view v set ( security_barrier = <tab>
FALSE  TRUE

postgres=# alter view v set ( security_invoker = <tab>
FALSE  TRUE


#Create view

postgres=# create view v
AS      WITH (
postgres=# create or replace view v
AS      WITH (

postgres=# create view v with (
CHECK_OPTION      SECURITY_BARRIER  SECURITY_INVOKER

postgres=# create or replace view v with (
CHECK_OPTION      SECURITY_BARRIER  SECURITY_INVOKER

postgres=# create view v with (*)<tab>AS
postgres=# create or replace view v with (*)<tab>AS

postgres=# create view v as <tab>SELECT
postgres=# create or replace view v as <tab>SELECT


For below changes,

      else if (TailMatches("CREATE", "VIEW", MatchAny, "AS") ||
-             TailMatches("CREATE", "OR", "REPLACE", "VIEW", MatchAny, 
"AS"))
+             TailMatches("CREATE", "VIEW", MatchAny, "WITH", "(*)", 
"AS") ||
+             TailMatches("CREATE", "OR", "REPLACE", "VIEW", MatchAny, 
"AS") ||
+             TailMatches("CREATE", "OR", "REPLACE", "VIEW", MatchAny, 
"WITH", "(*)", "AS"))

it would be great to switch the order of the 3rd and the 4th line to 
make a better match for "CREATE" and "CREATE OR REPLACE" .


Since it supports <tab> in the middle for below case,
postgres=# alter view v set ( security_<tab>
security_barrier  security_invoker

and during view reset it can also provide all the options list,
postgres=# alter view v reset (
CHECK_OPTION      SECURITY_BARRIER  SECURITY_INVOKER

but not sure if it is a good idea or possible to autocomplete the reset 
options after seeing one of the options showing up with "," for example,
postgres=# alter view v reset ( CHECK_OPTION, <tab>
SECURITY_BARRIER  SECURITY_INVOKER


Thank you,

David




В списке pgsql-hackers по дате отправления:

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: AssertLog instead of Assert in some places
Следующее
От: Thomas Munro
Дата:
Сообщение: Re: walsender "wakeup storm" on PG16, likely because of bc971f4025c (Optimize walsender wake up logic using condition variables)