zabbix-tools/zabbix-pgsql-partitioning

zbx_deprovision_partitions errors

36below opened this issue · 1 comments

When running the bootstrap.sql agains Postgres 8.4.20 I got:

ERROR: "$2" is declared CONSTANT
SQL state: 22005
Context: compilation of PL/pgSQL function "zbx_deprovision_partitions" near line 7

Fixed by :
DECLARE
child RECORD;
ins_count INTEGER DEFAULT 0;
new_trigger_name TEXT DEFAULT '';
BEGIN
-- default trigger name
IF trigger_name = '' THEN
new_trigger_name := table_name || '_insert';
ELSE
new_trigger_name := trigger_name;
END IF;

	-- delete the insert trigger on the parent table
	EXECUTE 'DROP TRIGGER ' || new_trigger_name || ' ON ' || schema_name || '.' || table_name || ' CASCADE;';

I've run up a new VM with Postgres 9.6 and it works fine on that