Thread: BUG #15752: Declarative partitions trigger with function attributes - empty attributes list on each partition
BUG #15752: Declarative partitions trigger with function attributes - empty attributes list on each partition
From
PG Bug reporting form
Date:
The following bug has been logged on the website: Bug reference: 15752 Logged by: Kamil Kukielka Email address: kamil.kukielka@gmail.com PostgreSQL version: 11.2 Operating system: Debian 4.9.0 Description: When trigger is created on partitioned table with execute function with attributes, each partition calls function without defined values. That makes triggers on partitioned tables little less useful. ``` -- partitioned table CREATE TABLE IF NOT EXISTS test_part(id serial, description text) PARTITION BY hash(id); -- partitions CREATE TABLE IF NOT EXISTS test_p0 PARTITION OF test_part FOR VALUES WITH (MODULUS 2, REMAINDER 0); CREATE TABLE IF NOT EXISTS test_p1 PARTITION OF test_part FOR VALUES WITH (MODULUS 2, REMAINDER 1); -- sample trigger function CREATE OR REPLACE FUNCTION trigger_test() RETURNS trigger AS $$ BEGIN RAISE NOTICE 'TG_NARGS: %', TG_NARGS; RAISE NOTICE 'TG_ARGV: %', TG_ARGV::text; RETURN NULL; END; $$ LANGUAGE plpgsql; CREATE TRIGGER test_with_part_trigger AFTER UPDATE ON test_part FOR EACH ROW EXECUTE FUNCTION trigger_test('sample params', 1, 2, 3); INSERT INTO test_part(description) SELECT 'table with partition'; UPDATE test_part SET description = 'table with partition'; /** -- code result NOTICE: TG_NARGS: 0 NOTICE: TG_ARGV: <NULL> UPDATE 1 */
Re: BUG #15752: Declarative partitions trigger with functionattributes - empty attributes list on each partition
From
Alvaro Herrera
Date:
On 2019-Apr-14, PG Bug reporting form wrote: > When trigger is created on partitioned table with execute function with > attributes, each partition calls function without defined values. That makes > triggers on partitioned tables little less useful. Hello, I pushed a fix for this (thanks, Patrick McHardy). It'll appear in the set of stable releases scheduled for next month. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services