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 07:11:00 UTC
[jira] [Updated] (CALCITE-6774) REPLACE function returns wrong result when search pattern is an empty string
[ https://issues.apache.org/jira/browse/CALCITE-6774?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
ZheHu updated CALCITE-6774:
---------------------------
Summary: REPLACE function returns wrong result when search pattern is an empty string (was: REPLACE function returns wrong result when search pattern is empty string)
> REPLACE function returns wrong result when search pattern is an 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
> Priority: Major
>
> 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)