From d3eb31f30cce495766e9b02f04f90234ca9fc072 Mon Sep 17 00:00:00 2001 From: Greg Sabino Mullane Date: Sun, 3 May 2009 20:58:17 -0400 Subject: [PATCH] More testing tweaks. --- t/CP_Testing.pm | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/t/CP_Testing.pm b/t/CP_Testing.pm index 60b9576c1..c997c43c7 100644 --- a/t/CP_Testing.pm +++ b/t/CP_Testing.pm @@ -87,7 +87,6 @@ sub test_database_handle { print $cfh qq{\n\n## check_postgres.pl testing parameters\n}; print $cfh qq{listen_addresses = ''\n}; print $cfh qq{max_connections = 10\n}; - print $cfh qq{max_fsm_pages = 99999\n}; ## Grab the version for finicky items if (qx{$initdb --version} !~ /(\d+)\.(\d+)/) { @@ -112,6 +111,11 @@ sub test_database_handle { print $cfh qq{stats_row_level = on\n}; } + ## <= 8.3 + if ($imaj < 8 or ($imaj==8 and $imin <= 3)) { + print $cfh qq{max_fsm_pages = 99999\n}; + } + print $cfh "\n"; close $cfh or die qq{Could not close "$cfile": $!\n}; @@ -262,17 +266,15 @@ sub test_database_handle { $dbh->{AutoCommit} = 1; $dbh->{RaiseError} = 0; - if ($maj < 8 or ($maj==8 and $min < 1)) { - ## Old school - $dbh->do('CREATE USER sixpack'); - $dbh->do('CREATE USER readonly'); - } - else { - $dbh->do("CREATE USER $dbuser SUPERUSER"); - $dbh->do('CREATE USER sixpack NOSUPERUSER CREATEDB'); - $dbh->do('CREATE USER readonly NOSUPERUSER NOCREATEDB'); + if ($maj > 8 or ($maj==8 and $min >= 1)) { + $SQL = q{SELECT count(*) FROM pg_user WHERE usename = ?}; + $sth = $dbh->prepare($SQL); + $sth->execute($dbuser); + $count = $sth->fetchall_arrayref()->[0][0]; + if (!$count) { + $dbh->do("CREATE USER $dbuser SUPERUSER"); + } } - $dbh->do('ALTER USER readonly SET default_transaction_read_only = 1'); $dbh->do('CREATE DATABASE beedeebeedee'); $dbh->do('CREATE DATABASE ardala'); $dbh->do('CREATE LANGUAGE plpgsql'); -- 2.39.5