Invalid memory alloc request size for repeat()

Поиск
Список
Период
Сортировка
От Japin Li
Тема Invalid memory alloc request size for repeat()
Дата
Msg-id ME3P282MB16676ED32167189CB0462173B6D69@ME3P282MB1667.AUSP282.PROD.OUTLOOK.COM
обсуждение исходный текст
Ответы Re: Invalid memory alloc request size for repeat()  ("David G. Johnston" <david.g.johnston@gmail.com>)
Re: Invalid memory alloc request size for repeat()  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Hi,

Today, I try to use repeat() to generate 1GB text, and it occurs invalid memory
alloc request size [1].  It is a limit from palloc(), then I try to reduce it,
it still complains out of memory which comes from enlargeStringInfo() [2].  The
documentation about repect() [3] doesn't mentaion the limitation.

I want to known the max memory size that the repect() can use?  Should we
mentaion it in documentation?  Or should we  report an error in repeat() if the
size exceeds the limitation?

[1]
postgres=# select repeat('x', 1024 * 1024 * 1024);
ERROR:  invalid memory alloc request size 1073741828

[2]
postgres=# select repeat('x', 1024 * 1024 * 1024 - 5);
ERROR:  out of memory
DETAIL:  Cannot enlarge string buffer containing 6 bytes by 1073741819 more bytes.

[3] https://www.postgresql.org/docs/14/functions-string.html

--
Regrads,
Japin Li.
ChengDu WenWu Information Technology Co.,Ltd.



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Build-farm - intermittent error in 031_column_list.pl
Следующее
От: Zhihong Yu
Дата:
Сообщение: Re: adding status for COPY progress report