Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bdecedb

Browse files
committed
Fix TAP test for PostgreSQL 9.6 and lower
1 parent 845db08 commit bdecedb

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

t/001_wal.pl

+15-2
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,23 @@ sub test_index_replay
1313
{
1414
my ($test_name) = @_;
1515

16+
# Check server version
17+
my $server_version = $node_master->safe_psql("postgres", "SELECT current_setting('server_version_num');") + 0;
18+
1619
# Wait for standby to catch up
1720
my $applname = $node_standby->name;
18-
my $caughtup_query =
19-
"SELECT pg_current_wal_lsn() <= write_lsn FROM pg_stat_replication WHERE application_name = '$applname';";
21+
my $caughtup_query;
22+
23+
if ($server_version < 100000)
24+
{
25+
$caughtup_query =
26+
"SELECT pg_current_xlog_location() <= write_location FROM pg_stat_replication WHERE application_name = '$applname';";
27+
}
28+
else
29+
{
30+
$caughtup_query =
31+
"SELECT pg_current_wal_lsn() <= write_lsn FROM pg_stat_replication WHERE application_name = '$applname';";
32+
}
2033
$node_master->poll_query_until('postgres', $caughtup_query)
2134
or die "Timed out while waiting for standby 1 to catch up";
2235

0 commit comments

Comments
 (0)