{"record":{"id":"d676170862383709","repo":"diesel-rs/diesel","slug":"only-mysql-backend-mariadb-backend-postgres","errorCode":null,"errorMessage":"only `mysql_backend`, `mariadb_backend`, `postgres_backend` and `sqlite` are supported features, but got `{feature}`","messagePattern":"only `mysql_backend`, `mariadb_backend`, `postgres_backend` and `sqlite` are supported features, but got `(.+?)`","errorType":"exception","errorClass":"syn::Error","httpStatus":null,"severity":"error","filePath":"diesel_derives/src/sql_function.rs","lineNumber":1965,"sourceCode":"            let _ = input.parse::<Token![=]>()?;\n            let feature = input.parse::<LitStr>()?;\n            let feature_value = feature.value();\n            let _ = input.parse::<Token![,]>()?;\n            let wrap_macro = match feature_value.as_str() {\n                \"postgres_backend\" => Some(syn::parse_quote!(\n                    diesel::internal::sql_functions::expand_pg\n                )),\n                \"sqlite\" | \"__sqlite_shared\" => Some(syn::parse_quote!(\n                    diesel::internal::sql_functions::expand_sqlite\n                )),\n                \"mysql_backend\" => Some(syn::parse_quote!(\n                    diesel::internal::sql_functions::expand_mysql\n                )),\n                \"mariadb_backend\" => Some(syn::parse_quote!(\n                    diesel::internal::sql_functions::expand_mariadb\n                )),\n                feature => {\n                    return Err(syn::Error::new(\n                        feature.span(),\n                        format!(\n                            \"only `mysql_backend`, `mariadb_backend`, `postgres_backend` and `sqlite` \\\n                                 are supported features, but got `{feature}`\"\n                        ),\n                    ));\n                }\n            };\n            let name = input.parse::<Ident>()?;\n            let inner;\n            let _paren = parenthesized!(inner in input);\n            let mut ret = SqlFunctionAttribute::parse_attr(name, &inner, attr, attribute_span)?;\n            if let SqlFunctionAttribute::Window { wrap_macro: w, .. } = &mut ret.item {\n                *w = wrap_macro;\n            }\n            Ok(ret)\n        } else {\n            let name_str = name.to_string();","sourceCodeStart":1947,"sourceCodeEnd":1983,"githubUrl":"https://github.com/diesel-rs/diesel/blob/6fa6ed01b24b24248ab2a611698d0a7c6a2e9120/diesel_derives/src/sql_function.rs#L1947-L1983","documentation":"When a `cfg_attr(feature = \"foo\", ...)` is attached to `#[sql_function]`, diesel only recognizes the features `mysql_backend`, `mariadb_backend`, `postgres_backend`, and `sqlite`. Any other feature name is rejected with this error listing the supported set.","triggerScenarios":"Writing `#[sql_function(cfg_attr(feature = \"my-feature\", ...))]` or any custom/misspelled feature name inside the macro's cfg_attr option.","commonSituations":"Using Cargo feature names of your own crate inside the proc-macro attribute; typos like `postgres` instead of `postgres_backend`; copying features from other macros.","solutions":["Use one of `mysql_backend`, `mariadb_backend`, `postgres_backend`, or `sqlite` as the feature name","Fix typos (e.g. `postgres` → `postgres_backend`)","Gate non-backend features with a regular `#[cfg_attr(feature = \"...\", ...)]` on the item instead of inside `#[sql_function]`"],"exampleFix":"// before\n#[sql_function(cfg_attr(feature = \"postgres\", ...))]\n// after\n#[sql_function(cfg_attr(feature = \"postgres_backend\", ...))]","handlingStrategy":"validation","validationCode":"const SUPPORTED_FEATURES: [&str; 4] = [\"mysql_backend\", \"mariadb_backend\", \"postgres_backend\", \"sqlite\"];\nfn is_supported_backend_feature(f: &str) -> bool { SUPPORTED_FEATURES.contains(&f) }","typeGuard":"fn is_supported_backend_feature(f: &str) -> bool {\n    matches!(f, \"mysql_backend\" | \"mariadb_backend\" | \"postgres_backend\" | \"sqlite\")\n}","tryCatchPattern":null,"preventionTips":["Inside #[sql_function] cfg_attr, use only mysql_backend, mariadb_backend, postgres_backend, or sqlite","Don't pass your crate's own Cargo feature names into the macro's cfg_attr option","Remember the *_backend suffix — plain `postgres`/`mysql` are rejected"],"tags":["proc-macro","rust","feature-flags","cfg","diesel"],"backgroundTag":"unsupported-enum-value","analyzedSha":"6fa6ed01b24b24248ab2a611698d0a7c6a2e9120","analyzedAt":"2026-09-07T01:50:13.074Z","contentChangedAt":"2026-09-07T01:50:13.074Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}