Re: COMMENT ON, psql and access methods - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: COMMENT ON, psql and access methods
Date
Msg-id 20160606223501.GA433569@alvherre.pgsql
Whole thread Raw
In response to Re: COMMENT ON, psql and access methods  (Michael Paquier <michael.paquier@gmail.com>)
Responses Re: COMMENT ON, psql and access methods  (Michael Paquier <michael.paquier@gmail.com>)
List pgsql-hackers
Michael Paquier wrote:
> On Thu, Jun 2, 2016 at 3:42 PM, Michael Paquier
> <michael.paquier@gmail.com> wrote:
> > On Thu, Jun 2, 2016 at 1:00 PM, Michael Paquier
> > <michael.paquier@gmail.com> wrote:
> >> I have added an open item for 9.6 regarding this patch, that would be
> >> good to complete this work in this release for consistency with the
> >> other objects.
> >
> > Doh. I forgot to update psql --help.
> 
> And Query_for_list_of_access_methods was defined more or less twice,
> the one of my patch having an error...

In looking at the DROP ACCESS METHOD completion I noticed that the
words_after_create gadget is a bit buggy: for things with more than one
word in the thing name (such as MATERIALIZED VIEW, USER MAPPING FOR,
EVENT TRIGGER among others) the "query/squery"-based completion isn't
triggered, because the loop at the end of psql_completion only considers
a single word (using strcmp against prev_wd), which obviously doesn't
match the multiple-word specifier in the struct.  Some things such as
EVENT TRIGGER and MATERIALIZED VIEW have specialized code that does the
actual work; the latter specifies a query in words_after_create, but
it's dead code.  As a probably separate but related bug, CREATE USER
MAPPING FOR stops working after you tab-complete the USER in it.
Lastly, there is an entry for CONFIGURATION which also doesn't work: if
you enter "DROP <tab>" it doesn't complete CONFIGURATION, but if you
enter "DROP CONFIGURATION <tab>" then it shows a list of text search
configurations, which is not a valid command.

To conclude, so far as I can tell, your patch (for DROP AM completion)
is fine, but the existing code has some minor flags which we could just
as well ignore for now, but could be improved in the future.

-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Problem with dumping bloom extension
Next
From: Korbin Hoffman
Date:
Subject: Re: hstore: add hstore_length function