Skip to content
This repository was archived by the owner on Mar 26, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class JdbcDatabaseMetaData extends AbstractJdbcWrapper implements DatabaseMetaDa
private static final int DATABASE_MAJOR_VERSION = 1;
private static final int DATABASE_MINOR_VERSION = 0;
private static final String PRODUCT_NAME = "Google Cloud Spanner";
private static final String POSTGRESQL_PRODUCT_NAME = PRODUCT_NAME + " PostgreSQL";

@VisibleForTesting
static String readSqlFromFile(String filename, Dialect dialect) {
Expand Down Expand Up @@ -137,7 +138,7 @@ public boolean nullsAreSortedAtEnd() {

@Override
public String getDatabaseProductName() {
return PRODUCT_NAME;
return connection.getDialect() == Dialect.POSTGRESQL ? POSTGRESQL_PRODUCT_NAME : PRODUCT_NAME;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ public static Object[] data() {
private static final int DATABASE_MAJOR_VERSION = 1;
private static final int DATABASE_MINOR_VERSION = 0;
private static final String DATABASE_PRODUCT_NAME = "Google Cloud Spanner";
private static final String POSTGRESQL_DATABASE_PRODUCT_NAME =
DATABASE_PRODUCT_NAME + " PostgreSQL";

@Test
public void testTrivialMethods() throws SQLException {
Expand Down Expand Up @@ -90,7 +92,6 @@ public void testTrivialMethods() throws SQLException {
assertEquals("CATALOG", meta.getCatalogTerm());
assertEquals(DATABASE_MAJOR_VERSION, meta.getDatabaseMajorVersion());
assertEquals(DATABASE_MINOR_VERSION, meta.getDatabaseMinorVersion());
assertEquals(DATABASE_PRODUCT_NAME, meta.getDatabaseProductName());
assertEquals(
DATABASE_MAJOR_VERSION + "." + DATABASE_MINOR_VERSION, meta.getDatabaseProductVersion());
assertEquals(Connection.TRANSACTION_SERIALIZABLE, meta.getDefaultTransactionIsolation());
Expand Down Expand Up @@ -134,8 +135,10 @@ public void testTrivialMethods() throws SQLException {
assertFalse(meta.isCatalogAtStart());
assertEquals(connection.isReadOnly(), meta.isReadOnly());
if (dialect == Dialect.POSTGRESQL) {
assertEquals(POSTGRESQL_DATABASE_PRODUCT_NAME, meta.getDatabaseProductName());
assertTrue(meta.storesLowerCaseIdentifiers());
} else {
assertEquals(DATABASE_PRODUCT_NAME, meta.getDatabaseProductName());
assertFalse(meta.storesLowerCaseIdentifiers());
}
assertFalse(meta.storesLowerCaseQuotedIdentifiers());
Expand Down
Loading