Skip to content

Commit

Permalink
Translate ENOMEM to ERRCODE_OUT_OF_MEMORY in errcode_for_file_access().
Browse files Browse the repository at this point in the history
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
  • Loading branch information
tglsfdc committed Feb 2, 2024
1 parent 87dcc5e commit a153781
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/backend/utils/error/elog.c
Original file line number Diff line number Diff line change
Expand Up @@ -920,6 +920,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;
Expand Down

0 comments on commit a153781

Please sign in to comment.