This is an automated email from the ASF dual-hosted git repository.
sunnianjun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 8106610c731 Fix object not found exception when config opengauss
schema name as database name (#25124)
8106610c731 is described below
commit 8106610c73144d71351cbbb179eb61222eb7690c
Author: Zhengqiang Duan <[email protected]>
AuthorDate: Wed Apr 12 09:51:15 2023 +0800
Fix object not found exception when config opengauss schema name as
database name (#25124)
---
.../infra/metadata/database/schema/util/SystemSchemaUtils.java | 2 +-
.../infra/metadata/database/schema/util/SystemSchemaUtilsTest.java | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git
a/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/schema/util/SystemSchemaUtils.java
b/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/schema/util/SystemSchemaUtils.java
index f21af0603df..7026b7a1c24 100644
---
a/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/schema/util/SystemSchemaUtils.java
+++
b/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/schema/util/SystemSchemaUtils.java
@@ -48,6 +48,6 @@ public final class SystemSchemaUtils {
return true;
}
}
- return databaseType.getSystemSchemas().contains(database.getName());
+ return databaseType instanceof SchemaSupportedDatabaseType ? false :
databaseType.getSystemSchemas().contains(database.getName());
}
}
diff --git
a/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/database/schema/util/SystemSchemaUtilsTest.java
b/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/database/schema/util/SystemSchemaUtilsTest.java
index 21ca225004c..01f531cc468 100644
---
a/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/database/schema/util/SystemSchemaUtilsTest.java
+++
b/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/database/schema/util/SystemSchemaUtilsTest.java
@@ -51,6 +51,8 @@ class SystemSchemaUtilsTest {
assertFalse(SystemSchemaUtils.containsSystemSchema(new
OpenGaussDatabaseType(), Collections.singletonList("sharding_db"),
shardingSchemaDatabase));
ShardingSphereDatabase customizedInformationSchemaDatabase =
mockShardingSphereDatabase("information_schema", true);
assertTrue(SystemSchemaUtils.containsSystemSchema(new
OpenGaussDatabaseType(), Arrays.asList("information_schema", "pg_catalog"),
customizedInformationSchemaDatabase));
+ ShardingSphereDatabase customizedGaussDBDatabase =
mockShardingSphereDatabase("gaussdb", true);
+ assertFalse(SystemSchemaUtils.containsSystemSchema(new
OpenGaussDatabaseType(), Collections.emptyList(), customizedGaussDBDatabase));
}
@Test