BUG #15752: Declarative partitions trigger with function attributes - empty attributes list on each partition - Mailing list pgsql-bugs

From PG Bug reporting form
Subject BUG #15752: Declarative partitions trigger with function attributes - empty attributes list on each partition
Date
Msg-id 15752-123bc90287986de4@postgresql.org
Whole thread Raw
Responses Re: BUG #15752: Declarative partitions trigger with functionattributes - empty attributes list on each partition  (Alvaro Herrera <alvherre@2ndquadrant.com>)
List pgsql-bugs
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
*/


pgsql-bugs by date:

Previous
From: Sandeep Thakkar
Date:
Subject: Re: Error occurred when i install in my pc.
Next
From: PG Bug reporting form
Date:
Subject: BUG #15753: FullText search cannot find bird, rat from birds, rats