{"record":{"id":"e545ce9f809639c2","repo":"prestodb/presto","slug":"generic-user-error-e545ce","errorCode":"GENERIC_USER_ERROR","errorMessage":"Function has more than %s parameters: %s","messagePattern":"Function has more than (.+?) parameters: (.+?)","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-function-namespace-managers/src/main/java/com/facebook/presto/functionNamespace/mysql/MySqlFunctionNamespaceManager.java","lineNumber":165,"sourceCode":"    }\n\n    @Override\n    public void createFunction(SqlInvokedFunction function, boolean replace)\n    {\n        checkCatalog(function);\n        checkFunctionLanguageSupported(function);\n        checkArgument(!function.hasVersion(), \"function '%s' is already versioned\", function);\n\n        QualifiedObjectName functionName = function.getFunctionId().getFunctionName();\n        checkFieldLength(\"Catalog name\", functionName.getCatalogName(), MAX_CATALOG_NAME_LENGTH);\n        checkFieldLength(\"Schema name\", functionName.getSchemaName(), MAX_SCHEMA_NAME_LENGTH);\n        if (!functionNamespaceDao.functionNamespaceExists(functionName.getCatalogName(), functionName.getSchemaName())) {\n            throw new PrestoException(NOT_FOUND, format(\"Function namespace not found: %s\", functionName.getCatalogSchemaName()));\n        }\n        checkFieldLength(\"Function name\", functionName.getObjectName(), MAX_FUNCTION_NAME_LENGTH);\n\n        if (function.getParameters().size() > MAX_PARAMETER_COUNT) {\n            throw new PrestoException(GENERIC_USER_ERROR, format(\"Function has more than %s parameters: %s\", MAX_PARAMETER_COUNT, function.getParameters().size()));\n        }\n        for (Parameter parameter : function.getParameters()) {\n            checkFieldLength(\"Parameter name\", parameter.getName(), MAX_PARAMETER_NAME_LENGTH);\n        }\n\n        checkFieldLength(\n                \"Parameter type list\",\n                function.getFunctionId().getArgumentTypes().stream()\n                        .map(TypeSignature::toString)\n                        .collect(joining(\",\")),\n                MAX_PARAMETER_TYPES_LENGTH);\n        checkFieldLength(\"Return type\", function.getSignature().getReturnType().toString(), MAX_RETURN_TYPE_LENGTH);\n\n        jdbi.useTransaction(handle -> {\n            FunctionNamespaceDao transactionDao = handle.attach(functionNamespaceDaoClass);\n            Optional<SqlInvokedFunctionRecord> latestVersion = transactionDao.getLatestRecordForUpdate(hash(function.getFunctionId()), function.getFunctionId());\n            if (!replace && latestVersion.isPresent() && !latestVersion.orElseThrow().isDeleted()) {\n                throw new PrestoException(ALREADY_EXISTS, \"Function already exists: \" + function.getFunctionId());","sourceCodeStart":147,"sourceCodeEnd":183,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-function-namespace-managers/src/main/java/com/facebook/presto/functionNamespace/mysql/MySqlFunctionNamespaceManager.java#L147-L183","documentation":"createFunction enforces a maximum parameter count (MAX_PARAMETER_COUNT) per SQL-invoked function to keep stored signatures within MySQL field/row limits and sane query planning. Exceeding it throws GENERIC_USER_ERROR.","triggerScenarios":"Calling createFunction with function.getParameters().size() > MAX_PARAMETER_COUNT.","commonSituations":"Code-generated SQL functions with very long parameter lists; bulk-generating overloads; porting a function from a system without a parameter limit.","solutions":["Reduce the number of parameters by grouping them into a ROW type or map parameter.","Split the function into multiple narrower functions/overloads.","If the limit is genuinely too low for a legitimate use, increase MAX_PARAMETER_COUNT in the source and redeploy.","Reformulate the SQL function to take fewer, richer arguments."],"exampleFix":"// before\nCREATE FUNCTION f(a1 bigint, ..., a200 bigint) ...\n// after\nCREATE FUNCTION f(inputs row(a1 bigint, ..., a200 bigint)) ...","handlingStrategy":"validation","validationCode":"if (function.getParameters().size() > MAX_PARAMETER_COUNT) {\n    throw new IllegalArgumentException(\"too many parameters: \" + function.getParameters().size());\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep SQL function parameter lists small; group args into ROW types","Check MAX_PARAMETER_COUNT when generating overloads programmatically","Review code-generated signatures before registration"],"tags":["sql-functions","mysql","limits"],"backgroundTag":"limit-exceeded","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"}