docs: private void addConstraintToCatalog(Table table,
              VoltXMLElement node,
              Map<String, String> indexReplacementMap,
              Map<String, Index> indexMap)
              throws VoltCompilerException
      {
          assert node.name.equals("constraint");
  
          String name = node.attributes.get("name");
          String typeName = node.attributes.get("constrainttype");
          ConstraintType type = ConstraintType.valueOf(typeName);
          String tableName = table.getTypeName();
  
          if (type == ConstraintType.LIMIT) {
              int tupleLimit = Integer.parseInt(node.attributes.get("rowslimit"));
              if (tupleLimit < 0) {
                  throw m_compiler.new VoltCompilerException("Invalid constraint limit number '" + tupleLimit + "'");
              }
              if (tableLimitConstraintCounter.contains(tableName)) {
                  throw m_compiler.new VoltCompilerException("Too many table limit constraints for table " + tableName);
              } else {
                  tableLimitConstraintCounter.add(tableName);
              }
  
              table.setTuplelimit(tupleLimit);
              String deleteStmt = node.attributes.get("rowslimitdeletestmt");
              if (deleteStmt != null) {
                  Statement catStmt = table.getTuplelimitdeletestmt().add("limit_delete");
                  catStmt.setSqltext(deleteStmt);
                  validateTupleLimitDeleteStmt(catStmt);
              }
              return;
          }
  
          if (type == ConstraintType.CHECK) {
              String msg = "VoltDB does not enforce check constraints. ";
              msg += "Constraint on table " + tableName + " will be ignored.";
              m_compiler.addWarn(msg);
              return;
          }
          else if (type == ConstraintType.FOREIGN_KEY) {
              String msg = "VoltDB does not enforce foreign key references and constraints. ";
              msg += "Constraint on table " + tableName + " will be ignored.";
              m_compiler.addWarn(msg);
              return;
          }
          else if (type == ConstraintType.MAIN) {
              // should never see these
              assert(false);
          }
          else if (type == ConstraintType.NOT_NULL) {
              // these get handled by table metadata inspection
              return;
          }
          else if (type != ConstraintType.PRIMARY_KEY &&  type != ConstraintType.UNIQUE) {
              throw m_compiler.new VoltCompilerException("Invalid constraint type '" + typeName + "'");
          }
  
          // else, create the unique index below
          // primary key code is in other places as well
  
          // The constraint is backed by an index, therefore we need to create it
          // TODO: We need to be able to use indexes for foreign keys. I am purposely
          //       leaving those out right now because HSQLDB just makes too many of them.
          Constraint catalog_const = table.getConstraints().add(name);
          String indexName = node.attributes.get("index");
          assert(indexName != null);
          // handle replacements from duplicate index pruning
          if (indexReplacementMap.containsKey(indexName)) {
              indexName = indexReplacementMap.get(indexName);
          }
  
          Index catalog_index = indexMap.get(indexName);
  
          // Attach the index to the catalog constraint (catalog_const).
          if (catalog_index != null) {
              catalog_const.setIndex(catalog_index);
              // This may be redundant.
              catalog_index.setUnique(true);
  
              boolean assumeUnique = Boolean.parseBoolean(node.attributes.get("assumeunique"));
              catalog_index.setAssumeunique(assumeUnique);
          }
          catalog_const.setType(type.getValue());
      }