From ccd340d46f5d0092a06f6fee29d7613459c5de71 Mon Sep 17 00:00:00 2001
From: Vincent Pelletier <vincent@nexedi.com>
Date: Mon, 4 Mar 2013 15:20:04 +0100
Subject: [PATCH] Improve comment.

---
 product/ERP5/Tool/SimulationTool.py | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/product/ERP5/Tool/SimulationTool.py b/product/ERP5/Tool/SimulationTool.py
index 6725959ed8..e26fb6691c 100644
--- a/product/ERP5/Tool/SimulationTool.py
+++ b/product/ERP5/Tool/SimulationTool.py
@@ -1568,10 +1568,19 @@ class SimulationTool(BaseTool):
           elif line_a[key] == line_b[key]:
             result[key] = line_a[key]
           elif key not in ('date', 'stock_uid', 'path'):
-            # This case happens when we got columns in result
-            # which are not part of the group by statement, MySQL
-            # used to choose randomly a value for this column, here
-            # we just do not set the key in result returned
+            # There are 2 possible reasons to end up here:
+            # - key corresponds to a projected column for which are neither
+            #   known aggregated columns (in which case they should be in
+            #   result_column_id_dict) nor part of grouping columns, and the
+            #   result happens to be unstable. There are cases in ERP5 where
+            #   such result is suposed to be stable, for example
+            #   group_by=('xxx_uid'), selection_list=('xxx_path') because the
+            #   relation is bijective (although the database doesn't know it).
+            #   These should result in stable results (but don't necessarily
+            #   do, ex: xxx_title when object title has been changed between
+            #   cache fill and cache lookup).
+            # - line_a and line_b are indeed mismatched, and code calling us
+            #   has a bug.
             LOG('InventoryTool.getInventoryList.addLineValues',
               PROBLEM,
               'mismatch for %s column: %s and %s' % (
-- 
2.30.9