Re: tab completion for setting search_path

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ian Barwick <ian(at)2ndquadrant(dot)com>
Cc: Andres Freund <andres(at)2ndquadrant(dot)com>, Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: tab completion for setting search_path
Date: 2014-06-23 03:02:57
Message-ID: 707.1403492577@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Ian Barwick <ian(at)2ndquadrant(dot)com> writes:
> On 23/06/14 00:58, Andres Freund wrote:
>> I thought about committing this but couldn't get over this bit. If you
>> type "SELECT * FROM pg_cat<tab>" it'll get autocompleted to
>> pg_catalog.pg_ and "pg_temp<tab>" will list all the temp schemas
>> including the numeric and toast ones. So we have precedent for *not*
>> bothering about excluding any schemas. I don't think we should start
>> doing so in a piecemal fashion in an individual command's completion.

> There is an exception of sorts already for system schemas, in that although
> "SELECT * FROM p<tab>" will list the system schemas, it will not list any
> tables from them, and won't until "SELECT * FROM pg_<tab>" is entered
> (see note in tab-completion.c around line 3722).

> Personally I'd be mildly annoyed if every "SET search_path TO p<tab>" resulted
> in all the system schemas being displayed when all I want is "public"; how
> about having these listed only once "pg_" is entered, i.e.
> "SET search_path TO pg_<tab>"?

I think there is a pretty strong practical argument for excluding the
pg_temp and pg_toast schemas from completion for search_path, namely
that when does anyone ever need to include those in their search_path
explicitly?

The use-case for including pg_catalog in your path is perhaps a bit
greater, but not by much.

I'm not sure that what we do when auto-completing after FROM is an
entirely valid analogy, because the use-cases are different as a result
of the rules about schemas getting automatically included in your path.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Abhijit Menon-Sen 2014-06-23 04:02:17 Re: idle_in_transaction_timeout
Previous Message David G Johnston 2014-06-23 02:45:08 Re: idle_in_transaction_timeout