HHH-10718 - Fix Underscore in table name can result in SchemaExtractionException: More than one table found
This commit is contained in:
parent
54ffced4dc
commit
55ce254d2d
|
@ -361,19 +361,11 @@ public class InformationExtractorJdbcDatabaseMetaDataImpl implements Information
|
||||||
Identifier tableName,
|
Identifier tableName,
|
||||||
ResultSet resultSet) throws SQLException {
|
ResultSet resultSet) throws SQLException {
|
||||||
try {
|
try {
|
||||||
if ( !resultSet.next() ) {
|
boolean found = false;
|
||||||
log.tableNotFound( tableName.render() );
|
TableInformation tableInformation = null;
|
||||||
return null;
|
while ( resultSet.next() ) {
|
||||||
}
|
if ( tableName.equals( identifierHelper().toIdentifier( resultSet.getString( "TABLE_NAME" ) ) ) ) {
|
||||||
|
if ( found ) {
|
||||||
final TableInformation tableInformation = extractTableInformation(
|
|
||||||
catalog,
|
|
||||||
schema,
|
|
||||||
tableName,
|
|
||||||
resultSet
|
|
||||||
);
|
|
||||||
|
|
||||||
if ( resultSet.next() ) {
|
|
||||||
log.multipleTablesFound( tableName.render() );
|
log.multipleTablesFound( tableName.render() );
|
||||||
final String catalogName = catalog == null ? "" : catalog.render();
|
final String catalogName = catalog == null ? "" : catalog.render();
|
||||||
final String schemaName = schema == null ? "" : schema.render();
|
final String schemaName = schema == null ? "" : schema.render();
|
||||||
|
@ -387,7 +379,21 @@ public class InformationExtractorJdbcDatabaseMetaDataImpl implements Information
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
found = true;
|
||||||
|
tableInformation = extractTableInformation(
|
||||||
|
catalog,
|
||||||
|
schema,
|
||||||
|
tableName,
|
||||||
|
resultSet
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( !found ) {
|
||||||
|
log.tableNotFound( tableName.render() );
|
||||||
|
}
|
||||||
return tableInformation;
|
return tableInformation;
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
|
|
Loading…
Reference in New Issue