[ https://issues.apache.org/jira/browse/CALCITE-6310?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17848753#comment-17848753 ]
James Duong edited comment on CALCITE-6310 at 5/22/24 10:17 PM: ---------------------------------------------------------------- The current implementation of REGEXP_REPLACE allows implicit conversion for the start and end integer values from string to integer Eg "REGEXP_REPLACE('abc def ghi', '[a-z]+', 'X', '2')" however PostgreSQL semantics allow the flags parameter to appear at the same indices as the start and end integer values Eg "REGEXP_REPLACE('abc def ghi', '[a-z]+', 'X', 'c')" Supporting the PostgreSQL semantics will break the implicit conversion since we can't tell if the user intent was to interpret the input as a flag or a position. Should we proceed with this? Thoughts [~tanclary] [~julianhyde] was (Author: jduong): The current implementation of REGEXP_REPLACE allows implicit conversion for the start and end integer values from string to integer Eg "REGEXP_REPLACE('abc def ghi', '[a-z]+', 'X', '2')" however PostgreSQL semantics allow the flags parameter to appear at the same indices as the start and end integer values Eg "REGEXP_REPLACE('abc def ghi', '[a-z]+', 'X', 'c')" Supporting the PostgreSQL semantics will break the implicit conversion. > Add REGEXP_REPLACE function (enabled in PostgreSQL library) > ----------------------------------------------------------- > > Key: CALCITE-6310 > URL: https://issues.apache.org/jira/browse/CALCITE-6310 > Project: Calcite > Issue Type: Sub-task > Reporter: James Duong > Assignee: James Duong > Priority: Minor > > * There is an existing implementation. > * PostgreSQL requires supporting an optional extra flags argument -- This message was sent by Atlassian Jira (v8.20.10#820010)