DBZ-3151 Use pattern for SYS_NC_OID$, SYS_NC_ROWINFO$, and SYS_NCnnnnn$ names

This commit is contained in:
Chris Cranford 2021-02-22 01:19:55 -05:00 committed by Gunnar Morling
parent f962524de7
commit 556886b522

View File

@ -20,6 +20,7 @@
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.function.Supplier; import java.util.function.Supplier;
import java.util.regex.Pattern;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -48,7 +49,10 @@ public class OracleConnection extends JdbcConnection {
*/ */
private static final int ORACLE_UNSET_SCALE = -127; private static final int ORACLE_UNSET_SCALE = -127;
private static final String SYS_NC_OID_COLUMN = "SYS_NC_OID$"; /**
* Pattern to identify system generated indices and column names.
*/
private static final Pattern SYS_NC_PATTERN = Pattern.compile("^SYS_NC(?:_OID|_ROWINFO|[0-9][0-9][0-9][0-9][0-9])\\$$");
/** /**
* A field for the raw jdbc url. This field has no default value. * A field for the raw jdbc url. This field has no default value.
@ -297,7 +301,7 @@ public List<String> readTableUniqueIndices(DatabaseMetaData metadata, TableId id
@Override @Override
protected boolean isTableUniqueIndexIncluded(String indexName, String columnName) { protected boolean isTableUniqueIndexIncluded(String indexName, String columnName) {
return !SYS_NC_OID_COLUMN.equals(columnName); return !SYS_NC_PATTERN.matcher(columnName).matches();
} }
private void overrideOracleSpecificColumnTypes(Tables tables, TableId tableId, TableId tableIdWithCatalog) { private void overrideOracleSpecificColumnTypes(Tables tables, TableId tableId, TableId tableIdWithCatalog) {