Skip to content

Revert delta patch removal#454

Open
mason-sharp wants to merge 11 commits into
mainfrom
revert-delta-patch-removal
Open

Revert delta patch removal#454
mason-sharp wants to merge 11 commits into
mainfrom
revert-delta-patch-removal

Conversation

@mason-sharp
Copy link
Copy Markdown
Member

@mason-sharp mason-sharp commented May 5, 2026

Do later in conjuction with a major Postgres release instead.

@mason-sharp mason-sharp marked this pull request as draft May 5, 2026 03:36
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 5, 2026

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

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: 95b74d95-247b-4948-89c3-929fafcaa04e

📥 Commits

Reviewing files that changed from the base of the PR and between c6d6e44 and c4e48f2.

⛔ Files ignored due to path filters (3)
  • tests/regress/expected/autoddl.out is excluded by !**/*.out
  • tests/regress/expected/basic.out is excluded by !**/*.out
  • tests/regress/expected/infofuncs.out is excluded by !**/*.out
📒 Files selected for processing (22)
  • Makefile
  • include/spock.h
  • include/spock_relcache.h
  • patches/15/pg15-015-attoptions.diff
  • patches/16/pg16-015-attoptions.diff
  • patches/17/pg17-015-attoptions.diff
  • patches/18/pg18-015-attoptions.diff
  • sql/spock--5.0.8--6.0.0.sql
  • sql/spock--6.0.0.sql
  • src/spock.c
  • src/spock_apply.c
  • src/spock_apply_heap.c
  • src/spock_autoddl.c
  • src/spock_executor.c
  • src/spock_relcache.c
  • src/spock_repset.c
  • tests/docker/Dockerfile-step-1.el9
  • tests/regress/sql/autoddl.sql
  • tests/regress/sql/basic.sql
  • tests/regress/sql/infofuncs.sql
  • tests/tap/schedule
  • tests/tap/t/012_delta_apply.pl
💤 Files with no reviewable changes (6)
  • tests/regress/sql/basic.sql
  • tests/tap/schedule
  • tests/regress/sql/infofuncs.sql
  • src/spock.c
  • include/spock.h
  • tests/tap/t/012_delta_apply.pl
✅ Files skipped from review due to trivial changes (1)
  • Makefile
🚧 Files skipped from review as they are similar to previous changes (11)
  • tests/docker/Dockerfile-step-1.el9
  • src/spock_apply.c
  • tests/regress/sql/autoddl.sql
  • patches/15/pg15-015-attoptions.diff
  • src/spock_autoddl.c
  • src/spock_executor.c
  • include/spock_relcache.h
  • patches/17/pg17-015-attoptions.diff
  • src/spock_apply_heap.c
  • patches/16/pg16-015-attoptions.diff
  • patches/18/pg18-015-attoptions.diff

📝 Walkthrough

Walkthrough

This PR migrates Spock's delta-apply configuration from security-label-based setup to per-column attribute reloptions across PostgreSQL 15–18, removes the security-label provider hook, updates DDL validation to reject SEC LABEL statements, and removes obsolete tests.

Changes

Delta-Apply Configuration and Provider Migration

Layer / File(s) Summary
Build-time configuration and header cleanup
Makefile, include/spock.h
Add NO_LOG_OLD_VALUE conditional build flag; remove SPOCK_SECLABEL_PROVIDER macro definition.
Data structure updates for delta-apply
include/spock_relcache.h
Reorder SpockRelation fields so has_delta_columns precedes delta_apply_functions; remove get_replication_identity(Relation rel) public function declaration.
PostgreSQL 15–18 attribute reloptions and heap update
patches/15/pg15-015-attoptions.diff, patches/16/pg16-015-attoptions.diff, patches/17/pg17-015-attoptions.diff, patches/18/pg18-015-attoptions.diff
For each PG version, register log_old_value (bool) and delta_apply_function (string) attribute reloptions, extend AttributeOpts struct, introduce HeapDetermineLogOldColumns() helper to scan per-column settings during heap_update(), and modify ExtractReplicaIdentity() to accept logged_old_attrs bitmap and union it into replica-identity key columns.
Relcache delta-apply resolution from attribute options
src/spock_relcache.c
Replace security-label-based delta-apply lookup with per-column AttributeOpts.delta_apply_function resolution in spock_relation_open(); remove get_replication_identity() helper; simplify cache allocation sites.
Delta tuple application with NULL-old special case
src/spock_apply_heap.c, src/spock_apply_heap.c (conditional compilation guard)
Wrap build_delta_tuple in #ifndef NO_LOG_OLD_VALUE guards; handle NULL remote-old values by direct application of remote-new value; compute delta via OidFunctionCall3Coll() for non-NULL old values.
Security-label provider hook removal
src/spock.c, src/spock_executor.c
Delete spock_object_relabel() hook and its _PG_init registration; remove DeleteSecurityLabels() helper and eliminate OAT_POST_ALTER security-label cleanup logic.
DDL validation and replication logic updates
src/spock_apply.c, src/spock_autoddl.c, src/spock_repset.c
Remove SEC LABEL exception from DDL statement filtering in spock_execute_sql_command; require LOGSTMT_DDL in autoddl_can_proceed without exception; simplify replication_set_add_table validation to check rd_replidindex directly.
SQL migration and function updates
sql/spock--5.0.8--6.0.0.sql, sql/spock--6.0.0.sql
Add spock.wait_for_sync_event() procedure overloads (origin_id and origin name variants); remove PL/pgSQL delta_apply() helper; reformat C delta_apply() numeric-type function declarations.
Test and environment cleanup
tests/regress/sql/autoddl.sql, tests/regress/sql/basic.sql, tests/regress/sql/infofuncs.sql, tests/tap/schedule, tests/tap/t/012_delta_apply.pl, tests/docker/Dockerfile-step-1.el9
Remove security-label propagation and delta_apply tests from regression suite; delete 012_delta_apply TAP test; remove branch specification from Spockbench Docker git clone.

Poem

A rabbit hops from labels old to options new and clean,
Where columns speak their secrets through AttributeOpts seen.
No more the seclabel provider—it hops into the past,
While delta-apply dances swiftly, per-column, built to last. 🐇✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 46.15% 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 title 'Revert delta patch removal' directly and accurately describes the main change—reverting prior removal of delta-related patches and infrastructure.
Description check ✅ Passed The description 'Do later in conjunction with a major Postgres release instead' clearly explains the rationale for the revert, relating it to deferring changes to coordinate with PostgreSQL releases.
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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch revert-delta-patch-removal

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

codacy-production Bot commented May 5, 2026

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
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.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/spock_apply_heap.c (1)

764-805: ⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Linker error when NO_LOG_OLD_VALUE is defined.

The call to build_delta_tuple at line 785 is unconditional, but the function definition (lines 575-645) is wrapped in #ifndef NO_LOG_OLD_VALUE. When NO_LOG_OLD_VALUE is defined, this will cause an undefined reference linker error.

The if (rel->has_delta_columns) check is a runtime guard and does not prevent compilation/linking failures.

🐛 Proposed fix: wrap the delta_columns block with compile-time guard
+#ifndef NO_LOG_OLD_VALUE
 	if (rel->has_delta_columns)
 	{
 		SpockTupleData deltatup;
 		HeapTuple	currenttuple;

 		/*
 		 * Depending on previous conflict resolution our final NEW tuple will
 		 * be based on either the incoming remote tuple or the existing local
 		 * one and then the delta processing on top of that.
 		 */
 		if (apply)
 		{
 			currenttuple = ExecFetchSlotHeapTuple(remoteslot, true,
 												  &clear_remoteslot);
 		}
 		else
 		{
 			currenttuple = ExecFetchSlotHeapTuple(localslot, true,
 												  &clear_localslot);
 		}
 		oldctx = MemoryContextSwitchTo(GetPerTupleMemoryContext(estate));
 		build_delta_tuple(rel, oldtup, newtup, &deltatup, localslot);
 		if (!apply)
 		{
 			/*
 			 * We are overriding apply=false because of delta apply.
 			 */
 			apply = true;
 			is_delta_apply = true;

 			/* Count the DCA event in stats */
 			handle_stats_counter(rel->rel, MyApplyWorker->subid,
 								 SPOCK_STATS_DCA_COUNT, 1);
 		}
 		applytuple = heap_modify_tuple(currenttuple,
 									   RelationGetDescr(rel->rel),
 									   deltatup.values,
 									   deltatup.nulls,
 									   deltatup.changed);
 		MemoryContextSwitchTo(oldctx);
 		slot_store_htup(remoteslot, rel, applytuple);
 	}
+#endif /* NO_LOG_OLD_VALUE */
🤖 Prompt for 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.

In `@src/spock_apply_heap.c` around lines 764 - 805, The call to build_delta_tuple
inside the rel->has_delta_columns block will fail to link when NO_LOG_OLD_VALUE
is defined because the function is conditionally compiled; wrap the entire
delta-processing block (the if (rel->has_delta_columns) { ... } that contains
build_delta_tuple, is_delta_apply, handle_stats_counter, heap_modify_tuple and
slot_store_htup calls) with the same compile-time guard used for the function
definition (`#ifndef` NO_LOG_OLD_VALUE / `#endif`) or alternatively conditionally
omit only the build_delta_tuple and dependent logic when NO_LOG_OLD_VALUE is
defined so the code compiles and links cleanly.
🧹 Nitpick comments (2)
patches/17/pg17-015-attoptions.diff (1)

178-181: 💤 Low value

Note: original idattrs from RelationGetIndexAttrBitmap is overwritten by bms_union.

The bitmap returned by RelationGetIndexAttrBitmap(INDEX_ATTR_BITMAP_IDENTITY_KEY) is leaked when idattrs = bms_union(idattrs, logged_old_attrs); reassigns. This is the prior behavior of the restored patch and is short-lived (freed at end of statement memory context), so no functional defect — flagging only as awareness for the future delta rework alongside the major PG release.

🤖 Prompt for 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.

In `@patches/17/pg17-015-attoptions.diff` around lines 178 - 181,
RelationGetIndexAttrBitmap(INDEX_ATTR_BITMAP_IDENTITY_KEY) returns a bitmap that
must not be leaked; instead of overwriting idattrs with bms_union(...) directly,
compute the union into a temporary Bitmapset, free the original idattrs, then
assign the temp to idattrs (i.e. use bms_union to produce a new set, call
bms_free on the prior idattrs, then set idattrs = <union result>); reference
symbols: RelationGetIndexAttrBitmap, INDEX_ATTR_BITMAP_IDENTITY_KEY, idattrs,
logged_old_attrs, bms_union, and bms_free.
src/spock_relcache.c (1)

110-134: 💤 Low value

Consider using OidIsValid for clarity.

At line 112, the check aopt->delta_apply_function != 0 works correctly but OidIsValid(aopt->delta_apply_function) would be more idiomatic for PostgreSQL code.

♻️ Suggested improvement
-			if (aopt != NULL && aopt->delta_apply_function != 0)
+			if (aopt != NULL && OidIsValid(aopt->delta_apply_function))
🤖 Prompt for 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.

In `@src/spock_relcache.c` around lines 110 - 134, Replace the non-idiomatic
numeric check "aopt->delta_apply_function != 0" with the PostgreSQL helper
OidIsValid(aopt->delta_apply_function) in the block that retrieves attribute
options (see get_attribute_options and the aopt->delta_apply_function usage),
leaving the rest of the logic (spock_lookup_delta_function, error elog, setting
entry->delta_apply_functions) unchanged so the presence of a valid Oid is tested
in the canonical way.
🤖 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.

Outside diff comments:
In `@src/spock_apply_heap.c`:
- Around line 764-805: The call to build_delta_tuple inside the
rel->has_delta_columns block will fail to link when NO_LOG_OLD_VALUE is defined
because the function is conditionally compiled; wrap the entire delta-processing
block (the if (rel->has_delta_columns) { ... } that contains build_delta_tuple,
is_delta_apply, handle_stats_counter, heap_modify_tuple and slot_store_htup
calls) with the same compile-time guard used for the function definition
(`#ifndef` NO_LOG_OLD_VALUE / `#endif`) or alternatively conditionally omit only the
build_delta_tuple and dependent logic when NO_LOG_OLD_VALUE is defined so the
code compiles and links cleanly.

---

Nitpick comments:
In `@patches/17/pg17-015-attoptions.diff`:
- Around line 178-181:
RelationGetIndexAttrBitmap(INDEX_ATTR_BITMAP_IDENTITY_KEY) returns a bitmap that
must not be leaked; instead of overwriting idattrs with bms_union(...) directly,
compute the union into a temporary Bitmapset, free the original idattrs, then
assign the temp to idattrs (i.e. use bms_union to produce a new set, call
bms_free on the prior idattrs, then set idattrs = <union result>); reference
symbols: RelationGetIndexAttrBitmap, INDEX_ATTR_BITMAP_IDENTITY_KEY, idattrs,
logged_old_attrs, bms_union, and bms_free.

In `@src/spock_relcache.c`:
- Around line 110-134: Replace the non-idiomatic numeric check
"aopt->delta_apply_function != 0" with the PostgreSQL helper
OidIsValid(aopt->delta_apply_function) in the block that retrieves attribute
options (see get_attribute_options and the aopt->delta_apply_function usage),
leaving the rest of the logic (spock_lookup_delta_function, error elog, setting
entry->delta_apply_functions) unchanged so the presence of a valid Oid is tested
in the canonical way.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 86d20554-645c-4a37-a1eb-0f38188fb106

📥 Commits

Reviewing files that changed from the base of the PR and between b7fc702 and 5e33c19.

⛔ Files ignored due to path filters (3)
  • tests/regress/expected/autoddl.out is excluded by !**/*.out
  • tests/regress/expected/basic.out is excluded by !**/*.out
  • tests/regress/expected/infofuncs.out is excluded by !**/*.out
📒 Files selected for processing (21)
  • Makefile
  • include/spock.h
  • include/spock_relcache.h
  • patches/15/pg15-015-attoptions.diff
  • patches/16/pg16-015-attoptions.diff
  • patches/17/pg17-015-attoptions.diff
  • patches/18/pg18-015-attoptions.diff
  • sql/spock--5.0.6--6.0.0-devel.sql
  • sql/spock--6.0.0-devel.sql
  • src/spock.c
  • src/spock_apply.c
  • src/spock_apply_heap.c
  • src/spock_autoddl.c
  • src/spock_executor.c
  • src/spock_relcache.c
  • src/spock_repset.c
  • tests/regress/sql/autoddl.sql
  • tests/regress/sql/basic.sql
  • tests/regress/sql/infofuncs.sql
  • tests/tap/schedule
  • tests/tap/t/012_delta_apply.pl
💤 Files with no reviewable changes (7)
  • tests/regress/sql/infofuncs.sql
  • include/spock.h
  • tests/tap/t/012_delta_apply.pl
  • tests/tap/schedule
  • tests/regress/sql/basic.sql
  • src/spock.c
  • sql/spock--5.0.6--6.0.0-devel.sql

@mason-sharp mason-sharp force-pushed the revert-delta-patch-removal branch from 5e33c19 to 519ab81 Compare May 10, 2026 20:51
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/spock_executor.c (1)

198-272: ⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

Keep a compatibility cleanup path for legacy Spock security labels.

Line 243 now returns immediately for Spock-owned drops, and this patch also removes the old post-alter cleanup path. If an upgraded cluster still has SECURITY LABEL FOR spock entries from the previous delta implementation, this leaves no scrub path for that catalog state on drop/alter anymore. Please either retain the legacy cleanup until a catalog migration removes those labels, or add that migration in the same change; otherwise this revert is not upgrade-safe.

🤖 Prompt for 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.

In `@src/spock_executor.c` around lines 198 - 272, The early return for
Spock-owned drops in spock_object_access (triggered by dropping_spock_obj)
removes the legacy cleanup path for old "SECURITY LABEL FOR spock" entries;
restore a compatibility cleanup by either calling a cleanup helper (e.g.,
implement/invoke spock_scrub_legacy_security_labels(&object) or similar) before
returning when dropping_spock_obj is true, or add a catalog migration (e.g.,
spock_migrate_remove_security_labels) in the same change to remove those labels
during upgrade; ensure the code path is reachable from spock_object_access so
legacy labels are scrubbed on DROP/ALTER.
🤖 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 `@src/spock_relcache.c`:
- Around line 99-133: The loop writes delta_apply_functions using local
attribute indexes (entry->attmap[i]) but the array was allocated for the remote
column count, so before scanning the local TupleDesc (RelationGetDescr(desc))
resize/allocate or memset-zero entry->delta_apply_functions to the local number
of attributes (TupleDesc->natts) and set entry->has_delta_columns = false; then
in the loop, when you find a valid aopt and resolve dfunc via
spock_lookup_delta_function(TupleDescAttr(...)->atttypid) store it into
entry->delta_apply_functions at the local column index (entry->attmap[i]) and
set entry->has_delta_columns = true only when a function is actually stored;
also ensure any leftover entries from previous cache state are cleared so stale
Oids cannot remain (i.e., zero the entire local-width array before recomputing).

---

Outside diff comments:
In `@src/spock_executor.c`:
- Around line 198-272: The early return for Spock-owned drops in
spock_object_access (triggered by dropping_spock_obj) removes the legacy cleanup
path for old "SECURITY LABEL FOR spock" entries; restore a compatibility cleanup
by either calling a cleanup helper (e.g., implement/invoke
spock_scrub_legacy_security_labels(&object) or similar) before returning when
dropping_spock_obj is true, or add a catalog migration (e.g.,
spock_migrate_remove_security_labels) in the same change to remove those labels
during upgrade; ensure the code path is reachable from spock_object_access so
legacy labels are scrubbed on DROP/ALTER.
🪄 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: 948e6c42-9137-4f31-b7c7-94847c9f3b92

📥 Commits

Reviewing files that changed from the base of the PR and between 5e33c19 and 519ab81.

⛔ Files ignored due to path filters (3)
  • tests/regress/expected/autoddl.out is excluded by !**/*.out
  • tests/regress/expected/basic.out is excluded by !**/*.out
  • tests/regress/expected/infofuncs.out is excluded by !**/*.out
📒 Files selected for processing (21)
  • Makefile
  • include/spock.h
  • include/spock_relcache.h
  • patches/15/pg15-015-attoptions.diff
  • patches/16/pg16-015-attoptions.diff
  • patches/17/pg17-015-attoptions.diff
  • patches/18/pg18-015-attoptions.diff
  • sql/spock--5.0.6--6.0.0-devel.sql
  • sql/spock--6.0.0-devel.sql
  • src/spock.c
  • src/spock_apply.c
  • src/spock_apply_heap.c
  • src/spock_autoddl.c
  • src/spock_executor.c
  • src/spock_relcache.c
  • src/spock_repset.c
  • tests/regress/sql/autoddl.sql
  • tests/regress/sql/basic.sql
  • tests/regress/sql/infofuncs.sql
  • tests/tap/schedule
  • tests/tap/t/012_delta_apply.pl
💤 Files with no reviewable changes (7)
  • tests/tap/t/012_delta_apply.pl
  • tests/tap/schedule
  • include/spock.h
  • tests/regress/sql/basic.sql
  • src/spock.c
  • sql/spock--5.0.6--6.0.0-devel.sql
  • tests/regress/sql/infofuncs.sql
🚧 Files skipped from review as they are similar to previous changes (12)
  • src/spock_apply.c
  • include/spock_relcache.h
  • Makefile
  • tests/regress/sql/autoddl.sql
  • src/spock_apply_heap.c
  • src/spock_repset.c
  • sql/spock--6.0.0-devel.sql
  • src/spock_autoddl.c
  • patches/18/pg18-015-attoptions.diff
  • patches/15/pg15-015-attoptions.diff
  • patches/17/pg17-015-attoptions.diff
  • patches/16/pg16-015-attoptions.diff

Comment thread src/spock_relcache.c
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

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 `@src/spock_relcache.c`:
- Around line 126-161: The code assumes the reloption delta_apply_function
exists in PostgreSQL; detect and warn when it is not registered so the user
knows to apply the Postgres-version patches: modify the loop in spock_relcache.c
(around tupdesc_get_att_by_name, get_attribute_options and the
delta_apply_function check) to explicitly log a clear WARNING or ERROR when aopt
is NULL or aopt->delta_apply_function == 0 (e.g., elog(WARNING, "SPOCK:
delta_apply_function reloption not registered; apply
spock/patches/Postgres-version/..."), mentioning the rel and column using
entry->nspname, entry->relname, entry->attnames[i]) so missing Postgres patches
are surfaced instead of silently skipping delta registration; keep existing
behavior for when delta_apply_function is present and continue to call
GET_STRING_RELOPTION, spock_lookup_delta_function and set
entry->delta_apply_functions and entry->has_delta_columns as before.
🪄 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: 92971dd9-39e0-4205-939b-7e521083ad37

📥 Commits

Reviewing files that changed from the base of the PR and between 07eb2cc and c6d6e44.

📒 Files selected for processing (1)
  • src/spock_relcache.c

Comment thread src/spock_relcache.c
@mason-sharp mason-sharp marked this pull request as ready for review May 15, 2026 19:31
mason-sharp and others added 11 commits May 15, 2026 15:28
Skip HeapDetermineLogOldColumns() for catalog relations to avoid
assertion failure during initdb when updating catalog tables.

The fix adds IsCatalogRelationOid check before calling
HeapDetermineLogOldColumns(), same as already done for PG18.

(cherry picked from commit 782d078)
Pointed out by Coderabbit
@mason-sharp mason-sharp force-pushed the revert-delta-patch-removal branch from c6d6e44 to c4e48f2 Compare May 15, 2026 22:30
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