public static Iterator helpMemoizeSqlJoin(Proposition proposition, LogicObject database, Stella_Object arguments) {
    { NamedDescription relation = Logic.getDescription(((Surrogate)(proposition.operator)));
      RelationTableInfo tableinfo = RDBMS.getRelationTableInfo(relation);
      Cons tables = Stella.NIL;
      Cons joinargs = Stella.NIL;
      OutputStringStream sql = OutputStringStream.newOutputStringStream();

      { Object [] caller_MV_returnarray = new Object[1];

        tables = RelationTableInfo.normalizeSqlJoinArguments(tableinfo, arguments, caller_MV_returnarray);
        joinargs = ((Cons)(caller_MV_returnarray[0]));
      }
      sql.nativeStream.print("SELECT DISTINCT ");
      { RelationColumnInfo column = null;
        Cons iter000 = tableinfo.columnList;
        int i = Stella.NULL_INTEGER;
        int iter001 = 1;

        for (;!(iter000 == Stella.NIL); iter000 = iter000.rest, iter001 = iter001 + 1) {
          column = ((RelationColumnInfo)(iter000.value));
          i = iter001;
          if (i > 1) {
            sql.nativeStream.print(", ");
          }
          sql.nativeStream.print(column.columnName);
        }
      }
      sql.nativeStream.print(" FROM ");
      { Stella_Object table = null;
        Cons iter002 = tables;
        int i = Stella.NULL_INTEGER;
        int iter003 = 1;

        for (;!(iter002 == Stella.NIL); iter002 = iter002.rest, iter003 = iter003 + 1) {
          table = iter002.value;
          i = iter003;
          if (i > 1) {
            sql.nativeStream.print(", ");
          }
          if (Stella_Object.consP(table)) {
            sql.nativeStream.print(StringWrapper.unwrapString(((StringWrapper)(((Cons)(table)).value))) + " " + StringWrapper.unwrapString(((StringWrapper)(((Cons)(table)).rest.value))));
          }
          else {
            sql.nativeStream.print(StringWrapper.unwrapString(((StringWrapper)(table))));
          }
        }
      }
      sql.nativeStream.print(" WHERE ");
      { Cons pair = null;
        Cons iter004 = joinargs;
        int i = Stella.NULL_INTEGER;
        int iter005 = 1;

        for (;!(iter004 == Stella.NIL); iter004 = iter004.rest, iter005 = iter005 + 1) {
          pair = ((Cons)(iter004.value));
          i = iter005;
          if (i > 1) {
            sql.nativeStream.print(" AND ");
          }
          sql.nativeStream.print(StringWrapper.unwrapString(((StringWrapper)(pair.value))) + "=" + StringWrapper.unwrapString(((StringWrapper)(pair.rest.value))));
        }
      }
      { Stella_Object arg = null;
        Vector vector000 = proposition.arguments;
        int index000 = 0;
        int length000 = vector000.length();
        RelationColumnInfo column = null;
        Cons iter006 = tableinfo.columnList;

        for (;(index000 < length000) &&
                  (!(iter006 == Stella.NIL)); index000 = index000 + 1, iter006 = iter006.rest) {
          arg = (vector000.theArray)[index000];
          column = ((RelationColumnInfo)(iter006.value));
          arg = Logic.safeArgumentBoundTo(arg);
          if (arg != null) {
            sql.nativeStream.print(" AND ");
            RDBMS.printArgumentConstraint(sql, arg, column);
          }
        }
      }
      return (RDBMS.allocateResultSetIterator(RDBMS.getConnectionFromDatabase(database), relation, sql.theStringReader()));
    }
  }