From: Tom Lane <tgl@sss.pgh.pa.us>
To: Joe Conway <mail@joeconway.com>
Cc: pgsql-hackers@postgresql.org
Subject: Re: Getting rid of "unknown error" in dblink and postgres_fdw
Date: Wed, 21 Dec 2016 19:22:09 -0500
Message-ID: <19852.1482366129@sss.pgh.pa.us> (raw)
In-Reply-To: <02fa2d90-2efd-00bc-fefc-c23c00eb671e@joeconway.com>
References: <19872.1482338965@sss.pgh.pa.us>
<dfa45c48-659c-caa8-76de-06006707c3aa@joeconway.com>
<21630.1482341251@sss.pgh.pa.us>
<1312.1482343733@sss.pgh.pa.us>
<02fa2d90-2efd-00bc-fefc-c23c00eb671e@joeconway.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>
Joe Conway <mail@joeconway.com> writes:
> I did notice that postgres_fdw has the following stanza that I don't see
> in dblink:
> 8<------------------
> /*
> * If we don't get a message from the PGresult, try the PGconn. This
> * is needed because for connection-level failures, PQexec may just
> * return NULL, not a PGresult at all.
> */
> if (message_primary == NULL)
> message_primary = PQerrorMessage(conn);
> 8<------------------
> I wonder if the original issue on pgsql-bugs was a connection-level
> failure rather than OOM? Seems like dblink ought to do the same.
Oooh ... I had thought that code was in both, which was why I was having
a hard time explaining the OP's failure. But I see you're right,
which provides a very straightforward explanation for the report.
I believe that if libpq is unable to malloc a PGresult, it will return
NULL but put an "out of memory" message into the PGconn's error buffer.
I had supposed that we'd capture and report the latter, but as the
dblink code stands, it won't.
In short, yes, please copy that bit into dblink.
regards, tom lane
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: tgl@sss.pgh.pa.us, mail@joeconway.com
Subject: Re: Getting rid of "unknown error" in dblink and postgres_fdw
In-Reply-To: <19852.1482366129@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox