Skip to content

Port snowflake to PostgreSQL 19#40

Merged
mason-sharp merged 1 commit into
mainfrom
spoc-610
Jul 6, 2026
Merged

Port snowflake to PostgreSQL 19#40
mason-sharp merged 1 commit into
mainfrom
spoc-610

Conversation

@danolivo

@danolivo danolivo commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Summary

Adapts the snowflake extension to build against PostgreSQL 19, tracking two upstream changes in the PG19 development cycle. All changes are guarded by PG_VERSION_NUM so the module continues to compile on PG ≤18.

Changes

1. Sequence WAL definitions moved to a new header

PG19 commit a87987cafca ("Move WAL sequence code into its own file") split the sequence WAL definitions out of commands/sequence.h into a new commands/sequence_xlog.h. The symbols SEQ_MAGIC, sequence_magic, xl_seq_rec and XLOG_SEQ_LOG — all used by snowflake_nextval() and read_seq_tuple() — now live there.

  • Include commands/sequence_xlog.h on PG19+ (guarded, since the header does not exist on earlier branches).
  • Guard the module's local SEQ_MAGIC define and sequence_magic struct behind #if PG_VERSION_NUM < 190000, so on PG19 they resolve solely from the upstream header and there is no duplicate-definition conflict. On ≤18 the header never exported them, so the local definitions are still required.

2. <time.h> no longer reached transitively

snowflake_nextval() calls clock_gettime(CLOCK_REALTIME, ...). On PG ≤18 the system <time.h> was pulled in transitively through the backend header chain; PG19 header-dependency cleanups (the instr_time.h TSC rework and removal of the clock_gettime configure probe) removed that path. Verified: without the include, PG19 fails with call to undeclared function 'clock_gettime' / undeclared identifier 'CLOCK_REALTIME', and no other included header provides the declaration.

Added an explicit #include <time.h> — the standard "include what you use" fix, applied unconditionally as it is harmless on all supported branches.

@danolivo danolivo self-assigned this Jul 6, 2026
@danolivo danolivo added the enhancement New feature or request label Jul 6, 2026
PG19 commit a87987cafca ("Move WAL sequence code into its own file")
split the sequence WAL definitions out of commands/sequence.h into a new
commands/sequence_xlog.h. Include that header on PG19+ so SEQ_MAGIC,
sequence_magic, xl_seq_rec and XLOG_SEQ_LOG keep resolving, and guard the
module's local SEQ_MAGIC/sequence_magic definitions behind the pre-19
version check to avoid duplicate definitions.

Also add an explicit <time.h> include for clock_gettime()/struct timespec.
On PG <=18 <time.h> was pulled in transitively through the backend header
chain, but PG19 header-dependency cleanups (the instr_time.h TSC rework and
removal of the clock_gettime configure probe) pruned that path, so without
the include PG19 fails with "call to undeclared function 'clock_gettime'".
Following the "include what you use" rule, add it directly; it is harmless
on all supported branches.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@danolivo, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 47 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e4a856d1-cdd0-468c-998c-0feb8255773a

📥 Commits

Reviewing files that changed from the base of the PR and between 5860f2c and fa8f647.

📒 Files selected for processing (1)
  • snowflake.c
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch spoc-610

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.

@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.

@danolivo
danolivo requested a review from mason-sharp July 6, 2026 09:32
@mason-sharp
mason-sharp merged commit 168f4b9 into main Jul 6, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants