anchor.diff:      ).
   
   
  -second_greater_than_check_which_is_a_great_value_is_removed_test() ->
  +second_greater_than_check_which_is_a_greater_value_is_removed_test() ->
       DDL = get_ddl(
           "CREATE TABLE table1("
           "a TIMESTAMP NOT NULL, "
  
positive.code:     end;
  check_where_clause_is_possible_fold(_, _, {'>',{field,FieldName,_},_} = F, Acc) ->
      case find_filter_check(FieldName, Acc) of
          #filtercheck{'=' = F} ->
              %% this filter has been specified twice so remove the second occurence
              {eliminate, Acc};
          #filtercheck{'=' = undefined} = Check1 ->
              %% this is the first equality check so just record it
              Check2 = Check1#filtercheck{'=' = F},
              {F, lists:keystore(FieldName, #filtercheck.name, Acc, Check2)};
          #filtercheck{'=' = F_x} when F_x < F ->
              %% we already have a filter that is a lower value than 
              {eliminate, Acc}
      end;
  check_where_clause_is_possible_fold(_, _, Filter, Acc) ->
      {Filter, Acc}.
  
  %% TODO put this in the table helper module
  is_field_nullable(FieldName, ?DDL{fields = Fields}) when is_binary(FieldName)->
  
negative.code:         S?SQL_SELECT.'WHERE'
      ).
  
  
  second_greater_than_check_which_is_a_lesser_value_removes_the_first_test() ->
      DDL = get_ddl(
          "CREATE TABLE table1("
          "a TIMESTAMP NOT NULL, "
          "b SINT64 NOT NULL, "
          "PRIMARY KEY ((a),a,b))"),
      {ok, Q} = get_query(
          "SELECT * FROM table1 "
          "WHERE a = 5 AND b > 11 AND b > 10"),
      {ok, [S|_]} = compile(DDL, Q),
      ?assertPropsEqual(
          [{startkey,[{<<"a">>,timestamp,5}]},
           {endkey,  [{<<"a">>,timestamp,5}]},
           {filter, {'>',{field,<<"b">>,sint64},{const, 10}}},
           {end_inclusive,true}],
          S?SQL_SELECT.'WHERE'
      ).
  
  -endif.
  