psql stops completion for the only matching schema name. - Mailing list pgsql-hackers

From Kyotaro HORIGUCHI
Subject psql stops completion for the only matching schema name.
Date
Msg-id 20160329.130020.231758399.horiguchi.kyotaro@lab.ntt.co.jp
Whole thread Raw
List pgsql-hackers
Hello, I found that COMPLETE_SCHEMA_QUERY doesn't complete
only-one-matching schema names.

=# alter foreign table <tab>
information_schema.  pg_temp_1.           pg_toast_temp_1.
pg_catalog.          pg_toast.            public.
=# alter foreign table i<tab>
<no complition>

or 

=# alter foreign table pu<tab>
<no complition>

This makes more perplexing behavior with addon query.

=# create schema alpha;
=# alter table <tab>
ALL IN TABLESPACE    pg_catalog.          pg_toast_temp_1.
alpha.               pg_temp_1.           public.
information_schema.  pg_toast.            
=# alter table a<tab>
=# alter table ALL IN TABLESPACE _

Where my alpha has gone?

_complete_from_query adds schema names only if more than one
shcmea names match the current input. The 'i' matches only one
schema name. The reason for the behavior seems not to add a
schema name when qualified names in the schema is added. So the
attached patch does exactly the thing to do. psql behaves as the
following with this patch.

=# create schema alpha;
=# create table alpha.a (a int);
=# create table alpha.b (a int);
=# alter table <tab>
ALL IN TABLESPACE    pg_catalog.          pg_toast_temp_1.
alpha.               pg_temp_1.           public.
information_schema.  pg_toast.            
=# alter table al<tab>
ALL IN TABLESPACE  alpha.a            alpha.b            
=# alter table alp<tab>
=# alter table alpha.
alpha.a  alpha.b  

This seems to me the intended behavior here.

Any comments?

regards,

-- 
Kyotaro Horiguchi
NTT Open Source Software Center

pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: raw output from copy
Next
From: Thomas Munro
Date:
Subject: Re: Proposal: "Causal reads" mode for load balancing reads without stale data