Why doesn't my alias show up in INFORMATION_SCHEMA.FUNCTION_ALIASES?

不羁岁月 提交于 2020-01-06 02:33:07

问题


I'm using H2 DB v1.4.182 for my test environment. It acts as a substitute in place of Oracle, which is the production vendor. I have a few aliases I create using a script in my test environment:

CREATE ALIAS IF NOT EXISTS REGEXP_LIKE as $$ boolean regexpLike(String s, String p) { return java.util.regex.Pattern.compile(p).matcher(s).find(); } $$;

CREATE ALIAS IF NOT EXISTS TO_NUMBER as $$ long toNumber(String s) { return Long.valueOf(s); } $$;

CREATE ALIAS if NOT EXISTS fn_val_check3 for "fakedata.testutil.TestUtil.fn_val_check";

The first two aliases show up in the INFORMATION_SCHEMA.FUNCTION_ALIASES table, the last one (fn_val_check3) doesn't.

SELECT ALIAS_NAME FROM INFORMATION_SCHEMA.FUNCTION_ALIASES;

Gives me two rows

ALIAS_NAME  
TO_NUMBER
REGEXP_LIKE

I verified that H2 has the other alias somewhere by running the CREATE ALIAS ... directly in the console and it says

CREATE ALIAS fn_val_check3 for "fakedata.testutil.TestUtil.fn_val_check";
Function alias "FN_VAL_CHECK3" already exists; SQL statement: CREATE ALIAS fn_val_check3 for "fakedata.testutil.TestUtil.fn_val_check" [90076-182] 90076/90076 (Help)

I'm using a validation component to verify the function exists in the database, which is why I'm wondering. Am I missing something or is this a known thing?

来源:https://stackoverflow.com/questions/28942779/why-doesnt-my-alias-show-up-in-information-schema-function-aliases

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!