psql tab completion & USERSET vars

Started by Neil Conwayalmost 22 years ago3 messages
#1Neil Conway
neilc@samurai.com

While reviewing Andrew Dunstan's patch that implements the
log_disconnections GUC var, I noticed that tab-complete.c in psql
claims that only "USERSET and possibly SUSET" GUC variables should be
included in the list of variables that can be auto-completed.

That policy is clearly not followed: fsync, max_connections, port,
shared_buffers, ssl, wal_sync_method, and various other non-USERSET or
SUSET variables are presently included in the completion list.

The two obvious ways to fix this are to add the remaining variables to
the completion list and remove the USERSET/SUSET policy, or to remove
the variables that violate this policy. I think the former is a better
idea, for two reasons:

(1) tab-completing GUC variables that one cannot set is still
useful for SHOW

(2) enforcing semantic validity is something psql is clearly not
in a position to do in the general case, so it strikes me as
rather pointless to try

Any comments?

-Neil

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Neil Conway (#1)
Re: psql tab completion & USERSET vars

Neil Conway <neilc@samurai.com> writes:

While reviewing Andrew Dunstan's patch that implements the
log_disconnections GUC var, I noticed that tab-complete.c in psql
claims that only "USERSET and possibly SUSET" GUC variables should be
included in the list of variables that can be auto-completed.

I think I was the one who put in that suggestion (which I agree has been
largely ignored subsequently). The motivation was to avoid cluttering
the tab completion facility with seldom-used parameters. As an example,
the presence of the "stats_xxx" parameters in the tab list means more
keystrokes are needed to type "statement_timeout". Seems like this is a
bad tradeoff considering that people would rarely bother to look at the
stats settings.

I'm not by any means wedded to the "USERSET and possibly SUSET" policy,
but I would like to stop somewhere short of "include everything". Any
thoughts?

regards, tom lane

#3Neil Conway
neilc@samurai.com
In reply to: Tom Lane (#2)
Re: psql tab completion & USERSET vars

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

I'm not by any means wedded to the "USERSET and possibly SUSET"
policy, but I would like to stop somewhere short of "include
everything". Any thoughts?

Perhaps we could have two sets of variables: all the GUC vars (that
can be displayed via SHOW), and a subset of those that can be set by
the user. We could use the first set for tab-completion on SHOW and
the second for tab completion on SET.

-Neil