diff --git a/src/gausskernel/optimizer/commands/functioncmds.cpp b/src/gausskernel/optimizer/commands/functioncmds.cpp index e7bf9df1e..f37bb6182 100644 --- a/src/gausskernel/optimizer/commands/functioncmds.cpp +++ b/src/gausskernel/optimizer/commands/functioncmds.cpp @@ -1093,25 +1093,28 @@ void CreateFunction(CreateFunctionStmt* stmt, const char* queryString, Oid pkg_o u_sess->plsql_cxt.isCreateFunction = false; } -#ifdef ENABLE_MULTIPLE_NODES if (languageOid == JavalanguageId) { +#ifdef ENABLE_MULTIPLE_NODES /* * single node dose not support Java UDF or other fenced functions. * check it here because users may not know the Java UDF is fenced by default, * so it's better to report detailed error messages for different senarios. */ if (IS_SINGLE_NODE) { - ereport(ERROR, - (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("JAVA UDF is not yet supported in current version."))); + ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("JAVA UDF is not yet supported in current version."))); } /* only support fenced mode Java UDF */ if (!fenced) { - ereport(ERROR, - (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("Java UDF dose not support NOT FENCED functions."))); + ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("Java UDF dose not support NOT FENCED functions."))); } - } +#else + ereport(ERROR, + (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("JAVA UDF is not yet supported in current version."))); #endif + } languageStruct = (Form_pg_language)GETSTRUCT(languageTuple); diff --git a/src/test/regress/output/single_node_forbidden.source b/src/test/regress/output/single_node_forbidden.source index f62da8373..6799db64e 100644 --- a/src/test/regress/output/single_node_forbidden.source +++ b/src/test/regress/output/single_node_forbidden.source @@ -15,8 +15,9 @@ CREATE FUNCTION java_getSystemProperty(VARCHAR) RETURNS VARCHAR AS 'java.lang.System.getProperty' LANGUAGE java NOT FENCED; +ERROR: JAVA UDF is not yet supported in current version. CREATE FUNCTION java_getSystemProperty(VARCHAR) RETURNS VARCHAR AS 'java.lang.System.getProperty' LANGUAGE java FENCED; -ERROR: function "java_getsystemproperty" already exists with same argument types +ERROR: JAVA UDF is not yet supported in current version. diff --git a/src/test/regress/output/sp_masking_udf.source b/src/test/regress/output/sp_masking_udf.source index 8d40d9231..0b0c7ec25 100644 --- a/src/test/regress/output/sp_masking_udf.source +++ b/src/test/regress/output/sp_masking_udf.source @@ -172,15 +172,17 @@ CREATE FUNCTION java_upperstring(VARCHAR) RETURNS VARCHAR AS 'Example.upperString' LANGUAGE JAVA; +ERROR: JAVA UDF is not yet supported in current version. set role p1 password 'udftest@123'; CREATE RESOURCE LABEL namecol ADD COLUMN(udftest.users.Name); CREATE MASKING POLICY pol_name public.java_upperstring ON LABEL(namecol); -ERROR: failed to mask -DETAIL: wrong masking function +ERROR: Don't find function which can be used by masking +DETAIL: function should be created by poladmin or function is not found drop RESOURCE LABEL namecol; \c --drop udf drop FUNCTION java_upperstring; +ERROR: function java_upperstring does not exist drop masking policy pol_creditcard; drop masking policy pol_sal; drop masking policy pol_phone;