https://github.com/EOSIO/eos/blob/5082391c60b0fa5e68157c385cd402bf25aea934/plugins/chain_plugin/chain_plugin.cpp#L1158

read_only::get_table_rows_result read_only::get_table_rows( const read_only::get_table_rows_params& p )const {
   const abi_def abi = eosio::chain_apis::get_abi( db, p.code );
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
   bool primary = false;
   auto table_with_index = get_table_index_name( p, primary );
   if( primary ) {
      EOS_ASSERT( p.table == table_with_index, chain::contract_table_query_exception, "Invalid table name ${t}", ( "t", p.table ));
      auto table_type = get_table_type( abi, p.table );
      if( table_type == KEYi64 || p.key_type == "i64" || p.key_type == "name" ) {
         return get_table_rows_ex<key_value_index>(p,abi);
      }
      EOS_ASSERT( false, chain::contract_table_query_exception,  "Invalid table type ${type}", ("type",table_type)("abi",abi));
   } else {
      EOS_ASSERT( !p.key_type.empty(), chain::contract_table_query_exception, "key type required for non-primary index" );

      if (p.key_type == chain_apis::i64 || p.key_type == "name") {
         return get_table_rows_by_seckey<index64_index, uint64_t>(p, abi, [](uint64_t v)->uint64_t {
            return v;
         });
      }
      else if (p.key_type == chain_apis::i128) {
         return get_table_rows_by_seckey<index128_index, uint128_t>(p, abi, [](uint128_t v)->uint128_t {
            return v;
         });
      }
      else if (p.key_type == chain_apis::i256) {
         if ( p.encode_type == chain_apis::hex) {
            using  conv = keytype_converter<chain_apis::sha256,chain_apis::hex>;
            return get_table_rows_by_seckey<conv::index_type, conv::input_type>(p, abi, conv::function());
         }
         using  conv = keytype_converter<chain_apis::i256>;
         return get_table_rows_by_seckey<conv::index_type, conv::input_type>(p, abi, conv::function());
      }

结论

primary key 只支持uint64_tcapi_name
如果想支持其他类型只能用
二级索引支持了 index_position + key_type

官方解释

它们是多索引表,因为它们支持在数据上使用多个索引,主索引类型必须是uint64_t并且必须是唯一的,但其他次要索引可以具有重复项。最多可以有16个附加索引,字段类型可以是uint64_t,uint128_t,eosio::checksum256,double或long double

参考

https://developers.eos.io/eosio-cpp/docs/using-multi-index-tables#section-introduction
https://developers.eos.io/eosio-nodeos/reference#get_table_rows
https://eosio.stackexchange.com/questions/3091/is-it-possible-to-use-a-type-other-than-uint64-t-for-a-table-primary-key/3097#3097