Re: Out-of-memory error reports in libpq

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

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Ranier Vilela <ranier.vf@gmail.com>
Cc: Andres Freund <andres@anarazel.de>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, Michael Paquier <michael@paquier.xyz>, Alvaro Herrera <alvherre@alvh.no-ip.org>, Peter Geoghegan <pg@bowt.ie>
Date: 2021-07-29T03:40:09Z
Lists: pgsql-hackers
Ranier Vilela <ranier.vf@gmail.com> writes:
> IMO, I think that "char *msg" is unnecessary, isn't it?

> + if (!PQExpBufferBroken(errorMessage))
> + res->errMsg = pqResultStrdup(res, errorMessage->data);
>   else
> - res->errMsg = NULL;
> + res->errMsg = libpq_gettext("out of memory\n");

Please read the comment.

			regards, tom lane



Commits

  1. Improve libpq's handling of OOM during error message construction.

  2. In libpq, always append new error messages to conn->errorMessage.