pgsql: Fix tab completion of "SET variable TO|=" to not offer bogus com

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix tab completion of "SET variable TO|=" to not offer bogus com
Date: 2019-07-02 18:05:02
Message-ID: E1hiN9K-0003UG-SZ@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix tab completion of "SET variable TO|=" to not offer bogus completions.

Don't think that the context "UPDATE tab SET var =" is a GUC-setting
command.

If we have "SET var =" but the "var" is not a known GUC variable,
don't offer any completions. The most likely explanation is that
we've misparsed the context and it's not really a GUC-setting command.

Per gripe from Ken Tanzer. Back-patch to 9.6. The issue exists
further back, but before 9.6 the code looks very different and it
doesn't actually know whether the "var" name matches anything,
so I desisted from trying to fix it.

Discussion: https://postgr.es/m/CAD3a31XpXzrZA9TT3BqLSHghdTK+=cXjNCE+oL2Zn4+oWoc=qA@mail.gmail.com

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/4f3648de2a0bcd6eae89cb5cb0d177a672c9e239

Modified Files
--------------
src/bin/psql/tab-complete.c | 39 ++++++++++++++++++++++++++-------------
1 file changed, 26 insertions(+), 13 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2019-07-02 22:39:08 pgsql: Remove redundant newlines from error messages
Previous Message Tom Lane 2019-07-02 16:32:57 pgsql: Simplify psql \d's rule for ordering the indexes of a table.