Re: psql tabcomplete - minor bugfix - tabcomplete for SET ROLE TO xxx

From: Andres Freund <andres(at)anarazel(dot)de>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, Jeevan Chalke <jeevan(dot)chalke(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: psql tabcomplete - minor bugfix - tabcomplete for SET ROLE TO xxx
Date: 2015-09-07 19:44:57
Message-ID: 20150907194457.GE5084@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2015-09-02 22:58:21 +0200, Pavel Stehule wrote:
> > Won't that mean that enum variables don't complete to default anymore?

> no, it does
>
> #define Query_for_enum \
> " SELECT name FROM ( "\
> " SELECT unnest(enumvals) AS name "\
> " FROM pg_catalog.pg_settings "\
> " WHERE pg_catalog.lower(name)=pg_catalog.lower('%s') "\
> " UNION SELECT 'DEFAULT' ) ss "\
> ****************
> " WHERE pg_catalog.substring(name,1,%%d)='%%s'"

Ah.

I've added a quote_ident() around unnest() - otherwise the
auto-completions for default_transaction_isolation will mostly be wrong
due to spaces.

I also renamed get_vartype into get_guctype, changed the comment as I
found the reference to the pg type system confusing, and more
importantly made it not return a static buffer.

The spellings for boolean values were a relatively small subset of what
the backend accepts - it's now on,off,true,false,yes,no,1,0. I'm not
sure whether that's a good idea. Comments?

Andres

Attachment Content-Type Size
0001-psql-Generic-tab-completion-support-for-enum-and-boo.patch text/x-patch 6.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Stark 2015-09-07 20:14:54 Re: [patch] Proposal for \rotate in psql
Previous Message Teodor Sigaev 2015-09-07 19:32:04 Re: WIP: Access method extendability