Skip to content

Commit 758ff98

Browse files
committed
Address comments
Signed-off-by: Moritz Hoffmann <mh@materialize.com>
1 parent 09e3971 commit 758ff98

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/expr/src/scalar.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1229,8 +1229,11 @@ impl MirScalarExpr {
12291229
.map_or("", |expr| expr.as_literal_str().unwrap());
12301230
let (limit, flags) = regexp_replace_parse_flags(flags);
12311231

1232-
// Defer errors until evaluation instead of eagerly returning them here
1233-
// to match the error behavior of the dynamic function (part of database-issues#4972).
1232+
// The behavior of `regexp_replace` is that if the data is `NULL`, the
1233+
// function returns `NULL`, independently of whether the pattern or
1234+
// flags are correct. We need to check for this case and introduce an
1235+
// if-then-else on the error path to only surface the error if the first
1236+
// input is non-NULL.
12341237
*e = match func::build_regex(pattern, &flags) {
12351238
Ok(regex) => {
12361239
let mut exprs = mem::take(exprs);

0 commit comments

Comments
 (0)