summaryrefslogtreecommitdiff
path: root/src/backend/access/brin/brin_tuple.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/access/brin/brin_tuple.c')
-rw-r--r--src/backend/access/brin/brin_tuple.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/backend/access/brin/brin_tuple.c b/src/backend/access/brin/brin_tuple.c
index 8d03e609a38..32ffd9f9fc2 100644
--- a/src/backend/access/brin/brin_tuple.c
+++ b/src/backend/access/brin/brin_tuple.c
@@ -220,10 +220,12 @@ brin_form_tuple(BrinDesc *brdesc, BlockNumber blkno, BrinMemTuple *tuple,
/*
* If the BRIN summary and indexed attribute use the same data
- * type, we can use the same compression method. Otherwise we
- * have to use the default method.
+ * type and it has a valid compression method, we can use the
+ * same compression method. Otherwise we have to use the
+ * default method.
*/
- if (att->atttypid == atttype->type_id)
+ if (att->atttypid == atttype->type_id &&
+ CompressionMethodIsValid(att->attcompression))
compression = att->attcompression;
else
compression = GetDefaultToastCompression();