From: | Joe Conway <mail(at)joeconway(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Getting rid of "unknown error" in dblink and postgres_fdw |
Date: | 2016-12-22 01:06:23 |
Message-ID: | 3f3f5c79-acb3-5b4b-0e69-9563b9722b84@joeconway.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 12/21/2016 04:22 PM, Tom Lane wrote:
> Joe Conway <mail(at)joeconway(dot)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.
The attached should do the trick I think. You think it is reasonable to
backpatch this part too?
Joe
--
Crunchy Data - http://crunchydata.com
PostgreSQL Support for Secure Enterprises
Consulting, Training, & Open Source Development
Attachment | Content-Type | Size |
---|---|---|
dblink-get-conn-errmsg.diff | text/x-diff | 5.6 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2016-12-22 01:30:48 | Potential data loss of 2PC files |
Previous Message | Amit Langote | 2016-12-22 01:00:18 | Re: [COMMITTERS] pgsql: Implement table partitioning. |