summaryrefslogtreecommitdiff
path: root/dev-db/citus/files/citus-11.2.0-redefine.patch
blob: d45fba3d65a14b6ce92b98cd3c554805feff3cac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
From 341fdb32fc07a3aea2dda2fa33a70d22819be37b Mon Sep 17 00:00:00 2001
From: Jelte Fennema <jelte.fennema@microsoft.com>
Date: Fri, 10 Feb 2023 16:02:03 +0100
Subject: [PATCH] Support compilation and run tests on latest PG versions
 (#6711)

Postgres got minor updates this starts using the images with the latest
version for our tests.

These new Postgres versions caused a compilation issue in PG14 and PG13
due to some function being backported that we had already backported
ourselves. Due this backport being a static inline function it doesn't
matter who provides this and there will be no linkage errors when either
running old Citus packages on new PG versions or the other way around.

(cherry picked from commit 3200187757600180fa2b90a5fdba13cbf8aee8b6)
---
 .circleci/config.yml            | 10 +++++-----
 src/include/pg_version_compat.h | 11 +++++++++++
 2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/.circleci/config.yml b/.circleci/config.yml
index 4905dfbc52c..3a5c30132f6 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -6,19 +6,19 @@ orbs:
 parameters:
   image_suffix:
     type: string
-    default: '-v7e4468f'
+    default: '-vc4b1573'
   pg13_version:
     type: string
-    default: '13.9'
+    default: '13.10'
   pg14_version:
     type: string
-    default: '14.6'
+    default: '14.7'
   pg15_version:
     type: string
-    default: '15.1'
+    default: '15.2'
   upgrade_pg_versions:
     type: string
-    default: '13.9-14.6-15.1'
+    default: '13.10-14.7-15.2'
   style_checker_tools_version:
     type: string
     default: '0.8.18'
diff --git a/src/include/pg_version_compat.h b/src/include/pg_version_compat.h
index fcb857c4111..eb81bca43ac 100644
--- a/src/include/pg_version_compat.h
+++ b/src/include/pg_version_compat.h
@@ -55,6 +55,14 @@ pg_strtoint64(char *s)
 }
 
 
+/*
+ * RelationGetSmgr got backported in 13.10 and 14.7 so redefining it for any
+ * version higher causes compilation errors due to redefining of the function.
+ * We want to use it in all versions. So we backport it ourselves in earlier
+ * versions, and rely on the Postgres provided version in the later versions.
+ */
+#if PG_VERSION_NUM >= PG_VERSION_13 && PG_VERSION_NUM < 130010 \
+	|| PG_VERSION_NUM >= PG_VERSION_14 && PG_VERSION_NUM < 140007
 static inline SMgrRelation
 RelationGetSmgr(Relation rel)
 {
@@ -66,6 +74,9 @@ RelationGetSmgr(Relation rel)
 }
 
 
+#endif
+
+
 #define CREATE_SEQUENCE_COMMAND \
 	"CREATE SEQUENCE IF NOT EXISTS %s AS %s INCREMENT BY " INT64_FORMAT \
 	" MINVALUE " INT64_FORMAT " MAXVALUE " INT64_FORMAT \