Re: [PATCH] Make jsonapi usable from libpq
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jacob Champion <pchampion@vmware.com>
Cc: "daniel@yesql.se" <daniel@yesql.se>,
"pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>,
"michael@paquier.xyz" <michael@paquier.xyz>
Date: 2021-06-29T19:34:29Z
Lists: pgsql-hackers
Jacob Champion <pchampion@vmware.com> writes: > On Tue, 2021-06-29 at 14:50 -0400, Tom Lane wrote: >> The existing convention is to use pqexpbuffer.c, which seems strictly >> cleaner and more robust than asprintf. In particular its behavior under >> OOM conditions is far easier/safer to work with. Maybe we should consider >> moving that into src/common/ so that it can be used by code that's not >> tightly bound into libpq? > I will take a look. Were you thinking we'd (hypothetically) migrate all > string allocation code under src/common to pqexpbuffer as part of that > move? Or just have it there to use as needed, when nm complains? Actually, I'd forgotten that the PQExpBuffer functions are already exported by libpq, and much of our frontend code already uses them from there. So we don't really need to move anything unless there's a call to use this code in clients that don't use libpq, which are a pretty small set. Also, having them be available both from libpq.so and from libpgcommon.a would be a tad problematic I think; it'd be hard to tell which way the linker would choose to resolve that. 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