Source:
<code>public void registerTables( Iterable<PostgresTableDefinition> tables ) throws SQLException { logger.info( "Processing postgres table registrations." ); for ( PostgresTableDefinition table : tables ) { if ( activeTables.containsKey( table.getName() ) ) { logger.debug( "Table has already been registered and initialized... skipping", table ); } else { logger.debug( "Processed postgres table registration for table {}", table.getName() ); try ( Connection conn = hds.getConnection(); Statement sctq = conn.createStatement() ) { if ( initializeTables ) { sctq.execute( table.createTableQuery() ); if ( citus ) { if ( table instanceof CitusDistributedTableDefinition ) { logger.info( "Creating distributed table {}.", table.getName() ); try ( Statement ddstmt = conn.createStatement() ) { ddstmt.execute( ( (CitusDistributedTableDefinition) table ) .createDistributedTableQuery() ); } catch ( SQLException ddex ) { if ( ddex.getSQLState().equals( INVALID_TABLE_DEFINITION_SQL_STATE ) <START> && ddex.getMessage().matches( "ERROR: table \"?" + table.getName() + "\"? is already distributed" ) ) { <END> logger.warn( "Table is already distributed.", table.getName() ); } else { logger.debug( "Unable to distribute table {}. Cause: {}", table.getName(), ddex.getMessage(), ddex ); } } } } } if ( initializeIndices ) { for ( PostgresIndexDefinition index : table.getIndexes() ) { String indexSql = index.sql(); try ( Statement sci = conn.createStatement() ) { sci.execute( indexSql ); } catch ( SQLException e ) { logger.info( "Failed to create index with query for table {}", index, indexSql, table ); throw e; } } } } catch ( SQLException e ) { logger.info( "Failed to initialize postgres table with query {}", table, table.createTableQuery(), e ); throw e; } } activeTables.put( table.getName(), table ); } }</code><technical_language>I a matcher avoid pattern recompilation</technical_language>

Target:
public void registerTables( Iterable<PostgresTableDefinition> tables ) throws SQLException { logger.info( "Processing postgres table registrations." ); for ( PostgresTableDefinition table : tables ) { if ( activeTables.containsKey( table.getName() ) ) { logger.debug( "Table has already been registered and initialized... skipping", table ); } else { logger.debug( "Processed postgres table registration for table {}", table.getName() ); try ( Connection conn = hds.getConnection(); Statement sctq = conn.createStatement() ) { if ( initializeTables ) { sctq.execute( table.createTableQuery() ); if ( citus ) { if ( table instanceof CitusDistributedTableDefinition ) { logger.info( "Creating distributed table {}.", table.getName() ); try ( Statement ddstmt = conn.createStatement() ) { ddstmt.execute( ( (CitusDistributedTableDefinition) table ) .createDistributedTableQuery() ); } catch ( SQLException ddex ) { if ( ddex.getSQLState().equals( INVALID_TABLE_DEFINITION_SQL_STATE ) && ddex.getMessage().contains( ALREADY_DISTRIBUTED_ERROR_MSG ) ) { logger.warn( "Table is already distributed.", table.getName() ); } else { logger.debug( "Unable to distribute table {}. Cause: {}", table.getName(), ddex.getMessage(), ddex ); } } } } } if ( initializeIndices ) { for ( PostgresIndexDefinition index : table.getIndexes() ) { String indexSql = index.sql(); try ( Statement sci = conn.createStatement() ) { sci.execute( indexSql ); } catch ( SQLException e ) { logger.info( "Failed to create index with query for table {}", index, indexSql, table ); throw e; } } } } catch ( SQLException e ) { logger.info( "Failed to initialize postgres table with query {}", table, table.createTableQuery(), e ); throw e; } } activeTables.put( table.getName(), table ); } }