Re: Fixup some appendStringInfo and appendPQExpBuffer calls
David Rowley <dgrowleyml@gmail.com>
From: David Rowley <dgrowleyml@gmail.com>
To: Michael Paquier <michael@paquier.xyz>,
Tomas Vondra <tomas.vondra@enterprisedb.com>
Cc: "houzj.fnst@fujitsu.com" <houzj.fnst@fujitsu.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2021-06-03T03:51:48Z
Lists: pgsql-hackers
Attachments
- appendstringinfo_fixes_v2.patch (application/octet-stream) patch v2
On Thu, 3 Jun 2021 at 15:06, David Rowley <dgrowleyml@gmail.com> wrote:
>
> On Thu, 3 Jun 2021 at 15:01, Michael Paquier <michael@paquier.xyz> wrote:
> > As you already did
> > 110d817, perhaps you would prefer taking care of it?
>
> Ok. I'll take care of it.
I looked at this and couldn't help but notice how the following used
DatumGetPointer() instead of DatumGetCString():
appendStringInfo(&str, "%s ... %s",
DatumGetPointer(a),
DatumGetPointer(b));
However, looking a bit further it looks like instead of using
FunctionCall1 to call the type's output function, that the code should
use OutputFunctionCall and get a char * directly.
e.g the attached.
There are quite a few other places in that file that should be using
DatumGetCString() instead of DatumGetPointer().
Should we fix those too for PG14?
In the meantime, I'll push a version of this with just the StringInfo
fixes first. If we do anything else it can be done as a separate
commit.
David
Commits
-
Clean up some questionable usages of DatumGet* macros
- 8bdb36aab287 14.0 landed
-
Standardize usages of appendStringInfo and appendPQExpBuffer
- f736e188ce70 14.0 landed