Add pg_stat_statements to shared_preload_libraries if installed

pull/2247/head
Murat Tuncer 2018-07-02 16:47:20 +03:00
parent 54aa865c3c
commit 3fc98e8225
1 changed files with 17 additions and 1 deletions

View File

@ -136,16 +136,19 @@ $ENV{PG_REGRESS_DIFF_OPTS} = '-dU10 -w';
my $plainRegress = ""; my $plainRegress = "";
my $isolationRegress = ""; my $isolationRegress = "";
my $pgConfig = "";
if ($usingWindows) if ($usingWindows)
{ {
$plainRegress = "$bindir\\pg_regress.exe"; $plainRegress = "$bindir\\pg_regress.exe";
$isolationRegress = "$bindir\\pg_isolation_regress.exe"; $isolationRegress = "$bindir\\pg_isolation_regress.exe";
$pgConfig = "$bindir\\pg_config.exe";
} }
else else
{ {
$plainRegress = "$pgxsdir/src/test/regress/pg_regress"; $plainRegress = "$pgxsdir/src/test/regress/pg_regress";
$isolationRegress = "${postgresBuilddir}/src/test/isolation/pg_isolation_regress"; $isolationRegress = "${postgresBuilddir}/src/test/isolation/pg_isolation_regress";
$pgConfig = "$bindir/pg_config";
} }
if ($isolationtester && ! -f "$isolationRegress") if ($isolationtester && ! -f "$isolationRegress")
@ -263,7 +266,20 @@ push(@pgOptions, '-c', "listen_addresses=${host}");
# not required, and we don't necessarily have access to the default directory # not required, and we don't necessarily have access to the default directory
push(@pgOptions, '-c', "unix_socket_directories="); push(@pgOptions, '-c', "unix_socket_directories=");
push(@pgOptions, '-c', "fsync=off"); push(@pgOptions, '-c', "fsync=off");
push(@pgOptions, '-c', "shared_preload_libraries=citus");
my $sharedPreloadLibraries = "citus";
# check if pg_stat_statements extension is installed
# if it is add it to shared preload libraries
my $sharedir = `$pgConfig --sharedir`;
chomp $sharedir;
my $pg_stat_statements_control = catfile($sharedir, "extension", "pg_stat_statements.control");
if (-e $pg_stat_statements_control)
{
$sharedPreloadLibraries .= ',pg_stat_statements';
}
push(@pgOptions, '-c', "shared_preload_libraries=${sharedPreloadLibraries}");
push(@pgOptions, '-c', "wal_level=logical"); push(@pgOptions, '-c', "wal_level=logical");
# Citus options set for the tests # Citus options set for the tests