Re: weird - invalid string enlargement request size

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: weird - invalid string enlargement request size
Дата
Msg-id 4622.1196921738@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: weird - invalid string enlargement request size  ("Walter Cruz" <walter.php@gmail.com>)
Список pgsql-hackers
"Walter Cruz" <walter.php@gmail.com> writes:
> My initdb was:
> initdb -E LATIN1 --locale=pt_BR
> By that initdb, the $LANG of the system was pt_BR.UTF-8 .
> A simple query that shows the problem:
> select true AS "�aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"

OK, I was able to reproduce this here:

postgres=# select true AS "�aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
;
ERROR:  invalid string enlargement request size 1073741823

What is happening is that vsnprintf() is failing because it doesn't like
its input data.  elog.c's EVALUATE_MESSAGE macro thinks that the only
possible reason for failure is that the output buffer isn't large
enough, so it enlarges and tries again, leading soon to the palloc error
displayed above.

Possibly we should put some effort into producing a more useful error
message here, but I'm reluctant to fool with it, because our historical
experience is that vsnprintf's behavior just isn't very consistent
across platforms.

In any case, the bottom-line reason why you're having a problem is that
the database encoding (LATIN1) is inconsistent with the encoding
specified by the server's locale (UTF-8), thus allowing vsnprintf to see
what it thinks is bad data.

PG 8.3 contains defenses to prevent that sort of inconsistency, and
I think that's probably all we need to do about this.
        regards, tom lane


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

Предыдущее
От: Joe Conway
Дата:
Сообщение: Re: [DOCS] Uniform policy for author credits in contrib module documentation?
Следующее
От: "Joshua D. Drake"
Дата:
Сообщение: Re: Uniform policy for author credits in contrib module documentation?