Skip to content

Commit

Permalink
Minor refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
mtuncer committed Feb 17, 2020
1 parent 31ed8df commit 00e1cbe
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
1 change: 1 addition & 0 deletions cstore_compression.c
Expand Up @@ -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,
Expand Down
10 changes: 2 additions & 8 deletions cstore_fdw.c
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions cstore_version_compat.h
Expand Up @@ -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 */

0 comments on commit 00e1cbe

Please sign in to comment.