Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb8d3dae

Browse files
committed
Improve error message for MaxAllocSize overrun in accumArrayResult.
Before, if you went past about 64M array elements in array_agg() andallied functions, you got a generic "invalid memory alloc requestsize" error. This patch replaces that with "array size exceeds themaximum allowed", which seems more user-friendly since it points youto needing to reduce the size of your array result. (This is thesame error text you'd get from construct_md_array in the event ofoverrunning the maximum physical size for the finished array.)Per question from Shaozhong Shi. Since this hasn't come up often,I don't feel a need to back-patch.Discussion:https://postgr.es/m/CA+i5JwYtVS9z2E71PcNKAVPbOn4R2wuj-LqbJsYr_XOz73q7dQ@mail.gmail.com
1 parent00f2a25 commitb8d3dae

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

‎src/backend/utils/adt/arrayfuncs.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5317,6 +5317,12 @@ accumArrayResult(ArrayBuildState *astate,
53175317
if (astate->nelems >=astate->alen)
53185318
{
53195319
astate->alen *=2;
5320+
/* give an array-related error if we go past MaxAllocSize */
5321+
if (!AllocSizeIsValid(astate->alen*sizeof(Datum)))
5322+
ereport(ERROR,
5323+
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
5324+
errmsg("array size exceeds the maximum allowed (%d)",
5325+
(int)MaxAllocSize)));
53205326
astate->dvalues= (Datum*)
53215327
repalloc(astate->dvalues,astate->alen*sizeof(Datum));
53225328
astate->dnulls= (bool*)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp