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

Поиск
Список
Период
Сортировка
От David Zhang
Тема Re: [PATCH] psql: Add tab-complete for optional view parameters
Дата
Msg-id ed54075e-506b-7860-ebce-1bfccc265780@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  (Dean Rasheed <dean.a.rasheed@gmail.com>)
Список pgsql-hackers
>> [..]
>>
>> 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" .
> I don't see how it would effect matching in any way - or am I
> overlooking something here?

It won't affect the SQL matching. What I was trying to say is that using 
'CREATE OR REPLACE ...' after 'CREATE ...' can enhance code structure, 
making it more readable. For instance,

/* Complete CREATE [ OR REPLACE ] VIEW <name> WITH ( ... ) with "AS" */
else if (TailMatches("CREATE", "VIEW", MatchAny, "WITH", "(*)") ||
                  TailMatches("CREATE", "OR", "REPLACE", "VIEW", 
MatchAny, "WITH", "(*)"))
         COMPLETE_WITH("AS");

"CREATE", "OR", "REPLACE", "VIEW", MatchAny, "WITH", "(*)" follows 
"CREATE", "VIEW", MatchAny, "WITH", "(*)") immediately.

best regards,

David




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

Предыдущее
От: Andy Fan
Дата:
Сообщение: Re: Extract numeric filed in JSONB more effectively
Следующее
От: Jeff Davis
Дата:
Сообщение: Re: CREATE FUNCTION ... SEARCH { DEFAULT | SYSTEM | SESSION }