init.sh

application/octet-stream

# $1 : Number of Columns
# $2 : Number of non null initial columns
# $3 : Number of records = 10000 * $3
# $4 : Table name

./psql postgres -c "drop table if exists $4;";
./psql postgres -c "create UNLOGGED table $4 (a0 int);";

for (( p1 = 1; p1 <= $1; p1 += 1 )); do
    ./psql postgres -c "alter table $4 add a${p1} int"; > dummy  2>&1
done

commnadstr="insert into $4 values( generate_series(1, 10000) ";
for (( p = 1; p < $2 ; p += 1 )) ; do
    commnadstr=`echo ${commnadstr}, ${p}`;
done

for (( p = $2; p < $1 ; p += 1 )) ; do
    commnadstr=`echo ${commnadstr}, NULL`;
done

commnadstr=`echo ${commnadstr} \)\;`;

echo $commnadstr
for (( p = 1; p <= $3 ; p += 1 )) ; do
./psql postgres -c "$commnadstr";
done