public static String generatePartitionMetadataTableName(String databaseId) {
    // There are 11 characters in the name format.
    // Maximum Spanner database ID length is 30 characters.
    // UUID always generates a String with 36 characters.
    // Since the Postgres table name length is 63, we may need to truncate the table name depending
    // on the database length.
    String fullString =
        String.format(PARTITION_METADATA_TABLE_NAME_FORMAT, databaseId, UUID.randomUUID())
            .replaceAll("-", "_");
    if (fullString.length() < MAX_TABLE_NAME_LENGTH) {
      return fullString;
    }
    return fullString.substring(0, MAX_TABLE_NAME_LENGTH);
  }
@Test
  public void testGenerateMetadataTableNameIsShorterThan64Characters() {
    final String tableName =
        NameGenerator.generatePartitionMetadataTableName("my-database-id1-maximum-length");
    assertTrue(tableName.length() <= MAXIMUM_POSTGRES_TABLE_NAME_LENGTH);
  }