Skip to content

feat: use PG_MODULE_MAGIC_EXT in PostgreSQL 18 and later - #203

Merged
Komzpa merged 2 commits into
postgis:mainfrom
jeltz:pg-module-magic-ext
Jun 8, 2026
Merged

feat: use PG_MODULE_MAGIC_EXT in PostgreSQL 18 and later#203
Komzpa merged 2 commits into
postgis:mainfrom
jeltz:pg-module-magic-ext

Conversation

@jeltz

@jeltz jeltz commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

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

I updated the change log myself, just tell me if that is against the project practice.

@coderabbitai

coderabbitai Bot commented Jun 8, 2026

Copy link
Copy Markdown

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: a1082354-ce0a-47c9-ad69-9a50562428aa

📥 Commits

Reviewing files that changed from the base of the PR and between 5558840 and 05f4d86.

📒 Files selected for processing (2)
  • CHANGELOG.md
  • h3_postgis/src/config.h.in
✅ Files skipped from review due to trivial changes (2)
  • h3_postgis/src/config.h.in
  • CHANGELOG.md

📝 Walkthrough

Walkthrough

Adds build-time config header generation for h3_postgis and updates both h3 and h3_postgis init files to conditionally use PG_MODULE_MAGIC_EXT on PostgreSQL 18+ while maintaining PG_MODULE_MAGIC for older PostgreSQL versions. CHANGELOG updated to mention the change.

Changes

PostgreSQL 18+ Compatibility

Layer / File(s) Summary
h3_postgis Configuration Infrastructure
h3_postgis/src/config.h.in, h3_postgis/CMakeLists.txt
New config.h.in template defines POSTGRESQL_PGH3_VERSION and CMake configure_file generates src/config.h; build directory added to target include paths.
h3_postgis Module Initialization
h3_postgis/src/init.c
Include generated config.h and conditionally use PG_MODULE_MAGIC_EXT on PostgreSQL 18+ with module name/version, falling back to PG_MODULE_MAGIC.
h3 Extension Module Initialization
h3/src/init.c
Include config.h and conditionally use PG_MODULE_MAGIC_EXT on PostgreSQL 18+ with module name and POSTGRESQL_H3_VERSION, falling back to PG_MODULE_MAGIC.
Release Notes
CHANGELOG.md
Add changelog bullet under Unreleased documenting the PG_MODULE_MAGIC_EXT requirement for PostgreSQL 18+ and update reference link definitions.

🎯 3 (Moderate) | ⏱️ ~20 minutes

I nibble at headers, stitch version threads,
Configure and build where the tiny token treads.
Magic hops to eighteen, politely stays back when not,
A rabbit's tidy patch — a lightweight spot. 🐇✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The pull request title accurately and concisely describes the main change: adopting PG_MODULE_MAGIC_EXT for PostgreSQL 18 and later.
Description check ✅ Passed The description explains the purpose of the change (PG_MODULE_MAGIC_EXT enables version visibility in pg_get_loaded_modules) and relates directly to the changeset modifications.
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

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@CHANGELOG.md`:
- Line 25: Fix the typo in the CHANGELOG entry referring to PostgreSQL: update
the release note line that mentions "Use `PG_MODULE_MAGIC_EXT` macro in
PostgreSQL 18 an later ([Andreas Karlsson])" to read "and later" instead of "an
later" so the text becomes "Use `PG_MODULE_MAGIC_EXT` macro in PostgreSQL 18 and
later ([Andreas Karlsson])"; ensure the `PG_MODULE_MAGIC_EXT` mention and author
attribution remain unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2bbad8a7-46be-4e0f-8980-52d94e4bf88d

📥 Commits

Reviewing files that changed from the base of the PR and between 5319a1d and 2045995.

📒 Files selected for processing (5)
  • CHANGELOG.md
  • h3/src/init.c
  • h3_postgis/CMakeLists.txt
  • h3_postgis/src/config.h.in
  • h3_postgis/src/init.c

Comment thread CHANGELOG.md Outdated
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().
@jeltz
jeltz force-pushed the pg-module-magic-ext branch from 2045995 to 5558840 Compare June 8, 2026 14:46
@Komzpa

Komzpa commented Jun 8, 2026

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Komzpa Komzpa left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@codex can you fix this in the branch?

Comment thread CHANGELOG.md Outdated
Comment thread h3_postgis/src/config.h.in Outdated
@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create an environment for this repo.

@Komzpa

Komzpa commented Jun 8, 2026

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Komzpa
Komzpa merged commit 9d70e9c into postgis:main Jun 8, 2026
35 checks passed
@Komzpa

Komzpa commented Jun 8, 2026

Copy link
Copy Markdown
Member

@jeltz thank you!

@jeltz

jeltz commented Jun 9, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the speedy merge!

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.

2 participants