dbt-labs/dbt-core · error

PostgreSQL's list_relations_schemas

Error message

PostgreSQL's list_relations_schemas

What it means

This is a Rust `todo!()` panic inside the PostgreSQL adapter trait implementation: `list_relations_schemas_inner` is a required trait method that was left unimplemented, so calling list_relations_schemas on a PostgresAdapter panics with 'PostgreSQL's list_relations_schemas'. It marks unfinished batch schema-loading functionality, not a Postgres server failure.

Source

Thrown at crates/dbt-adapter/src/metadata/postgres/mod.rs:157

                },
            };

            columns_by_relation
                .entry(fully_qualified_name.clone())
                .or_insert(BTreeMap::new())
                .insert(column_name.to_string(), column);
        }
        Ok(columns_by_relation)
    }

    fn list_relations_schemas_inner(
        &self,
        _unique_id: Option<String>,
        _phase: Option<ExecutionPhase>,
        _relations: &[Arc<dyn BaseRelation>],
        _token: CancellationToken,
    ) -> AsyncAdapterResult<'_, HashMap<String, AdapterResult<Arc<Schema>>>> {
        let future = async move { todo!("PostgreSQL's list_relations_schemas") };
        Box::pin(future)
    }

    fn list_relations_schemas_by_patterns_inner(
        &self,
        _patterns: &[RelationPattern],
        _token: CancellationToken,
    ) -> AsyncAdapterResult<'_, Vec<(String, AdapterResult<RelationSchemaPair>)>> {
        todo!("PostgresAdapter::list_relations_schemas_by_patterns")
    }

    fn freshness_inner(
        &self,
        _relations: &[Arc<dyn BaseRelation>],
        _token: CancellationToken,
    ) -> AsyncAdapterResult<'_, BTreeMap<String, MetadataFreshness>> {
        todo!("PostgresAdapter::freshness")
    }

View on GitHub (pinned to 0267ce9170)

Solutions

  1. Use the per-relation/single get_relation path that is implemented instead of the batch list_relations_schemas API
  2. Implement list_relations_schemas_inner (e.g. batched INFORMATION_SCHEMA.TABLES queries grouped per schema) in PostgresAdapter
  3. Update/pin to a dbt-adapter version where the Postgres batch implementation exists
  4. Feature-gate or route around batch schema loading until the implementation lands

Example fix

// before
let future = async move { todo!("PostgreSQL's list_relations_schemas") };
// after
let future = async move {
    let mut out = HashMap::new();
    for rel in relations {
        out.insert(rel.identifier().to_string(), load_schema(conn, rel).await?);
    }
    Ok(out)
};
Defensive patterns

Strategy: try-catch

Validate before calling

// call only if batch schema loading is available
if !adapter.supports_batch_schema_loading() {
    return Err("Postgres batch list_relations_schemas unavailable; use per-relation lookup".into());
}

Type guard

fn has_batch_schemas(a: &dyn Adapter) -> bool { a.capabilities().list_relations_schemas }

Try / catch

match std::panic::AssertUnwindSafe(adapter.list_relations_schemas(...)).catch_unwind().await {
    Ok(res) => res,
    Err(_) => per_relation_schema_fallback(relations).await,
}

Prevention

When it happens

Trigger: Invoking the list_relations_schemas operation (which fans out to `list_relations_schemas_inner` at crates/dbt-adapter/src/metadata/postgres/mod.rs:157) on a PostgresAdapter; the stubbed future immediately panics.

Common situations: A dbt workflow that requests schemas for many relations in one batch (e.g. caching all schemas before a run) against Postgres while this batch API is still a stub; any caller of the batch endpoints hits the panic regardless of database health.

Related errors


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