@@ -246,10 +246,10 @@ detoast_attr_slice(struct varlena *attr,
246
246
* Determine maximum amount of compressed data needed for a prefix
247
247
* of a given length (after decompression).
248
248
*
249
- * At least for now, if it's LZ4 data, we'll have to fetch the
250
- * whole thing, because there doesn't seem to be an API call to
251
- * determine how much compressed data we need to be sure of being
252
- * able to decompress the required slice.
249
+ * At least for now, if it's LZ4 or Zstandard data, we'll have to
250
+ * fetch the whole thing, because there doesn't seem to be an API
251
+ * call to determine how much compressed data we need to be sure
252
+ * of being able to decompress the required slice.
253
253
*/
254
254
if (VARATT_EXTERNAL_GET_COMPRESS_METHOD (toast_pointer ) ==
255
255
TOAST_PGLZ_COMPRESSION_ID )
@@ -478,13 +478,15 @@ toast_decompress_datum(struct varlena *attr)
478
478
* Fetch the compression method id stored in the compression header and
479
479
* decompress the data using the appropriate decompression routine.
480
480
*/
481
- cmid = TOAST_COMPRESS_METHOD (attr );
481
+ cmid = VARDATA_COMPRESSED_GET_COMPRESS_METHOD (attr );
482
482
switch (cmid )
483
483
{
484
484
case TOAST_PGLZ_COMPRESSION_ID :
485
485
return pglz_decompress_datum (attr );
486
486
case TOAST_LZ4_COMPRESSION_ID :
487
487
return lz4_decompress_datum (attr );
488
+ case TOAST_ZSTD_NODICT_COMPRESSION_ID :
489
+ return zstd_decompress_datum (attr );
488
490
default :
489
491
elog (ERROR , "invalid compression method id %d" , cmid );
490
492
return NULL ; /* keep compiler quiet */
@@ -514,20 +516,22 @@ toast_decompress_datum_slice(struct varlena *attr, int32 slicelength)
514
516
* have been seen to give wrong results if passed an output size that is
515
517
* more than the data's true decompressed size.
516
518
*/
517
- if ((uint32 ) slicelength >= TOAST_COMPRESS_EXTSIZE (attr ))
519
+ if ((uint32 ) slicelength >= VARDATA_COMPRESSED_GET_EXTSIZE (attr ))
518
520
return toast_decompress_datum (attr );
519
521
520
522
/*
521
523
* Fetch the compression method id stored in the compression header and
522
524
* decompress the data slice using the appropriate decompression routine.
523
525
*/
524
- cmid = TOAST_COMPRESS_METHOD (attr );
526
+ cmid = VARDATA_COMPRESSED_GET_COMPRESS_METHOD (attr );
525
527
switch (cmid )
526
528
{
527
529
case TOAST_PGLZ_COMPRESSION_ID :
528
530
return pglz_decompress_datum_slice (attr , slicelength );
529
531
case TOAST_LZ4_COMPRESSION_ID :
530
532
return lz4_decompress_datum_slice (attr , slicelength );
533
+ case TOAST_ZSTD_NODICT_COMPRESSION_ID :
534
+ return zstd_decompress_datum_slice (attr , slicelength );
531
535
default :
532
536
elog (ERROR , "invalid compression method id %d" , cmid );
533
537
return NULL ; /* keep compiler quiet */
0 commit comments