Fix postgres metadata storage warning logs because of tablename causing issues (#17351)

This commit is contained in:
Akshat Jain 2024-10-17 15:48:22 +05:30 committed by GitHub
parent 450fb0147b
commit 8c52be81d3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 21 additions and 0 deletions

View File

@ -42,6 +42,7 @@ import java.sql.DatabaseMetaData;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.Set;
public class PostgreSQLConnector extends SQLMetadataConnector public class PostgreSQLConnector extends SQLMetadataConnector
{ {
@ -287,4 +288,24 @@ public class PostgreSQLConnector extends SQLMetadataConnector
} }
return false; 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<String> getIndexOnTable(String tableName)
{
return super.getIndexOnTable(StringUtils.toLowerCase(tableName));
}
} }