{"record":{"id":"914438960c9ce854","repo":"prestodb/presto","slug":"function-not-found-914438","errorCode":"FUNCTION_NOT_FOUND","errorMessage":"Function not found: %s%s","messagePattern":"Function not found: (.+?)(.+?)","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-main-base/src/main/java/com/facebook/presto/sql/rewrite/ShowQueriesRewrite.java","lineNumber":660,"sourceCode":"            throw new UnsupportedOperationException(\"SHOW CREATE only supported for tables and views\");\n        }\n\n        @Override\n        protected Node visitShowCreateFunction(ShowCreateFunction node, Void context)\n        {\n            QualifiedObjectName functionName = metadata.getFunctionAndTypeManager().getFunctionAndTypeResolver().qualifyObjectName(node.getName());\n            Collection<? extends SqlFunction> functions = metadata.getFunctionAndTypeManager().getFunctions(session, functionName);\n            if (node.getParameterTypes().isPresent()) {\n                List<TypeSignature> parameterTypes = node.getParameterTypes().get().stream()\n                        .map(TypeSignature::parseTypeSignature)\n                        .collect(toImmutableList());\n                functions = functions.stream()\n                        .filter(function -> function.getSignature().getArgumentTypes().equals(parameterTypes))\n                        .collect(toImmutableList());\n            }\n            if (functions.isEmpty()) {\n                String types = node.getParameterTypes().map(parameterTypes -> format(\"(%s)\", Joiner.on(\", \").join(parameterTypes))).orElse(\"\");\n                throw new PrestoException(FUNCTION_NOT_FOUND, format(\"Function not found: %s%s\", functionName, types));\n            }\n\n            ImmutableList.Builder<Expression> rows = ImmutableList.builder();\n            for (SqlFunction function : functions) {\n                if (!(function instanceof SqlInvokedFunction)) {\n                    throw new PrestoException(GENERIC_USER_ERROR, \"SHOW CREATE FUNCTION is only supported for SQL functions\");\n                }\n\n                SqlInvokedFunction sqlFunction = (SqlInvokedFunction) function;\n                boolean temporary = sqlFunction.getFunctionId().getFunctionName().getCatalogSchemaName().equals(SESSION_NAMESPACE);\n                CreateFunction createFunction = new CreateFunction(\n                        node.getName(),\n                        false,\n                        temporary,\n                        sqlFunction.getParameters().stream()\n                                .map(parameter -> new SqlParameterDeclaration(new Identifier(parameter.getName()), parameter.getType().toString()))\n                                .collect(toImmutableList()),\n                        sqlFunction.getSignature().getReturnType().toString(),","sourceCodeStart":642,"sourceCodeEnd":678,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-main-base/src/main/java/com/facebook/presto/sql/rewrite/ShowQueriesRewrite.java#L642-L678","documentation":"SHOW CREATE FUNCTION <name>[types] found no function matching the given name and (optionally) parameter types. The resolver returned an empty function list after optional filtering by argument types, so Presto throws FUNCTION_NOT_FOUND. The name may exist but with different argument types than those specified.","triggerScenarios":"SHOW CREATE FUNCTION for a misspelled or unqualified function name, a function living in another schema, or a correct name with parameterTypes that match no overload (e.g. (varchar) when only (double) exists).","commonSituations":"Catalog/schema-qualified name required but omitted; overload resolution mistakes with numeric vs varchar args; function exists only in the session namespace of another session; built-in (non-SQL) functions whose definitions cannot be shown anyway.","solutions":["List available functions with SHOW FUNCTIONS and copy the exact name and signature","Fully qualify the function name (catalog.schema.function) if it is not a built-in","Match the declared parameter types exactly when using the (types) form, or omit the types clause to match any overload","Create the function first with CREATE FUNCTION if it does not exist"],"exampleFix":"// before\nSHOW CREATE FUNCTION my_avg(varchar)\n// after (overload takes double, per SHOW FUNCTIONS)\nSHOW CREATE FUNCTION my_avg(double)","handlingStrategy":"validation","validationCode":"-- verify name and signature first\nSELECT function_name, argument_types, return_type FROM information_schema.functions\nWHERE function_name = 'my_avg';","typeGuard":null,"tryCatchPattern":"try { session.execute(\"SHOW CREATE FUNCTION \" + sig); } catch (PrestoException e) { if (e.getErrorCode() == FUNCTION_NOT_FOUND.toErrorCode()) { /* list overloads via SHOW FUNCTIONS */ } throw e; }","preventionTips":["Copy exact signatures from SHOW FUNCTIONS","Omit the (types) clause unless disambiguating overloads","Fully qualify non-builtin function names","Create the function before attempting SHOW CREATE FUNCTION"],"tags":["presto","sql","function-not-found","overload-resolution"],"backgroundTag":"function-not-found","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"}