code: function createInputColumnSelector(nodes) {
    return builder => {
      const selects = new Map();
  
      for (const node of nodes) {
        const databaseJson = node.obj.$toDatabaseJson(builder);
  
        for (const column of Object.keys(databaseJson)) {
          if (!shouldSelectColumn(column, selects, node)) {
            continue;
          }
  
          const selection =
            createManyToManyExtraSelectionIfNeeded(builder, column, node) ||
            createSelection(builder, column, node);
  
          selects.set(column, selection);
        }
      }
  
      const selectArr = Array.from(selects.values());
      const idColumn = builder.fullIdColumn();
  
      if (!selectArr.includes(idColumn)) {
        // Always select the identifer.
        selectArr.push(idColumn);
      }
  
      builder.select(selectArr);
    };
  }
docs: Returns a function that only selects the columns that exist in the input.