set -ex

psql -c "create table test1(id int primary key) partition by range(id);";

for idx in $(seq 2 1000);
do
    psql -c "create table test$idx(id int primary key) partition by range(id);"
    psql -c "alter table test$((idx - 1)) attach partition test$idx for values from ($idx) to (1000000000);"
done;
