Content-Length: 278694 | pFad | http://github.com/postgrespro/postgres_cluster/commit/9bc9f72b28fe4d2c22244f3443af8f1b98b56474

2A MAXALIGN the target address where we store flattened value. · postgrespro/postgres_cluster@9bc9f72 · GitHub
Skip to content

Commit 9bc9f72

Browse files
author
Amit Kapila
committed
MAXALIGN the target address where we store flattened value.
The API (EOH_flatten_into) that flattens the expanded value representation expects the target address to be maxaligned. All it's usage adhere to that principle except when serializing datums for parallel query. Fix that usage. Diagnosed-by: Tom Lane Author: Tom Lane and Amit Kapila Backpatch-through: 9.6 Discussion: https://postgr.es/m/11629.1536550032@sss.pgh.pa.us
1 parent a33245a commit 9bc9f72

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/backend/utils/adt/datum.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,8 +338,19 @@ datumSerialize(Datum value, bool isnull, bool typByVal, int typLen,
338338
}
339339
else if (eoh)
340340
{
341-
EOH_flatten_into(eoh, (void *) *start_address, header);
341+
char *tmp;
342+
343+
/*
344+
* EOH_flatten_into expects the target address to be maxaligned,
345+
* so we can't store directly to *start_address.
346+
*/
347+
tmp = (char *) palloc(header);
348+
EOH_flatten_into(eoh, (void *) tmp, header);
349+
memcpy(*start_address, tmp, header);
342350
*start_address += header;
351+
352+
/* be tidy. */
353+
pfree(tmp);
343354
}
344355
else
345356
{

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres_cluster/commit/9bc9f72b28fe4d2c22244f3443af8f1b98b56474

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy