diff --git a/java/yb-pgsql/src/test/java/org/yb/pgsql/TestPgMemoryGC.java b/java/yb-pgsql/src/test/java/org/yb/pgsql/TestPgMemoryGC.java index 3d47d5263645..2b3cf6749f22 100644 --- a/java/yb-pgsql/src/test/java/org/yb/pgsql/TestPgMemoryGC.java +++ b/java/yb-pgsql/src/test/java/org/yb/pgsql/TestPgMemoryGC.java @@ -10,6 +10,7 @@ import java.io.BufferedReader; import java.io.InputStreamReader; +import java.sql.ResultSet; import java.sql.Statement; import java.util.Collections; import java.util.Map; @@ -90,7 +91,9 @@ public void testPgMemoryGcOrderBy() throws Exception { try (Statement stmt = connection.createStatement()) { stmt.execute("SET work_mem='1GB'"); - final int pgPid = getPgBackendPid(connection); + ResultSet rs = stmt.executeQuery("SELECT pg_backend_pid()"); + rs.next(); + final int pgPid = rs.getInt("pg_backend_pid"); final long rssBefore = getRssForPid(pgPid); /*