You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "ZheHu (Jira)" <ji...@apache.org> on 2025/01/09 05:25:00 UTC

[jira] [Created] (CALCITE-6774) REPLACE function returns wrong result when search pattern is empty string

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)