anchor.diff:      %% now make the result - expecting 2 queries
       [Where1, Where2] =
           test_data_where_clause(<<"Scotland">>, <<"user_1">>, [{3000, 15000}, {15000, 30000}]),
  -    PK = get_standard_pk(),
  -    LK = get_standard_lk(),
  -    ?assertMatch(
  -       {ok, [?SQL_SELECT{ 'WHERE'       = Where1,
  -                          partition_key = PK,
  -                          local_key     = LK},
  -             ?SQL_SELECT{ 'WHERE'       = Where2,
  -                          partition_key = PK,
  -                          local_key     = LK
  -                        }]},
  -       compile(DDL, Q, 5)
  -      ).
  +    _PK = get_standard_pk(),
  +    _LK = get_standard_lk(),
  +    {ok, [Select1, Select2]} = compile(DDL, Q, 5),
  +    ?assertEqual(
  +        [Where1, Where2],
  +        [Select1?SQL_SELECT.'WHERE', Select2?SQL_SELECT.'WHERE']
  +    ),
  +    ?assertEqual(
  +        [get_standard_pk(), get_standard_pk()],
  +        [Select1?SQL_SELECT.partition_key, Select2?SQL_SELECT.partition_key]
  +    ),
  +    ?assertEqual(
  +        [get_standard_lk(), get_standard_lk()],
  +        [Select1?SQL_SELECT.local_key, Select2?SQL_SELECT.local_key]
  +    ).
   
   %%
   %% test failures
  
positive.code:         "PRIMARY KEY  ((a,b), a,b))"),
      {ok, Q} = get_query(
            "SELECT * FROM tab1 WHERE a = 1 AND b = 1"),
      ?assertMatch(
          {ok, [?SQL_SELECT{
              'WHERE' =
                  [{startkey,[{<<"a">>,timestamp,1},{<<"b">>,varchar,1}]},
                   {endkey,  [{<<"a">>,timestamp,1},{<<"b">>,varchar,1}]},
                   {filter,[]},
                   {end_inclusive,true}] }]},
          compile(DDL, Q, 100)
      ).
  
  %% partition and local key are different
  
negative.code:     {X,Y,Z,Index};
  find_quantum_field_index_in_key2([_|Tail], Index) ->
      find_quantum_field_index_in_key2(Tail, Index+1).
  
  hash_timestamp_to_quanta(QField, QSize, QUnit, QIndex, MaxSubQueries, Where1) ->
      GetMaxMinFun = fun({startkey, List}, {_S, E}) ->
  