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

From: Daniel Gustafsson <daniel(at)yesql(dot)se>
To: Anthonin Bonnefoy <anthonin(dot)bonnefoy(at)datadoghq(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Converting tab-complete.c's else-if chain to a switch
Date: 2024-10-10 07:30:41
Message-ID: 901EFF66-B387-4E69-BC63-C6A0512C2AF1@yesql.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On 10 Oct 2024, at 09:22, Anthonin Bonnefoy <anthonin(dot)bonnefoy(at)datadoghq(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Gustafsson 2024-10-10 07:43:27 Re: Allow default \watch interval in psql to be configured
Previous Message Daniel Gustafsson 2024-10-10 07:26:15 Re: Doc: typo in config.sgml