sstate = PG_GETARG_BYTEA_PP(0);
/*
- * Fake up a StringInfo pointing to the bytea's value so we can "receive"
- * the serialized aggregate state value.
+ * Copy the bytea into a StringInfo so that we can "receive" it using the
+ * standard recv-function infrastructure.
*/
- buf.data = VARDATA_ANY(sstate);
- buf.len = VARSIZE_ANY_EXHDR(sstate);
- buf.maxlen = 0;
- buf.cursor = 0;
+ initStringInfo(&buf);
+ appendBinaryStringInfo(&buf,
+ VARDATA_ANY(sstate), VARSIZE_ANY_EXHDR(sstate));
/* element_type */
element_type = pq_getmsgint(&buf, 4);
}
pq_getmsgend(&buf);
+ pfree(buf.data);
PG_RETURN_POINTER(result);
}
sstate = PG_GETARG_BYTEA_PP(0);
/*
- * Fake up a StringInfo pointing to the bytea's value so we can "receive"
- * the serialized aggregate state value.
+ * Copy the bytea into a StringInfo so that we can "receive" it using the
+ * standard recv-function infrastructure.
*/
- buf.data = VARDATA_ANY(sstate);
- buf.len = VARSIZE_ANY_EXHDR(sstate);
- buf.maxlen = 0;
- buf.cursor = 0;
+ initStringInfo(&buf);
+ appendBinaryStringInfo(&buf,
+ VARDATA_ANY(sstate), VARSIZE_ANY_EXHDR(sstate));
/* 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);
}
init_var(&tmp_var);
/*
- * Fake up a StringInfo pointing to the bytea's value so we can "receive"
- * the serialized aggregate state value.
+ * Copy the bytea into a StringInfo so that we can "receive" it using the
+ * standard recv-function infrastructure.
*/
- buf.data = VARDATA_ANY(sstate);
- buf.len = VARSIZE_ANY_EXHDR(sstate);
- buf.maxlen = 0;
- buf.cursor = 0;
+ initStringInfo(&buf);
+ appendBinaryStringInfo(&buf,
+ VARDATA_ANY(sstate), VARSIZE_ANY_EXHDR(sstate));
result = makeNumericAggStateCurrentContext(false);
result->nInfcount = pq_getmsgint64(&buf);
pq_getmsgend(&buf);
+ pfree(buf.data);
free_var(&tmp_var);
init_var(&tmp_var);
/*
- * Fake up a StringInfo pointing to the bytea's value so we can "receive"
- * the serialized aggregate state value.
+ * Copy the bytea into a StringInfo so that we can "receive" it using the
+ * standard recv-function infrastructure.
*/
- buf.data = VARDATA_ANY(sstate);
- buf.len = VARSIZE_ANY_EXHDR(sstate);
- buf.maxlen = 0;
- buf.cursor = 0;
+ initStringInfo(&buf);
+ appendBinaryStringInfo(&buf,
+ VARDATA_ANY(sstate), VARSIZE_ANY_EXHDR(sstate));
result = makeNumericAggStateCurrentContext(false);
result->nInfcount = pq_getmsgint64(&buf);
pq_getmsgend(&buf);
+ pfree(buf.data);
free_var(&tmp_var);
init_var(&tmp_var);
/*
- * Fake up a StringInfo pointing to the bytea's value so we can "receive"
- * the serialized aggregate state value.
+ * Copy the bytea into a StringInfo so that we can "receive" it using the
+ * standard recv-function infrastructure.
*/
- buf.data = VARDATA_ANY(sstate);
- buf.len = VARSIZE_ANY_EXHDR(sstate);
- buf.maxlen = 0;
- buf.cursor = 0;
+ initStringInfo(&buf);
+ appendBinaryStringInfo(&buf,
+ VARDATA_ANY(sstate), VARSIZE_ANY_EXHDR(sstate));
result = makePolyNumAggStateCurrentContext(false);
#endif
pq_getmsgend(&buf);
+ pfree(buf.data);
free_var(&tmp_var);
init_var(&tmp_var);
/*
- * Fake up a StringInfo pointing to the bytea's value so we can "receive"
- * the serialized aggregate state value.
+ * Copy the bytea into a StringInfo so that we can "receive" it using the
+ * standard recv-function infrastructure.
*/
- buf.data = VARDATA_ANY(sstate);
- buf.len = VARSIZE_ANY_EXHDR(sstate);
- buf.maxlen = 0;
- buf.cursor = 0;
+ initStringInfo(&buf);
+ appendBinaryStringInfo(&buf,
+ VARDATA_ANY(sstate), VARSIZE_ANY_EXHDR(sstate));
result = makePolyNumAggStateCurrentContext(false);
#endif
pq_getmsgend(&buf);
+ pfree(buf.data);
free_var(&tmp_var);
sstate = PG_GETARG_BYTEA_PP(0);
/*
- * Fake up a StringInfo pointing to the bytea's value so we can "receive"
- * the serialized aggregate state value.
+ * Copy the bytea into a StringInfo so that we can "receive" it using the
+ * standard recv-function infrastructure.
*/
- buf.data = VARDATA_ANY(sstate);
- buf.len = VARSIZE_ANY_EXHDR(sstate);
- buf.maxlen = 0;
- buf.cursor = 0;
+ initStringInfo(&buf);
+ appendBinaryStringInfo(&buf,
+ VARDATA_ANY(sstate), VARSIZE_ANY_EXHDR(sstate));
result = makeStringAggState(fcinfo);
appendBinaryStringInfo(result, data, datalen);
pq_getmsgend(&buf);
+ pfree(buf.data);
PG_RETURN_POINTER(result);
}