Skip to content

Commit bb616ed

Browse files
committed
Use the correct PG_DETOAST_DATUM macro in BRIN
Commit 6bcda4a replaced PG_DETOAST_DATUM with PG_DETOAST_DATUM_PACKED in two BRIN output functions, for minmax-multi and bloom opclasses. But this is incorrect - the code is accessing the data through structs that already include a 4B header, so the detoast needs to match that. But the PACKED macro may keep the 1B header, which means the struct fields will point to incorrect data. Backpatch-through: 16 Discussion: https://postgr.es/m/1df00a66-db5a-4e66-809a-99b386a06d86%40enterprisedb.com
1 parent 2f20ced commit bb616ed

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/backend/access/brin/brin_bloom.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -800,7 +800,7 @@ brin_bloom_summary_out(PG_FUNCTION_ARGS)
800800
StringInfoData str;
801801

802802
/* detoast the data to get value with a full 4B header */
803-
filter = (BloomFilter *) PG_DETOAST_DATUM_PACKED(PG_GETARG_DATUM(0));
803+
filter = (BloomFilter *) PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
804804

805805
initStringInfo(&str);
806806
appendStringInfoChar(&str, '{');

src/backend/access/brin/brin_minmax_multi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3023,7 +3023,7 @@ brin_minmax_multi_summary_out(PG_FUNCTION_ARGS)
30233023
* Detoast to get value with full 4B header (can't be stored in a toast
30243024
* table, but can use 1B header).
30253025
*/
3026-
ranges = (SerializedRanges *) PG_DETOAST_DATUM_PACKED(PG_GETARG_DATUM(0));
3026+
ranges = (SerializedRanges *) PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
30273027

30283028
/* lookup output func for the type */
30293029
getTypeOutputInfo(ranges->typid, &outfunc, &isvarlena);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy