Skip to content

test: cover regexp_replace multiline flag#22287

Open
Sean-Kenneth-Doherty wants to merge 1 commit into
apache:mainfrom
Sean-Kenneth-Doherty:codex/regexp-replace-m-flag
Open

test: cover regexp_replace multiline flag#22287
Sean-Kenneth-Doherty wants to merge 1 commit into
apache:mainfrom
Sean-Kenneth-Doherty:codex/regexp-replace-m-flag

Conversation

@Sean-Kenneth-Doherty
Copy link
Copy Markdown

Which issue does this PR close?

Rationale for this change

PostgreSQL-compatible regexp_replace should honor the multiline flag m so anchors like ^ can match after newlines. The issue report covers regexp_replace(E'a\nb', '^b', 'x', 'm'), which should produce a\nx.

Current main already returns the PostgreSQL-compatible result, so this PR adds explicit regression coverage to keep that behavior from drifting.

What changes are included in this PR?

  • Adds Rust unit coverage for scalar/static regexp_replace with flag m.
  • Adds sqllogictest coverage for m and gm multiline flag behavior.

Are these changes tested?

  • cargo fmt --all
  • TMPDIR=/home/sean/Projects/datafusion-regexp-replace/target/tmp cargo test -p datafusion-functions regex::regexpreplace::tests::test_static_pattern_regexp_replace_multiline_flag -- --nocapture
  • TMPDIR=/home/sean/Projects/datafusion-regexp-replace/target/tmp cargo test --profile=ci --test sqllogictests -- regexp/regexp_replace.slt
  • TMPDIR=/home/sean/Projects/datafusion-regexp-replace/target/tmp cargo clippy --all-targets --all-features -- -D warnings
  • git diff --check

Are there any user-facing changes?

No behavior change intended. This adds regression coverage for PostgreSQL-compatible multiline regexp_replace behavior.

@github-actions github-actions Bot added sqllogictest SQL Logic Tests (.slt) functions Changes to functions implementation labels May 17, 2026
@Sean-Kenneth-Doherty
Copy link
Copy Markdown
Author

Fresh validation on the PR head (b50d56520):

  • TMPDIR=/home/sean/Projects/datafusion-regexp-replace/target/tmp cargo test -p datafusion-functions regex::regexpreplace::tests::test_static_pattern_regexp_replace_multiline_flag -- --nocapture -> passed (1 passed)
  • TMPDIR=/home/sean/Projects/datafusion-regexp-replace/target/tmp cargo test --profile=ci --test sqllogictests -- regexp/regexp_replace.slt -> passed (1/1 files completed)
  • cargo fmt --all -- --check -> passed
  • git diff --check origin/main...HEAD -> clean

GitHub Actions only ran the labeler for this PR, so this leaves current regression evidence visible for review.

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_replace should honor PostgreSQL multiline flag m

1 participant