diff --git a/sql/item.cc b/sql/item.cc
index d51b931a3d1..9f69ec8eece 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -11545,6 +11545,10 @@ table_map Item_ref_null_helper::used_tables() const
 
 #ifndef DBUG_OFF
 
+void print_query_stderr()
+{
+  fprintf(stderr, "Q:%s\n", current_thd->query());
+}
 /* Debugger help function */
 static char dbug_item_print_buf[2048];
 
diff --git a/sql/item.h b/sql/item.h
index a207b2c2f2a..2d31504c623 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -8031,7 +8031,8 @@ class Item_cache_date: public Item_cache_temporal
   }
 };
 
-
+const char *dbug_print_item(Item *item);
+void print_query_stderr();
 class Item_cache_timestamp: public Item_cache
 {
   Timestamp_or_zero_datetime_native m_native;
@@ -8043,7 +8044,11 @@ class Item_cache_timestamp: public Item_cache
   Item *shallow_copy(THD *thd) const override
   { return get_item_copy<Item_cache_timestamp>(thd, this); }
   Item *deep_copy(THD *thd) const override
-  { return shallow_copy_with_checks(thd); }
+  {
+    fprintf(stderr,"AABBQQ-1: cloning %s\n", dbug_print_item(example));
+    print_query_stderr();
+    return shallow_copy_with_checks(thd); 
+  }
 public:
   bool cache_value() override;
   String* val_str(String *to) override
@@ -8107,7 +8112,11 @@ class Item_cache_double: public Item_cache_real
   Item *shallow_copy(THD *thd) const override
   { return get_item_copy<Item_cache_double>(thd, this); }
   Item *deep_copy(THD *thd) const override
-  { return shallow_copy_with_checks(thd); }
+  {
+    fprintf(stderr,"AABBQQ-2: cloning %s\n", dbug_print_item(example));
+    print_query_stderr();
+    return shallow_copy_with_checks(thd); 
+  }
 };
 
 
@@ -8122,7 +8131,11 @@ class Item_cache_float: public Item_cache_real
   Item *shallow_copy(THD *thd) const override
   { return get_item_copy<Item_cache_float>(thd, this); }
   Item *deep_copy(THD *thd) const override
-  { return shallow_copy_with_checks(thd); }
+  {
+    fprintf(stderr,"AABBQQ-3: cloning %s\n", dbug_print_item(example));
+    print_query_stderr();
+    return shallow_copy_with_checks(thd); 
+  }
 };
 
 
@@ -8148,7 +8161,11 @@ class Item_cache_decimal: public Item_cache
   Item *shallow_copy(THD *thd) const override
   { return get_item_copy<Item_cache_decimal>(thd, this); }
   Item *deep_copy(THD *thd) const override
-  { return shallow_copy_with_checks(thd); }
+  {
+    fprintf(stderr,"AABBQQ-4: cloning %s\n", dbug_print_item(example));
+    print_query_stderr();
+    return shallow_copy_with_checks(thd); 
+  }
 };
 
 
@@ -8181,7 +8198,11 @@ class Item_cache_str: public Item_cache
   Item *shallow_copy(THD *thd) const override
   { return get_item_copy<Item_cache_str>(thd, this); }
   Item *deep_copy(THD *thd) const override
-  { return shallow_copy_with_checks(thd); }
+  {
+    fprintf(stderr,"AABBQQ-5: cloning %s\n", dbug_print_item(example));
+    print_query_stderr();
+    return shallow_copy_with_checks(thd); 
+  }
 };
 
 
@@ -8292,7 +8313,9 @@ class Item_cache_row: public Item_cache
   { return get_item_copy<Item_cache_row>(thd, this); }
   Item *deep_copy(THD *thd) const override
   {
-    return shallow_copy_with_checks(thd);
+    fprintf(stderr,"AABBQQ-6: cloning %s\n", dbug_print_item(example));
+    print_query_stderr();
+    return shallow_copy_with_checks(thd); 
   }
 };
 
