Error and wrong lenghth of non-ASCII Unicode string in plpythonu

Поиск
Список
Период
Сортировка
От Volker Paul
Тема Error and wrong lenghth of non-ASCII Unicode string in plpythonu
Дата
Msg-id 569D27E5.90400@v-paul.de
обсуждение исходный текст
Ответы Re: Error and wrong lenghth of non-ASCII Unicode string in plpythonu
Список pgsql-bugs
Hi,

the following plpythonu function reveals wrong length calculation
and error on accessing single characters in a Unicode string.

Is the problem solved in more recent versions?

Or is there a possibility to work around the problem?


CREATE OR REPLACE FUNCTION test_plpython_unicode()
RETURNS TEXT AS $$
     s = u"abc"
     plpy.notice("s:%s len:%d; 2+:%s" % (s, len(s), s[2:]))
     # output: NOTICE:  s:abc len:3; 2+:c
     s = u"äbc"
     plpy.notice("len:%d; 2+:%s" % (len(s), s[2:]))
     # output:   NOTICE:  len:4; 2+:bc
     # expected: NOTICE:  len:3; 2+:c
     # Note that including s:%s as above leads to an error
     for c in u"abcÄÖÜ":
         plpy.notice(c)
     # output: (the first umlaut leads to error, even to error in error
reporting)
     #NOTICE:  a
     #NOTICE:  b
     #NOTICE:  c
     #ERROR:  plpy.Error: could not parse error message in plpy.elog
     # platform info:
     # psql (9.3.10, server 9.1.18)
     # Ubuntu 14.04.3 LTS
$$ LANGUAGE plpythonu;

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Dean Rasheed
Дата:
Сообщение: Re: BUG #13863: Select from views gives wrong results
Следующее
От: hukim99@gmail.com
Дата:
Сообщение: BUG #13874: The index of a json field which is created after data are inserted doesn't work.