RE: Psql meta-command conninfo+

Поиск
Список
Период
Сортировка
От Maiquel Grassi
Тема RE: Psql meta-command conninfo+
Дата
Msg-id CP8P284MB2496BA609AD64698B5550A58EC4B2@CP8P284MB2496.BRAP284.PROD.OUTLOOK.COM
обсуждение исходный текст
Ответ на Re: Psql meta-command conninfo+  (Jim Jones <jim.jones@uni-muenster.de>)
Ответы Re: Psql meta-command conninfo+  (Nathan Bossart <nathandbossart@gmail.com>)
Список pgsql-hackers

On 08.02.24 21:37, Erik Wienhold wrote:
>> Modifiers such as + or S in \dS are not covered by autocompletion.
>> src/bin/psql/tab-complete.c only specifies backslash commands in their
>> basic form (without modifiers).
>>
>> (\dS<TAB> actually autocompletes to \ds to my surprise)
>>
>Aha... I never noticed it. Well, with most commands having 1 - 3
>characters it is not a surprised I never used it :)
>That "\dS<TAB>" autocompletes to "\ds " surprises me even more.
>Thanks for pointing out!

--//--

Good evening, dear all!

Here is the mechanism that implements this:

https://github.com/postgres/postgres/blob/b619852086ed2b5df76631f5678f60d3bebd3745/src/bin/psql/tab-complete.h

.
.
.
1673       /* Match the last N words before point, case-sensitively. */

1674 #define TailMatchesCS(...) \
1675       TailMatchesImpl(true, previous_words_count, previous_words, \

1676                               VA_ARGS_NARGS(__VA_ARGS__), __VA_ARGS__)
.
.
.
4824       else if (TailMatchesCS("\\ds*"))
4825             COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
.
.
.

There is a rather large list of meta-commands that are handled by TailMatchesCS(...).

For example:
\ENCODING<TAB> autocompletes to \encoding
\eNcOdInG<TAB> autocompletes to \encoding
\dU<TAB> or \DU<TAB> autocompletes to \du

Including the command under discussion:
\CONNINFO<TAB> autocompletes to \conninfo


For the meta-commands[+], there is no autocomplete.

Regards,
Maiquel Grassi.

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

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: Make COPY format extendable: Extract COPY TO format implementations
Следующее
От: Jeevan Chalke
Дата:
Сообщение: Re: recently added jsonpath method change jsonb_path_query, jsonb_path_query_first immutability