Skip to content

Commit 5552736

Browse files
committed
Use PG_MODULE_MAGIC_EXT in our installable shared libraries.
It seems potentially useful to label our shared libraries with version information, now that a facility exists for retrieving that. This patch labels them with the PG_VERSION string. There was some discussion about using semantic versioning conventions, but that doesn't seem terribly helpful for modules with no SQL-level presence; and for those that do have SQL objects, we typically expect them to support multiple revisions of the SQL definitions, so it'd still not be very helpful. I did not label any of src/test/modules/. It seems unnecessary since we don't install those, and besides there ought to be someplace that still provides test coverage for the original PG_MODULE_MAGIC macro. Author: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/dd4d1b59-d0fe-49d5-b28f-1e463b68fa32@gmail.com
1 parent 9324c8c commit 5552736

File tree

89 files changed

+356
-89
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+356
-89
lines changed

contrib/amcheck/verify_nbtree.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@
4242
#include "utils/snapmgr.h"
4343

4444

45-
PG_MODULE_MAGIC;
45+
PG_MODULE_MAGIC_EXT(
46+
.name = "amcheck",
47+
.version = PG_VERSION
48+
);
4649

4750
/*
4851
* A B-Tree cannot possibly have this many levels, since there must be one

contrib/auth_delay/auth_delay.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@
1616
#include "libpq/auth.h"
1717
#include "utils/guc.h"
1818

19-
PG_MODULE_MAGIC;
19+
PG_MODULE_MAGIC_EXT(
20+
.name = "auth_delay",
21+
.version = PG_VERSION
22+
);
2023

2124
/* GUC Variables */
2225
static int auth_delay_milliseconds = 0;

contrib/basebackup_to_shell/basebackup_to_shell.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@
1818
#include "utils/acl.h"
1919
#include "utils/guc.h"
2020

21-
PG_MODULE_MAGIC;
21+
PG_MODULE_MAGIC_EXT(
22+
.name = "basebackup_to_shell",
23+
.version = PG_VERSION
24+
);
2225

2326
typedef struct bbsink_shell
2427
{

contrib/basic_archive/basic_archive.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@
3737
#include "storage/fd.h"
3838
#include "utils/guc.h"
3939

40-
PG_MODULE_MAGIC;
40+
PG_MODULE_MAGIC_EXT(
41+
.name = "basic_archive",
42+
.version = PG_VERSION
43+
);
4144

4245
static char *archive_directory = NULL;
4346

contrib/bloom/blinsert.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@
2222
#include "utils/memutils.h"
2323
#include "utils/rel.h"
2424

25-
PG_MODULE_MAGIC;
25+
PG_MODULE_MAGIC_EXT(
26+
.name = "bloom",
27+
.version = PG_VERSION
28+
);
2629

2730
/*
2831
* State of bloom index build. We accumulate one page data here before

contrib/bool_plperl/bool_plperl.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
#include "plperl.h"
55

66

7-
PG_MODULE_MAGIC;
7+
PG_MODULE_MAGIC_EXT(
8+
.name = "bool_plperl",
9+
.version = PG_VERSION
10+
);
811

912
PG_FUNCTION_INFO_V1(bool_to_plperl);
1013

contrib/btree_gin/btree_gin.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@
1414
#include "utils/timestamp.h"
1515
#include "utils/uuid.h"
1616

17-
PG_MODULE_MAGIC;
17+
PG_MODULE_MAGIC_EXT(
18+
.name = "btree_gin",
19+
.version = PG_VERSION
20+
);
1821

1922
typedef struct QueryInfo
2023
{

contrib/btree_gist/btree_gist.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77
#include "access/stratnum.h"
88
#include "utils/builtins.h"
99

10-
PG_MODULE_MAGIC;
10+
PG_MODULE_MAGIC_EXT(
11+
.name = "btree_gist",
12+
.version = PG_VERSION
13+
);
1114

1215
PG_FUNCTION_INFO_V1(gbt_decompress);
1316
PG_FUNCTION_INFO_V1(gbtreekey_in);

contrib/citext/citext.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@
1010
#include "utils/varlena.h"
1111
#include "varatt.h"
1212

13-
PG_MODULE_MAGIC;
13+
PG_MODULE_MAGIC_EXT(
14+
.name = "citext",
15+
.version = PG_VERSION
16+
);
1417

1518
/*
1619
* ====================

contrib/cube/cube.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@
1717
#include "utils/array.h"
1818
#include "utils/float.h"
1919

20-
PG_MODULE_MAGIC;
20+
PG_MODULE_MAGIC_EXT(
21+
.name = "cube",
22+
.version = PG_VERSION
23+
);
2124

2225
/*
2326
* Taken from the intarray contrib header

contrib/dblink/dblink.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,10 @@
6565
#include "utils/varlena.h"
6666
#include "utils/wait_event.h"
6767

68-
PG_MODULE_MAGIC;
68+
PG_MODULE_MAGIC_EXT(
69+
.name = "dblink",
70+
.version = PG_VERSION
71+
);
6972

7073
typedef struct remoteConn
7174
{

contrib/dict_int/dict_int.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@
1515
#include "commands/defrem.h"
1616
#include "tsearch/ts_public.h"
1717

18-
PG_MODULE_MAGIC;
18+
PG_MODULE_MAGIC_EXT(
19+
.name = "dict_int",
20+
.version = PG_VERSION
21+
);
1922

2023
typedef struct
2124
{

contrib/dict_xsyn/dict_xsyn.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@
2020
#include "tsearch/ts_public.h"
2121
#include "utils/formatting.h"
2222

23-
PG_MODULE_MAGIC;
23+
PG_MODULE_MAGIC_EXT(
24+
.name = "dict_xsyn",
25+
.version = PG_VERSION
26+
);
2427

2528
typedef struct
2629
{

contrib/earthdistance/earthdistance.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@
1111
#define M_PI 3.14159265358979323846
1212
#endif
1313

14-
PG_MODULE_MAGIC;
14+
PG_MODULE_MAGIC_EXT(
15+
.name = "earthdistance",
16+
.version = PG_VERSION
17+
);
1518

1619
/* Earth's radius is in statute miles. */
1720
static const double EARTH_RADIUS = 3958.747716;

contrib/file_fdw/file_fdw.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@
4242
#include "utils/sampling.h"
4343
#include "utils/varlena.h"
4444

45-
PG_MODULE_MAGIC;
45+
PG_MODULE_MAGIC_EXT(
46+
.name = "file_fdw",
47+
.version = PG_VERSION
48+
);
4649

4750
/*
4851
* Describes the valid options for objects that use this wrapper.

contrib/fuzzystrmatch/fuzzystrmatch.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,10 @@
4444
#include "utils/varlena.h"
4545
#include "varatt.h"
4646

47-
PG_MODULE_MAGIC;
47+
PG_MODULE_MAGIC_EXT(
48+
.name = "fuzzystrmatch",
49+
.version = PG_VERSION
50+
);
4851

4952
/*
5053
* Soundex

contrib/hstore/hstore_io.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@
2121
#include "utils/memutils.h"
2222
#include "utils/typcache.h"
2323

24-
PG_MODULE_MAGIC;
24+
PG_MODULE_MAGIC_EXT(
25+
.name = "hstore",
26+
.version = PG_VERSION
27+
);
2528

2629
/* old names for C functions */
2730
HSTORE_POLLUTE(hstore_from_text, tconvert);

contrib/hstore_plperl/hstore_plperl.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
#include "hstore/hstore.h"
55
#include "plperl.h"
66

7-
PG_MODULE_MAGIC;
7+
PG_MODULE_MAGIC_EXT(
8+
.name = "hstore_plperl",
9+
.version = PG_VERSION
10+
);
811

912
/* Linkage to functions in hstore module */
1013
typedef HStore *(*hstoreUpgrade_t) (Datum orig);

contrib/hstore_plpython/hstore_plpython.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
#include "plpy_typeio.h"
66
#include "plpython.h"
77

8-
PG_MODULE_MAGIC;
8+
PG_MODULE_MAGIC_EXT(
9+
.name = "hstore_plpython",
10+
.version = PG_VERSION
11+
);
912

1013
/* Linkage to functions in plpython module */
1114
typedef char *(*PLyObject_AsString_t) (PyObject *plrv);

contrib/intarray/_int_op.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55

66
#include "_int.h"
77

8-
PG_MODULE_MAGIC;
8+
PG_MODULE_MAGIC_EXT(
9+
.name = "intarray",
10+
.version = PG_VERSION
11+
);
912

1013
PG_FUNCTION_INFO_V1(_int_different);
1114
PG_FUNCTION_INFO_V1(_int_same);

contrib/isn/isn.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@
2323
#include "isn.h"
2424
#include "utils/guc.h"
2525

26-
PG_MODULE_MAGIC;
26+
PG_MODULE_MAGIC_EXT(
27+
.name = "isn",
28+
.version = PG_VERSION
29+
);
2730

2831
#ifdef USE_ASSERT_CHECKING
2932
#define ISN_DEBUG 1

contrib/jsonb_plperl/jsonb_plperl.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77
#include "utils/fmgrprotos.h"
88
#include "utils/jsonb.h"
99

10-
PG_MODULE_MAGIC;
10+
PG_MODULE_MAGIC_EXT(
11+
.name = "jsonb_plperl",
12+
.version = PG_VERSION
13+
);
1114

1215
static SV *Jsonb_to_SV(JsonbContainer *jsonb);
1316
static JsonbValue *SV_to_JsonbValue(SV *obj, JsonbParseState **ps, bool is_elem);

contrib/jsonb_plpython/jsonb_plpython.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77
#include "utils/jsonb.h"
88
#include "utils/numeric.h"
99

10-
PG_MODULE_MAGIC;
10+
PG_MODULE_MAGIC_EXT(
11+
.name = "jsonb_plpython",
12+
.version = PG_VERSION
13+
);
1114

1215
/* for PLyObject_AsString in plpy_typeio.c */
1316
typedef char *(*PLyObject_AsString_t) (PyObject *plrv);

contrib/lo/lo.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@
1212
#include "utils/fmgrprotos.h"
1313
#include "utils/rel.h"
1414

15-
PG_MODULE_MAGIC;
15+
PG_MODULE_MAGIC_EXT(
16+
.name = "lo",
17+
.version = PG_VERSION
18+
);
1619

1720

1821
/*

contrib/ltree/ltree_op.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@
1313
#include "utils/selfuncs.h"
1414
#include "varatt.h"
1515

16-
PG_MODULE_MAGIC;
16+
PG_MODULE_MAGIC_EXT(
17+
.name = "ltree",
18+
.version = PG_VERSION
19+
);
1720

1821
/* compare functions */
1922
PG_FUNCTION_INFO_V1(ltree_cmp);

contrib/ltree_plpython/ltree_plpython.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
#include "ltree/ltree.h"
55
#include "plpython.h"
66

7-
PG_MODULE_MAGIC;
7+
PG_MODULE_MAGIC_EXT(
8+
.name = "ltree_plpython",
9+
.version = PG_VERSION
10+
);
811

912
/* Linkage to functions in plpython module */
1013
typedef PyObject *(*PLyUnicode_FromStringAndSize_t) (const char *s, Py_ssize_t size);

contrib/pageinspect/rawpage.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@
2929
#include "utils/rel.h"
3030
#include "utils/varlena.h"
3131

32-
PG_MODULE_MAGIC;
32+
PG_MODULE_MAGIC_EXT(
33+
.name = "pageinspect",
34+
.version = PG_VERSION
35+
);
3336

3437
static bytea *get_raw_page_internal(text *relname, ForkNumber forknum,
3538
BlockNumber blkno);

contrib/passwordcheck/passwordcheck.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@
2525
#include "fmgr.h"
2626
#include "libpq/crypt.h"
2727

28-
PG_MODULE_MAGIC;
28+
PG_MODULE_MAGIC_EXT(
29+
.name = "passwordcheck",
30+
.version = PG_VERSION
31+
);
2932

3033
/* Saved hook value */
3134
static check_password_hook_type prev_check_password_hook = NULL;

contrib/pg_buffercache/pg_buffercache_pages.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@
2020
#define NUM_BUFFERCACHE_SUMMARY_ELEM 5
2121
#define NUM_BUFFERCACHE_USAGE_COUNTS_ELEM 4
2222

23-
PG_MODULE_MAGIC;
23+
PG_MODULE_MAGIC_EXT(
24+
.name = "pg_buffercache",
25+
.version = PG_VERSION
26+
);
2427

2528
/*
2629
* Record structure holding the to be exposed cache data.

contrib/pg_freespacemap/pg_freespacemap.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@
1212
#include "fmgr.h"
1313
#include "storage/freespace.h"
1414

15-
PG_MODULE_MAGIC;
15+
PG_MODULE_MAGIC_EXT(
16+
.name = "pg_freespacemap",
17+
.version = PG_VERSION
18+
);
1619

1720
/*
1821
* Returns the amount of free space on a given page, according to the

contrib/pg_logicalinspect/pg_logicalinspect.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@
1818
#include "utils/builtins.h"
1919
#include "utils/pg_lsn.h"
2020

21-
PG_MODULE_MAGIC;
21+
PG_MODULE_MAGIC_EXT(
22+
.name = "pg_logicalinspect",
23+
.version = PG_VERSION
24+
);
2225

2326
PG_FUNCTION_INFO_V1(pg_get_logical_snapshot_meta);
2427
PG_FUNCTION_INFO_V1(pg_get_logical_snapshot_info);

contrib/pg_prewarm/pg_prewarm.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@
2626
#include "utils/lsyscache.h"
2727
#include "utils/rel.h"
2828

29-
PG_MODULE_MAGIC;
29+
PG_MODULE_MAGIC_EXT(
30+
.name = "pg_prewarm",
31+
.version = PG_VERSION
32+
);
3033

3134
PG_FUNCTION_INFO_V1(pg_prewarm);
3235

contrib/pg_stat_statements/pg_stat_statements.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,10 @@
7171
#include "utils/memutils.h"
7272
#include "utils/timestamp.h"
7373

74-
PG_MODULE_MAGIC;
74+
PG_MODULE_MAGIC_EXT(
75+
.name = "pg_stat_statements",
76+
.version = PG_VERSION
77+
);
7578

7679
/* Location of permanent stats file (valid when database is shut down) */
7780
#define PGSS_DUMP_FILE PGSTAT_STAT_PERMANENT_DIRECTORY "/pg_stat_statements.stat"

0 commit comments

Comments
 (0)