On Tue, Apr 16, 2013 at 5:40 AM, Colin 't Hart <co...@sharpheart.org> wrote: > Here's a new version of a small patch to psql I'm using locally. > > It adds a command \ns to psql which is a shortcut to set the > SEARCH_PATH variable. > > I've also added tab completion making this command much more useful. I > don't think tab completition would be possible if this command was > defined as a variable (which was another suggestion offered at the > time).
It's possible that the tab completion argument is a sufficient reason for including this, but I'm kinda skeptical. The amount of typing saved is pretty minimal, considering that set sea<tab> completes to set search_path. Assuming we had proper tab completion for set search_path = (and off-hand, it doesn't look like that does anything useful), this would be saving 5 keystrokes every time you want to change the search path (set sea<tab> is eight keystrokes, where \ns<space> is four... but it also saves you the semicolon at the end). I'm sure some people would find that worthwhile, but personally, I don't. Short commands are cryptic, and IMHO psql is already an impenetrable thicket of difficult-to-remember abbreviations. I've been using it for more than 10 years now and I still have to to run \? on a semi-regular basis. I think that if we start adding things like this, that help message is going to rapidly fill up with a whole lot more abbreviations for things that are quite a bit incrementally less useful than what's there right now. After all, if we're going to have \ns to set the search path, why not have something similar for work_mem, or random_page_cost? I set both of those variables more often than I set search_path; and there could easily be someone else out there whose favorite GUC is client_encoding or whatever. And, for that matter, why stop with GUCs? \ct for CREATE TABLE would save lots of typing, too.... -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers