diff --git a/extensions-core/postgresql-metadata-storage/src/main/java/org/apache/druid/metadata/storage/postgresql/PostgreSQLConnector.java b/extensions-core/postgresql-metadata-storage/src/main/java/org/apache/druid/metadata/storage/postgresql/PostgreSQLConnector.java index b44d57115cf7..f0b9ba0b4a0b 100644 --- a/extensions-core/postgresql-metadata-storage/src/main/java/org/apache/druid/metadata/storage/postgresql/PostgreSQLConnector.java +++ b/extensions-core/postgresql-metadata-storage/src/main/java/org/apache/druid/metadata/storage/postgresql/PostgreSQLConnector.java @@ -42,6 +42,7 @@ import java.sql.SQLException; import java.util.List; import java.util.Locale; +import java.util.Set; public class PostgreSQLConnector extends SQLMetadataConnector { @@ -287,4 +288,24 @@ protected boolean connectorIsTransientException(Throwable e) } return false; } + + /** + * This method has been overridden to pass lowercase tableName. + * This is done because PostgreSQL creates tables with lowercased names unless explicitly enclosed in double quotes. + */ + @Override + protected boolean tableHasColumn(String tableName, String columnName) + { + return super.tableHasColumn(StringUtils.toLowerCase(tableName), columnName); + } + + /** + * This method has been overridden to pass lowercase tableName. + * This is done because PostgreSQL creates tables with lowercased names unless explicitly enclosed in double quotes. + */ + @Override + public Set getIndexOnTable(String tableName) + { + return super.getIndexOnTable(StringUtils.toLowerCase(tableName)); + } }