On 29.03.2016 10:59, Pavel Stehule wrote:
Hi
2016-03-29 8:43 GMT+02:00 Kyotaro HORIGUCHI
<horiguchi.kyot...@lab.ntt.co.jp <mailto:horiguchi.kyot...@lab.ntt.co.jp>>:
Thank you Pavel, David.
Thank you for pointing syntaxes to be addressed. Most of the are
addressed in the attached patch.
At Tue, 22 Mar 2016 12:57:27 -0400, David Steele
<da...@pgmasters.net <mailto:da...@pgmasters.net>> wrote in
<56f17977.8040...@pgmasters.net <mailto:56f17977.8040...@pgmasters.net>>
> Hi Kyotaro,
>
> On 3/18/16 3:22 AM, Pavel Stehule wrote:
>
> > I am looking this patch. It looks well, but this feature doesn't
> > respect upper or lower chars. It enforce upper chars. This is not
> > consistent with any other autocomplete.
As mentioned before, upper-lower problem is an existing
issue. The case of the words in a query result list cannot be
edited since it may contain words that should not be changed,
such as relation names. So we can address it only before issueing
a query but I haven't found simple way to do it.
This is unpleasant. I am sorry. I had very uncomfortable feeling from
this behave. I am thinking so it should be solvable - you have to
convert only keyword IF EXISTS or IF NOT EXISTS. Maybe there are not
trivial solution, but this should be fixed.
Hello,
Can we do something like in the patch? This patch should be applied
after the patch
"0001-Suggest-IF-NOT-EXISTS-for-tab-completion-of-psql_v3.patch".
--
Artur Zakirov
Postgres Professional: http://www.postgrespro.com
Russian Postgres Company
diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index 73c5601..ed4ff09 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -153,6 +153,7 @@ do { \
do { \
completion_squery = &(query); \
completion_charp = addon; \
+ completion_case_sensitive = false; \
matches = completion_matches(text, complete_from_schema_query); \
} while (0)
@@ -3754,7 +3755,17 @@ _complete_from_query(int is_schema_query, const char *text, int state)
while (list_index < PQntuples(result) &&
(item = PQgetvalue(result, list_index++, 0)))
if (pg_strncasecmp(text, item, byte_length) == 0)
- return pg_strdup(item);
+ {
+ if (completion_case_sensitive)
+ return pg_strdup(item);
+ else
+
+ /*
+ * If case insensitive matching was requested initially,
+ * adjust the case according to setting.
+ */
+ return pg_strdup_keyword_case(item, text);
+ }
}
/* If nothing matches, free the db structure and return null */
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers