aboutsummaryrefslogtreecommitdiff
path: root/src/backend/tcop/postgres.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/tcop/postgres.c')
-rw-r--r--src/backend/tcop/postgres.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index c900427ecf9..6a070b5d8cb 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -1817,23 +1817,19 @@ exec_bind_message(StringInfo input_message)
if (!isNull)
{
- const char *pvalue = pq_getmsgbytes(input_message, plength);
+ char *pvalue;
/*
- * Rather than copying data around, we just set up a phony
+ * Rather than copying data around, we just initialize a
* StringInfo pointing to the correct portion of the message
- * buffer. We assume we can scribble on the message buffer so
- * as to maintain the convention that StringInfos have a
- * trailing null. This is grotty but is a big win when
- * dealing with very large parameter strings.
+ * buffer. We assume we can scribble on the message buffer to
+ * add a trailing NUL which is required for the input function
+ * call.
*/
- pbuf.data = unconstify(char *, pvalue);
- pbuf.maxlen = plength + 1;
- pbuf.len = plength;
- pbuf.cursor = 0;
-
- csave = pbuf.data[plength];
- pbuf.data[plength] = '\0';
+ pvalue = unconstify(char *, pq_getmsgbytes(input_message, plength));
+ csave = pvalue[plength];
+ pvalue[plength] = '\0';
+ initReadOnlyStringInfo(&pbuf, pvalue, plength);
}
else
{