Hi hackers, My colleague Prabhat Sahu reported off list that transition tables don't work for views. I probably should have thought about that when I fixed something similar for partitioned tables, and after some experimentation I see that this is also broken for foreign tables.
For foreign tables using postgres_fdw, I see that transition tables capture new rows for INSERT but capture nothing for DELETE and UPDATE. For views, aside from the question of transition tables, I noticed that statement triggers don't seem to fire at all with updatable views. Surely they should -- isn't that a separate bug? Example: create table my_table (i int); create view my_view as select * from my_table; create function my_trigger_function() returns trigger language plpgsql as $$ begin raise warning 'hello world'; return null; end; $$; create trigger my_trigger after insert or update or delete on my_view for each statement execute procedure my_trigger_function(); insert into my_view values (42); ... and the world remains ungreeted. As for transition tables, there are probably meaningful ways to support those for both views and foreign tables at least in certain cases, as future feature enhancements. For now, do you agree that we should reject such triggers as unsupported? See attached. Separately, I noticed an obsolete sentence in the trigger documentation. See doc.patch. -- Thomas Munro http://www.enterprisedb.com
prevent-unsupported-transition-tables.patch
Description: Binary data
doc.patch
Description: Binary data
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers