From 0fddcd8fe70a6032089fbe31c3afc4a9116c0db6 Mon Sep 17 00:00:00 2001 From: Mike Reeves Date: Fri, 17 Apr 2026 15:22:57 -0400 Subject: [PATCH] Pass unquoted schema.name to partman.create_parent pg_partman 5.x splits p_parent_table on '.' and looks up the parts as raw identifiers, so the literal must be 'schema.name' rather than the double-quoted form quoteLiteral emits for .table. --- salt/telegraf/etc/telegraf.conf | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/salt/telegraf/etc/telegraf.conf b/salt/telegraf/etc/telegraf.conf index e18205ad1..8a48186af 100644 --- a/salt/telegraf/etc/telegraf.conf +++ b/salt/telegraf/etc/telegraf.conf @@ -110,9 +110,14 @@ # Every metric table is a daily time-range partitioned parent managed by # pg_partman. Retention drops old partitions instead of row-by-row DELETEs. {% raw %} + # pg_partman.create_parent() splits p_parent_table on '.' and looks the + # parts up as raw identifiers, so the string literal must be + # 'schema.name', NOT '"schema"."name"'. {{ .table|quoteLiteral }} would + # emit the double-quoted form and partman fails with "Unable to find + # given parent table in system catalogs." create_templates = [ '''CREATE TABLE {{ .table }} ({{ .columns }}) PARTITION BY RANGE ("time")''', - '''SELECT partman.create_parent(p_parent_table := {{ .table|quoteLiteral }}, p_control := 'time', p_type := 'range', p_interval := '1 day', p_premake := 3)''' + '''SELECT partman.create_parent(p_parent_table := {{ printf "%s.%s" .table.Schema .table.Name | quoteLiteral }}, p_control := 'time', p_type := 'range', p_interval := '1 day', p_premake := 3)''' ] {% endraw %} {%- endif %}