dbt-labs/dbt-core · error

list_relations_schemas_by_patterns for Redshift

Error message

list_relations_schemas_by_patterns for Redshift

What it means

This is a Rust `todo!()` panic: Redshift's `run_by_patterns` (the implementation behind list_relations_schemas_by_patterns) is unimplemented, so pattern-based relation-schema lookups on Redshift panic with 'list_relations_schemas_by_patterns for Redshift'. The trait method exists but the Redshift-specific batch/pattern query was never written.

Source

Thrown at crates/dbt-adapter/src/metadata/redshift/mod.rs:616

            Ok(table_schema)
        };
        let reduce_f = |acc: &mut Acc,
                        relation: Arc<dyn BaseRelation>,
                        schema: AdapterResult<Arc<Schema>>|
         -> Result<(), Cancellable<AdapterError>> {
            acc.insert(relation.semantic_fqn(), schema);
            Ok(())
        };
        let map_reduce = MapReduce::new(factory, Box::new(map_f), Box::new(reduce_f), None);
        map_reduce.run(Arc::new(relations.to_vec()), token)
    }

    fn run_by_patterns(
        &self,
        _patterns: Arc<Vec<RelationPattern>>,
        _token: CancellationToken,
    ) -> AsyncAdapterResult<'static, Vec<(String, AdapterResult<RelationSchemaPair>)>> {
        todo!("list_relations_schemas_by_patterns for Redshift")
    }
}

// This list was created using brute force since I can't find docs for which tables support it
const TABLES_WITH_OID: [&str; 10] = [
    "pg_cast",
    "pg_opclass",
    "pg_class",
    "pg_constraint",
    "pg_database",
    "pg_language",
    "pg_namespace",
    "pg_operator",
    "pg_proc",
    "pg_type",
];

pub(crate) struct RedshiftFreshnessStrategy {

View on GitHub (pinned to 0267ce9170)

Solutions

  1. Resolve relations without pattern matching (enumerate schemas/relations via implemented Redshift endpoints) and filter in the caller
  2. Implement run_by_patterns, reusing Redshift's existing relation listing and applying pattern predicates per schema
  3. Upgrade/pin to a dbt-adapter version where Redshift pattern-based schema listing is implemented
  4. Block pattern-based selection for Redshift early with an explicit unsupported-feature error

Example fix

// before
fn run_by_patterns(&self, _patterns: Arc<Vec<RelationPattern>>, _token: CancellationToken) -> ... {
    todo!("list_relations_schemas_by_patterns for Redshift")
}
// after
fn run_by_patterns(&self, patterns: Arc<Vec<RelationPattern>>, token: CancellationToken) -> ... {
    self.list_and_match_patterns(conn, &patterns, token)
}
Defensive patterns

Strategy: fallback

Validate before calling

if !adapter.capabilities().patterns_supported {
    return Err("Redshift does not support list_relations_schemas_by_patterns yet".into());
}

Type guard

fn supports_patterns(a: &dyn Adapter) -> bool { a.capabilities().run_by_patterns }

Try / catch

match redshift_adapter.run_by_patterns(patterns, token).await {
    Ok(pairs) => pairs,
    Err(_) => list_redshift_relations_then_match(patterns).await,
}

Prevention

When it happens

Trigger: Calling list_relations_schemas_by_patterns on a Redshift adapter, which dispatches to `run_by_patterns` at crates/dbt-adapter/src/metadata/redshift/mod.rs:616; the stub panics immediately for any `Arc<Vec<RelationPattern>>` input.

Common situations: dbt features that resolve relations by name pattern (e.g. selector patterns like 'stg_*') against Redshift before the pattern API is implemented there; every pattern-resolution call panics regardless of cluster health.

Related errors


AI-assisted analysis of dbt-labs/dbt-core@0267ce9170 (2026-09-07). Data as JSON: /api/errors/c80a073e4caaaad0. Report an issue: GitHub.