diff --git a/engine.c b/engine.c index 329f13a..afaae1f 100644 --- a/engine.c +++ b/engine.c @@ -117,16 +117,25 @@ is_cfm_file_path(const char *filepath) { off_t get_cfs_relation_file_decompressed_size(RelFileNodeBackend rnode, const char *fullpath, ForkNumber forknum) { File fd; - int compressor; off_t size; +#if PG_VERSION_NUM >= 120000 + int compressor; compressor = md_get_compressor_internal(nodeOf(rnode), rnode.backend, forknum); fd = PathNameOpenFile(fullpath, O_RDWR | PG_BINARY, compressor); +#else + fd = PathNameOpenFile(fullpath, O_RDWR | PG_BINARY | PG_COMPRESSION); +#endif if(fd < 0) return (off_t)-1; +#if PG_VERSION_NUM >= 120000 size = FileSize(fd); +#else + size = FileSeek(fd, 0, SEEK_END); +#endif + FileClose(fd); return size; diff --git a/engine.h b/engine.h index 3ba868c..56777fc 100644 --- a/engine.h +++ b/engine.h @@ -45,7 +45,7 @@ #define PTRACK_MAGIC_SIZE 4 /* CFS support macro */ -#if defined(PGPRO_EE) && PG_VERSION_NUM >= 120000 +#if defined(PGPRO_EE) && PG_VERSION_NUM >= 110000 #define CFS_SUPPORT 1 #endif