summaryrefslogtreecommitdiff
path: root/src/backend/executor
diff options
context:
space:
mode:
authorDavid Rowley <drowley@postgresql.org>2019-07-23 00:14:11 +1200
committerDavid Rowley <drowley@postgresql.org>2019-07-23 00:14:11 +1200
commit1e6a759838f7c104f3cd1fe6981a98780da4131b (patch)
tree47047d8991d0918b531fe71f38b637dc086c9ffa /src/backend/executor
parent19781729f789f3c6b2540e02b96f8aa500460322 (diff)
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
Diffstat (limited to 'src/backend/executor')
-rw-r--r--src/backend/executor/execMain.c4
-rw-r--r--src/backend/executor/execPartition.c2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c
index 29e2681484c..dbd7dd9bcd4 100644
--- a/src/backend/executor/execMain.c
+++ b/src/backend/executor/execMain.c
@@ -2290,7 +2290,7 @@ ExecBuildSlotValueDescription(Oid reloid,
/* truncate if needed */
vallen = strlen(val);
if (vallen <= maxfieldlen)
- appendStringInfoString(&buf, val);
+ appendBinaryStringInfo(&buf, val, vallen);
else
{
vallen = pg_mbcliplen(val, vallen, maxfieldlen);
@@ -2309,7 +2309,7 @@ ExecBuildSlotValueDescription(Oid reloid,
if (!table_perm)
{
appendStringInfoString(&collist, ") = ");
- appendStringInfoString(&collist, buf.data);
+ appendBinaryStringInfo(&collist, buf.data, buf.len);
return collist.data;
}
diff --git a/src/backend/executor/execPartition.c b/src/backend/executor/execPartition.c
index f49a48adb68..729dc396a94 100644
--- a/src/backend/executor/execPartition.c
+++ b/src/backend/executor/execPartition.c
@@ -1406,7 +1406,7 @@ ExecBuildSlotPartitionKeyDescription(Relation rel,
/* truncate if needed */
vallen = strlen(val);
if (vallen <= maxfieldlen)
- appendStringInfoString(&buf, val);
+ appendBinaryStringInfo(&buf, val, vallen);
else
{
vallen = pg_mbcliplen(val, vallen, maxfieldlen);