#!/bin/bash

dropdb --if-exists test > /dev/null 2>&1

createdb test > /dev/null 2>&1

psql test -c "create unlogged table detoast_c (a text)" > /dev/null 2>&1

psql test -c "insert into detoast_c (a) select 'abc'|| repeat((SELECT string_agg(md5(chr(i)), '') FROM generate_series(1,127) i), 10000) ||'xyz' from generate_series(1,100)" > /dev/null 2>&1

psql test -c "create unlogged table detoast_u (a text)" > /dev/null 2>&1

psql test -c "alter table detoast_u alter a set storage external" > /dev/null 2>&1

psql test -c "insert into detoast_u (a) select 'abc'|| repeat((SELECT string_agg(md5(chr(i)), '') FROM generate_series(1,127) i), 10000) ||'xyz' from generate_series(1,100);" > /dev/null 2>&1

