Replace effects only the first match when using postgres

18 views
Skip to first unread message

Vasil Vasilev

unread,
Nov 15, 2022, 8:17:13 AM11/15/22
to ontop4obda
Hello,

The following query returns "ZBC AA" when executed against Postgres:
select ?s where {
    bind(replace(
            'ABC AA', 'A', 'Z'
        ) as ?s)
}
It matches only the first 'A' in the string "ABC AA". The replace function in SPARQL will replace all of them.
The same query returns "ZBC ZZ" against H2 database. I can see that in Postgres there are two types of replace functions - REPLACE that replaces all of the matches and REGEXP_REPLACE that changes only the first match and my assumption is that the replace is translated to REGEXP_REPLACE. 
Is that the expected behavior or is it a bug that needs to be fixed?

Kind regards,
Vasil 

Benjamin Cogrel

unread,
Nov 17, 2022, 4:55:37 AM11/17/22
to Vasil Vasilev, ontop4obda
Hi Vasil,

Thanks for reporting the issue. That is indeed a bug.

I just opened an issue to track it: https://github.com/ontop/ontop/issues/569 .
It should be a priori easy to fix.

Best,
Benjamin


--
Please follow our guidelines on how to report a bug https://ontop-vkg.org/community/contributing/bug-report
---
You received this message because you are subscribed to the Google Groups "ontop4obda" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ontop4obda+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ontop4obda/39c83031-4588-4678-83a2-43154e691ecan%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages