Permalink
Browse files

test: fix replication test in Pg10 (#746)

In PostgreSQL 10 the function pg_current_xlog_location() is renamed to
pg_current_xlog_location().

See postgres/postgres@806091c
  • Loading branch information...
jorsol authored and vlsi committed Feb 10, 2017
1 parent c8125cf commit 63ed2129f7aa4375d009f19c64dc2404e725aabb
@@ -11,6 +11,8 @@
import org.postgresql.PGConnection;
import org.postgresql.PGProperty;
import org.postgresql.core.BaseConnection;
import org.postgresql.core.ServerVersion;
import org.postgresql.test.TestUtil;
import org.postgresql.test.util.rules.ServerVersionRule;
import org.postgresql.test.util.rules.annotation.HaveMinimalServerVersion;
@@ -509,7 +511,9 @@ private LogSequenceNumber getCurrentLSN() throws SQLException {
Statement st = sqlConnection.createStatement();
ResultSet rs = null;
try {
rs = st.executeQuery("select pg_current_xlog_location()");
rs = st.executeQuery("select "
+ (((BaseConnection) sqlConnection).haveMinimumServerVersion(ServerVersion.v10)
? "pg_current_wal_location()" : "pg_current_xlog_location()"));
if (rs.next()) {
String lsn = rs.getString(1);
@@ -12,6 +12,8 @@
import org.postgresql.PGConnection;
import org.postgresql.PGProperty;
import org.postgresql.core.BaseConnection;
import org.postgresql.core.ServerVersion;
import org.postgresql.test.TestUtil;
import org.postgresql.test.util.rules.ServerVersionRule;
import org.postgresql.test.util.rules.annotation.HaveMinimalServerVersion;
@@ -841,7 +843,9 @@ private LogSequenceNumber getCurrentLSN() throws SQLException {
Statement st = sqlConnection.createStatement();
ResultSet rs = null;
try {
rs = st.executeQuery("select pg_current_xlog_location()");
rs = st.executeQuery("select "
+ (((BaseConnection) sqlConnection).haveMinimumServerVersion(ServerVersion.v10)
? "pg_current_wal_location()" : "pg_current_xlog_location()"));
if (rs.next()) {
String lsn = rs.getString(1);
@@ -11,6 +11,8 @@
import org.postgresql.PGConnection;
import org.postgresql.PGProperty;
import org.postgresql.core.BaseConnection;
import org.postgresql.core.ServerVersion;
import org.postgresql.test.TestUtil;
import org.postgresql.test.util.rules.ServerVersionRule;
import org.postgresql.test.util.rules.annotation.HaveMinimalServerVersion;
@@ -226,7 +228,9 @@ private LogSequenceNumber getCurrentLSN() throws SQLException {
Statement st = sqlConnection.createStatement();
ResultSet rs = null;
try {
rs = st.executeQuery("select pg_current_xlog_location()");
rs = st.executeQuery("select "
+ (((BaseConnection) sqlConnection).haveMinimumServerVersion(ServerVersion.v10)
? "pg_current_wal_location()" : "pg_current_xlog_location()"));
if (rs.next()) {
String lsn = rs.getString(1);
@@ -12,6 +12,8 @@
import org.postgresql.PGProperty;
import org.postgresql.copy.CopyDual;
import org.postgresql.copy.CopyManager;
import org.postgresql.core.BaseConnection;
import org.postgresql.core.ServerVersion;
import org.postgresql.replication.LogSequenceNumber;
import org.postgresql.test.TestUtil;
import org.postgresql.test.util.rules.ServerVersionRule;
@@ -178,7 +180,9 @@ private LogSequenceNumber getCurrentLSN() throws SQLException {
Statement st = sqlConnection.createStatement();
ResultSet rs = null;
try {
rs = st.executeQuery("select pg_current_xlog_location()");
rs = st.executeQuery("select "
+ (((BaseConnection) sqlConnection).haveMinimumServerVersion(ServerVersion.v10)
? "pg_current_wal_location()" : "pg_current_xlog_location()"));
if (rs.next()) {
String lsn = rs.getString(1);

0 comments on commit 63ed212

Please sign in to comment.