From 80a69ad2afb91f245764793d45df5d83a58ec0dc Mon Sep 17 00:00:00 2001 From: Karina Litskevich Date: Fri, 1 Sep 2023 11:01:46 +0300 Subject: [PATCH] Add support for PostgreSQL v16 --- decode.c | 14 ++++++++++++++ pg_filedump.c | 2 +- stringinfo.c | 4 ++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/decode.c b/decode.c index bf28189..7542b9d 100644 --- a/decode.c +++ b/decode.c @@ -244,6 +244,7 @@ static bool copyStringInitDone = false; static char decompress_tmp_buff[64 * 1024]; /* Used by some PostgreSQL macro definitions */ +#if PG_VERSION_NUM < 160000 void ExceptionalCondition(const char *conditionName, const char *errorType, @@ -257,6 +258,19 @@ ExceptionalCondition(const char *conditionName, lineNumber); exit(1); } +#else +void +ExceptionalCondition(const char *conditionName, + const char *fileName, + int lineNumber) +{ + printf("Exceptional condition: name = %s, type = FailedAssertion, fname = %s, line = %d\n", + conditionName ? conditionName : "(NULL)", + fileName ? fileName : "(NULL)", + lineNumber); + exit(1); +} +#endif /* Append given string to current COPY line */ static void diff --git a/pg_filedump.c b/pg_filedump.c index 8b6be98..c4f2989 100644 --- a/pg_filedump.c +++ b/pg_filedump.c @@ -681,7 +681,7 @@ GetBlockSize(FILE *fp) rewind(fp); if (bytesRead == sizeof(PageHeaderData)) - localSize = (unsigned int) PageGetPageSize(&localCache); + localSize = (unsigned int) PageGetPageSize(localCache); else { printf("Error: Unable to read full page header from block 0.\n" diff --git a/stringinfo.c b/stringinfo.c index 8d54bee..637d643 100644 --- a/stringinfo.c +++ b/stringinfo.c @@ -75,7 +75,11 @@ appendStringInfoString(StringInfo str, const char *s) * if necessary. */ void +#if PG_VERSION_NUM < 160000 appendBinaryStringInfo(StringInfo str, const char *data, int datalen) +#else +appendBinaryStringInfo(StringInfo str, const void *data, int datalen) +#endif { assert(str != NULL); -- 2.39.5