public inbox for [email protected]  
help / color / mirror / Atom feed
From: Maiquel Grassi <[email protected]>
To: Jim Jones <[email protected]>
To: Erik Wienhold <[email protected]>
Cc: Pavel Luzanov <[email protected]>
Cc: Nathan Bossart <[email protected]>
Cc: [email protected] <[email protected]>
Subject: RE: Psql meta-command conninfo+
Date: Fri, 9 Feb 2024 02:00:11 +0000
Message-ID: <CP8P284MB2496BA609AD64698B5550A58EC4B2@CP8P284MB2496.BRAP284.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <[email protected]>
References: <CP8P284MB24965479BA59DF5C2CC01CA0EC462@CP8P284MB2496.BRAP284.PROD.OUTLOOK.COM>
	<20240206215022.GA3452@nathanxps13>
	<CP8P284MB2496A17A9852265A0F363A6AEC452@CP8P284MB2496.BRAP284.PROD.OUTLOOK.COM>
	<[email protected]>
	<CP8P284MB24961361A9C1D32C28A7EC0EEC452@CP8P284MB2496.BRAP284.PROD.OUTLOOK.COM>
	<[email protected]>
	<CP4P284MB24830F5BF17FFA7F3D733142EC452@CP4P284MB2483.BRAP284.PROD.OUTLOOK.COM>
	<[email protected]>
	<CP8P284MB2496D053FD15C80780B72F46EC442@CP8P284MB2496.BRAP284.PROD.OUTLOOK.COM>
	<[email protected]>
	<gdgfqn2kuxp6w635bzz35me45a5zsswdcmqciuylui5dxxgmmd@par2aijoq4jw>
	<[email protected]>

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-...

.
.
.
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.


view thread (43+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: RE: Psql meta-command conninfo+
  In-Reply-To: <CP8P284MB2496BA609AD64698B5550A58EC4B2@CP8P284MB2496.BRAP284.PROD.OUTLOOK.COM>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox