Skip to content

Commit d818d29

Browse files
authored
chore: use default schema from Dialect (googleapis#1745)
1 parent 25f7f61 commit d818d29

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

src/main/java/com/google/cloud/spanner/jdbc/JdbcConnection.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -523,14 +523,7 @@ public String getSchema() throws SQLException {
523523

524524
@Nonnull
525525
String getDefaultSchema() {
526-
// TODO: Update to use getDialect()#getDefaultSchema() when available.
527-
switch (getDialect()) {
528-
case POSTGRESQL:
529-
return "public";
530-
case GOOGLE_STANDARD_SQL:
531-
default:
532-
return "";
533-
}
526+
return getDialect().getDefaultSchema();
534527
}
535528

536529
@Override

src/test/java/com/google/cloud/spanner/jdbc/JdbcConnectionTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -738,6 +738,8 @@ public void testSchema() throws SQLException {
738738
// The default schema is the empty string for GoogleSQL databases.
739739
// The default schema is 'public' for PostgreSQL databases.
740740
assertEquals(connection.getDefaultSchema(), connection.getSchema());
741+
String expectedDefaultSchema = dialect == Dialect.POSTGRESQL ? "public" : "";
742+
assertEquals(expectedDefaultSchema, connection.getSchema());
741743
// This should be allowed.
742744
connection.setSchema(connection.getDefaultSchema());
743745
JdbcSqlExceptionImpl exception =

0 commit comments

Comments
 (0)