diesel-rs/diesel · critical

not implemented

Error message

not implemented

What it means

Query projection inference hit a select expression shape it cannot lower to a concrete type. The offending input is the element at this position in the select list; this is an inference limitation, not a database failure.

Solutions

  1. Rewrite the unsupported select expression using supported constructs
  2. Provide an explicit type annotation instead of relying on inference
  3. Use a hand-written queryable projection for this query

Example fix

// before
let data = select(unknown_complex_item).load(...);
// after
let data = select((users::id, users::name)).load(...);
Defensive patterns

Strategy: fallback

Validate before calling

// ensure the select projection uses only explicit columns or single-source wildcard

Try / catch

// this is a panic (todo!()), not a Result; cannot be caught with try/catch in Rust
// guard by testing projections in CI before production use

Prevention

When it happens

Trigger: Building a select query whose projection contains a `SelectItem` variant unsupported by the inference logic (e.g. complex/compound select items or wildcard with multiple query sources handled by the unimplemented branch).

Common situations: Using `diesel_infer_query` with unusual SELECT expressions such as aliased function results, tuples from multiple sources in a form the inferencer doesn't cover, or newer internal query representations.

Related errors


AI-assisted analysis of diesel-rs/diesel@6fa6ed01b2 (2026-09-07). Data as JSON: /api/errors/7294afc5b385aac6. Report an issue: GitHub.

Appendix: source

Thrown at diesel_infer_query/src/select.rs:253

        ) => {
            if let Some(item) = name
                .0
                .last()
                .and_then(|a| a.as_ident())
                .map(|a| a.value.as_str())
                .and_then(|k| query_source_lookup.get(k))
            {
                let is_left_joined = item.contains_left_join(query_source_lookup)?;
                Ok(SelectField {
                    ident: None,
                    kind: Expression::Wildcard {
                        schema: item.schema.map(|s| s.to_owned()),
                        relation: item.name.to_owned(),
                        is_left_joined,
                    },
                })
            } else {
                todo!()
            }
        }
        SelectItem::Wildcard(_) if query_source_lookup.len() == 1 => {
            let wildcard = query_source_lookup.values().next().expect("Is exactly one");
            Ok(SelectField {
                ident: None,
                kind: Expression::Wildcard {
                    schema: wildcard.schema.map(|c| c.to_owned()),
                    relation: wildcard.name.to_owned(),
                    is_left_joined: false,
                },
            })
        }
        s @ SelectItem::Wildcard(_wildcard_additional_options) => Err(Error::UnsupportedSql {
            msg: format!("Unsupported `SELECT` expression: `{s}`"),
        }),
        s @ SelectItem::QualifiedWildcard(
            _select_item_qualified_wildcard_kind,

View on GitHub (pinned to 6fa6ed01b2)