Skip to content

Fix conflicting SHARD option validation - #1401

Merged
gaoxueyu merged 1 commit into
IvorySQL:masterfrom
messere1:codex/fix-sequence-shard-conflict
Jul 17, 2026
Merged

gaoxueyu merged 1 commit into
IvorySQL:masterfrom
messere1:codex/fix-sequence-shard-conflict

Conversation

@messere1

@messere1 messere1 commented Jul 15, 2026 •

Copy link
Copy Markdown
Contributor

fix #1402

Summary

  • use shardcnt when validating duplicate or conflicting SHARD options
  • add Oracle regression coverage for SHARD EXTEND combined with NOSHARD

Background

The Clang warning check in #1386 exposed that shardcnt was incremented but never read. The following validation condition mistakenly checked keepcnt, copied from the preceding KEEP/NOKEEP block. As a result, conflicting SHARD options were not rejected by the existing error path.

This runtime logic fix is split from #1386 so that the Clang CI PR remains CI-only.

Testing

  • make check
  • make oracle-check (250 tests)

Summary by CodeRabbit

  • Bug Fixes
    • Corrected validation for conflicting sequence sharding options.
    • Invalid combinations such as SHARD EXTEND NOSHARD are now consistently rejected with an accurate error location.

Related issue

Discovered while implementing the Clang warning check requested in #1221. The runtime fix is kept in this separate PR so that #1386 remains CI-only.

Use the SHARD option counter when checking for duplicate or conflicting SHARD clauses instead of the unrelated KEEP counter.

Add an Oracle regression case covering conflicting SHARD EXTEND and NOSHARD options.

Assisted-by: OpenAI:gpt-5
Copilot AI review requested due to automatic review settings July 15, 2026 06:07

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Jul 15, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The sequence parser now uses shardcnt when detecting conflicting shard options. Regression coverage verifies that SHARD EXTEND NOSHARD is rejected with the expected error and caret position.

Changes

Sequence shard option validation

Layer / File(s) Summary
Correct shard conflict validation
src/backend/commands/sequence.c, src/oracle_test/regress/sql/sequence.sql, src/oracle_test/regress/expected/sequence.out
The parser checks shard option occurrences with shardcnt, and regression output verifies rejection of SHARD EXTEND NOSHARD.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: copilot, hs-liuxh

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main fix to SHARD option validation.
✨ 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.

@bigplaice

Copy link
Copy Markdown
Collaborator

Good catch! I agree this is a real bug. Thanks for fixing it.

@bigplaice

Copy link
Copy Markdown
Collaborator

fix issue #1402

@bigplaice bigplaice self-assigned this Jul 17, 2026
@gaoxueyu
gaoxueyu merged commit 1e6aa76 into IvorySQL:master Jul 17, 2026
8 of 10 checks passed
hs-liuxh pushed a commit to hs-liuxh/IvorySQL that referenced this pull request Sep 2, 2026
…rd-conflict

Fix conflicting SHARD option validation

(cherry picked from commit 1e6aa76)
hs-liuxh pushed a commit to hs-liuxh/IvorySQL that referenced this pull request Sep 2, 2026
…rd-conflict

Fix conflicting SHARD option validation

(cherry picked from commit 1e6aa76)
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.

wrong variable is used in init_params()

4 participants