From 1e2e3c91eba5a0ed99b28ce2cc30a3651a534803 Mon Sep 17 00:00:00 2001
From: Valery Kharseko <vharseko@3a-systems.ru>
Date: Tue, 22 Sep 2026 09:07:31 +0000
Subject: [PATCH] [#902] Name the table to the index guard of the JDBC backend the way the database stores it (#1001)
---
opendj-server-legacy/src/test/java/org/opends/server/backends/jdbc/TestCase.java | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/backends/jdbc/TestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/backends/jdbc/TestCase.java
index 75001d3..da5f705 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/backends/jdbc/TestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/backends/jdbc/TestCase.java
@@ -102,6 +102,14 @@
/**
* Backend test classes sharing one database map the same tree names to the same tables,
* so a previous run may leave trees behind — including entries encrypted with a lost cipher key.
+ * <p>
+ * Each one is dropped where it was listed: this lookup is narrowed to no schema, so it reports the
+ * tables of the whole database - pgjdbc adds a schema predicate for a pattern that is not null and
+ * for nothing else - while an unqualified {@code drop table} resolves through the search_path alone.
+ * A table left behind outside it would fail to drop, and the failure of one drop is a
+ * {@link SkipException} over the whole class in {@link #setUp()}: the class would go on skipping run
+ * after run, and the leftover would never be dropped. A driver reporting no schema of its own - mysql
+ * names the database in the catalog instead - keeps the name as it was listed.
*/
static void dropStaleTrees(Connection con) throws SQLException {
final List<String> stale = new ArrayList<>();
@@ -109,7 +117,8 @@
while (rs.next()) {
final String name = rs.getString("TABLE_NAME");
if (name.toLowerCase().startsWith("opendj_")) {
- stale.add(name);
+ final String schema = rs.getString("TABLE_SCHEM");
+ stale.add(schema == null || schema.isEmpty() ? name : schema + "." + name);
}
}
}
--
Gitblit v1.10.0