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

Appearance settings

Commit 1029bde

Browse filesBrowse 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
Copy full SHA for 1029bde

File tree

Expand file treeCollapse file tree

1 file changed

+3
-3
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+3
-3
lines changed

‎src/common/stringinfo.c

Copy file name to clipboardExpand all lines: src/common/stringinfo.c
+3-3Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.