Add DatabaseType POSTGRES for the product name EnterpriseDB

Resolves #4627
This commit is contained in:
Sheel Prabhakar
2024-06-29 07:50:41 +05:30
committed by Mahmoud Ben Hassine
parent 7d151234b1
commit 5fb7b5a3f1
2 changed files with 11 additions and 2 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2023 the original author or authors.
* Copyright 2006-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -103,6 +103,9 @@ public enum DatabaseType {
databaseProductName = JdbcUtils.commonDatabaseName(databaseProductName);
}
}
else if (StringUtils.hasText(databaseProductName) && databaseProductName.startsWith("EnterpriseDB")) {
databaseProductName = "PostgreSQL";
}
else {
databaseProductName = JdbcUtils.commonDatabaseName(databaseProductName);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2008-2022 the original author or authors.
* Copyright 2008-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -138,6 +138,12 @@ class DatabaseTypeTests {
assertEquals(POSTGRES, DatabaseType.fromMetaData(ds));
}
@Test
void testFromMetaDataForEnterpriseDB() throws Exception {
DataSource ds = DatabaseTypeTestUtils.getMockDataSource("EnterpriseDB");
assertEquals(POSTGRES, DatabaseType.fromMetaData(ds));
}
@Test
void testFromMetaDataForSybase() throws Exception {
DataSource ds = DatabaseTypeTestUtils.getMockDataSource("Adaptive Server Enterprise");