Content-Length: 273568 | pFad | http://github.com/postgrespro/postgres/commit/1029bdec2d641f378eaa59f00a93b136f191f3c7

CA Improve enlargeStringInfo's ERROR message · postgrespro/postgres@1029bde · GitHub
Skip to content

Commit 1029bde

Browse files
committed
Improve enlargeStringInfo's ERROR message
Until now, when an enlargeStringInfo() call would cause the StringInfo to exceed its maximum size, we reported an "out of memory" error. This is misleading as it's no such thing. Here we remove the "out of memory" text and replace it with something more relevant to better indicate that it's a program limitation that's been reached. Reported-by: Michael Banck Reviewed-by: Daniel Gustafsson, Tom Lane Discussion: https://postgr.es/m/18484-3e357ade5fe50e61@postgresql.org
1 parent e26810d commit 1029bde

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/common/stringinfo.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -311,13 +311,13 @@ enlargeStringInfo(StringInfo str, int needed)
311311
#ifndef FRONTEND
312312
ereport(ERROR,
313313
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
314-
errmsg("out of memory"),
314+
errmsg("string buffer exceeds maximum allowed length (%zu bytes)", MaxAllocSize),
315315
errdetail("Cannot enlarge string buffer containing %d bytes by %d more bytes.",
316316
str->len, needed)));
317317
#else
318318
fprintf(stderr,
319-
_("out of memory\n\nCannot enlarge string buffer containing %d bytes by %d more bytes.\n"),
320-
str->len, needed);
319+
_("string buffer exceeds maximum allowed length (%zu bytes)\n\nCannot enlarge string buffer containing %d bytes by %d more bytes.\n"),
320+
MaxAllocSize, str->len, needed);
321321
exit(EXIT_FAILURE);
322322
#endif
323323
}

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres/commit/1029bdec2d641f378eaa59f00a93b136f191f3c7

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy