Skip to content

fix(oracle): validate REGEXP_INSTR return option - #1805

Open
yyqdbngt wants to merge 1 commit into
IvorySQL:masterfrom
yyqdbngt:codex/regexp-instr-return-option
Open

fix(oracle): validate REGEXP_INSTR return option#1805
yyqdbngt wants to merge 1 commit into
IvorySQL:masterfrom
yyqdbngt:codex/regexp-instr-return-option

Conversation

@yyqdbngt

@yyqdbngt yyqdbngt commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Summary

  • reject REGEXP_INSTR return_option values outside 0 and 1
  • add regression coverage for return_option 2

Root cause

The validation checked only the lower bound, while the execution path treated every nonzero value as the end-of-match option.

Validation

  • git diff --check
  • Added focused ora_character_datatype_functions regression coverage; full execution is delegated to the upstream Linux CI because the local Windows environment does not have the IvorySQL build toolchain.

Closes #1799

Summary by CodeRabbit

  • Bug Fixes

    • Corrected regexp_instr validation so the return_option accepts only 0 or 1.
    • Invalid values, such as 2, now return an appropriate out-of-range error.
  • Tests

    • Added regression coverage confirming invalid return_option values are rejected.

Assisted-by: OpenAI:gpt-5

Percentage of AI-generated code: 100%
@coderabbitai

coderabbitai Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: ddbd477f-7c16-478d-8fe3-15851e37fb19

📥 Commits

Reviewing files that changed from the base of the PR and between 5beb990 and 121e4c8.

📒 Files selected for processing (3)
  • contrib/ivorysql_ora/expected/ora_character_datatype_functions.out
  • contrib/ivorysql_ora/sql/ora_character_datatype_functions.sql
  • contrib/ivorysql_ora/src/builtin_functions/character_datatype_functions.c

Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review.


📝 Walkthrough

Walkthrough

ora_regexp_instr now rejects return_option values outside 0–1. Regression coverage verifies that value 2 raises an out-of-range error.

Changes

REGEXP_INSTR validation

Layer / File(s) Summary
Validate and test return_option
contrib/ivorysql_ora/src/builtin_functions/character_datatype_functions.c, contrib/ivorysql_ora/sql/ora_character_datatype_functions.sql, contrib/ivorysql_ora/expected/ora_character_datatype_functions.out
The function rejects return_option values above 1. Regression coverage verifies that value 2 raises an out-of-range error.

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

Merge Risk: ⚪ Minimal · up to 121e4

The change restricts REGEXP_INSTR return_option to the supported values 0 and 1 and adds regression coverage for invalid input; no actionable merge-blocking risk remains after normal checks and review.

Suggested reviewers: ai-yang

🚥 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%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. (2 skipped: 2 … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the Oracle REGEXP_INSTR validation fix and matches the main code and regression-test changes.
Linked Issues check ✅ Passed The pull request satisfies issue #1799. It rejects return_option values outside 0 and 1 by adding an upper-bound check, and it adds regression coverage for return_option = 2. Existing handling for 0 a…
Out of Scope Changes check ✅ Passed All changes are directly related to issue #1799. The code change tightens REGEXP_INSTR validation, and the SQL and expected-output changes add the required regression coverage. No unrelated changes ar…
Full details: Linked Issues check

Explanation

The pull request satisfies issue #1799. It rejects return_option values outside 0 and 1 by adding an upper-bound check, and it adds regression coverage for return_option = 2. Existing handling for 0 and 1 remains unchanged.

Full details: Out of Scope Changes check

Explanation

All changes are directly related to issue #1799. The code change tightens REGEXP_INSTR validation, and the SQL and expected-output changes add the required regression coverage. No unrelated changes are present.

Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. (2 skipped: 2 unsupported.)

  • Fix all pre-merge checks with AI
✨ 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.

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.

REGEXP_INSTR accepts invalid return_option values

1 participant