Skip to content

Commit 5c6041b

Browse files
committed
test: Handle cleanup of privileged connection in DatabaseMetaDataTest
1 parent 1c5f527 commit 5c6041b

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

pgjdbc/src/test/java/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ public static Iterable<Object[]> data() {
6464

6565
@Before
6666
public void setUp() throws Exception {
67-
Connection conPriv = TestUtil.openPrivilegedDB();
6867
if (binaryMode == BinaryMode.FORCE) {
6968
final Properties props = new Properties();
7069
PGProperty.PREPARE_THRESHOLD.set(props, -1);
@@ -93,7 +92,9 @@ public void setUp() throws Exception {
9392
TestUtil.execute("comment on table duplicate is 'duplicate table'", con);
9493
TestUtil.execute("create or replace function bar() returns integer language sql as $$ select 1 $$", con);
9594
TestUtil.execute("comment on function bar() is 'bar function'", con);
96-
TestUtil.execute("update pg_description set objoid = 'duplicate'::regclass where objoid = 'bar'::regproc",conPriv);
95+
try (Connection conPriv = TestUtil.openPrivilegedDB()) {
96+
TestUtil.execute("update pg_description set objoid = 'duplicate'::regclass where objoid = 'bar'::regproc", conPriv);
97+
}
9798

9899
// 8.2 does not support arrays of composite types
99100
TestUtil.createTable(con, "customtable", "c1 custom, c2 _custom"

0 commit comments

Comments
 (0)