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

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: kamil(dot)kukielka(at)gmail(dot)com
Subject: BUG #15752: Declarative partitions trigger with function attributes - empty attributes list on each partition
Date: 2019-04-14 11:51:41
Message-ID: 15752-123bc90287986de4@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 15752
Logged by: Kamil Kukielka
Email address: kamil(dot)kukielka(at)gmail(dot)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
*/

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2019-04-14 16:29:35 BUG #15753: FullText search cannot find bird, rat from birds, rats
Previous Message Sandeep Thakkar 2019-04-14 10:08:33 Re: Error occurred when i install in my pc.