Re: [HACKERS] Getting rid of "unknown error" in dblink and postgres_fdw

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [HACKERS] Getting rid of "unknown error" in dblink and postgres_fdw
Дата
Msg-id 19852.1482366129@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [HACKERS] Getting rid of "unknown error" in dblink andpostgres_fdw  (Joe Conway <mail@joeconway.com>)
Ответы Re: [HACKERS] Getting rid of "unknown error" in dblink andpostgres_fdw  (Joe Conway <mail@joeconway.com>)
Список pgsql-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



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Joe Conway
Дата:
Сообщение: Re: [HACKERS] Getting rid of "unknown error" in dblink andpostgres_fdw
Следующее
От: Joel Jacobson
Дата:
Сообщение: Re: [HACKERS] SET NOT NULL [NOT VALID / CONCURRENTLY]?