| From: | Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp> |
|---|---|
| To: | Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Make PQgetResult() not return NULL on out-of-memory error |
| Date: | 2025-11-10 17:07:01 |
| Message-ID: | 20251111020701.807f7e9b45c18e8b09ac1d88@sraoss.co.jp |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi,
Currently, PQgetResult() returns NULL not only when no results remain for
a sent query, but also when an out-of-memory error occurs, except when
PGconn itself is NULL. As a result, users cannot distinguish between query
completion and an out-of-memory error when PQgetResult() returns NULL.
The result returned by PQgetResult() is generated by either pqPipelineProcessQueue()
or getCopyResult(). While pqPipelineProcessQueue() never returns NULL, even in the
case of an out-of-memory error, getCopyResult() may return NULL.
Therefore, I propose modifying getCopyResult() so that it never returns NULL, but
instead returns OOM_result, as pqPipelineProcessQueue() does.
I’ve attached a patch for this.
Regards,
Yugo Nagata
--
Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp>
| Attachment | Content-Type | Size |
|---|---|---|
| 0001-Make-PQgetResult-not-return-NULL-on-out-of-memory-er.patch | text/x-diff | 2.1 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2025-11-10 17:36:14 | Re: Move SLRU_PAGES_PER_SEGMENT to pg_config_manual.h |
| Previous Message | AIX PG user | 2025-11-10 17:00:13 | Re: AIX support |