From: Tom Lane Date: Fri, 2 Feb 2024 20:34:29 +0000 (-0500) Subject: Translate ENOMEM to ERRCODE_OUT_OF_MEMORY in errcode_for_file_access(). X-Git-Tag: REL_12_18~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4493bfb709ae1b83e537daf82014d9b5ad65b26d;p=thirdparty%2Fpostgresql.git Translate ENOMEM to ERRCODE_OUT_OF_MEMORY in errcode_for_file_access(). Previously you got ERRCODE_INTERNAL_ERROR, which seems inappropriate, especially given that we're trying to avoid emitting that in reachable cases. Alexander Kuzmenkov Discussion: https://postgr.es/m/CALzhyqzgQph0BY8-hFRRGdHhF8CoqmmDHW9S=hMZ-HMzLxRqDQ@mail.gmail.com --- diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index bca06ca3315..1df08e40218 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -632,6 +632,10 @@ errcode_for_file_access(void) edata->sqlerrcode = ERRCODE_DISK_FULL; break; + case ENOMEM: /* Out of memory */ + edata->sqlerrcode = ERRCODE_OUT_OF_MEMORY; + break; + case ENFILE: /* File table overflow */ case EMFILE: /* Too many open files */ edata->sqlerrcode = ERRCODE_INSUFFICIENT_RESOURCES;