pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Prepare tab-complete.c for preprocessing.
Date: Mon, 07 Oct 2024 16:31:49 +0000
Message-ID: <E1sxqeD-002ZUI-4O@gemulon.postgresql.org> (raw)

Prepare tab-complete.c for preprocessing.

Separate out psql_completion's giant else-if chain of *Matches
tests into a new function.  Add the infrastructure needed for
table-driven checking of the initial match of each completion
rule.  As-is, however, the code continues to operate as it did.
The new behavior applies only if SWITCH_CONVERSION_APPLIED
is #defined, which it is not here.  (The preprocessor added
in the next patch will add a #define for that.)

The first and last couple of bits of psql_completion are not
based on HeadMatches/TailMatches/Matches tests, so they stay
where they are; they won't become part of the switch.

This patch also fixes up a couple of if-conditions that didn't meet
the conditions enumerated in the comment for match_previous_words().
Those restrictions exist to simplify the preprocessor.

Discussion: https://postgr.es/m/2208466.1720729502@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/bd1276a3c9433a9e2760db6ae6e73560d7d32a22

Modified Files
--------------
src/bin/psql/tab-complete.c      | 344 ++++++++++++++++++++++++++++++---------
src/tools/pgindent/typedefs.list |   1 +
2 files changed, 269 insertions(+), 76 deletions(-)



Message-ID: <E1sxqeD-002ZUI-4O@gemulon.postgresql.org>
Permalink:  ../E1sxqeD-002ZUI-4O@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1sxqeD-002ZUI-4O@gemulon.postgresql.org

 · 

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: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Prepare tab-complete.c for preprocessing.
  In-Reply-To: <E1sxqeD-002ZUI-4O@gemulon.postgresql.org>

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

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