Re: tab completion for setting search_path

From: Bernd Helmle <mailings(at)oopsware(dot)de>
To: Andres Freund <andres(at)2ndquadrant(dot)com>, Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: tab completion for setting search_path
Date: 2014-05-05 13:49:34
Message-ID: 095C748792186DC819637750@apophis.credativ.lan
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

--On 3. Mai 2014 10:11:33 +0200 Andres Freund <andres(at)2ndquadrant(dot)com>
wrote:

>> diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
>> new file mode 100644
>> index 6d26ffc..dec3d4a
>> *** a/src/bin/psql/tab-complete.c
>> --- b/src/bin/psql/tab-complete.c
>> *************** psql_completion(const char *text, int st
>> *** 3230,3235 ****
>> --- 3230,3242 ----
>>
>> COMPLETE_WITH_LIST(my_list);
>> }
>> + else if (pg_strcasecmp(prev2_wd, "search_path") == 0)
>> + {
>> + COMPLETE_WITH_QUERY(Query_for_list_of_schemas
>> + " AND nspname not like 'pg\\_%%' "
>> + " AND nspname not like 'information_schema' "
>> + " UNION SELECT 'DEFAULT' ");
>> + }
>
> Why should we exclude system schemata? That seems more likely to be
> confusing than helpful? I can see a point in excluding another backend's
> temp tables, but otherwise?

I put my hands on this a while ago, too, but had a different notion in
mind, which schema the completion should select. I came up with the
following:

<http://git.postgresql.org/gitweb/?p=users/bernd/postgres.git;a=commitdiff;h=03fd00cd190e8b529efeec1a1bb038454fb0b05f>

Just complete to a schema someone has CREATE or USAGE privs. However, the
reason i stopped working on it was that i really want to have a completion
to a list of schemas as well and i couldn't figure a good and easy way to
do this atm.

--
Thanks

Bernd

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2014-05-05 13:52:33 Re: Cluster name in ps output
Previous Message Bruce Momjian 2014-05-05 13:48:39 Re: 9.4 release notes