1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-09 06:21:09 +03:00

Fix interaction of TOAST compression with expression indexes.

Before, trying to compress a value for insertion into an expression
index would crash.

Dilip Kumar, with some editing by me. Report by Jaime Casanova.

Discussion: http://postgr.es/m/CAJKUy5gcs0zGOp6JXU2mMVdthYhuQpFk=S3V8DOKT=LZC1L36Q@mail.gmail.com
This commit is contained in:
Robert Haas
2021-03-25 19:55:32 -04:00
parent 71f4c8c6f7
commit 5db1fd7823
6 changed files with 54 additions and 5 deletions

View File

@@ -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();