{"record":{"id":"0665444668b77b2e","repo":"windmill-labs/windmill","slug":"unexpected-null-schema-name-in-publication-entry","errorCode":null,"errorMessage":"Unexpected NULL `schema_name` in publication entry (pubname: `{}`). This should never happen unless PostgreSQL internals are corrupted.","messagePattern":"Unexpected NULL `schema_name` in publication entry \\(pubname: `(.+?)`\\)\\. This should never happen unless PostgreSQL internals are corrupted\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"backend/windmill-trigger-postgres/src/handler.rs","lineNumber":934,"sourceCode":"            pubname = $1;\n        \"#\n    };\n\n    let rows = pg_connection\n        .query(query, &[&publication_name])\n        .await\n        .map_err(to_anyhow)?;\n\n    let mut table_to_track: HashMap<String, Relations> = HashMap::new();\n\n    for row in rows {\n        let schema_name: Option<String> = row.get(\"schema_name\");\n        let table_name: Option<String> = row.get(\"table_name\");\n        let columns: Option<Vec<String>> = row.get(\"columns\");\n        let where_clause: Option<String> = row.get(\"where_clause\");\n\n        let schema_name = schema_name.ok_or_else::<Error, _>(|| {\n            anyhow::anyhow!(\n                \"Unexpected NULL `schema_name` in publication entry (pubname: `{}`). This should never happen unless PostgreSQL internals are corrupted.\",\n                publication_name,\n            )\n            .into()\n        })?;\n\n        let table_name = table_name.ok_or_else::<Error, _>(|| {\n            anyhow::anyhow!(\n                \"Unexpected NULL `table_name` for schema `{}` in publication `{}`. This should never happen unless PostgreSQL internals are corrupted.\",\n                schema_name,\n                publication_name,\n            )\n            .into()\n        })?;\n\n        let entry = table_to_track.entry(schema_name.clone());\n        let table_to_track_item = TableToTrack::new(table_name, where_clause, columns);\n","sourceCodeStart":916,"sourceCodeEnd":952,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/backend/windmill-trigger-postgres/src/handler.rs#L916-L952","documentation":"get_tracked_relations reads publication relation rows from PostgreSQL (pg_publication_tables-style query). The schema_name column is nullable in the row type, but a NULL here would mean corrupt PostgreSQL catalog internals, so the code fails loudly with this error instead of proceeding.","triggerScenarios":"Running the publication-info query against a PostgreSQL instance whose catalog returns NULL schema_name for an entry in the given publication — per PostgreSQL this should never occur in a healthy database.","commonSituations":"A corrupted system catalog after a botched upgrade/restore; querying via a proxy/federated layer that mangles catalog columns; a Postgres version with divergent catalog behavior read with mismatched column aliases.","solutions":["Verify catalog integrity: dump pg_publication_tables on the same DB and inspect the rows","Check for pg_upgrade/restore issues; reindex system catalogs or restore from a clean backup","Confirm the connection targets a real PostgreSQL server, not a shim rewriting catalog queries","Compare your PostgreSQL version against the versions Windmill's postgres trigger supports","Report to Windmill if a supported Postgres version reproduces it on a healthy database"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"-- verify publication catalog integrity before configuring the trigger\nSELECT pubname, schemaname, tablename\nFROM pg_publication_tables\nWHERE pubname = 'my_publication' AND schemaname IS NULL;\n-- must return zero rows","typeGuard":null,"tryCatchPattern":"match get_publication_info(...).await {\n    Err(e) if e.to_string().contains(\"Unexpected NULL `schema_name`\") => {\n        anyhow::bail!(\"Postgres catalog looks corrupted; refusing to sync publication state\")\n    }\n    other => other,\n}","preventionTips":["Run the trigger against vanilla PostgreSQL of a supported version","Avoid proxies/shims that rewrite catalog queries between Windmill and Postgres","Validate pg_publication_tables after any pg_upgrade or restore","Keep clean backups; treat system-catalog corruption as a stop-everything incident"],"tags":["postgres","catalog","corruption","triggers"],"backgroundTag":"postgres-catalog-corruption","analyzedSha":"e474e8803ce2ff5c2df09a58dab51d45f5c922ca","analyzedAt":"2026-09-03T12:38:19.024Z","contentChangedAt":"2026-09-03T12:38:19.024Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}