set client_min_messages to NOTICE;

\set code 'patched'

-- 2 way join
insert into msmts select 2, 'npart', :'code', * from readable_measure_query_times('select * from t1 a, t1 b where a.a = b.a', 3);
set enable_partitionwise_join to false;
insert into msmts select 2, 'npwj', :'code', * from readable_measure_query_times('select * from t1_parted a, t1_parted b where a.a = b.a', 3);
set enable_partitionwise_join to true;
insert into msmts select 2, 'pwj', :'code', * from readable_measure_query_times('select * from t1_parted a, t1_parted b where a.a = b.a', 3);

-- 3 way join
insert into msmts select 3, 'npart', :'code', * from readable_measure_query_times('select * from t1 a, t1 b, t1 c where a.a = b.a and b.a = c.a', 3);
set enable_partitionwise_join to false;
insert into msmts select 3, 'npwj', :'code', * from readable_measure_query_times('select * from t1_parted a, t1_parted b, t1_parted c where a.a = b.a and b.a = c.a', 3);
set enable_partitionwise_join to true;
insert into msmts select 3, 'pwj', :'code', * from readable_measure_query_times('select * from t1_parted a, t1_parted b, t1_parted c where a.a = b.a and b.a = c.a', 3);

-- 4 way join
insert into msmts select 4, 'npart', :'code', * from readable_measure_query_times('select * from t1 a, t1 b, t1 c, t1 d where a.a = b.a and b.a = c.a and c.a = d.a', 3);
set enable_partitionwise_join to false;
insert into msmts select 4, 'npwj', :'code', * from readable_measure_query_times('select * from t1_parted a, t1_parted b, t1_parted c, t1_parted d where a.a = b.a and b.a = c.a and c.a = d.a', 3);
set enable_partitionwise_join to true;
insert into msmts select 4, 'pwj', :'code', * from readable_measure_query_times('select * from t1_parted a, t1_parted b, t1_parted c, t1_parted d where a.a = b.a and b.a = c.a and c.a = d.a', 3);

-- 5 way join
insert into msmts select 5, 'npart', :'code', * from readable_measure_query_times('select * from t1 a, t1 b, t1 c, t1 d, t1 e where a.a = b.a and b.a = c.a and c.a = d.a and d.a = e.a', 3);
set enable_partitionwise_join to false;
insert into msmts select 5, 'npwj', :'code', * from readable_measure_query_times('select * from t1_parted a, t1_parted b, t1_parted c, t1_parted d, t1_parted e where a.a = b.a and b.a = c.a and c.a = d.a and d.a = e.a', 3);
set enable_partitionwise_join to true;
insert into msmts select 5, 'pwj', :'code', * from readable_measure_query_times('select * from t1_parted a, t1_parted b, t1_parted c, t1_parted d, t1_parted e where a.a = b.a and b.a = c.a and c.a = d.a and d.a = e.a', 3);