Skip to content

Use PG_MODULE_MAGIC_EXT in PostgreSQL 18 and later#463

Open
jeltz wants to merge 1 commit into
pgEdge:mainfrom
jeltz:pg-module-magic-ext
Open

Use PG_MODULE_MAGIC_EXT in PostgreSQL 18 and later#463
jeltz wants to merge 1 commit into
pgEdge:mainfrom
jeltz:pg-module-magic-ext

Conversation

@jeltz
Copy link
Copy Markdown

@jeltz jeltz commented May 8, 2026

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().

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().
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 8, 2026

Review Change Stack
No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 867434c2-ead3-45fe-bffa-873e6caa4d07

📥 Commits

Reviewing files that changed from the base of the PR and between f0a3d64 and baae98b.

📒 Files selected for processing (2)
  • src/spock.c
  • src/spock_output.c

📝 Walkthrough

Walkthrough

Two PostgreSQL modules (spock.c and spock_output.c) are updated to use the new PG_MODULE_MAGIC_EXT macro for PostgreSQL 18+, explicitly declaring module name and version. Older versions fall back to PG_MODULE_MAGIC. The output plugin also includes the core header and retains its existing initialization logic.

Changes

PostgreSQL 18+ Module Magic Migration

Layer / File(s) Summary
Core Module Magic Update
src/spock.c
Module-magic initialization uses PG_MODULE_MAGIC_EXT with module name "spock" and SPOCK_VERSION for PostgreSQL 18+, falling back to PG_MODULE_MAGIC for older versions.
Output Plugin Module Magic Update
src/spock_output.c
Includes spock.h and conditionally uses PG_MODULE_MAGIC_EXT with module name "spock_output" and SPOCK_VERSION for PostgreSQL 18+, with legacy fallback for older versions.
Plugin Initialization (Unchanged)
src/spock_output.c
The _PG_output_plugin_init function continues to load spock's output plugin init and forward the callback unchanged.

Poem

🐰 A rabbit hops through version trees,
Module magic now with metadata—
PostgreSQL eighteen sees the breeze,
Names and versions clear for all to plea,
While older versions rest with ease.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: updating code to use PG_MODULE_MAGIC_EXT for PostgreSQL 18 and later.
Description check ✅ Passed The description is related to the changeset, explaining the purpose of PG_MODULE_MAGIC_EXT and why it was added.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codacy-production
Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 duplication

Metric Results
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@mason-sharp mason-sharp requested a review from danolivo May 8, 2026 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant