use pg_strncasecmp to replace strncmp when compare "pg_"
Hi
When try to improve the tab compleation feature in [1]/messages/by-id/OS0PR01MB61131A4347D385F02F60E123FB469@OS0PR01MB6113.jpnprd01.prod.outlook.com, I found an existing problem and a typo.
The patch was attached, please kindly to take a look at it. Thanks.
[1]: /messages/by-id/OS0PR01MB61131A4347D385F02F60E123FB469@OS0PR01MB6113.jpnprd01.prod.outlook.com
/messages/by-id/OS0PR01MB61131A4347D385F02F60E123FB469@OS0PR01MB6113.jpnprd01.prod.outlook.com
Regards,
Tang
Attachments:
0001-use-pg_strncasecmp-to-replace-strncmp-when-compare-p.patchapplication/octet-stream; name=0001-use-pg_strncasecmp-to-replace-strncmp-when-compare-p.patchDownload
From a1a0d96927b24eff0c01b1a01be9e45c816b2838 Mon Sep 17 00:00:00 2001
From: tanghy <tanghy.fnst@cn.fujitsu.com>
Date: Thu, 22 Apr 2021 21:32:04 +0900
Subject: [PATCH] use pg_strncasecmp to replace strncmp when compare "pg_"
diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index c3bd75e797..a6ff9b8683 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -1033,7 +1033,7 @@ static const VersionedQuery Query_for_list_of_subscriptions[] = {
};
/*
- * This is a list of all "things" in Pgsql, which can show up after CREATE or
+ * This is a list of all "things" in pgsql, which can show up after CREATE or
* DROP; and there is also a query to get a list of them.
*/
@@ -4502,7 +4502,7 @@ _complete_from_query(const char *simple_query,
*/
if (strcmp(schema_query->catname,
"pg_catalog.pg_class c") == 0 &&
- strncmp(text, "pg_", 3) != 0)
+ pg_strncasecmp(text, "pg_", 3) != 0)
{
appendPQExpBufferStr(&query_buffer,
" AND c.relnamespace <> (SELECT oid FROM"
--
2.30.0.windows.2
At Thu, 22 Apr 2021 12:44:28 +0000, "tanghy.fnst@fujitsu.com" <tanghy.fnst@fujitsu.com> wrote in
Hi
When try to improve the tab compleation feature in [1], I found an existing problem and a typo.
The patch was attached, please kindly to take a look at it. Thanks.[1]
htdrop indetps://www.postgresql.org/message-id/OS0PR01MB61131A4347D385F02F60E123FB469%40OS0PR01MB6113.jpnprd01.prod.outlook.com
That doesn't matter at all for now since we match schema identifiers
case-sensitively. Maybe it should be a part of the patch in [1].
regards.
--
Kyotaro Horiguchi
NTT Open Source Software Center
Kyotaro Horiguchi <horikyota.ntt@gmail.com> writes:
At Thu, 22 Apr 2021 12:44:28 +0000, "tanghy.fnst@fujitsu.com" <tanghy.fnst@fujitsu.com> wrote in
When try to improve the tab compleation feature in [1], I found an existing problem and a typo.
The patch was attached, please kindly to take a look at it. Thanks.
That doesn't matter at all for now since we match schema identifiers
case-sensitively. Maybe it should be a part of the patch in [1].
Yeah --- maybe this'd make sense as part of a full patch to improve
tab-complete.c's handling of case folding, but I'm suspicious that
applying it on its own would just make things less consistent.
regards, tom lane
On Friday, April 23, 2021 2:06 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote
Kyotaro Horiguchi <horikyota.ntt@gmail.com> writes:
That doesn't matter at all for now since we match schema identifiers
case-sensitively. Maybe it should be a part of the patch in [1].Yeah --- maybe this'd make sense as part of a full patch to improve
tab-complete.c's handling of case folding, but I'm suspicious that
applying it on its own would just make things less consistent.
Thanks for your reply. Merged this patch to [1]/messages/by-id/OS0PR01MB6113CA04E06D5BF221BC4FE2FB429@OS0PR01MB6113.jpnprd01.prod.outlook.com. Any further comment on [1]/messages/by-id/OS0PR01MB6113CA04E06D5BF221BC4FE2FB429@OS0PR01MB6113.jpnprd01.prod.outlook.com is very welcome.
[1]: /messages/by-id/OS0PR01MB6113CA04E06D5BF221BC4FE2FB429@OS0PR01MB6113.jpnprd01.prod.outlook.com
Regards,
Tang