Don't permit transition tables with TRUNCATE triggers.

Prior to this prohibition, such a trigger caused a crash.

Thomas Munro, per a report from Neha Sharma.  I added a
regression test.

Discussion: http://postgr.es/m/CAEepm=0VR5W-N38eTkO_FqJbGqQ_ykbBRmzmvHyxDhy1p=0Csw@mail.gmail.com
This commit is contained in:
Robert Haas
2017-05-09 23:22:39 -04:00
parent 304007d9f1
commit 29fd3d9da0
3 changed files with 21 additions and 0 deletions

View File

@ -4736,6 +4736,14 @@ BEGIN
END;
$$;
-- should fail, TRUNCATE is not compatible with transition tables
CREATE TRIGGER alter_table_under_transition_tables_upd_trigger
AFTER TRUNCATE OR UPDATE ON alter_table_under_transition_tables
REFERENCING OLD TABLE AS d NEW TABLE AS i
FOR EACH STATEMENT EXECUTE PROCEDURE
alter_table_under_transition_tables_upd_func();
-- should work
CREATE TRIGGER alter_table_under_transition_tables_upd_trigger
AFTER UPDATE ON alter_table_under_transition_tables
REFERENCING OLD TABLE AS d NEW TABLE AS i