Skip to content

fix: align regexp_instr empty-pattern behavior with PostgreSQL#22288

Open
toby-bridges wants to merge 1 commit into
apache:mainfrom
toby-bridges:fix/issue-22257-postgresql-compatibility-regexp-instr-wi
Open

fix: align regexp_instr empty-pattern behavior with PostgreSQL#22288
toby-bridges wants to merge 1 commit into
apache:mainfrom
toby-bridges:fix/issue-22257-postgresql-compatibility-regexp-instr-wi

Conversation

@toby-bridges
Copy link
Copy Markdown

Summary

  • remove the regexp_instr empty-pattern special case that forced 0
  • rely on the existing regex search path so non-empty strings return PostgreSQL-compatible 1-based positions for empty patterns
  • add scalar regression coverage and a sqllogictest case for SELECT regexp_instr('abc', '')

Fixes #22257.

Testing

  • cargo test -p datafusion-functions regexp_instr
  • cargo test -p datafusion-sqllogictest --test sqllogictests -- regexp_instr.slt
  • cargo fmt --all --check
  • git diff --check

@github-actions github-actions Bot added sqllogictest SQL Logic Tests (.slt) functions Changes to functions implementation labels May 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

functions Changes to functions implementation sqllogictest SQL Logic Tests (.slt)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PostgreSQL compatibility: regexp_instr with an empty pattern should return 1

1 participant