{"record":{"id":"105a7df8e03b742d","repo":"dbt-labs/dbt-core","slug":"postgresadapter-freshness","errorCode":null,"errorMessage":"PostgresAdapter::freshness","messagePattern":"PostgresAdapter::freshness","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/dbt-adapter/src/metadata/postgres/mod.rs","lineNumber":174,"sourceCode":"    ) -> AsyncAdapterResult<'_, HashMap<String, AdapterResult<Arc<Schema>>>> {\n        let future = async move { todo!(\"PostgreSQL's list_relations_schemas\") };\n        Box::pin(future)\n    }\n\n    fn list_relations_schemas_by_patterns_inner(\n        &self,\n        _patterns: &[RelationPattern],\n        _token: CancellationToken,\n    ) -> AsyncAdapterResult<'_, Vec<(String, AdapterResult<RelationSchemaPair>)>> {\n        todo!(\"PostgresAdapter::list_relations_schemas_by_patterns\")\n    }\n\n    fn freshness_inner(\n        &self,\n        _relations: &[Arc<dyn BaseRelation>],\n        _token: CancellationToken,\n    ) -> AsyncAdapterResult<'_, BTreeMap<String, MetadataFreshness>> {\n        todo!(\"PostgresAdapter::freshness\")\n    }\n\n    fn create_schemas_if_not_exists(\n        &self,\n        state: &State<'_, '_>,\n        catalog_schemas: Vec<(String, String, String)>,\n    ) -> AdapterResult<Vec<(String, String, String, AdapterResult<()>)>> {\n        create_schemas_if_not_exists(&self.adapter, self, state, catalog_schemas)\n    }\n\n    fn list_relations_in_parallel_inner(\n        &self,\n        _db_schemas: &[CatalogAndSchema],\n        _token: CancellationToken,\n    ) -> AsyncAdapterResult<'_, BTreeMap<CatalogAndSchema, AdapterResult<RelationVec>>> {\n        // FIXME: Implement cache hydration\n        let future = async move { Ok(BTreeMap::new()) };\n        Box::pin(future)","sourceCodeStart":156,"sourceCodeEnd":192,"githubUrl":"https://github.com/dbt-labs/dbt-core/blob/0267ce9170576975b76b64ce856b2e5848e96617/crates/dbt-adapter/src/metadata/postgres/mod.rs#L156-L192","documentation":"This is a Rust `todo!()` panic: `PostgresAdapter::freshness_inner`, the source-freshness hook, is unimplemented, so any freshness check on Postgres panics with 'PostgresAdapter::freshness'. Freshness queries (last-updated timestamps for sources) were never wired up for the Postgres adapter.","triggerScenarios":"Calling the freshness operation on a PostgresAdapter (fan-in from `freshness_inner` at crates/dbt-adapter/src/metadata/postgres/mod.rs:174) with one or more `Arc<dyn BaseRelation>` sources; the stub panics before any SQL runs.","commonSituations":"Running `dbt source freshness` against Postgres sources while the adapter's freshness support is stubbed; the run fails with a panic rather than a freshness report, regardless of table metadata availability.","solutions":["Skip source freshness for Postgres sources until supported (exclude them from freshness selection)","Implement freshness_inner by querying source tables' max update timestamps (e.g. a configured freshness column via SELECT max(...))","Upgrade/pin to a dbt-adapter release where Postgres freshness is implemented","Fail fast: validate at DAG parse time that selected sources' adapters support freshness, raising a clear error instead of a panic"],"exampleFix":"// before\ntodo!(\"PostgresAdapter::freshness\")\n// after\nasync move {\n    let mut out = BTreeMap::new();\n    for rel in relations {\n        out.insert(rel.unique_id().to_string(), query_max_loaded_at(conn, rel).await?);\n    }\n    Ok(out)\n}","handlingStrategy":"validation","validationCode":"// skip freshness if the adapter does not implement it\nif !adapter.capabilities().freshness {\n    return Ok(FreshnessReport::skipped(\"Postgres freshness not implemented\"));\n}","typeGuard":"fn freshness_supported(a: &dyn Adapter) -> bool { a.capabilities().freshness }","tryCatchPattern":"match adapter.freshness(relations, token).await {\n    Ok(map) => map,\n    Err(_) => BTreeMap::new(), // degrade to empty freshness instead of failing the run\n}","preventionTips":["Exclude Postgres sources from `dbt source freshness` until implemented","Declare per-adapter capability sets and consult them before freshness runs","Surface skipped freshness as a warning, not a hard failure","Add tests that call every trait method on every adapter to expose todo!() stubs"],"tags":["rust","todo-panic","postgres","unimplemented","freshness"],"backgroundTag":"method-not-implemented","analyzedSha":"0267ce9170576975b76b64ce856b2e5848e96617","analyzedAt":"2026-09-07T21:53:39.732Z","contentChangedAt":"2026-09-07T21:53:39.732Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}