Source:
public void create(byte[] tableMetadata) { if (conns.get().selectExistsUnregisteredQuery( "SELECT 1 FROM " + config.metadataTable().getQualifiedName() + " WHERE table_name = ?", tableName.getQualifiedName())) { return; } String prefixedTableName = prefixedTableName(); try { conns.get().executeUnregisteredQuery( String.format("CREATE TABLE %s (" + " row_name BYTEA NOT NULL," + " col_name BYTEA NOT NULL," + " ts INT8 NOT NULL," + " val BYTEA," + " CONSTRAINT %s PRIMARY KEY (row_name, col_name, ts) ", prefixedTableName, PrimaryKeyConstraintNames.get(prefixedTableName)) + ")"); } catch (PalantirSqlException e) { if (!e.getMessage().contains("already exists")) { log.error("Error occurred trying to create the table", e); throw e; } else if (prefixedTableName.length() > AtlasDbConstants.ATLASDB_POSTGRES_TABLE_NAME_LIMIT) { String msg = String.format("The table name is longer than the postgres limit of %d characters. " + "Attempted to truncate the name but the truncated table name or truncated primary " + "key constraint name already exists. Please ensure all your table names have unique " + "first %d characters.", AtlasDbConstants.ATLASDB_POSTGRES_TABLE_NAME_LIMIT, AtlasDbConstants.ATLASDB_POSTGRES_TABLE_NAME_LIMIT); String logMessage = "Failed to create the table {}. " + msg; log.error(logMessage, prefixedTableName, e); throw new RuntimeException("Failed to create the table" + prefixedTableName + "." + msg, e); } } ignoringError(() -> { conns.get().insertOneUnregisteredQuery( String.format( "INSERT INTO %s (table_name, table_size) VALUES (?, ?)", config.metadataTable().getQualifiedName()), tableName.getQualifiedName(), TableValueStyle.RAW.getId()); }, ExceptionCheck::isUniqueConstraintViolation); }

Target:
public void create(byte[] tableMetadata) { if (conns.get().selectExistsUnregisteredQuery( "SELECT 1 FROM " + config.metadataTable().getQualifiedName() + " WHERE table_name = ?", tableName.getQualifiedName())) { return; } String prefixedTableName = prefixedTableName(); try { conns.get().executeUnregisteredQuery( String.format("CREATE TABLE %s (" + " row_name BYTEA NOT NULL," + " col_name BYTEA NOT NULL," + " ts INT8 NOT NULL," + " val BYTEA," + " CONSTRAINT %s PRIMARY KEY (row_name, col_name, ts) ", prefixedTableName, PrimaryKeyConstraintNames.get(prefixedTableName)) + ")"); } catch (PalantirSqlException e) { if (!e.getMessage().contains("already exists")) { log.error("Error occurred trying to create the table", e); throw e; } else if (prefixedTableName.length() > ATLASDB_POSTGRES_TABLE_NAME_LIMIT) { String msg = String.format("The table name is longer than the postgres limit of %d characters. " + "Attempted to truncate the name but the truncated table name or truncated primary " + "key constraint name already exists. Please ensure all your table names have unique " + "first %d characters.", ATLASDB_POSTGRES_TABLE_NAME_LIMIT, ATLASDB_POSTGRES_TABLE_NAME_LIMIT); String logMessage = "Failed to create the table {}. " + msg; log.error(logMessage, prefixedTableName, e); throw new RuntimeException("Failed to create the table" + prefixedTableName + "." + msg, e); } } ignoringError(() -> { conns.get().insertOneUnregisteredQuery( String.format( "INSERT INTO %s (table_name, table_size) VALUES (?, ?)", config.metadataTable().getQualifiedName()), tableName.getQualifiedName(), TableValueStyle.RAW.getId()); }, ExceptionCheck::isUniqueConstraintViolation); }