psql completion for ids in multibyte string

From: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>
To: pgsql-hackers(at)postgresql(dot)org
Subject: psql completion for ids in multibyte string
Date: 2015-11-05 09:10:31
Message-ID: 20151105.181031.216373331.horiguchi.kyotaro@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello. I don't know whether this is a bug fix or improvement,
anyway show you a patch for psql completion.

psql completes identifiers in many places but donesn't for
multibyte identifiers.

=> ALTER TABLE "[tab]
"いろは" "with space"

=> ALTER TABLE "い[tab]
<none>

Currently psql counts the length of the string to complete in
bytes but it is desirable to count in client encoding. The
attached patch does so and the uncompleted completion would
be completed.

=> ALTER TABLE "い[tab]
=> ALTER TABLE "いろは" _

During the investigation into this issue, I found a mistake in
the comment for PQmblen. It give the byte length of the character
at the point, not word. The attached patche also fixes it.

> /*
> * returns the byte length of the word beginning s, using the
> * specified encoding.
> */
> int
> PQmblen(const char *s, int encoding)

What do you think about this?

regards,

--
Kyotaro Horiguchi
NTT Open Source Software Center

Attachment Content-Type Size
0001-Fix-identifier-completion-of-multibyte-characters.patch text/x-patch 2.0 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2015-11-05 09:23:24 Re: OS X El Capitan and DYLD_LIBRARY_PATH
Previous Message Kyotaro HORIGUCHI 2015-11-05 09:03:29 Re: Freeze avoidance of very large table.