Re: [PATCH] Make jsonapi usable from libpq
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Cc: Michael Paquier <michael@paquier.xyz>,
Jacob Champion <pchampion@vmware.com>,
"pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>,
Daniel Gustafsson <daniel@yesql.se>
Date: 2021-06-30T20:13:56Z
Lists: 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
Commits
-
Remove libpq's use of abort(3) to handle mutex failure cases.
- aaddf6ba09e2 15.0 landed
-
Don't use abort(3) in libpq's fe-print.c.
- cf1f545bf281 14.0 landed
- b54be47cdc2d 9.6.23 landed
- 34c24e5a4337 11.13 landed
- 240d56fc4351 12.8 landed
- 1603deca34ef 13.4 landed
- 06a2b2fe5580 10.18 landed
- 6f5d9bce57a7 15.0 landed
-
Remove undesirable libpq dependency on stringinfo.c.
- 8ec00dc5cd70 14.0 landed
-
Remove arbitrary line length limit for libpq service files.
- c0cb87fbb664 14.0 cited
-
Use abort() instead of exit() to abort library functions
- c6ea8ccea6bf 9.2.0 cited