psql completion for ids in multibyte string - Mailing list pgsql-hackers

From Kyotaro HORIGUCHI
Subject psql completion for ids in multibyte string
Date
Msg-id 20151105.181031.216373331.horiguchi.kyotaro@lab.ntt.co.jp
Whole thread Raw
Responses Re: psql completion for ids in multibyte string  (Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>)
List 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

pgsql-hackers by date:

Previous
From: Kyotaro HORIGUCHI
Date:
Subject: Re: Freeze avoidance of very large table.
Next
From: Andres Freund
Date:
Subject: Re: OS X El Capitan and DYLD_LIBRARY_PATH