################################################################################
#
# Verify that  SELECT COUNT(*) FROM t1 is never 0.
# This should hold because we take care not to delete all rows from that table.
#
# There have been bugs in the past where this query sporadically has returned 
# 0 for non-empty tables.
#
################################################################################

SET autocommit = 0;
START TRANSACTION;
--echo *** Running query: SELECT COUNT(*) FROM t1
let $count= `SELECT COUNT(*) FROM t1`;
if (!$count)
{
    # count was zero (0)
    --echo FAIL! SELECT COUNT(*) returned 0 - this should neven happen.
}

# Check that the count of rows with pk divisible by 5 is constant.
# This should hold because
#  a) We do not delete rows with pk MOD 5 = 0
#  b) We cannot insert new pk's below the initial auto_increment counter (see init test).
SELECT COUNT(*) FROM t1 WHERE `pk` MOD 5 = 0 AND `pk` BETWEEN 1 AND 1000;
--sleep 1
SELECT COUNT(*) FROM t1 WHERE `pk` MOD 5 = 0 AND `pk` BETWEEN 1 AND 1000;
COMMIT;
