Re: Converting tab-complete.c's else-if chain to a switch

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Anthonin Bonnefoy <anthonin.bonnefoy@datadoghq.com>
Cc: Thomas Munro <thomas.munro@gmail.com>, Andres Freund <andres@anarazel.de>, pgsql-hackers@lists.postgresql.org
Date: 2024-10-10T16:12:20Z
Lists: pgsql-hackers
Anthonin Bonnefoy <anthonin.bonnefoy@datadoghq.com> writes:
> bd1276a3c9 seems to have introduced a segfault when trying to complete
> a word that doesn't have any match. For example, 'postgres=# z\t' will
> yield the following backtrace:

Interesting --- it seems to depend on which readline version you're
using, because I see a crash with current MacPorts' libreadline
but not with RHEL8's.  Thanks for the report and patch!

			regards, tom lane



Commits

  1. Don't hard-code the input file name in gen_tabcomplete.pl's output.

  2. Avoid possible segfault in psql's tab completion.

  3. Convert tab-complete's long else-if chain to a switch statement.

  4. Prepare tab-complete.c for preprocessing.

  5. Invent "MatchAnyN" option for tab-complete.c's Matches/MatchesCS.