prestodb/presto · error · PrestoException
FUNCTION_NOT_FOUND
FUNCTION_NOT_FOUND
Error message
Functions that are not temporary or builtin must be referenced by 'catalog.schema.function_name', found: %s
What it means
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.
Source
Thrown at presto-main-base/src/main/java/com/facebook/presto/metadata/FunctionAndTypeManager.java:358
return FunctionAndTypeManager.this.lookupCast(CastType.valueOf(castType), fromType, toType);
}
@Override
public void validateFunctionCall(FunctionHandle functionHandle, List<?> arguments)
{
FunctionAndTypeManager.this.validateFunctionCall(functionHandle, arguments);
}
public QualifiedObjectName qualifyObjectName(QualifiedName name)
{
if (name.getSuffix().startsWith("$internal")) {
return QualifiedObjectName.valueOf(JAVA_BUILTIN_NAMESPACE, name.getSuffix());
}
if (!name.getPrefix().isPresent()) {
return QualifiedObjectName.valueOf(defaultNamespace, name.getSuffix());
}
if (name.getOriginalParts().size() != 3) {
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));
}
return QualifiedObjectName.valueOf(name.getParts().get(0), name.getParts().get(1), name.getParts().get(2));
}
};
}
@Managed
@Nested
public CacheStatsMBean getFunctionResolutionCacheStats()
{
return cacheStatsMBean;
}
public void loadFunctionNamespaceManager(
String functionNamespaceManagerName,
String catalogName,
Map<String, String> properties,
NodeManager nodeManager,View on GitHub (pinned to 55bb57d202)
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.
Example fix
// before SELECT my_schema.my_fn(1); // after SELECT my_catalog.my_schema.my_fn(1);
Defensive patterns
Strategy: validation
Validate before calling
if (parts.size() != 3 && !isTemporary && !isBuiltIn) {
throw new IllegalArgumentException("use catalog.schema.function_name, got: " + name);
} Type guard
boolean isFullyQualifiedFunctionName(String name) { return name.split("\\.").length == 3; } Try / catch
try { fn = getFunctions(qualify(name)); }
catch (PrestoException e) { if (isFunctionNotFound(e)) throw new IllegalArgumentException("Fully qualify as catalog.schema.function_name", e); else throw e; } Prevention
- Always write three-part function names
- Use TEMPORARY functions for session-local unqualified names
- Lint SQL scripts for 1-2 part function references
When it happens
Trigger: 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).
Common situations: Omitting the catalog when referencing a SQL function; scripts written against engines that allow schema-qualified two-part function names; session catalog confusion.
Related errors
- DUPLICATE_PARAMETER_NAME
- %s is not lowercase: %s
- FUNCTION_NOT_FOUND
- FUNCTION_IMPLEMENTATION_ERROR
- FUNCTION_NOT_FOUND
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/279565691a18ec5e.
Report an issue: GitHub.