Re: [PATCH] Make jsonapi usable from libpq

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [PATCH] Make jsonapi usable from libpq
Дата
Msg-id 622803.1625084036@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [PATCH] Make jsonapi usable from libpq  (Peter Eisentraut <peter.eisentraut@enterprisedb.com>)
Список pgsql-hackers
Peter Eisentraut <peter.eisentraut@enterprisedb.com> writes:
> On 26.06.21 19:43, Tom Lane wrote:
>> fe-print.c's handling of OOM isn't nice at all:
>>     fprintf(stderr, libpq_gettext("out of memory\n"));
>>     abort();
>> Although fe-print.c is semi-deprecated, it still seems like it'd
>> be a good idea to clean that up.

> These abort() calls were put there on purpose by:
> commit c6ea8ccea6bf23501962ddc7ac9ffdb99c8643e1
>      Use abort() instead of exit() to abort library functions

Well, the exit() calls that that replaced were quite inappropriate
too IMO.  I don't think it boots much to argue about which way was
less bad; libpq has no business doing either thing.

What might be more useful is to consider whether there's a way
to retrofit an error-reporting convention onto these functions.
I thought about that for a bit, but concluded that the possible
interactions with stdio's error handling made that fairly tricky,
and it didn't seem worth messing with for such backwater code.
(Too bad POSIX didn't see fit to provide seterr(FILE*), or maybe
we could have reported OOM in fe-print that way.)

            regards, tom lane



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

Предыдущее
От: Rahila Syed
Дата:
Сообщение: Column Filtering in Logical Replication
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Preventing abort() and exit() calls in libpq