diff --git a/cstore_compression.c b/cstore_compression.c index 5ea77d0..3b37fd4 100644 --- a/cstore_compression.c +++ b/cstore_compression.c @@ -141,6 +141,7 @@ DecompressBuffer(StringInfo buffer, CompressionType compressionType) decompressedData = palloc0(decompressedDataSize); #if PG_VERSION_NUM >= 90500 + #if PG_VERSION_NUM >= 120000 decompressedByteCount = pglz_decompress(CSTORE_COMPRESS_RAWDATA(buffer->data), compressedDataSize, decompressedData, diff --git a/cstore_fdw.c b/cstore_fdw.c index 623d509..94c7018 100644 --- a/cstore_fdw.c +++ b/cstore_fdw.c @@ -986,13 +986,7 @@ DistributedTable(Oid relationId) bool distributedTable = false; Oid partitionOid = InvalidOid; Relation heapRelation = NULL; -#if PG_VERSION_NUM >= 120000 TableScanDesc scanDesc = NULL; -#define heap_beginscan table_beginscan -#define heap_endscan table_endscan -#else - HeapScanDesc scanDesc = NULL; -#endif const int scanKeyCount = 1; ScanKeyData scanKey[1]; HeapTuple heapTuple = NULL; @@ -1017,13 +1011,13 @@ DistributedTable(Oid relationId) ScanKeyInit(&scanKey[0], ATTR_NUM_PARTITION_RELATION_ID, InvalidStrategy, F_OIDEQ, ObjectIdGetDatum(relationId)); - scanDesc = heap_beginscan(heapRelation, SnapshotSelf, scanKeyCount, scanKey); + scanDesc = table_beginscan(heapRelation, SnapshotSelf, scanKeyCount, scanKey); heapTuple = heap_getnext(scanDesc, ForwardScanDirection); distributedTable = HeapTupleIsValid(heapTuple); - heap_endscan(scanDesc); + table_endscan(scanDesc); relation_close(heapRelation, AccessShareLock); return distributedTable; diff --git a/cstore_version_compat.h b/cstore_version_compat.h index 4ea093b..a7f961f 100644 --- a/cstore_version_compat.h +++ b/cstore_version_compat.h @@ -49,6 +49,10 @@ #define TTS_EMPTY(slot) ((slot)->tts_isempty) #define ExecForceStoreHeapTuple(tuple, slot, shouldFree) \ ExecStoreTuple(newTuple, tupleSlot, InvalidBuffer, shouldFree); +#define HeapScanDesc TableScanDesc +#define table_beginscan heap_beginscan +#define table_endscan heap_endscan + #endif #endif /* CSTORE_COMPAT_H */