
-- Test TRUNCATE with Foreign Keys (on delete triggers)

create table truncate_a (col1 serial primary key);
create table truncate_b (col1 int4 references truncate_a);

truncate truncate_a; -- fail
truncate truncate_b;

-- Test TRUNCATE with on delete rules
create rule truncate_b_rule as on delete to truncate_b do instead nothing;

truncate truncate_b; -- fail