I am using uc_views 6.x-3.1 with ubercart 6.x-2.4 and views 6.x-2.12. If I create a simple view to test, of type "Ubercart orders" and add a field "Ubercart order: Order ID" and run the query, I get the following SQL:

SELECT uc_orders.order_id AS order_id,
   uc_orders.uid AS uc_orders_uid
 FROM uc_orders uc_orders 

I don't think that uc_orders.uid is necessary. In most cases this is harmless, but when I add views_groupby which adds a GROUP BY clause to the query, and lets you select the fields to group by or aggregate, the uc_orders.uid is not in the list (since the UI only lets you pick fields you've explicitly asked for) and as a result uc_orders.uid does not become part of the GROUP BY clause, breaking the query.

Couldn't the above SQL be:

SELECT uc_orders.order_id AS order_id
 FROM uc_orders uc_orders 

by default, and only add uc_orders.uid if I actually add the "Ubercart order: uid" Views field?