index 5c4fdcfba4693dcf6d83047806bd62cbe3adfd1d..7f87df45df654f37b159210c42c65b40d02b59cc 100644 (file)
sstate = PG_GETARG_BYTEA_PP(0);
/*
- * Copy the bytea into a StringInfo so that we can "receive" it using the
- * standard recv-function infrastructure.
+ * Fake up a StringInfo pointing to the bytea's value so we can "receive"
+ * the serialized aggregate state value.
*/
- initStringInfo(&buf);
- appendBinaryStringInfo(&buf,
- VARDATA_ANY(sstate), VARSIZE_ANY_EXHDR(sstate));
+ buf.data = VARDATA_ANY(sstate);
+ buf.len = VARSIZE_ANY_EXHDR(sstate);
+ buf.maxlen = 0;
+ buf.cursor = 0;
/* element_type */
element_type = pq_getmsgint(&buf, 4);
}
pq_getmsgend(&buf);
- pfree(buf.data);
PG_RETURN_POINTER(result);
}
sstate = PG_GETARG_BYTEA_PP(0);
/*
- * Copy the bytea into a StringInfo so that we can "receive" it using the
- * standard recv-function infrastructure.
+ * Fake up a StringInfo pointing to the bytea's value so we can "receive"
+ * the serialized aggregate state value.
*/
- initStringInfo(&buf);
- appendBinaryStringInfo(&buf,
- VARDATA_ANY(sstate), VARSIZE_ANY_EXHDR(sstate));
+ buf.data = VARDATA_ANY(sstate);
+ buf.len = VARSIZE_ANY_EXHDR(sstate);
+ buf.maxlen = 0;
+ buf.cursor = 0;
/* element_type */
element_type = pq_getmsgint(&buf, 4);
memcpy(result->lbs, temp, sizeof(result->lbs));
pq_getmsgend(&buf);
- pfree(buf.data);
PG_RETURN_POINTER(result);
}
index 3c3184f15b5692341342e2d720a09f906d74fba7..f4b885005fca8c6ef5d4e8b93539c505e2799798 100644 (file)
init_var(&tmp_var);
/*
- * Copy the bytea into a StringInfo so that we can "receive" it using the
- * standard recv-function infrastructure.
+ * Fake up a StringInfo pointing to the bytea's value so we can "receive"
+ * the serialized aggregate state value.
*/
- initStringInfo(&buf);
- appendBinaryStringInfo(&buf,
- VARDATA_ANY(sstate), VARSIZE_ANY_EXHDR(sstate));
+ buf.data = VARDATA_ANY(sstate);
+ buf.len = VARSIZE_ANY_EXHDR(sstate);
+ buf.maxlen = 0;
+ buf.cursor = 0;
result = makeNumericAggStateCurrentContext(false);
result->nInfcount = pq_getmsgint64(&buf);
pq_getmsgend(&buf);
- pfree(buf.data);
free_var(&tmp_var);
init_var(&tmp_var);
/*
- * Copy the bytea into a StringInfo so that we can "receive" it using the
- * standard recv-function infrastructure.
+ * Fake up a StringInfo pointing to the bytea's value so we can "receive"
+ * the serialized aggregate state value.
*/
- initStringInfo(&buf);
- appendBinaryStringInfo(&buf,
- VARDATA_ANY(sstate), VARSIZE_ANY_EXHDR(sstate));
+ buf.data = VARDATA_ANY(sstate);
+ buf.len = VARSIZE_ANY_EXHDR(sstate);
+ buf.maxlen = 0;
+ buf.cursor = 0;
result = makeNumericAggStateCurrentContext(false);
result->nInfcount = pq_getmsgint64(&buf);
pq_getmsgend(&buf);
- pfree(buf.data);
free_var(&tmp_var);
init_var(&tmp_var);
/*
- * Copy the bytea into a StringInfo so that we can "receive" it using the
- * standard recv-function infrastructure.
+ * Fake up a StringInfo pointing to the bytea's value so we can "receive"
+ * the serialized aggregate state value.
*/
- initStringInfo(&buf);
- appendBinaryStringInfo(&buf,
- VARDATA_ANY(sstate), VARSIZE_ANY_EXHDR(sstate));
+ buf.data = VARDATA_ANY(sstate);
+ buf.len = VARSIZE_ANY_EXHDR(sstate);
+ buf.maxlen = 0;
+ buf.cursor = 0;
result = makePolyNumAggStateCurrentContext(false);
#endif
pq_getmsgend(&buf);
- pfree(buf.data);
free_var(&tmp_var);
init_var(&tmp_var);
/*
- * Copy the bytea into a StringInfo so that we can "receive" it using the
- * standard recv-function infrastructure.
+ * Fake up a StringInfo pointing to the bytea's value so we can "receive"
+ * the serialized aggregate state value.
*/
- initStringInfo(&buf);
- appendBinaryStringInfo(&buf,
- VARDATA_ANY(sstate), VARSIZE_ANY_EXHDR(sstate));
+ buf.data = VARDATA_ANY(sstate);
+ buf.len = VARSIZE_ANY_EXHDR(sstate);
+ buf.maxlen = 0;
+ buf.cursor = 0;
result = makePolyNumAggStateCurrentContext(false);
#endif
pq_getmsgend(&buf);
- pfree(buf.data);
free_var(&tmp_var);
index 72e1e24fe02c24217f354e931808bed941843dc0..1aff04fa77d7d3cc19c128f72639b8db3a104aec 100644 (file)
sstate = PG_GETARG_BYTEA_PP(0);
/*
- * Copy the bytea into a StringInfo so that we can "receive" it using the
- * standard recv-function infrastructure.
+ * Fake up a StringInfo pointing to the bytea's value so we can "receive"
+ * the serialized aggregate state value.
*/
- initStringInfo(&buf);
- appendBinaryStringInfo(&buf,
- VARDATA_ANY(sstate), VARSIZE_ANY_EXHDR(sstate));
+ buf.data = VARDATA_ANY(sstate);
+ buf.len = VARSIZE_ANY_EXHDR(sstate);
+ buf.maxlen = 0;
+ buf.cursor = 0;
result = makeStringAggState(fcinfo);
appendBinaryStringInfo(result, data, datalen);
pq_getmsgend(&buf);
- pfree(buf.data);
PG_RETURN_POINTER(result);
}