pg.ddx.io  reorg/pg_repack GitHub issues and pull requests  
help / color / mirror / Atom feed
[reorg/pg_repack] PR #484: Use PG_MODULE_MAGIC_EXT in PostgreSQL 18 and later
4+ messages / 2 participants
[nested] [flat]

* [reorg/pg_repack] PR #484: Use PG_MODULE_MAGIC_EXT in PostgreSQL 18 and later
@ 2026-05-08 09:23  "jeltz (@jeltz)" <noreply+jeltz@github.com>
  0 siblings, 0 replies; 4+ messages in thread

From: jeltz (@jeltz) @ 2026-05-08 09:23 UTC (permalink / raw)
  To: reorg/pg_repack <noreply+reorg-pg_repack@github.com>

The `PG_MODULE_MAGIC_EXT` macro was added in PostgreSQL 18 and makes it possible to see which version of the library is actually loaded using `pg_get_loaded_modules()`.

inline patch 1: lib/repack.c (+16/-9 lines) download inline-1.patchdiff --git a/lib/repack.c b/lib/repack.c index 6aa519b..ca2c91a 100644 --- a/lib/repack.c +++ b/lib/repack.c @@ -64,7 +64,23 @@ #include "utils/ruleutils.h" #endif +#ifdef REPACK_VERSION +/* macro trick to stringify a macro expansion */ +#define xstr(s) str(s) +#define str(s) #s +#define LIBRARY_VERSION xstr(REPACK_VERSION) +#else +#define LIBRARY_VERSION "unknown" +#endif + +#if PG_VERSION_NUM >= 180000 +PG_MODULE_MAGIC_EXT( + .name = "pg_repack", + .version = LIBRARY_VERSION +); +#else PG_MODULE_MAGIC; +#endif extern Datum PGUT_EXPORT repack_version(PG_FUNCTION_ARGS); extern Datum PGUT_EXPORT repack_trigger(PG_FUNCTION_ARGS); @@ -136,15 +152,6 @@ must_be_owner(Oid relId) #define RENAME_INDEX(relid, newrelname) RenameRelationInternal(relid, newrelname, true, true); #endif -#ifdef REPACK_VERSION -/* macro trick to stringify a macro expansion */ -#define xstr(s) str(s) -#define str(s) #s -#define LIBRARY_VERSION xstr(REPACK_VERSION) -#else -#define LIBRARY_VERSION "unknown" -#endif - Datum repack_version(PG_FUNCTION_ARGS) {
^ permalink raw [nested|flat] 4+ messages in thread

* Re: [reorg/pg_repack] PR #484: Use PG_MODULE_MAGIC_EXT in PostgreSQL 18 and later
@ 2026-05-08 15:57  "za-arthur (@za-arthur)" <noreply+za-arthur@github.com>
  2 siblings, 0 replies; 4+ messages in thread

From: za-arthur (@za-arthur) @ 2026-05-08 15:57 UTC (permalink / raw)
  To: reorg/pg_repack <noreply+reorg-pg_repack@github.com>

Thank you for the improvement! Merging the PR.

^ permalink  raw  [nested|flat] 4+ messages in thread

* Re: [reorg/pg_repack] PR #484: Use PG_MODULE_MAGIC_EXT in PostgreSQL 18 and later
@ 2026-05-08 15:58  "za-arthur (@za-arthur)" <noreply+za-arthur@github.com>
  2 siblings, 0 replies; 4+ messages in thread

From: za-arthur (@za-arthur) @ 2026-05-08 15:58 UTC (permalink / raw)
  To: reorg/pg_repack <noreply+reorg-pg_repack@github.com>

@za-arthur merged this (commit 82120316e840).

^ permalink  raw  [nested|flat] 4+ messages in thread

* Re: [reorg/pg_repack] PR #484: Use PG_MODULE_MAGIC_EXT in PostgreSQL 18 and later
@ 2026-05-08 15:58  "za-arthur (@za-arthur)" <noreply+za-arthur@github.com>
  2 siblings, 0 replies; 4+ messages in thread

From: za-arthur (@za-arthur) @ 2026-05-08 15:58 UTC (permalink / raw)
  To: reorg/pg_repack <noreply+reorg-pg_repack@github.com>

@za-arthur closed this.

^ permalink  raw  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2026-05-08 15:58 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-05-08 09:23 [reorg/pg_repack] PR #484: Use PG_MODULE_MAGIC_EXT in PostgreSQL 18 and later "jeltz (@jeltz)" <noreply+jeltz@github.com>
2026-05-08 15:57 ` "za-arthur (@za-arthur)" <noreply+za-arthur@github.com>
2026-05-08 15:58 ` "za-arthur (@za-arthur)" <noreply+za-arthur@github.com>
2026-05-08 15:58 ` "za-arthur (@za-arthur)" <noreply+za-arthur@github.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox