Skip to content

Commit

Permalink
Fix postgres metadata storage warning logs because of tablename causi…
Browse files Browse the repository at this point in the history
…ng issues (apache#17351)
  • Loading branch information
Akshat-Jain authored Oct 17, 2024
1 parent 450fb01 commit 8c52be8
Showing 1 changed file with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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<String> getIndexOnTable(String tableName)
{
return super.getIndexOnTable(StringUtils.toLowerCase(tableName));
}
}

0 comments on commit 8c52be8

Please sign in to comment.