Re: psql tabcomplete - minor bugfix - tabcomplete for SET ROLE TO xxx - Mailing list pgsql-hackers

From Andres Freund
Subject Re: psql tabcomplete - minor bugfix - tabcomplete for SET ROLE TO xxx
Date
Msg-id 20150907194457.GE5084@alap3.anarazel.de
Whole thread Raw
In response to Re: psql tabcomplete - minor bugfix - tabcomplete for SET ROLE TO xxx  (Pavel Stehule <pavel.stehule@gmail.com>)
Responses Re: psql tabcomplete - minor bugfix - tabcomplete for SET ROLE TO xxx  (Pavel Stehule <pavel.stehule@gmail.com>)
List 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

pgsql-hackers by date:

Previous
From: Teodor Sigaev
Date:
Subject: Re: WIP: Access method extendability
Next
From: Greg Stark
Date:
Subject: Re: [patch] Proposal for \rotate in psql