[
https://issues.apache.org/jira/browse/CALCITE-6923?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17941700#comment-17941700
]
Julian Hyde commented on CALCITE-6923:
--------------------------------------
Can you add some tests to some .iq files? It would be helpful to see the actual
SQL query and output. This is especially true because backslashes are involved,
and if test cases are written in Java (or BigQuery's dialect of SQL) then the
backslashes need to be escaped.
I see that {{{}big-query.iq{}}}, {{postgresql.iq}} and {{redshift.iq}}
currently have tests for {{{}REGEXP_REPLACE{}}}. It would be useful if there
was an {{oracle.iq}} test even though (I presume) this is not affected by your
fix.
Since there are several functions called REGEXP_REPLACE, can you be explicit
(in the summary and commit message) which libraries are affected by this bug
and this fix.
> REGEXP_REPLACE backward references not working
> ----------------------------------------------
>
> Key: CALCITE-6923
> URL: https://issues.apache.org/jira/browse/CALCITE-6923
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.38.0
> Reporter: Ulrich Kramer
> Priority: Minor
> Labels: pull-request-available
>
> REGEXP_REPLACE builtin function differs from Postgres/BigQuery
> The builtin function is using {{$1}} for backward reference. Postgres and
> [BigQuery|https://cloud.google.com/bigquery/docs/reference/standard-sql/string_functions#regexp_replace]
> are using {{\1}}.
> {code:SQL}
> SELECT REGEXP_REPLACE('abc','([bc]+)','$1','g')
> {code}
> produces {{abc}}. Running the same query against Postgres or BigQuery will
> return {{a$1}}.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)