#!/bin/bash

# first argument: number of transactions

declare num_trans
if [ -n "$1" ]; then
    num_trans=$1
else
    num_trans=1000
fi


for i in `seq 1 $num_trans`
do
    echo "${i}th try"
    (
	echo "BEGIN;"
	echo "SELECT alter_sequence();"
	echo "ABORT;"
    ) | psql -U postgres > /dev/null
done

echo "done"
