Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit882b2cd

Browse files
committed
Use valid compression method in brin_form_tuple
When compressing the BRIN summary, we can't simply use the compressionmethod from the indexed attribute. The summary may use a different datatype, e.g. fixed-length attribute may have varlena summary, leading tocompression failures. For the built-in BRIN opclasses this happens towork, because the summary uses the same data type as the attribute.When the data types match, we can inherit use the compression methodspecified 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 VondraReviewed-by: Justin Pryzby <pryzby@telsasoft.com>Discussion:https://postgr.es/m/e0367f27-392c-321a-7411-a58e1a7e4817%40enterprisedb.com
1 parentaa25d10 commit882b2cd

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

‎src/backend/access/brin/brin_tuple.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,10 +213,22 @@ brin_form_tuple(BrinDesc *brdesc, BlockNumber blkno, BrinMemTuple *tuple,
213213
(atttype->typstorage==TYPSTORAGE_EXTENDED||
214214
atttype->typstorage==TYPSTORAGE_MAIN))
215215
{
216+
Datumcvalue;
217+
charcompression;
216218
Form_pg_attributeatt=TupleDescAttr(brdesc->bd_tupdesc,
217219
keyno);
218-
Datumcvalue=toast_compress_datum(value,
219-
att->attcompression);
220+
221+
/*
222+
* If the BRIN summary and indexed attribute use the same data
223+
* type, we can use the same compression method. Otherwise we
224+
* have to use the default method.
225+
*/
226+
if (att->atttypid==atttype->type_id)
227+
compression=att->attcompression;
228+
else
229+
compression=GetDefaultToastCompression();
230+
231+
cvalue=toast_compress_datum(value,compression);
220232

221233
if (DatumGetPointer(cvalue)!=NULL)
222234
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp