{"record":{"id":"62e3c33c3eef0935","repo":"risingwavelabs/risingwave","slug":"using-is-not-supported-for-rust-function","errorCode":null,"errorMessage":"USING is not supported for rust function","messagePattern":"USING is not supported for rust function","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/expr/impl/src/udf/wasm.rs","lineNumber":92,"sourceCode":"            // test if the function exists in the wasm binary\n            _ = runtime.find_table_function(&name_in_runtime, arg_types, return_type)?;\n        }\n        UdfKind::Aggregate => {\n            todo!(\"wasm udaf\");\n        }\n    }\n\n    let compressed_binary = Some(zstd::stream::encode_all(&*wasm_binary, 0)?);\n    Ok(CreateFunctionOutput {\n        name_in_runtime,\n        body: None,\n        compressed_binary,\n    })\n}\n\nfn create_rust(opts: CreateOptions<'_>) -> Result<CreateFunctionOutput> {\n    if opts.using_link.is_some() {\n        bail!(\"USING is not supported for rust function\");\n    }\n    let name_in_runtime = opts.name.to_owned();\n\n    let prelude = \"use arrow_udf::{{function, types::*}};\";\n    let export_macro = if opts\n        .arg_types\n        .iter()\n        .chain(std::iter::once(opts.return_type))\n        .all(|t| !t.is_struct())\n    {\n        let identifier_v1 = wasm_identifier_v1(\n            &name_in_runtime,\n            opts.arg_types,\n            opts.return_type,\n            opts.kind.is_table(),\n        )?;\n        format!(\"#[function(\\\"{}\\\")]\", identifier_v1)\n    } else {","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/expr/impl/src/udf/wasm.rs#L74-L110","documentation":"Rust UDFs are registered by source code (compiled/embedded), not by fetching a binary, so the USING clause (LINK or base64 binary) is invalid for them. `create_rust` rejects any attempt to pass USING options.","triggerScenarios":"`CREATE FUNCTION ... AS <rust source> ... USING LINK '...'` — `create_rust` sees `opts.using_link.is_some()`.","commonSituations":"Copy-pasting a WASM UDF DDL template (which requires USING) for a rust UDF; mixing rust and wasm registration syntax.","solutions":["Remove the USING clause from the rust UDF CREATE FUNCTION statement","If you need a binary/link-based function, register it as a WASM UDF instead (`AS wasm USING LINK ...`)","Provide the rust source with AS and the return type as required for rust UDFs"],"exampleFix":"-- before\nCREATE FUNCTION f(INT) RETURNS INT LANGUAGE rust AS 'fn f(x: i32) -> i32 { x }' USING LINK 'http://x/f.wasm';\n-- after\nCREATE FUNCTION f(INT) RETURNS INT LANGUAGE rust AS 'fn f(x: i32) -> i32 { x }';","handlingStrategy":"validation","validationCode":"if (language === 'rust' && sql.includes('USING')) throw new Error('USING is not supported for rust function');","typeGuard":null,"tryCatchPattern":"try { await rw.query(createFunctionSql) } catch (e) { if (String(e).includes('USING is not supported for rust')) { /* strip USING and retry */ } else throw e; }","preventionTips":["Never reuse wasm DDL templates for rust UDFs","Validate USING only appears with AS wasm","Lint generated DDL per language type"],"tags":["udf","rust","conflicting-options"],"backgroundTag":"mutually-exclusive-options","analyzedSha":"6469eb736d691e8e9b8a419a57edd6429ca77417","analyzedAt":"2026-09-11T21:06:21.487Z","contentChangedAt":"2026-09-11T21:06:21.487Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}