Skip to content

feat(v3/sem): pin ORE comparators IMMUTABLE + regression test#263

Open
tobyhede wants to merge 1 commit into
eql_v3from
v3-sem-ore-immutable
Open

feat(v3/sem): pin ORE comparators IMMUTABLE + regression test#263
tobyhede wants to merge 1 commit into
eql_v3from
v3-sem-ore-immutable

Conversation

@tobyhede
Copy link
Copy Markdown
Contributor

@tobyhede tobyhede commented Jun 5, 2026

What

Mark the three eql_v3.compare_ore_block_u64_8_256_term(s) overloads IMMUTABLE (term×term, term[]×term[], composite×composite). They previously had no volatility marker and defaulted to VOLATILE.

Why

The comparison is deterministic — its only crypto call, pgcrypto encrypt(), is itself IMMUTABLE STRICT PARALLEL SAFE — so marking the comparators IMMUTABLE lets the planner fold/cache them in ordering and index contexts.

 CREATE FUNCTION eql_v3.compare_ore_block_u64_8_256_term(a …, b …)
   RETURNS integer
+  IMMUTABLE
   SET search_path = pg_catalog, extensions, public

NOT STRICT: the NULL-handling branches in the array overload are load-bearing — a STRICT marker would let PostgreSQL skip the body on a NULL argument.

Test

family::sem::ore_comparators_are_immutable (T8) asserts exactly 3 overloads exist and all carry provolatile = 'i', so a silent regression to VOLATILE fails CI.

Summary by CodeRabbit

Release Notes

  • Improvements

    • Encrypted data comparison functions now explicitly declared as immutable for enhanced query optimization and performance.
    • Enhanced documentation clarifying deterministic comparison behavior and NULL-handling expectations.
  • Tests

    • Added test coverage to validate immutability declarations and prevent future regressions.

The three compare_ore_block_u64_8_256_term(s) overloads (term×term,
term[]×term[], composite×composite) are now IMMUTABLE, diverging from
the v2 originals which default to VOLATILE. The comparison is
deterministic — its only crypto call, pgcrypto encrypt(), is IMMUTABLE —
so the planner can fold/cache in ordering and index contexts. NOT STRICT:
the NULL-handling branches are load-bearing.

T8 (family::sem::ore_comparators_are_immutable) asserts exactly 3
overloads exist and all have provolatile = 'i', so a silent regression
to VOLATILE fails CI.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 5, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d1ab539b-95a5-4b16-9bf0-f61b66e0caef

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • ✅ Review completed - (🔄 Check again to review again)
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch v3-sem-ore-immutable

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.

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