aboutsummaryrefslogtreecommitdiffstats
path: root/testing/agensgraph/pg_config-add-major-version.patch
blob: 8f10f366d4e66ef137f17eaa152c67cb33930d48 (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
From: Jakub Jirutka <jakub@jirutka.cz>
Date: Tue, 09 Nov 2021 00:33:22 +0100
Subject: [PATCH] pg_config: Add new option --major-version

We use this option in aports for PostgreSQL extensions to easily get major
version of the default postgresql.

--- a/src/bin/pg_config/pg_config.c
+++ b/src/bin/pg_config/pg_config.c
@@ -65,6 +65,7 @@
 	{"--ldflags_ex", "LDFLAGS_EX"},
 	{"--ldflags_sl", "LDFLAGS_SL"},
 	{"--libs", "LIBS"},
+	{"--major-version", "MAJOR-VERSION"},
 	{"--version", "VERSION"},
 	{NULL, NULL}
 };
@@ -101,6 +102,8 @@
 	printf(_("  --ldflags_ex          show LDFLAGS_EX value used when PostgreSQL was built\n"));
 	printf(_("  --ldflags_sl          show LDFLAGS_SL value used when PostgreSQL was built\n"));
 	printf(_("  --libs                show LIBS value used when PostgreSQL was built\n"));
+	printf(_("  --major-version       show the PostgreSQL major version number\n"
+			 "                        (Alpine Linux specific option)\n"));
 	printf(_("  --version             show the PostgreSQL version\n"));
 	printf(_("  -?, --help            show this help, then exit\n"));
 	printf(_("\nWith no arguments, all known items are shown.\n\n"));
--- a/src/common/config_info.c
+++ b/src/common/config_info.c
@@ -38,7 +38,7 @@
 	int			i = 0;
 
 	/* Adjust this to match the number of items filled below */
-	*configdata_len = 23;
+	*configdata_len = 24;
 	configdata = (ConfigData *) palloc(*configdata_len * sizeof(ConfigData));
 
 	configdata[i].name = pstrdup("BINDIR");
@@ -193,6 +193,11 @@
 
 	configdata[i].name = pstrdup("VERSION");
 	configdata[i].setting = pstrdup("PostgreSQL " PG_VERSION);
+	i++;
+
+	// XXX-Patched: Alpine Linux specific, used in extension aports.
+	configdata[i].name = pstrdup("MAJOR-VERSION");
+	configdata[i].setting = pstrdup(PG_MAJORVERSION);
 	i++;
 
 	Assert(i == *configdata_len);