{"record":{"id":"626ca821224a8b9c","repo":"prestodb/presto","slug":"not-supported-626ca8","errorCode":"NOT_SUPPORTED","errorMessage":"Alter Function is not supported in JsonFileBasedFunctionNamespaceManager","messagePattern":"Alter Function is not supported in JsonFileBasedFunctionNamespaceManager","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-function-namespace-managers/src/main/java/com/facebook/presto/functionNamespace/json/JsonFileBasedFunctionNamespaceManager.java","lineNumber":348,"sourceCode":"    {\n        checkFunctionLanguageSupported(function);\n        SqlFunctionId functionId = function.getFunctionId();\n        if (!replace && latestFunctions.containsKey(function.getFunctionId())) {\n            throw new PrestoException(GENERIC_USER_ERROR, format(\"Function '%s' already exists\", functionId.getId()));\n        }\n\n        SqlInvokedFunction replacedFunction = latestFunctions.get(functionId);\n        long version = 1;\n        if (replacedFunction != null) {\n            version = parseLong(replacedFunction.getRequiredVersion()) + 1;\n        }\n        latestFunctions.put(functionId, function.withVersion(String.valueOf(version)));\n    }\n\n    @Override\n    public void alterFunction(QualifiedObjectName functionName, Optional<List<TypeSignature>> parameterTypes, AlterRoutineCharacteristics alterRoutineCharacteristics)\n    {\n        throw new PrestoException(NOT_SUPPORTED, \"Alter Function is not supported in JsonFileBasedFunctionNamespaceManager\");\n    }\n\n    @Override\n    public void dropFunction(QualifiedObjectName functionName, Optional<List<TypeSignature>> parameterTypes, boolean exists)\n    {\n        throw new PrestoException(NOT_SUPPORTED, \"Drop Function is not supported in JsonFileBasedFunctionNamespaceManager\");\n    }\n\n    @Override\n    public Collection<SqlInvokedFunction> listFunctions(Optional<String> likePattern, Optional<String> escape)\n    {\n        return latestFunctions.values();\n    }\n\n    @Override\n    public void addUserDefinedType(UserDefinedType userDefinedType)\n    {\n        QualifiedObjectName name = userDefinedType.getUserDefinedTypeName();","sourceCodeStart":330,"sourceCodeEnd":366,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-function-namespace-managers/src/main/java/com/facebook/presto/functionNamespace/json/JsonFileBasedFunctionNamespaceManager.java#L330-L366","documentation":"Feature sentinel: the JSON-file function-namespace manager is read-mostly and does not implement ALTER FUNCTION; only CREATE (with replace semantics via createFunction) is supported against the JSON file.","triggerScenarios":"Calling alterFunction(functionName, parameterTypes, alterRoutineCharacteristics) on a catalog backed by JsonFileBasedFunctionNamespaceManager (e.g. issuing ALTER FUNCTION statements routed to this manager).","commonSituations":"Running ALTER FUNCTION ... SET CHARACTERISTICS / metadata SQL against a catalog configured with the JSON file namespace manager; migration scripts assuming MySQL-style manager features.","solutions":["Edit the function definition JSON file and reload instead of using ALTER FUNCTION","Use a function namespace manager that supports DDL (e.g. the REST/DB-backed manager)"],"exampleFix":"// before\nmanager.alterFunction(name, paramTypes, characteristics);\n// after\nmanager.createFunction(updatedFunction, true);","handlingStrategy":"type-guard","validationCode":"if (manager instanceof JsonFileBasedFunctionNamespaceManager) {\n    throw new UnsupportedOperationException(\"alterFunction unsupported; use createFunction(replace=true)\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    manager.alterFunction(name, types, chars);\n} catch (PrestoException e) {\n    if (isNotSupported(e)) { /* fall back to createFunction(replace=true) */ } else { throw e; }\n}","preventionTips":["Feature-detect manager capabilities before issuing ALTER FUNCTION","Route metadata changes through createFunction(replace=true)","Do not use JSON-backed catalogs for function lifecycle DDL"],"tags":["sql-functions","not-supported","function-namespace"],"backgroundTag":"operation-not-supported","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-12T02:17:10.037Z"}