From ff4ba09aff38201e8a772e44decaee1a802649d4 Mon Sep 17 00:00:00 2001 From: serprex <159546+serprex@users.noreply.github.com> Date: Mon, 23 Nov 2026 20:54:40 +0000 Subject: [PATCH] Honor stream naming for tables with columns mapped by number These tables ignored auto_create_name_all, check that before falling back to schema_table --- src/emit/ch_emitter.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/emit/ch_emitter.rs b/src/emit/ch_emitter.rs index cc8500f5..2b65a0eb 100644 --- a/src/emit/ch_emitter.rs +++ b/src/emit/ch_emitter.rs @@ -1372,6 +1372,7 @@ impl EmitterConfig { self.namespaces .get(ns) .and_then(|n| n.auto_create_name.clone()) + .or_else(|| self.auto_create_name_all.clone()) .unwrap_or_default() .render(&self.source.dbname, ns, &name) }); @@ -4893,14 +4894,18 @@ mod tests { #[test] fn pinned_columns_follow_namespace_template_and_opt_out() { let c = EmitterConfig::from_toml_str( - "[ch]\n[namespace.app]\nauto_create_name = \"wh_\"\n\ + "[ch]\n[stream]\nauto_create_name_all = \"all_\"\n\ + [namespace.app]\nauto_create_name = \"wh_\"\n\ [table.app.events]\ncolumns = [{ attnum = 1, target = \"id\", type = \"UInt64\" }]\n\ + [table.audit.log]\ncolumns = [{ attnum = 1, target = \"id\", type = \"UInt64\" }]\n\ [table.app.skipped]\nreplicate = false\n\ columns = [{ attnum = 1, target = \"id\", type = \"UInt64\" }]\n", ) .unwrap(); let m = &c.tables[&RelName::new("app", "events")]; assert_eq!(m.target.table, "wh_events"); + let m = &c.tables[&RelName::new("audit", "log")]; + assert_eq!(m.target.table, "all_log"); assert!(!c.tables.contains_key(&RelName::new("app", "skipped"))); }