Add support for PostgreSQL v12
authorGuillaume Lelarge <guillaume@lelarge.info>
Thu, 28 Nov 2019 11:31:55 +0000 (12:31 +0100)
committerChristoph Berg <christoph.berg@credativ.de>
Thu, 28 Nov 2019 11:31:55 +0000 (12:31 +0100)
decode.c
pg_filedump.c

index a842675c15979a4007dd5fa984d7f55c9f6de545..9415baa3d175be35f291a2d7dd4a9cad0a5b2c62 100644 (file)
--- a/decode.c
+++ b/decode.c
@@ -898,7 +898,11 @@ decode_string(const char *buffer, unsigned int buff_size, unsigned int *out_size
                }
 
                decompress_ret = pglz_decompress(VARDATA_4B_C(buffer), len - 2 * sizeof(uint32),
-                                                                                decompress_tmp_buff, decompressed_len);
+                                                                                decompress_tmp_buff, decompressed_len
+#if PG_VERSION_NUM >= 120000
+                                                                                , true
+#endif
+                                                                                );
                if ((decompress_ret != decompressed_len) || (decompress_ret < 0))
                {
                        printf("WARNING: Unable to decompress a string. Data is corrupted.\n");
@@ -979,7 +983,11 @@ static int DumpCompressedString(const char *data, int32 decompressed_size)
 
        decompress_ret = pglz_decompress(TOAST_COMPRESS_RAWDATA(data),
                        decompressed_size - TOAST_COMPRESS_HEADER_SIZE,
-                       decompress_tmp_buff, TOAST_COMPRESS_RAWSIZE(data));
+                       decompress_tmp_buff, TOAST_COMPRESS_RAWSIZE(data)
+#if PG_VERSION_NUM >= 120000
+                       , true
+#endif
+                       );
        if ((decompress_ret != TOAST_COMPRESS_RAWSIZE(data)) ||
                        (decompress_ret < 0))
        {
index 318e4bdad384935446c6ab5ad88fd6a2f1faa0dc..a2722e1886b6f66580f7ea5750add21baf66cdb9 100644 (file)
@@ -1314,9 +1314,11 @@ FormatItem(char *buffer, unsigned int numBytes, unsigned int startIndex,
                                   HeapTupleHeaderGetRawXmax(htup),
                                   HeapTupleHeaderGetRawCommandId(htup));
 
+#if PG_VERSION_NUM < 120000
                        if (infoMask & HEAP_HASOID)
                                printf("  OID: %u",
                                           HeapTupleHeaderGetOid(htup));
+#endif
 
                        printf("\n"
                                   "  Block Id: %u  linp Index: %u   Attributes: %d   Size: %d\n",
@@ -1334,8 +1336,10 @@ FormatItem(char *buffer, unsigned int numBytes, unsigned int startIndex,
                                strcat(flagString, "HASVARWIDTH|");
                        if (infoMask & HEAP_HASEXTERNAL)
                                strcat(flagString, "HASEXTERNAL|");
+#if PG_VERSION_NUM < 120000
                        if (infoMask & HEAP_HASOID)
                                strcat(flagString, "HASOID|");
+#endif
                        if (infoMask & HEAP_XMAX_KEYSHR_LOCK)
                                strcat(flagString, "XMAX_KEYSHR_LOCK|");
                        if (infoMask & HEAP_COMBOCID)
@@ -1380,8 +1384,10 @@ FormatItem(char *buffer, unsigned int numBytes, unsigned int startIndex,
                        else
                                bitmapLength = 0;
 
+#if PG_VERSION_NUM < 120000
                        if (infoMask & HEAP_HASOID)
                                oidLength += sizeof(Oid);
+#endif
 
                        computedLength =
                                MAXALIGN(localBitOffset + bitmapLength + oidLength);
@@ -1774,7 +1780,12 @@ FormatControl(char *buffer)
 #endif
                           (uint32) (checkPoint->redo >> 32), (uint32) checkPoint->redo,
                           checkPoint->ThisTimeLineID,
+#if PG_VERSION_NUM < 120000
                           checkPoint->nextXidEpoch, checkPoint->nextXid,
+#else
+                          EpochFromFullTransactionId(checkPoint->nextFullXid),
+                          XidFromFullTransactionId(checkPoint->nextFullXid),
+#endif
                           checkPoint->nextOid,
                           checkPoint->nextMulti, checkPoint->nextMultiOffset,
                           ctime(&cp_time),