mirror of
https://github.com/postgres/postgres.git
synced 2025-11-10 17:42:29 +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:
@@ -103,8 +103,19 @@ index_form_tuple(TupleDesc tupleDescriptor,
|
||||
(att->attstorage == TYPSTORAGE_EXTENDED ||
|
||||
att->attstorage == TYPSTORAGE_MAIN))
|
||||
{
|
||||
Datum cvalue = toast_compress_datum(untoasted_values[i],
|
||||
att->attcompression);
|
||||
Datum cvalue;
|
||||
char compression = att->attcompression;
|
||||
|
||||
/*
|
||||
* If the compression method is not valid, use the default. We
|
||||
* don't expect this to happen for regular index columns, which
|
||||
* inherit the setting from the corresponding table column, but
|
||||
* we do expect it to happen whenever an expression is indexed.
|
||||
*/
|
||||
if (!CompressionMethodIsValid(compression))
|
||||
compression = GetDefaultToastCompression();
|
||||
|
||||
cvalue = toast_compress_datum(untoasted_values[i], compression);
|
||||
|
||||
if (DatumGetPointer(cvalue) != NULL)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user