ZheHu created CALCITE-6774:
------------------------------
Summary: REPLACE function returns wrong result when search pattern
is empty string
Key: CALCITE-6774
URL: https://issues.apache.org/jira/browse/CALCITE-6774
Project: Calcite
Issue Type: Bug
Components: core
Affects Versions: 1.38.0
Reporter: ZheHu
Assignee: ZheHu
Run the following test in SqlOperatorTest:
{code:java}
f.checkString("REPLACE('ciao', '', 'ciao')", "ciao", "VARCHAR NOT NULL");
{code}
we will get "ciaocciaoiciaoaciaoociao", however the right result should be
"ciao".
Replace function should return unchanged string when search is an empty string
('').
{code:java}
REPLACE(string, search, replace)
{code}
I've tested this behavior in Oracle, PostgreSQL and SQL Server.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)