Re: Correct SQLSTATE for ENOMEM in file access

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alexander Kuzmenkov <akuzmenkov@timescale.com>
Cc: pgsql-hackers@postgresql.org
Date: 2024-02-02T19:12:13Z
Lists: pgsql-hackers
Alexander Kuzmenkov <akuzmenkov@timescale.com> writes:
> Looking through the logs of some server that were experiencing out of
> memory errors, I noticed that errcode_for_file_access() reports
> ERRCODE_INTERNAL_ERROR for ENOMEM, while the correct SQLSTATE for this
> should probably be ERRCODE_OUT_OF_MEMORY. Attached is a small patch to
> fix this.

Hmm, do you think this is actually reachable?  AFAIK we should only be
calling errcode_for_file_access() after functions that are unlikely to
report ENOMEM.

			regards, tom lane



Commits

  1. Translate ENOMEM to ERRCODE_OUT_OF_MEMORY in errcode_for_file_access().