1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-11 20:28:21 +03:00

Use appendBinaryStringInfo in more places where the length is known

When we already know the length that we're going to append, then it
makes sense to use appendBinaryStringInfo instead of
appendStringInfoString so that the append can be performed with a simple
memcpy() using a known length rather than having to first perform a
strlen() call to obtain the length.

Discussion: https://postgr.es/m/CAKJS1f8+FRAM1s5+mAa3isajeEoAaicJ=4e0WzrH3tAusbbiMQ@mail.gmail.com
This commit is contained in:
David Rowley
2019-07-23 00:14:11 +12:00
parent 19781729f7
commit 1e6a759838
7 changed files with 20 additions and 18 deletions

View File

@ -1531,7 +1531,7 @@ deparseFromExprForRel(StringInfo buf, PlannerInfo *root, RelOptInfo *foreignrel,
{
Assert(fpinfo->jointype == JOIN_INNER);
Assert(fpinfo->joinclauses == NIL);
appendStringInfoString(buf, join_sql_o.data);
appendBinaryStringInfo(buf, join_sql_o.data, join_sql_o.len);
return;
}
}
@ -1552,7 +1552,7 @@ deparseFromExprForRel(StringInfo buf, PlannerInfo *root, RelOptInfo *foreignrel,
{
Assert(fpinfo->jointype == JOIN_INNER);
Assert(fpinfo->joinclauses == NIL);
appendStringInfoString(buf, join_sql_i.data);
appendBinaryStringInfo(buf, join_sql_i.data, join_sql_i.len);
return;
}
}