anchor.diff:      ?assertPropsEqual(
           [{startkey,[{<<"a">>,timestamp,5}]},
            {endkey,  [{<<"a">>,timestamp,5}]},
  -         {filter, {'<',{field,<<"b">>,sint64},{const, 10}}},
  +         {filter, {'<',{field,<<"b">>,sint64},{const,10}}},
            {end_inclusive,true}],
           S?SQL_SELECT.'WHERE'
       ).
   
  +less_than_eliminated_if_it_is_greater_than_equals_to_on_same_column_test() ->
  +    DDL = get_ddl(
  +        "CREATE TABLE table1("
  +        "a TIMESTAMP NOT NULL, "
  +        "b SINT64 NOT NULL, "
  +        "PRIMARY KEY ((a),a))"),
  +    {ok, Q} = get_query(
  +        "SELECT * FROM table1 "
  +        "WHERE a = 5 AND b = 9 AND b < 10"),
  +    {ok, [S|_]} = compile(DDL, Q),
  +    ?assertPropsEqual(
  +        [{startkey,[{<<"a">>,timestamp,5}]},
  +         {endkey,  [{<<"a">>,timestamp,5}]},
  +         {filter, {'=',{field,<<"b">>,sint64},{const,9}}},
  +         {end_inclusive,true}],
  +        S?SQL_SELECT.'WHERE'
  +    ).
  +
  +query_impossible_if_less_than_is_equal_to_equality_filter_on_same_column_test() ->
  +    DDL = get_ddl(
  +        "CREATE TABLE table1("
  +        "a TIMESTAMP NOT NULL, "
  +        "b SINT64 NOT NULL, "
  +        "PRIMARY KEY ((a),a))"),
  +    {ok, Q} = get_query(
  +        "SELECT * FROM table1 "
  +        "WHERE a = 5 AND b = 9 AND b < 9"),
  +    ?assertEqual(
  +        {error,{impossible_where_clause, << >>}},
  +        compile(DDL, Q)
  +    ).
  +
  +query_impossible_if_less_than_is_less_than_equality_filter_on_same_column_test() ->
  +    DDL = get_ddl(
  +        "CREATE TABLE table1("
  +        "a TIMESTAMP NOT NULL, "
  +        "b SINT64 NOT NULL, "
  +        "PRIMARY KEY ((a),a))"),
  +    {ok, Q} = get_query(
  +        "SELECT * FROM table1 "
  +        "WHERE a = 5 AND b = 9 AND b < 8"),
  +    ?assertEqual(
  +        {error,{impossible_where_clause, << >>}},
  +        compile(DDL, Q)
  +    ).
  +
   -endif.
  
positive.code:     ?assertPropsEqual(
          [{startkey,[{<<"a">>,timestamp,5}]},
           {endkey,  [{<<"a">>,timestamp,5}]},
           {filter, {'<',{field,<<"b">>,sint64},{const, 10}}},
           {end_inclusive,true}],
          S?SQL_SELECT.'WHERE'
      ).
  
negative.code:             Acc3 = append_to_eliminate_later(F_x, Acc2),
              {F, Acc3}
      end;
  check_where_clause_is_possible_fold(_, _, {'<',{field,FieldName,_},{const,LtVal}} = F, Acc) ->
      case find_filter_check(FieldName, Acc) of
          #filtercheck{'=' = {_,_,{const,EqVal}}} when LtVal > EqVal ->
              %% existing equality check is less than than this less than filter,
              %% so this filter is already included so it can be eliminated
              {eliminate, Acc};
          #filtercheck{'=' = {_,_,{const,EqVal}}} when LtVal =< EqVal ->
              %% query requires a column to be equal to a value AND less than that
              %% value which is impossible
              throw({error, {impossible_where_clause, << >>}});
          #filtercheck{'<' = undefined} = Check1 ->
              %% this is the first less than check so just record it
              Check2 = Check1#filtercheck{'<' = F},
  