Issue with Alias and User Defined Function

237 views
Skip to first unread message

Kyle Reiter

unread,
Jun 28, 2019, 2:14:11 PM6/28/19
to H2 Database
I am having an issue with a User Defined function in an integration test with an embedded H2 database that shares the same name as an H2 Function.  I am using version 1.4.199 of H2.

CREATE SCHEMA DBMS_LOB;
CREATE ALIAS DBMS_LOB.SUBSTR AS '
String substring(String value, Long max, Long start) {
return "value";
}
';

The error I get is Function Alias SUBSTR already exists.  If I change the alias to DBMS_LOB.SUBSTRR, then the code works as expected.  However, I then have to change my query which will cause it to not work against my real oracle database.  I would have thought giving the Alias a schema would not cause issues with the SUBSTR, but that doesn't seem to be the case.  

Any tips on how to work around this issue?

Noel Grandin

unread,
Jun 28, 2019, 3:17:49 PM6/28/19
to h2-da...@googlegroups.com
You can append BUILTIN_ALIAS_OVERRIDE=1 to your H2 URL and it will allow overriding the normal functions.


Reply all
Reply to author
Forward
0 new messages