Thread: Use appendStringInfoString and appendPQExpBufferStr where possible

Use appendStringInfoString and appendPQExpBufferStr where possible

From
"Hou, Zhijie"
Date:
Hi hackers

In(/src/bin/scripts/reindexdb.c; /src/backend/access/rmgrdesc/dbasedesc.c; /src/pl/plpython/plpy_elog.c)

I found some more places that should use appendPQExrBufferStr instead of appendPQExpBuffer.

Here is the patch.

Previous Discussion:
https://www.postgresql.org/message-id/CAKJS1f9P=M-3ULmPvr8iCno8yvfDViHibJjpriHU8+SXUgeZ=w@mail.gmail.com

Best regards,
Houzj/huangj



Attachment

Re: Use appendStringInfoString and appendPQExpBufferStr where possible

From
David Rowley
Date:
On Tue, 22 Sep 2020 at 17:00, Hou, Zhijie <houzj.fnst@cn.fujitsu.com> wrote:
> I found some more places that should use appendPQExrBufferStr instead of appendPQExpBuffer.
>
> Here is the patch.

Seems like a good idea.  Please add it to the next commitfest.

David



RE: Use appendStringInfoString and appendPQExpBufferStr where possible

From
"Hou, Zhijie"
Date:
> On Tue, 22 Sep 2020 at 17:00, Hou, Zhijie <houzj.fnst@cn.fujitsu.com> wrote:
> > I found some more places that should use appendPQExrBufferStr instead
> of appendPQExpBuffer.
> >
> > Here is the patch.
> 
> Seems like a good idea.  Please add it to the next commitfest.

Thanks, added it to the next commitfest.
https://commitfest.postgresql.org/30/2735/

Best regards,
houzj



RE: Use appendStringInfoString and appendPQExpBufferStr where possible

From
"Hou, Zhijie"
Date:
Hi

I made a slight update to the patch

> > > I found some more places that should use appendPQExrBufferStr instead
> > of appendPQExpBuffer.
> > >
> > > Here is the patch.
> >
> > Seems like a good idea.  Please add it to the next commitfest.
> 
> Thanks, added it to the next commitfest.
> https://commitfest.postgresql.org/30/2735/

Best regards,
houzj



Attachment

RE: Use appendStringInfoString and appendPQExpBufferStr where possible

From
"Hou, Zhijie"
Date:
> Good point.  There's another one:

> $ git grep -E 'appendStringInfoString.*".{,1}");'
> src/backend/utils/adt/ruleutils.c:      appendStringInfoString(buf, "(");

> I noticed you added a similar thread here.
> https://commitfest.postgresql.org/30/

> I think this one could be combined as a single patchset with the existing CF entry for the other thread.

Thanks for your response, combined them as a single patchset now.

Best regards,




Attachment

Re: Use appendStringInfoString and appendPQExpBufferStr where possible

From
David Rowley
Date:
On Mon, 28 Sep 2020 at 13:47, Hou, Zhijie <houzj.fnst@cn.fujitsu.com> wrote:
> Thanks for your response, combined them as a single patchset now.

I had a look over the three patches.  All the changes look fine.
Thanks for working on it.

After a bit of grep work, I found about 6 times more calls that could
be improved.  These involved searching for appendStringInfo calls that
could become appendStringInfoString calls and also appendPQExpBuffer
that could be converted to appendPQExpBufferStr.

I didn't really go hunting for any other calls that append a 1 char
string that don't use the Char variant of the function. So perhaps
there's more of those to be found.

I've attached the patch I ended up with. I plan on pushing this in the
next few days.

David

Attachment

Re: Use appendStringInfoString and appendPQExpBufferStr where possible

From
David Rowley
Date:
On Wed, 14 Oct 2020 at 21:05, David Rowley <dgrowleyml@gmail.com> wrote:
> I've attached the patch I ended up with. I plan on pushing this in the
> next few days.

Pushed.

David