Use valid compression method in brin_form_tuple

Tomas Vondra <tomas.vondra@postgresql.org>

Commit: 882b2cdc08c4100e273f24742e2118be98708a07
Author: Tomas Vondra <tomas.vondra@postgresql.org>
Date: 2021-03-20T23:28:34Z
Releases: 14.0
Use valid compression method in brin_form_tuple

When compressing the BRIN summary, we can't simply use the compression
method from the indexed attribute.  The summary may use a different data
type, e.g. fixed-length attribute may have varlena summary, leading to
compression failures.  For the built-in BRIN opclasses this happens to
work, because the summary uses the same data type as the attribute.

When the data types match, we can inherit use the compression method
specified for the attribute (it's copied into the index descriptor).
Otherwise we don't have much choice and have to use the default one.

Author: Tomas Vondra
Reviewed-by: Justin Pryzby <pryzby@telsasoft.com>
Discussion: https://postgr.es/m/e0367f27-392c-321a-7411-a58e1a7e4817%40enterprisedb.com

Files

PathChange+/−
src/backend/access/brin/brin_tuple.c modified +14 −2

Discussion