{"record":{"id":"279565691a18ec5e","repo":"prestodb/presto","slug":"function-not-found","errorCode":"FUNCTION_NOT_FOUND","errorMessage":"Functions that are not temporary or builtin must be referenced by 'catalog.schema.function_name', found: %s","messagePattern":"Functions that are not temporary or builtin must be referenced by 'catalog\\.schema\\.function_name', found: (.+?)","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-main-base/src/main/java/com/facebook/presto/metadata/FunctionAndTypeManager.java","lineNumber":358,"sourceCode":"                return FunctionAndTypeManager.this.lookupCast(CastType.valueOf(castType), fromType, toType);\n            }\n\n            @Override\n            public void validateFunctionCall(FunctionHandle functionHandle, List<?> arguments)\n            {\n                FunctionAndTypeManager.this.validateFunctionCall(functionHandle, arguments);\n            }\n\n            public QualifiedObjectName qualifyObjectName(QualifiedName name)\n            {\n                if (name.getSuffix().startsWith(\"$internal\")) {\n                    return QualifiedObjectName.valueOf(JAVA_BUILTIN_NAMESPACE, name.getSuffix());\n                }\n                if (!name.getPrefix().isPresent()) {\n                    return QualifiedObjectName.valueOf(defaultNamespace, name.getSuffix());\n                }\n                if (name.getOriginalParts().size() != 3) {\n                    throw new PrestoException(FUNCTION_NOT_FOUND, format(\"Functions that are not temporary or builtin must be referenced by 'catalog.schema.function_name', found: %s\", name));\n                }\n                return QualifiedObjectName.valueOf(name.getParts().get(0), name.getParts().get(1), name.getParts().get(2));\n            }\n        };\n    }\n\n    @Managed\n    @Nested\n    public CacheStatsMBean getFunctionResolutionCacheStats()\n    {\n        return cacheStatsMBean;\n    }\n\n    public void loadFunctionNamespaceManager(\n            String functionNamespaceManagerName,\n            String catalogName,\n            Map<String, String> properties,\n            NodeManager nodeManager,","sourceCodeStart":340,"sourceCodeEnd":376,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-main-base/src/main/java/com/facebook/presto/metadata/FunctionAndTypeManager.java#L340-L376","documentation":"FunctionAndTypeManager.qualifyObjectName normalizes function references. Temporary and built-in functions may be referenced unqualified, but all other functions must use the three-part name catalog.schema.function_name. A 1- or 2-part name for a non-built-in/non-temporary function throws FUNCTION_NOT_FOUND.","triggerScenarios":"Calling/creating/altering a user SQL function with a partially qualified name like schema.fn or just fn when it is neither temporary nor in the built-in namespace (name.getOriginalParts().size() != 3).","commonSituations":"Omitting the catalog when referencing a SQL function; scripts written against engines that allow schema-qualified two-part function names; session catalog confusion.","solutions":["Use the fully qualified name: catalog.schema.function_name.","If the function is meant to be built-in, reference it via the built-in namespace instead.","Declare the function as TEMPORARY if it should be session-scoped and unqualified."],"exampleFix":"// before\nSELECT my_schema.my_fn(1);\n// after\nSELECT my_catalog.my_schema.my_fn(1);","handlingStrategy":"validation","validationCode":"if (parts.size() != 3 && !isTemporary && !isBuiltIn) {\n    throw new IllegalArgumentException(\"use catalog.schema.function_name, got: \" + name);\n}","typeGuard":"boolean isFullyQualifiedFunctionName(String name) { return name.split(\"\\\\.\").length == 3; }","tryCatchPattern":"try { fn = getFunctions(qualify(name)); }\ncatch (PrestoException e) { if (isFunctionNotFound(e)) throw new IllegalArgumentException(\"Fully qualify as catalog.schema.function_name\", e); else throw e; }","preventionTips":["Always write three-part function names","Use TEMPORARY functions for session-local unqualified names","Lint SQL scripts for 1-2 part function references"],"tags":["presto","sql-functions","naming","function-not-found"],"backgroundTag":"function-name-not-qualified","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}