summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rowley2024-07-01 00:11:10 +0000
committerDavid Rowley2024-07-01 00:11:10 +0000
commit1029bdec2d641f378eaa59f00a93b136f191f3c7 (patch)
tree830316c3c1f5eef15fc85aa69460c6f7dcf8c7e8
parente26810d01d441a457217a6eae9c2989fba29b80f (diff)
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/[email protected]
-rw-r--r--src/common/stringinfo.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/common/stringinfo.c b/src/common/stringinfo.c
index ec5fc2422d..eb9d6502fc 100644
--- a/src/common/stringinfo.c
+++ b/src/common/stringinfo.c
@@ -311,13 +311,13 @@ enlargeStringInfo(StringInfo str, int needed)
#ifndef FRONTEND
ereport(ERROR,
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
- errmsg("out of memory"),
+ errmsg("string buffer exceeds maximum allowed length (%zu bytes)", MaxAllocSize),
errdetail("Cannot enlarge string buffer containing %d bytes by %d more bytes.",
str->len, needed)));
#else
fprintf(stderr,
- _("out of memory\n\nCannot enlarge string buffer containing %d bytes by %d more bytes.\n"),
- str->len, needed);
+ _("string buffer exceeds maximum allowed length (%zu bytes)\n\nCannot enlarge string buffer containing %d bytes by %d more bytes.\n"),
+ MaxAllocSize, str->len, needed);
exit(EXIT_FAILURE);
#endif
}