psql stops completion for the only matching schema name.

From: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>
To: pgsql-hackers(at)postgresql(dot)org
Subject: psql stops completion for the only matching schema name.
Date: 2016-03-29 04:00:20
Message-ID: 20160329.130020.231758399.horiguchi.kyotaro@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Attachment Content-Type Size
0001-Fix-the-condition-to-decide-whether-to-add-schema-na.patch text/x-patch 4.7 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2016-03-29 04:11:29 Re: Proposal: "Causal reads" mode for load balancing reads without stale data
Previous Message Pavel Stehule 2016-03-29 03:56:10 Re: raw output from copy