Re: Converting tab-complete.c's else-if chain to a switch
Daniel Gustafsson <daniel@yesql.se>
From: Daniel Gustafsson <daniel@yesql.se>
To: Anthonin Bonnefoy <anthonin.bonnefoy@datadoghq.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>,
Thomas Munro <thomas.munro@gmail.com>,
Andres Freund <andres@anarazel.de>,
pgsql-hackers@lists.postgresql.org
Date: 2024-10-10T07:30:41Z
Lists: pgsql-hackers
> On 10 Oct 2024, at 09:22, Anthonin Bonnefoy <anthonin.bonnefoy@datadoghq.com> wrote: > psql tries to read the previous word when matches are NULL. However, > there's no previous word set here, leading to the segfault. > > I've attached a patch that checks if the previous word does exist > before trying to use it, along with an additional test for this > codepath. Nice, I was just typing up an email with the same fix when your landed in my inbox after having ended up with a segfaulting psql testing a patch. (I didn't include a test though so yours is better.) From reading the code I agree that we must check previous_words_count here so +1 on this patch. -- Daniel Gustafsson
Commits
-
Don't hard-code the input file name in gen_tabcomplete.pl's output.
- c75c6f8d280a 18.0 landed
-
Avoid possible segfault in psql's tab completion.
- 95eb4cd4ff06 18.0 landed
-
Convert tab-complete's long else-if chain to a switch statement.
- f391d9dc93a2 18.0 landed
-
Prepare tab-complete.c for preprocessing.
- bd1276a3c943 18.0 landed
-
Invent "MatchAnyN" option for tab-complete.c's Matches/MatchesCS.
- ef0938f7bdd0 18.0 landed