pg.ddx.io pgsql-hackers@postgresql.org mailing list archive
help / color / mirror / Atom feedFrom: Artur Zakirov <a.zakirov@postgrespro.ru>
To: Pavel Stehule <pavel.stehule@gmail.com>
To: Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>
Cc: David Steele <david@pgmasters.net>
Cc: Peter Eisentraut <peter_e@gmx.net>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Subject: Re: IF (NOT) EXISTS in psql-completion
Date: Tue, 29 Mar 2016 12:54:01 +0300
Message-ID: <56FA50B9.7000107@postgrespro.ru> (raw)
In-Reply-To: <CAFj8pRDEPgGyMz2aXgTL33PuD7X+xieaO++wa+V9nQPQiYDMGQ@mail.gmail.com>
References: <CAFj8pRDO97DxLHnj8FHSXVRMoaZWotWPK8b1O3izjgaODPZU1w@mail.gmail.com>
<CAFj8pRBCv3hkruPivtcOA3ijYN2-jWo6L8h=4t7nZCYt38KE4A@mail.gmail.com>
<56F17977.8040503@pgmasters.net>
<20160329.154307.130628969.horiguchi.kyotaro@lab.ntt.co.jp>
<CAFj8pRDEPgGyMz2aXgTL33PuD7X+xieaO++wa+V9nQPQiYDMGQ@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>
On 29.03.2016 10:59, Pavel Stehule wrote:
> Hi
>
> 2016-03-29 8:43 GMT+02:00 Kyotaro HORIGUCHI
> <horiguchi.kyotaro@lab.ntt.co.jp <mailto:horiguchi.kyotaro@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
> <david@pgmasters.net <mailto:david@pgmasters.net>> wrote in
> <56F17977.8040503@pgmasters.net <mailto:56F17977.8040503@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
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Attachments:
[text/x-patch] tab-complete.patch (1003B, ../56FA50B9.7000107@postgrespro.ru/2-tab-complete.patch)
download | inline diff:
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 */
view thread (90+ messages) latest in thread
Message-ID: <56FA50B9.7000107@postgrespro.ru>
Permalink: ../56FA50B9.7000107@postgrespro.ru/
Also on: postgresql.org/message-id/56FA50B9.7000107@postgrespro.ru
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: a.zakirov@postgrespro.ru, pavel.stehule@gmail.com, horiguchi.kyotaro@lab.ntt.co.jp, david@pgmasters.net, peter_e@gmx.net
Subject: Re: IF (NOT) EXISTS in psql-completion
In-Reply-To: <56FA50B9.7000107@postgrespro.ru>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox