List:Commits« Previous MessageNext Message »
From:Evgeny Potemkin Date:July 22 2011 9:54am
Subject:bzr push into mysql-trunk branch (evgeny.potemkin:3011 to 3012)
View as plain text  
 3012 Evgeny Potemkin	2011-07-22
      Post-merge fix: updated opt_trace suite result files.

    modified:
      mysql-test/suite/opt_trace/r/bugs_no_prot_none.result
      mysql-test/suite/opt_trace/r/bugs_ps_prot_none.result
      mysql-test/suite/opt_trace/r/charset.result
      mysql-test/suite/opt_trace/r/general2_no_prot.result
      mysql-test/suite/opt_trace/r/general2_ps_prot.result
      mysql-test/suite/opt_trace/r/general_no_prot_none.result
      mysql-test/suite/opt_trace/r/general_ps_prot_none.result
      mysql-test/suite/opt_trace/r/range_no_prot.result
      mysql-test/suite/opt_trace/r/range_ps_prot.result
      mysql-test/suite/opt_trace/r/security_no_prot.result
      mysql-test/suite/opt_trace/r/security_ps_prot.result
 3011 Evgeny Potemkin	2011-07-21 [merge]
      Manual merge: mysql-trunk => wl#5274.

    added:
      mysql-test/include/have_optimizer_trace.inc
      mysql-test/suite/opt_trace/
      mysql-test/suite/opt_trace/include/
      mysql-test/suite/opt_trace/include/bugs.inc
      mysql-test/suite/opt_trace/include/general.inc
      mysql-test/suite/opt_trace/include/general2.inc
      mysql-test/suite/opt_trace/include/range.inc
      mysql-test/suite/opt_trace/include/security.inc
      mysql-test/suite/opt_trace/include/subquery.inc
      mysql-test/suite/opt_trace/r/
      mysql-test/suite/opt_trace/r/bugs_no_prot_all.result
      mysql-test/suite/opt_trace/r/bugs_no_prot_none.result
      mysql-test/suite/opt_trace/r/bugs_ps_prot_all.result
      mysql-test/suite/opt_trace/r/bugs_ps_prot_none.result
      mysql-test/suite/opt_trace/r/charset.result
      mysql-test/suite/opt_trace/r/debug.result
      mysql-test/suite/opt_trace/r/general2_no_prot.result
      mysql-test/suite/opt_trace/r/general2_ps_prot.result
      mysql-test/suite/opt_trace/r/general_no_prot_all.result
      mysql-test/suite/opt_trace/r/general_no_prot_none.result
      mysql-test/suite/opt_trace/r/general_ps_prot_all.result
      mysql-test/suite/opt_trace/r/general_ps_prot_none.result
      mysql-test/suite/opt_trace/r/range_no_prot.result
      mysql-test/suite/opt_trace/r/range_ps_prot.result
      mysql-test/suite/opt_trace/r/security_no_prot.result
      mysql-test/suite/opt_trace/r/security_ps_prot.result
      mysql-test/suite/opt_trace/r/subquery_no_prot.result
      mysql-test/suite/opt_trace/r/subquery_ps_prot.result
      mysql-test/suite/opt_trace/t/
      mysql-test/suite/opt_trace/t/bugs_no_prot_all.test
      mysql-test/suite/opt_trace/t/bugs_no_prot_none.test
      mysql-test/suite/opt_trace/t/bugs_ps_prot_all.test
      mysql-test/suite/opt_trace/t/bugs_ps_prot_none.test
      mysql-test/suite/opt_trace/t/charset.test
      mysql-test/suite/opt_trace/t/debug.test
      mysql-test/suite/opt_trace/t/general2_no_prot.test
      mysql-test/suite/opt_trace/t/general2_ps_prot.test
      mysql-test/suite/opt_trace/t/general_no_prot_all.test
      mysql-test/suite/opt_trace/t/general_no_prot_none.test
      mysql-test/suite/opt_trace/t/general_ps_prot_all.test
      mysql-test/suite/opt_trace/t/general_ps_prot_none.test
      mysql-test/suite/opt_trace/t/range_no_prot.test
      mysql-test/suite/opt_trace/t/range_ps_prot.test
      mysql-test/suite/opt_trace/t/security_no_prot.test
      mysql-test/suite/opt_trace/t/security_ps_prot.test
      mysql-test/suite/opt_trace/t/subquery_no_prot.test
      mysql-test/suite/opt_trace/t/subquery_ps_prot.test
      mysql-test/suite/opt_trace/validate_json.py
      mysql-test/suite/sys_vars/r/optimizer_trace_basic.result
      mysql-test/suite/sys_vars/r/optimizer_trace_features_basic.result
      mysql-test/suite/sys_vars/r/optimizer_trace_limit_basic.result
      mysql-test/suite/sys_vars/r/optimizer_trace_max_mem_size_basic.result
      mysql-test/suite/sys_vars/r/optimizer_trace_offset_basic.result
      mysql-test/suite/sys_vars/r/optimizer_trace_offset_max.result
      mysql-test/suite/sys_vars/t/optimizer_trace_basic.test
      mysql-test/suite/sys_vars/t/optimizer_trace_features_basic.test
      mysql-test/suite/sys_vars/t/optimizer_trace_limit_basic.test
      mysql-test/suite/sys_vars/t/optimizer_trace_max_mem_size_basic.test
      mysql-test/suite/sys_vars/t/optimizer_trace_offset_basic.test
      mysql-test/suite/sys_vars/t/optimizer_trace_offset_max-master.opt
      mysql-test/suite/sys_vars/t/optimizer_trace_offset_max.test
      sql/opt_trace.cc
      sql/opt_trace.h
      sql/opt_trace2server.cc
      sql/opt_trace_Doxyfile
      sql/opt_trace_context.h
      unittest/gunit/opt_trace-t.cc
    modified:
      .bzrignore
      CMakeLists.txt
      client/mysqltest.cc
      config.h.cmake
      dbug/dbug.c
      include/my_getopt.h
      include/my_sys.h
      include/mysql/plugin.h
      include/mysql/plugin_audit.h.pp
      include/mysql/plugin_auth.h.pp
      include/mysql/plugin_ftparser.h.pp
      mysql-test/collections/default.experimental
      mysql-test/extra/rpl_tests/rpl_reset_slave.test
      mysql-test/include/subquery.inc
      mysql-test/mysql-test-run.pl
      mysql-test/r/archive_gis.result
      mysql-test/r/auto_increment.result
      mysql-test/r/bench_count_distinct.result
      mysql-test/r/bigint.result
      mysql-test/r/case.result
      mysql-test/r/cast.result
      mysql-test/r/compare.result
      mysql-test/r/compress.result
      mysql-test/r/ctype_binary.result
      mysql-test/r/ctype_collate.result
      mysql-test/r/ctype_cp1251.result
      mysql-test/r/ctype_latin1.result
      mysql-test/r/ctype_ucs.result
      mysql-test/r/ctype_utf8.result
      mysql-test/r/date_formats.result
      mysql-test/r/derived.result
      mysql-test/r/explain.result
      mysql-test/r/fulltext.result
      mysql-test/r/func_compress.result
      mysql-test/r/func_crypt.result
      mysql-test/r/func_default.result
      mysql-test/r/func_encrypt.result
      mysql-test/r/func_gconcat.result
      mysql-test/r/func_group.result
      mysql-test/r/func_if.result
      mysql-test/r/func_in_all.result
      mysql-test/r/func_in_icp.result
      mysql-test/r/func_in_icp_mrr.result
      mysql-test/r/func_in_mrr.result
      mysql-test/r/func_in_mrr_cost.result
      mysql-test/r/func_in_none.result
      mysql-test/r/func_like.result
      mysql-test/r/func_math.result
      mysql-test/r/func_op.result
      mysql-test/r/func_regexp.result
      mysql-test/r/func_set.result
      mysql-test/r/func_str.result
      mysql-test/r/func_system.result
      mysql-test/r/func_test.result
      mysql-test/r/func_time.result
      mysql-test/r/gis.result
      mysql-test/r/group_by.result
      mysql-test/r/group_min_max.result
      mysql-test/r/having.result
      mysql-test/r/information_schema.result
      mysql-test/r/information_schema_db.result
      mysql-test/r/innodb_explain_non_select_all.result
      mysql-test/r/innodb_explain_non_select_none.result
      mysql-test/r/innodb_mrr.result
      mysql-test/r/innodb_mrr_all.result
      mysql-test/r/innodb_mrr_cost.result
      mysql-test/r/innodb_mrr_cost_all.result
      mysql-test/r/innodb_mrr_cost_icp.result
      mysql-test/r/innodb_mrr_icp.result
      mysql-test/r/innodb_mrr_none.result
      mysql-test/r/insert_update.result
      mysql-test/r/join.result
      mysql-test/r/join_nested.result
      mysql-test/r/join_nested_jcl6.result
      mysql-test/r/join_outer.result
      mysql-test/r/join_outer_jcl6.result
      mysql-test/r/myisam_explain_non_select_all.result
      mysql-test/r/myisam_explain_non_select_none.result
      mysql-test/r/myisam_mrr.result
      mysql-test/r/myisam_mrr_all.result
      mysql-test/r/myisam_mrr_cost.result
      mysql-test/r/myisam_mrr_cost_all.result
      mysql-test/r/myisam_mrr_cost_icp.result
      mysql-test/r/myisam_mrr_icp.result
      mysql-test/r/myisam_mrr_none.result
      mysql-test/r/mysqld--help-notwin.result
      mysql-test/r/mysqld--help-win.result
      mysql-test/r/mysqlshow.result
      mysql-test/r/named_pipe.result
      mysql-test/r/negation_elimination.result
      mysql-test/r/null.result
      mysql-test/r/olap.result
      mysql-test/r/order_by_all.result
      mysql-test/r/order_by_icp_mrr.result
      mysql-test/r/order_by_none.result
      mysql-test/r/partition.result
      mysql-test/r/partition_pruning.result
      mysql-test/r/ps.result
      mysql-test/r/query_cache.result
      mysql-test/r/row.result
      mysql-test/r/select_all.result
      mysql-test/r/select_all_jcl6.result
      mysql-test/r/select_icp_mrr.result
      mysql-test/r/select_icp_mrr_jcl6.result
      mysql-test/r/select_none.result
      mysql-test/r/select_none_jcl6.result
      mysql-test/r/shm.result
      mysql-test/r/ssl.result
      mysql-test/r/ssl_compress.result
      mysql-test/r/subquery_all.result
      mysql-test/r/subquery_all_jcl6.result
      mysql-test/r/subquery_mat.result
      mysql-test/r/subquery_mat_all.result
      mysql-test/r/subquery_mat_none.result
      mysql-test/r/subquery_nomat_nosj.result
      mysql-test/r/subquery_nomat_nosj_jcl6.result
      mysql-test/r/subquery_none.result
      mysql-test/r/subquery_none_jcl6.result
      mysql-test/r/subquery_sj_all.result
      mysql-test/r/subquery_sj_all_jcl6.result
      mysql-test/r/subquery_sj_all_jcl7.result
      mysql-test/r/subquery_sj_dupsweed.result
      mysql-test/r/subquery_sj_dupsweed_jcl6.result
      mysql-test/r/subquery_sj_dupsweed_jcl7.result
      mysql-test/r/subquery_sj_firstmatch.result
      mysql-test/r/subquery_sj_firstmatch_jcl6.result
      mysql-test/r/subquery_sj_firstmatch_jcl7.result
      mysql-test/r/subquery_sj_loosescan.result
      mysql-test/r/subquery_sj_loosescan_jcl6.result
      mysql-test/r/subquery_sj_loosescan_jcl7.result
      mysql-test/r/subquery_sj_mat.result
      mysql-test/r/subquery_sj_mat_jcl6.result
      mysql-test/r/subquery_sj_mat_jcl7.result
      mysql-test/r/subquery_sj_mat_nosj.result
      mysql-test/r/subquery_sj_none.result
      mysql-test/r/subquery_sj_none_jcl6.result
      mysql-test/r/subquery_sj_none_jcl7.result
      mysql-test/r/subselect_innodb.result
      mysql-test/r/type_blob.result
      mysql-test/r/type_datetime.result
      mysql-test/r/udf.result
      mysql-test/r/union.result
      mysql-test/r/varbinary.result
      mysql-test/r/variables.result
      mysql-test/r/view.result
      mysql-test/suite/binlog/r/binlog_stm_blackhole.result
      mysql-test/suite/funcs_1/r/is_columns_is.result
      mysql-test/suite/funcs_1/r/is_columns_is_embedded.result
      mysql-test/suite/funcs_1/r/is_tables_is.result
      mysql-test/suite/innodb/r/innodb_bug54044.result
      mysql-test/suite/innodb/r/innodb_gis.result
      mysql-test/suite/innodb/t/innodb_bug54044.test
      mysql-test/suite/perfschema/include/event_aggregate_cleanup.inc
      mysql-test/suite/perfschema/include/event_aggregate_load.inc
      mysql-test/suite/perfschema/include/event_aggregate_setup.inc
      mysql-test/suite/perfschema/include/table_aggregate_cleanup.inc
      mysql-test/suite/perfschema/include/table_aggregate_load.inc
      mysql-test/suite/perfschema/include/table_aggregate_setup.inc
      mysql-test/suite/perfschema/r/event_aggregate.result
      mysql-test/suite/perfschema/r/table_aggregate_global_2u_2t.result
      mysql-test/suite/perfschema/r/table_aggregate_global_2u_3t.result
      mysql-test/suite/perfschema/r/table_aggregate_global_4u_2t.result
      mysql-test/suite/perfschema/r/table_aggregate_global_4u_3t.result
      mysql-test/suite/perfschema/r/table_aggregate_hist_2u_2t.result
      mysql-test/suite/perfschema/r/table_aggregate_hist_2u_3t.result
      mysql-test/suite/perfschema/r/table_aggregate_hist_4u_2t.result
      mysql-test/suite/perfschema/r/table_aggregate_hist_4u_3t.result
      mysql-test/suite/perfschema/r/table_aggregate_off.result
      mysql-test/suite/perfschema/r/table_aggregate_thread_2u_2t.result
      mysql-test/suite/perfschema/r/table_aggregate_thread_2u_3t.result
      mysql-test/suite/perfschema/r/table_aggregate_thread_4u_2t.result
      mysql-test/suite/perfschema/r/table_aggregate_thread_4u_3t.result
      mysql-test/suite/perfschema/r/table_io_aggregate_global_2u_2t.result
      mysql-test/suite/perfschema/r/table_io_aggregate_global_2u_3t.result
      mysql-test/suite/perfschema/r/table_io_aggregate_global_4u_2t.result
      mysql-test/suite/perfschema/r/table_io_aggregate_global_4u_3t.result
      mysql-test/suite/perfschema/r/table_io_aggregate_hist_2u_2t.result
      mysql-test/suite/perfschema/r/table_io_aggregate_hist_2u_3t.result
      mysql-test/suite/perfschema/r/table_io_aggregate_hist_4u_2t.result
      mysql-test/suite/perfschema/r/table_io_aggregate_hist_4u_3t.result
      mysql-test/suite/perfschema/r/table_io_aggregate_thread_2u_2t.result
      mysql-test/suite/perfschema/r/table_io_aggregate_thread_2u_3t.result
      mysql-test/suite/perfschema/r/table_io_aggregate_thread_4u_2t.result
      mysql-test/suite/perfschema/r/table_io_aggregate_thread_4u_3t.result
      mysql-test/suite/perfschema/r/table_lock_aggregate_global_2u_2t.result
      mysql-test/suite/perfschema/r/table_lock_aggregate_global_2u_3t.result
      mysql-test/suite/perfschema/r/table_lock_aggregate_global_4u_2t.result
      mysql-test/suite/perfschema/r/table_lock_aggregate_global_4u_3t.result
      mysql-test/suite/perfschema/r/table_lock_aggregate_hist_2u_2t.result
      mysql-test/suite/perfschema/r/table_lock_aggregate_hist_2u_3t.result
      mysql-test/suite/perfschema/r/table_lock_aggregate_hist_4u_2t.result
      mysql-test/suite/perfschema/r/table_lock_aggregate_hist_4u_3t.result
      mysql-test/suite/perfschema/r/table_lock_aggregate_thread_2u_2t.result
      mysql-test/suite/perfschema/r/table_lock_aggregate_thread_2u_3t.result
      mysql-test/suite/perfschema/r/table_lock_aggregate_thread_4u_2t.result
      mysql-test/suite/perfschema/r/table_lock_aggregate_thread_4u_3t.result
      mysql-test/suite/rpl/r/rpl_get_lock.result
      mysql-test/suite/rpl/r/rpl_master_pos_wait.result
      mysql-test/suite/rpl/r/rpl_row_reset_slave.result
      mysql-test/suite/rpl/r/rpl_stm_reset_slave.result
      mysql-test/suite/sys_vars/t/all_vars.test
      mysql-test/t/func_if.test
      mysys/array.c
      mysys/my_alloc.c
      mysys/my_getopt.c
      mysys/my_malloc.c
      sql/CMakeLists.txt
      sql/field.cc
      sql/ha_ndbcluster.cc
      sql/handler.h
      sql/item.cc
      sql/item_cmpfunc.cc
      sql/item_cmpfunc.h
      sql/item_func.cc
      sql/item_subselect.cc
      sql/item_subselect.h
      sql/log_event.cc
      sql/mysqld.cc
      sql/mysqld.h
      sql/opt_explain.cc
      sql/opt_range.cc
      sql/opt_range.h
      sql/rpl_mi.cc
      sql/rpl_mi.h
      sql/rpl_slave.cc
      sql/set_var.cc
      sql/set_var.h
      sql/sp_head.cc
      sql/sp_head.h
      sql/sql_array.h
      sql/sql_class.h
      sql/sql_delete.cc
      sql/sql_derived.cc
      sql/sql_help.cc
      sql/sql_lex.h
      sql/sql_parse.cc
      sql/sql_plugin.h
      sql/sql_prepare.cc
      sql/sql_select.cc
      sql/sql_select.h
      sql/sql_show.cc
      sql/sql_test.cc
      sql/sql_test.h
      sql/sql_update.cc
      sql/sql_view.cc
      sql/sql_yacc.yy
      sql/sys_vars.cc
      sql/sys_vars.h
      sql/table.cc
      unittest/gunit/CMakeLists.txt
=== modified file 'mysql-test/suite/opt_trace/r/bugs_no_prot_none.result'
--- a/mysql-test/suite/opt_trace/r/bugs_no_prot_none.result	2011-07-20 13:10:44 +0000
+++ b/mysql-test/suite/opt_trace/r/bugs_no_prot_none.result	2011-07-22 09:53:44 +0000
@@ -713,9 +713,9 @@ field1	( SELECT COUNT( col_int_key )
 FROM t1
 )
 0	4
+1	4
 8	4
 8	4
-1	4
 8	4
 8	4
 select * from information_schema.optimizer_trace;

=== modified file 'mysql-test/suite/opt_trace/r/bugs_ps_prot_none.result'
--- a/mysql-test/suite/opt_trace/r/bugs_ps_prot_none.result	2011-07-20 13:10:44 +0000
+++ b/mysql-test/suite/opt_trace/r/bugs_ps_prot_none.result	2011-07-22 09:53:44 +0000
@@ -703,9 +703,9 @@ field1	( SELECT COUNT( col_int_key )
 FROM t1
 )
 0	4
+1	4
 8	4
 8	4
-1	4
 8	4
 8	4
 select * from information_schema.optimizer_trace;

=== modified file 'mysql-test/suite/opt_trace/r/charset.result'
--- a/mysql-test/suite/opt_trace/r/charset.result	2011-07-20 13:10:44 +0000
+++ b/mysql-test/suite/opt_trace/r/charset.result	2011-07-22 09:53:44 +0000
@@ -152,44 +152,6 @@ select * from v1 where v1.col = 'ÁÂÃ�
       } /* join_preparation */
     },
     {
-      "join_optimization": {
-        "select#": 2,
-        "steps": [
-          {
-            "records_estimation": [
-              {
-                "database": "test",
-                "table": "t1",
-                "records": 1,
-                "cost": 1,
-                "table_type": "system"
-              }
-            ] /* records_estimation */
-          },
-          {
-            "attaching_conditions_to_tables": {
-              "original_condition": null,
-              "attached_conditions_computation": [
-              ] /* attached_conditions_computation */,
-              "attached_conditions_summary": [
-              ] /* attached_conditions_summary */
-            } /* attaching_conditions_to_tables */
-          },
-          {
-            "refine_plan": [
-            ] /* refine_plan */
-          }
-        ] /* steps */
-      } /* join_optimization */
-    },
-    {
-      "join_execution": {
-        "select#": 2,
-        "steps": [
-        ] /* steps */
-      } /* join_execution */
-    },
-    {
       "join_preparation": {
         "select#": 1,
         "steps": [
@@ -204,6 +166,44 @@ select * from v1 where v1.col = 'ÁÂÃ�
         "select#": 1,
         "steps": [
           {
+            "join_optimization": {
+              "select#": 2,
+              "steps": [
+                {
+                  "records_estimation": [
+                    {
+                      "database": "test",
+                      "table": "t1",
+                      "records": 1,
+                      "cost": 1,
+                      "table_type": "system"
+                    }
+                  ] /* records_estimation */
+                },
+                {
+                  "attaching_conditions_to_tables": {
+                    "original_condition": null,
+                    "attached_conditions_computation": [
+                    ] /* attached_conditions_computation */,
+                    "attached_conditions_summary": [
+                    ] /* attached_conditions_summary */
+                  } /* attaching_conditions_to_tables */
+                },
+                {
+                  "refine_plan": [
+                  ] /* refine_plan */
+                }
+              ] /* steps */
+            } /* join_optimization */
+          },
+          {
+            "join_execution": {
+              "select#": 2,
+              "steps": [
+              ] /* steps */
+            } /* join_execution */
+          },
+          {
             "condition_processing": {
               "condition": "WHERE",
               "original_condition": "(`v1`.`col` = 'ÁÂÃÄÅ')",

=== modified file 'mysql-test/suite/opt_trace/r/general2_no_prot.result'
--- a/mysql-test/suite/opt_trace/r/general2_no_prot.result	2011-07-20 13:10:44 +0000
+++ b/mysql-test/suite/opt_trace/r/general2_no_prot.result	2011-07-22 09:53:44 +0000
@@ -1012,77 +1012,6 @@ TRACE
       } /* join_preparation */
     },
     {
-      "join_optimization": {
-        "select#": 2,
-        "steps": [
-          {
-            "records_estimation": [
-              {
-                "database": "test",
-                "table": "t1",
-                "table_scan": {
-                  "records": 3,
-                  "cost": 2
-                } /* table_scan */
-              }
-            ] /* records_estimation */
-          },
-          {
-            "considered_execution_plans": [
-              {
-                "database": "test",
-                "table": "t1",
-                "best_access_path": {
-                  "considered_access_paths": [
-                    {
-                      "access_type": "scan",
-                      "records": 3,
-                      "cost": 2.0066,
-                      "chosen": true,
-                      "use_temp_table": true
-                    }
-                  ] /* considered_access_paths */
-                } /* best_access_path */,
-                "cost_for_plan": 2.6066,
-                "records_for_plan": 3,
-                "chosen": true
-              }
-            ] /* considered_execution_plans */
-          },
-          {
-            "attaching_conditions_to_tables": {
-              "original_condition": null,
-              "attached_conditions_computation": [
-              ] /* attached_conditions_computation */,
-              "attached_conditions_summary": [
-                {
-                  "database": "test",
-                  "table": "t1",
-                  "attached": null
-                }
-              ] /* attached_conditions_summary */
-            } /* attaching_conditions_to_tables */
-          },
-          {
-            "refine_plan": [
-              {
-                "database": "test",
-                "table": "t1",
-                "scan_type": "table"
-              }
-            ] /* refine_plan */
-          }
-        ] /* steps */
-      } /* join_optimization */
-    },
-    {
-      "join_execution": {
-        "select#": 2,
-        "steps": [
-        ] /* steps */
-      } /* join_execution */
-    },
-    {
       "join_preparation": {
         "select#": 1,
         "steps": [
@@ -1097,6 +1026,70 @@ TRACE
         "select#": 1,
         "steps": [
           {
+            "join_optimization": {
+              "select#": 2,
+              "steps": [
+                {
+                  "records_estimation": [
+                    {
+                      "database": "test",
+                      "table": "t1",
+                      "table_scan": {
+                        "records": 3,
+                        "cost": 2
+                      } /* table_scan */
+                    }
+                  ] /* records_estimation */
+                },
+                {
+                  "considered_execution_plans": [
+                    {
+                      "database": "test",
+                      "table": "t1",
+                      "best_access_path": {
+                        "considered_access_paths": [
+                          {
+                            "access_type": "scan",
+                            "records": 3,
+                            "cost": 2.0066,
+                            "chosen": true,
+                            "use_temp_table": true
+                          }
+                        ] /* considered_access_paths */
+                      } /* best_access_path */,
+                      "cost_for_plan": 2.6066,
+                      "records_for_plan": 3,
+                      "chosen": true
+                    }
+                  ] /* considered_execution_plans */
+                },
+                {
+                  "attaching_conditions_to_tables": {
+                    "original_condition": null,
+                    "attached_conditions_computation": [
+                    ] /* attached_conditions_computation */,
+                    "attached_conditions_summary": [
+                      {
+                        "database": "test",
+                        "table": "t1",
+                        "attached": null
+                      }
+                    ] /* attached_conditions_summary */
+                  } /* attaching_conditions_to_tables */
+                },
+                {
+                  "refine_plan": [
+                    {
+                      "database": "test",
+                      "table": "t1",
+                      "scan_type": "table"
+                    }
+                  ] /* refine_plan */
+                }
+              ] /* steps */
+            } /* join_optimization */
+          },
+          {
             "records_estimation": [
               {
                 "database": "",
@@ -1159,6 +1152,13 @@ TRACE
       "join_execution": {
         "select#": 1,
         "steps": [
+          {
+            "join_execution": {
+              "select#": 2,
+              "steps": [
+              ] /* steps */
+            } /* join_execution */
+          }
         ] /* steps */
       } /* join_execution */
     }
@@ -1175,7 +1175,7 @@ CREATE TABLE t1(f1 int);
 INSERT INTO t1 values (0),(0);
 set optimizer_trace="enabled=off";
 SELECT POLYGON((SELECT 1 FROM (SELECT 1 IN (GROUP_CONCAT(t1.f1)) FROM t1, t1 t GROUP BY t.f1 ) d));
-ERROR 22007: Illegal non geometric '(select 1 from (select (1 = group_concat(`test`.`t1`.`f1` separator ',')) AS `1 IN (GROUP_CONCAT(t1.f1))` from `test`.`t1` join `test`.`t1` `t` group by `t`.`f1`) `d`)' value found during parsing
+ERROR 22007: Illegal non geometric '(select 1 from (select (1 = group_concat(`test`.`t1`.`f1` separator ',')) AS `1 IN (GROUP_CONCAT(t1.f1))` from `test`.`t1` join `test`.`t1` `t` group by `test`.`t`.`f1`) `d`)' value found during parsing
 set optimizer_trace="enabled=on";
 SELECT POLYGON((SELECT 1 FROM (SELECT 1 IN (GROUP_CONCAT(t1.f1)) FROM t1, t1 t GROUP BY t.f1 ) d));
 ERROR 22007: Illegal non geometric '(select 1 from (select (1 = group_concat(`test`.`t1`.`f1` separator ',')) AS `1 IN (GROUP_CONCAT(t1.f1))` from `test`.`t1` join `test`.`t1` `t` group by `test`.`t`.`f1`) `d`)' value found during parsing

=== modified file 'mysql-test/suite/opt_trace/r/general2_ps_prot.result'
--- a/mysql-test/suite/opt_trace/r/general2_ps_prot.result	2011-07-20 13:10:44 +0000
+++ b/mysql-test/suite/opt_trace/r/general2_ps_prot.result	2011-07-22 09:53:44 +0000
@@ -1030,77 +1030,6 @@ TRACE
       } /* join_preparation */
     },
     {
-      "join_optimization": {
-        "select#": 2,
-        "steps": [
-          {
-            "records_estimation": [
-              {
-                "database": "test",
-                "table": "t1",
-                "table_scan": {
-                  "records": 3,
-                  "cost": 2
-                } /* table_scan */
-              }
-            ] /* records_estimation */
-          },
-          {
-            "considered_execution_plans": [
-              {
-                "database": "test",
-                "table": "t1",
-                "best_access_path": {
-                  "considered_access_paths": [
-                    {
-                      "access_type": "scan",
-                      "records": 3,
-                      "cost": 2.0066,
-                      "chosen": true,
-                      "use_temp_table": true
-                    }
-                  ] /* considered_access_paths */
-                } /* best_access_path */,
-                "cost_for_plan": 2.6066,
-                "records_for_plan": 3,
-                "chosen": true
-              }
-            ] /* considered_execution_plans */
-          },
-          {
-            "attaching_conditions_to_tables": {
-              "original_condition": null,
-              "attached_conditions_computation": [
-              ] /* attached_conditions_computation */,
-              "attached_conditions_summary": [
-                {
-                  "database": "test",
-                  "table": "t1",
-                  "attached": null
-                }
-              ] /* attached_conditions_summary */
-            } /* attaching_conditions_to_tables */
-          },
-          {
-            "refine_plan": [
-              {
-                "database": "test",
-                "table": "t1",
-                "scan_type": "table"
-              }
-            ] /* refine_plan */
-          }
-        ] /* steps */
-      } /* join_optimization */
-    },
-    {
-      "join_execution": {
-        "select#": 2,
-        "steps": [
-        ] /* steps */
-      } /* join_execution */
-    },
-    {
       "join_preparation": {
         "select#": 1,
         "steps": [
@@ -1115,6 +1044,70 @@ TRACE
         "select#": 1,
         "steps": [
           {
+            "join_optimization": {
+              "select#": 2,
+              "steps": [
+                {
+                  "records_estimation": [
+                    {
+                      "database": "test",
+                      "table": "t1",
+                      "table_scan": {
+                        "records": 3,
+                        "cost": 2
+                      } /* table_scan */
+                    }
+                  ] /* records_estimation */
+                },
+                {
+                  "considered_execution_plans": [
+                    {
+                      "database": "test",
+                      "table": "t1",
+                      "best_access_path": {
+                        "considered_access_paths": [
+                          {
+                            "access_type": "scan",
+                            "records": 3,
+                            "cost": 2.0066,
+                            "chosen": true,
+                            "use_temp_table": true
+                          }
+                        ] /* considered_access_paths */
+                      } /* best_access_path */,
+                      "cost_for_plan": 2.6066,
+                      "records_for_plan": 3,
+                      "chosen": true
+                    }
+                  ] /* considered_execution_plans */
+                },
+                {
+                  "attaching_conditions_to_tables": {
+                    "original_condition": null,
+                    "attached_conditions_computation": [
+                    ] /* attached_conditions_computation */,
+                    "attached_conditions_summary": [
+                      {
+                        "database": "test",
+                        "table": "t1",
+                        "attached": null
+                      }
+                    ] /* attached_conditions_summary */
+                  } /* attaching_conditions_to_tables */
+                },
+                {
+                  "refine_plan": [
+                    {
+                      "database": "test",
+                      "table": "t1",
+                      "scan_type": "table"
+                    }
+                  ] /* refine_plan */
+                }
+              ] /* steps */
+            } /* join_optimization */
+          },
+          {
             "records_estimation": [
               {
                 "database": "",
@@ -1177,6 +1170,13 @@ TRACE
       "join_execution": {
         "select#": 1,
         "steps": [
+          {
+            "join_execution": {
+              "select#": 2,
+              "steps": [
+              ] /* steps */
+            } /* join_execution */
+          }
         ] /* steps */
       } /* join_execution */
     }
@@ -1193,7 +1193,7 @@ CREATE TABLE t1(f1 int);
 INSERT INTO t1 values (0),(0);
 set optimizer_trace="enabled=off";
 SELECT POLYGON((SELECT 1 FROM (SELECT 1 IN (GROUP_CONCAT(t1.f1)) FROM t1, t1 t GROUP BY t.f1 ) d));
-ERROR 22007: Illegal non geometric '(select 1 from (select (1 = group_concat(`test`.`t1`.`f1` separator ',')) AS `1 IN (GROUP_CONCAT(t1.f1))` from `test`.`t1` join `test`.`t1` `t` group by `t`.`f1`) `d`)' value found during parsing
+ERROR 22007: Illegal non geometric '(select 1 from (select (1 = group_concat(`test`.`t1`.`f1` separator ',')) AS `1 IN (GROUP_CONCAT(t1.f1))` from `test`.`t1` join `test`.`t1` `t` group by `test`.`t`.`f1`) `d`)' value found during parsing
 set optimizer_trace="enabled=on";
 SELECT POLYGON((SELECT 1 FROM (SELECT 1 IN (GROUP_CONCAT(t1.f1)) FROM t1, t1 t GROUP BY t.f1 ) d));
 ERROR 22007: Illegal non geometric '(select 1 from (select (1 = group_concat(`test`.`t1`.`f1` separator ',')) AS `1 IN (GROUP_CONCAT(t1.f1))` from `test`.`t1` join `test`.`t1` `t` group by `test`.`t`.`f1`) `d`)' value found during parsing

=== modified file 'mysql-test/suite/opt_trace/r/general_no_prot_none.result'
--- a/mysql-test/suite/opt_trace/r/general_no_prot_none.result	2011-07-20 13:10:44 +0000
+++ b/mysql-test/suite/opt_trace/r/general_no_prot_none.result	2011-07-22 09:53:44 +0000
@@ -662,13 +662,6 @@ SELECT (SELECT 1 FROM t6 WHERE d = ifnul
                   } /* join_optimization */
                 },
                 {
-                  "join_execution": {
-                    "select#": 2,
-                    "steps": [
-                    ] /* steps */
-                  } /* join_execution */
-                },
-                {
                   "join_optimization": {
                     "select#": 3,
                     "steps": [
@@ -749,6 +742,13 @@ SELECT (SELECT 1 FROM t6 WHERE d = ifnul
                 },
                 {
                   "join_execution": {
+                    "select#": 2,
+                    "steps": [
+                    ] /* steps */
+                  } /* join_execution */
+                },
+                {
+                  "join_execution": {
                     "select#": 3,
                     "steps": [
                     ] /* steps */
@@ -1010,13 +1010,6 @@ SELECT * FROM t5 WHERE 5 IN (SELECT 1 FR
                   } /* join_optimization */
                 },
                 {
-                  "join_execution": {
-                    "select#": 2,
-                    "steps": [
-                    ] /* steps */
-                  } /* join_execution */
-                },
-                {
                   "join_optimization": {
                     "select#": 3,
                     "steps": [
@@ -1048,6 +1041,13 @@ SELECT * FROM t5 WHERE 5 IN (SELECT 1 FR
                 },
                 {
                   "join_execution": {
+                    "select#": 2,
+                    "steps": [
+                    ] /* steps */
+                  } /* join_execution */
+                },
+                {
+                  "join_execution": {
                     "select#": 3,
                     "steps": [
                     ] /* steps */
@@ -3684,13 +3684,6 @@ SELECT * FROM t1 WHERE c1=5 UNION SELECT
       } /* join_optimization */
     },
     {
-      "join_execution": {
-        "select#": 1,
-        "steps": [
-        ] /* steps */
-      } /* join_execution */
-    },
-    {
       "join_optimization": {
         "select#": 2,
         "steps": [
@@ -3779,6 +3772,13 @@ SELECT * FROM t1 WHERE c1=5 UNION SELECT
     },
     {
       "join_execution": {
+        "select#": 1,
+        "steps": [
+        ] /* steps */
+      } /* join_execution */
+    },
+    {
+      "join_execution": {
         "select#": 2,
         "steps": [
         ] /* steps */
@@ -9113,7 +9113,7 @@ drop view v1;
 create view v1 as select * from t1 where id < "c" limit 2;
 explain select * from v1 where id="b";
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	PRIMARY	<derived2>	ALL	NULL	NULL	NULL	NULL	2	Using where
+1	PRIMARY	<derived2>	ref	auto_key0	auto_key0	16	const	0	Using where
 2	DERIVED	t1	ALL	NULL	NULL	NULL	NULL	3	Using where
 select * from information_schema.OPTIMIZER_TRACE;
 QUERY	TRACE	MISSING_BYTES_BEYOND_MAX_MEM_SIZE	INSUFFICIENT_PRIVILEGES
@@ -9139,114 +9139,107 @@ explain select * from v1 where id="b"	{
       } /* join_preparation */
     },
     {
+      "join_preparation": {
+        "select#": 1,
+        "steps": [
+          {
+            "expanded_query": "/* select#1 */ select `v1`.`id` AS `id`,`v1`.`data` AS `data` from `test`.`v1` where (`v1`.`id` = 'b')"
+          }
+        ] /* steps */
+      } /* join_preparation */
+    },
+    {
       "join_optimization": {
-        "select#": 2,
+        "select#": 1,
         "steps": [
           {
-            "condition_processing": {
-              "condition": "WHERE",
-              "original_condition": "(`test`.`t1`.`id` < 'c')",
+            "join_optimization": {
+              "select#": 2,
               "steps": [
                 {
-                  "transformation": "equality_propagation",
-                  "resulting_condition": "(`test`.`t1`.`id` < 'c')"
+                  "condition_processing": {
+                    "condition": "WHERE",
+                    "original_condition": "(`test`.`t1`.`id` < 'c')",
+                    "steps": [
+                      {
+                        "transformation": "equality_propagation",
+                        "resulting_condition": "(`test`.`t1`.`id` < 'c')"
+                      },
+                      {
+                        "transformation": "constant_propagation",
+                        "resulting_condition": "(`test`.`t1`.`id` < 'c')"
+                      },
+                      {
+                        "transformation": "trivial_condition_removal",
+                        "resulting_condition": "(`test`.`t1`.`id` < 'c')"
+                      }
+                    ] /* steps */
+                  } /* condition_processing */
                 },
                 {
-                  "transformation": "constant_propagation",
-                  "resulting_condition": "(`test`.`t1`.`id` < 'c')"
+                  "ref_optimizer_key_uses": [
+                  ] /* ref_optimizer_key_uses */
                 },
                 {
-                  "transformation": "trivial_condition_removal",
-                  "resulting_condition": "(`test`.`t1`.`id` < 'c')"
-                }
-              ] /* steps */
-            } /* condition_processing */
-          },
-          {
-            "ref_optimizer_key_uses": [
-            ] /* ref_optimizer_key_uses */
-          },
-          {
-            "records_estimation": [
-              {
-                "database": "test",
-                "table": "t1",
-                "table_scan": {
-                  "records": 3,
-                  "cost": 2
-                } /* table_scan */
-              }
-            ] /* records_estimation */
-          },
-          {
-            "considered_execution_plans": [
-              {
-                "database": "test",
-                "table": "t1",
-                "best_access_path": {
-                  "considered_access_paths": [
+                  "records_estimation": [
                     {
-                      "access_type": "scan",
-                      "records": 3,
-                      "cost": 2.0154,
+                      "database": "test",
+                      "table": "t1",
+                      "table_scan": {
+                        "records": 3,
+                        "cost": 2
+                      } /* table_scan */
+                    }
+                  ] /* records_estimation */
+                },
+                {
+                  "considered_execution_plans": [
+                    {
+                      "database": "test",
+                      "table": "t1",
+                      "best_access_path": {
+                        "considered_access_paths": [
+                          {
+                            "access_type": "scan",
+                            "records": 3,
+                            "cost": 2.0154,
+                            "chosen": true
+                          }
+                        ] /* considered_access_paths */
+                      } /* best_access_path */,
+                      "cost_for_plan": 2.6154,
+                      "records_for_plan": 3,
                       "chosen": true
                     }
-                  ] /* considered_access_paths */
-                } /* best_access_path */,
-                "cost_for_plan": 2.6154,
-                "records_for_plan": 3,
-                "chosen": true
-              }
-            ] /* considered_execution_plans */
-          },
-          {
-            "attaching_conditions_to_tables": {
-              "original_condition": "(`test`.`t1`.`id` < 'c')",
-              "attached_conditions_computation": [
-              ] /* attached_conditions_computation */,
-              "attached_conditions_summary": [
+                  ] /* considered_execution_plans */
+                },
                 {
-                  "database": "test",
-                  "table": "t1",
-                  "attached": "(`test`.`t1`.`id` < 'c')"
+                  "attaching_conditions_to_tables": {
+                    "original_condition": "(`test`.`t1`.`id` < 'c')",
+                    "attached_conditions_computation": [
+                    ] /* attached_conditions_computation */,
+                    "attached_conditions_summary": [
+                      {
+                        "database": "test",
+                        "table": "t1",
+                        "attached": "(`test`.`t1`.`id` < 'c')"
+                      }
+                    ] /* attached_conditions_summary */
+                  } /* attaching_conditions_to_tables */
+                },
+                {
+                  "refine_plan": [
+                    {
+                      "database": "test",
+                      "table": "t1",
+                      "scan_type": "table"
+                    }
+                  ] /* refine_plan */
                 }
-              ] /* attached_conditions_summary */
-            } /* attaching_conditions_to_tables */
+              ] /* steps */
+            } /* join_optimization */
           },
           {
-            "refine_plan": [
-              {
-                "database": "test",
-                "table": "t1",
-                "scan_type": "table"
-              }
-            ] /* refine_plan */
-          }
-        ] /* steps */
-      } /* join_optimization */
-    },
-    {
-      "join_execution": {
-        "select#": 2,
-        "steps": [
-        ] /* steps */
-      } /* join_execution */
-    },
-    {
-      "join_preparation": {
-        "select#": 1,
-        "steps": [
-          {
-            "expanded_query": "/* select#1 */ select `v1`.`id` AS `id`,`v1`.`data` AS `data` from `test`.`v1` where (`v1`.`id` = 'b')"
-          }
-        ] /* steps */
-      } /* join_preparation */
-    },
-    {
-      "join_optimization": {
-        "select#": 1,
-        "steps": [
-          {
             "condition_processing": {
               "condition": "WHERE",
               "original_condition": "(`v1`.`id` = 'b')",
@@ -9268,17 +9261,20 @@ explain select * from v1 where id="b"	{
           },
           {
             "ref_optimizer_key_uses": [
+              {
+                "database": "",
+                "table": "v1",
+                "field": "id",
+                "equals": "'b'",
+                "null_rejecting": false
+              }
             ] /* ref_optimizer_key_uses */
           },
           {
             "records_estimation": [
               {
                 "database": "",
-                "table": "v1",
-                "table_scan": {
-                  "records": 2,
-                  "cost": 10
-                } /* table_scan */
+                "table": "v1"
               }
             ] /* records_estimation */
           },
@@ -9290,15 +9286,23 @@ explain select * from v1 where id="b"	{
                 "best_access_path": {
                   "considered_access_paths": [
                     {
+                      "access_type": "ref",
+                      "index": "auto_key0",
+                      "records": 0.2,
+                      "cost": 0.24,
+                      "chosen": true
+                    },
+                    {
                       "access_type": "scan",
+                      "cost": 10,
                       "records": 2,
-                      "cost": 10.1,
-                      "chosen": true
+                      "cause": "cost",
+                      "chosen": false
                     }
                   ] /* considered_access_paths */
                 } /* best_access_path */,
-                "cost_for_plan": 10.5,
-                "records_for_plan": 2,
+                "cost_for_plan": 0.24,
+                "records_for_plan": 0.2,
                 "chosen": true
               }
             ] /* considered_execution_plans */
@@ -9321,8 +9325,7 @@ explain select * from v1 where id="b"	{
             "refine_plan": [
               {
                 "database": "",
-                "table": "v1",
-                "scan_type": "table"
+                "table": "v1"
               }
             ] /* refine_plan */
           }
@@ -9497,15 +9500,15 @@ select TRACE into dumpfile 'MYSQLTEST_VA
       }
     },
     {
-      "join_execution": {
-        "select#": 1,
+      "join_optimization": {
+        "select#": 2,
         "steps": [
         ]
       }
     },
     {
-      "join_optimization": {
-        "select#": 2,
+      "join_execution": {
+        "select#": 1,
         "steps": [
         ]
       }

=== modified file 'mysql-test/suite/opt_trace/r/general_ps_prot_none.result'
--- a/mysql-test/suite/opt_trace/r/general_ps_prot_none.result	2011-07-20 13:10:44 +0000
+++ b/mysql-test/suite/opt_trace/r/general_ps_prot_none.result	2011-07-22 09:53:44 +0000
@@ -662,13 +662,6 @@ SELECT (SELECT 1 FROM t6 WHERE d = ifnul
                   } /* join_optimization */
                 },
                 {
-                  "join_execution": {
-                    "select#": 2,
-                    "steps": [
-                    ] /* steps */
-                  } /* join_execution */
-                },
-                {
                   "join_optimization": {
                     "select#": 3,
                     "steps": [
@@ -749,6 +742,13 @@ SELECT (SELECT 1 FROM t6 WHERE d = ifnul
                 },
                 {
                   "join_execution": {
+                    "select#": 2,
+                    "steps": [
+                    ] /* steps */
+                  } /* join_execution */
+                },
+                {
+                  "join_execution": {
                     "select#": 3,
                     "steps": [
                     ] /* steps */
@@ -990,13 +990,6 @@ SELECT * FROM t5 WHERE 5 IN (SELECT 1 FR
                   } /* join_optimization */
                 },
                 {
-                  "join_execution": {
-                    "select#": 2,
-                    "steps": [
-                    ] /* steps */
-                  } /* join_execution */
-                },
-                {
                   "join_optimization": {
                     "select#": 3,
                     "steps": [
@@ -1028,6 +1021,13 @@ SELECT * FROM t5 WHERE 5 IN (SELECT 1 FR
                 },
                 {
                   "join_execution": {
+                    "select#": 2,
+                    "steps": [
+                    ] /* steps */
+                  } /* join_execution */
+                },
+                {
+                  "join_execution": {
                     "select#": 3,
                     "steps": [
                     ] /* steps */
@@ -3654,13 +3654,6 @@ SELECT * FROM t1 WHERE c1=5 UNION SELECT
       } /* join_optimization */
     },
     {
-      "join_execution": {
-        "select#": 1,
-        "steps": [
-        ] /* steps */
-      } /* join_execution */
-    },
-    {
       "join_optimization": {
         "select#": 2,
         "steps": [
@@ -3749,6 +3742,13 @@ SELECT * FROM t1 WHERE c1=5 UNION SELECT
     },
     {
       "join_execution": {
+        "select#": 1,
+        "steps": [
+        ] /* steps */
+      } /* join_execution */
+    },
+    {
+      "join_execution": {
         "select#": 2,
         "steps": [
         ] /* steps */
@@ -9029,7 +9029,7 @@ drop view v1;
 create view v1 as select * from t1 where id < "c" limit 2;
 explain select * from v1 where id="b";
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	PRIMARY	<derived2>	ALL	NULL	NULL	NULL	NULL	2	Using where
+1	PRIMARY	<derived2>	ref	auto_key0	auto_key0	16	const	0	Using where
 2	DERIVED	t1	ALL	NULL	NULL	NULL	NULL	3	Using where
 select * from information_schema.OPTIMIZER_TRACE;
 QUERY	TRACE	MISSING_BYTES_BEYOND_MAX_MEM_SIZE	INSUFFICIENT_PRIVILEGES
@@ -9055,114 +9055,107 @@ explain select * from v1 where id="b"	{
       } /* join_preparation */
     },
     {
+      "join_preparation": {
+        "select#": 1,
+        "steps": [
+          {
+            "expanded_query": "/* select#1 */ select `v1`.`id` AS `id`,`v1`.`data` AS `data` from `test`.`v1` where (`v1`.`id` = 'b')"
+          }
+        ] /* steps */
+      } /* join_preparation */
+    },
+    {
       "join_optimization": {
-        "select#": 2,
+        "select#": 1,
         "steps": [
           {
-            "condition_processing": {
-              "condition": "WHERE",
-              "original_condition": "(`test`.`t1`.`id` < 'c')",
+            "join_optimization": {
+              "select#": 2,
               "steps": [
                 {
-                  "transformation": "equality_propagation",
-                  "resulting_condition": "(`test`.`t1`.`id` < 'c')"
+                  "condition_processing": {
+                    "condition": "WHERE",
+                    "original_condition": "(`test`.`t1`.`id` < 'c')",
+                    "steps": [
+                      {
+                        "transformation": "equality_propagation",
+                        "resulting_condition": "(`test`.`t1`.`id` < 'c')"
+                      },
+                      {
+                        "transformation": "constant_propagation",
+                        "resulting_condition": "(`test`.`t1`.`id` < 'c')"
+                      },
+                      {
+                        "transformation": "trivial_condition_removal",
+                        "resulting_condition": "(`test`.`t1`.`id` < 'c')"
+                      }
+                    ] /* steps */
+                  } /* condition_processing */
                 },
                 {
-                  "transformation": "constant_propagation",
-                  "resulting_condition": "(`test`.`t1`.`id` < 'c')"
+                  "ref_optimizer_key_uses": [
+                  ] /* ref_optimizer_key_uses */
                 },
                 {
-                  "transformation": "trivial_condition_removal",
-                  "resulting_condition": "(`test`.`t1`.`id` < 'c')"
-                }
-              ] /* steps */
-            } /* condition_processing */
-          },
-          {
-            "ref_optimizer_key_uses": [
-            ] /* ref_optimizer_key_uses */
-          },
-          {
-            "records_estimation": [
-              {
-                "database": "test",
-                "table": "t1",
-                "table_scan": {
-                  "records": 3,
-                  "cost": 2
-                } /* table_scan */
-              }
-            ] /* records_estimation */
-          },
-          {
-            "considered_execution_plans": [
-              {
-                "database": "test",
-                "table": "t1",
-                "best_access_path": {
-                  "considered_access_paths": [
+                  "records_estimation": [
                     {
-                      "access_type": "scan",
-                      "records": 3,
-                      "cost": 2.0154,
+                      "database": "test",
+                      "table": "t1",
+                      "table_scan": {
+                        "records": 3,
+                        "cost": 2
+                      } /* table_scan */
+                    }
+                  ] /* records_estimation */
+                },
+                {
+                  "considered_execution_plans": [
+                    {
+                      "database": "test",
+                      "table": "t1",
+                      "best_access_path": {
+                        "considered_access_paths": [
+                          {
+                            "access_type": "scan",
+                            "records": 3,
+                            "cost": 2.0154,
+                            "chosen": true
+                          }
+                        ] /* considered_access_paths */
+                      } /* best_access_path */,
+                      "cost_for_plan": 2.6154,
+                      "records_for_plan": 3,
                       "chosen": true
                     }
-                  ] /* considered_access_paths */
-                } /* best_access_path */,
-                "cost_for_plan": 2.6154,
-                "records_for_plan": 3,
-                "chosen": true
-              }
-            ] /* considered_execution_plans */
-          },
-          {
-            "attaching_conditions_to_tables": {
-              "original_condition": "(`test`.`t1`.`id` < 'c')",
-              "attached_conditions_computation": [
-              ] /* attached_conditions_computation */,
-              "attached_conditions_summary": [
+                  ] /* considered_execution_plans */
+                },
                 {
-                  "database": "test",
-                  "table": "t1",
-                  "attached": "(`test`.`t1`.`id` < 'c')"
+                  "attaching_conditions_to_tables": {
+                    "original_condition": "(`test`.`t1`.`id` < 'c')",
+                    "attached_conditions_computation": [
+                    ] /* attached_conditions_computation */,
+                    "attached_conditions_summary": [
+                      {
+                        "database": "test",
+                        "table": "t1",
+                        "attached": "(`test`.`t1`.`id` < 'c')"
+                      }
+                    ] /* attached_conditions_summary */
+                  } /* attaching_conditions_to_tables */
+                },
+                {
+                  "refine_plan": [
+                    {
+                      "database": "test",
+                      "table": "t1",
+                      "scan_type": "table"
+                    }
+                  ] /* refine_plan */
                 }
-              ] /* attached_conditions_summary */
-            } /* attaching_conditions_to_tables */
+              ] /* steps */
+            } /* join_optimization */
           },
           {
-            "refine_plan": [
-              {
-                "database": "test",
-                "table": "t1",
-                "scan_type": "table"
-              }
-            ] /* refine_plan */
-          }
-        ] /* steps */
-      } /* join_optimization */
-    },
-    {
-      "join_execution": {
-        "select#": 2,
-        "steps": [
-        ] /* steps */
-      } /* join_execution */
-    },
-    {
-      "join_preparation": {
-        "select#": 1,
-        "steps": [
-          {
-            "expanded_query": "/* select#1 */ select `v1`.`id` AS `id`,`v1`.`data` AS `data` from `test`.`v1` where (`v1`.`id` = 'b')"
-          }
-        ] /* steps */
-      } /* join_preparation */
-    },
-    {
-      "join_optimization": {
-        "select#": 1,
-        "steps": [
-          {
             "condition_processing": {
               "condition": "WHERE",
               "original_condition": "(`v1`.`id` = 'b')",
@@ -9184,17 +9177,20 @@ explain select * from v1 where id="b"	{
           },
           {
             "ref_optimizer_key_uses": [
+              {
+                "database": "",
+                "table": "v1",
+                "field": "id",
+                "equals": "'b'",
+                "null_rejecting": false
+              }
             ] /* ref_optimizer_key_uses */
           },
           {
             "records_estimation": [
               {
                 "database": "",
-                "table": "v1",
-                "table_scan": {
-                  "records": 2,
-                  "cost": 10
-                } /* table_scan */
+                "table": "v1"
               }
             ] /* records_estimation */
           },
@@ -9206,15 +9202,23 @@ explain select * from v1 where id="b"	{
                 "best_access_path": {
                   "considered_access_paths": [
                     {
+                      "access_type": "ref",
+                      "index": "auto_key0",
+                      "records": 0.2,
+                      "cost": 0.24,
+                      "chosen": true
+                    },
+                    {
                       "access_type": "scan",
+                      "cost": 10,
                       "records": 2,
-                      "cost": 10.1,
-                      "chosen": true
+                      "cause": "cost",
+                      "chosen": false
                     }
                   ] /* considered_access_paths */
                 } /* best_access_path */,
-                "cost_for_plan": 10.5,
-                "records_for_plan": 2,
+                "cost_for_plan": 0.24,
+                "records_for_plan": 0.2,
                 "chosen": true
               }
             ] /* considered_execution_plans */
@@ -9237,8 +9241,7 @@ explain select * from v1 where id="b"	{
             "refine_plan": [
               {
                 "database": "",
-                "table": "v1",
-                "scan_type": "table"
+                "table": "v1"
               }
             ] /* refine_plan */
           }
@@ -9413,15 +9416,15 @@ select TRACE into dumpfile 'MYSQLTEST_VA
       }
     },
     {
-      "join_execution": {
-        "select#": 1,
+      "join_optimization": {
+        "select#": 2,
         "steps": [
         ]
       }
     },
     {
-      "join_optimization": {
-        "select#": 2,
+      "join_execution": {
+        "select#": 1,
         "steps": [
         ]
       }

=== modified file 'mysql-test/suite/opt_trace/r/range_no_prot.result'
--- a/mysql-test/suite/opt_trace/r/range_no_prot.result	2011-07-20 13:10:44 +0000
+++ b/mysql-test/suite/opt_trace/r/range_no_prot.result	2011-07-22 09:53:44 +0000
@@ -3483,68 +3483,167 @@ EXPLAIN SELECT 1 FROM
       } /* join_preparation */
     },
     {
+      "join_preparation": {
+        "select#": 1,
+        "steps": [
+          {
+            "expanded_query": "/* select#1 */ select 1 AS `1` from (/* select#2 */ select 1 AS `1` from `test`.`t2` join `test`.`t1` where (`test`.`t2`.`b` < `test`.`t1`.`c`) group by 1 limit 1) `d2`"
+          }
+        ] /* steps */
+      } /* join_preparation */
+    },
+    {
       "join_optimization": {
-        "select#": 2,
+        "select#": 1,
         "steps": [
           {
-            "condition_processing": {
-              "condition": "WHERE",
-              "original_condition": "(`test`.`t2`.`b` < `test`.`t1`.`c`)",
+            "join_optimization": {
+              "select#": 2,
               "steps": [
                 {
-                  "transformation": "equality_propagation",
-                  "resulting_condition": "(`test`.`t2`.`b` < `test`.`t1`.`c`)"
+                  "condition_processing": {
+                    "condition": "WHERE",
+                    "original_condition": "(`test`.`t2`.`b` < `test`.`t1`.`c`)",
+                    "steps": [
+                      {
+                        "transformation": "equality_propagation",
+                        "resulting_condition": "(`test`.`t2`.`b` < `test`.`t1`.`c`)"
+                      },
+                      {
+                        "transformation": "constant_propagation",
+                        "resulting_condition": "(`test`.`t2`.`b` < `test`.`t1`.`c`)"
+                      },
+                      {
+                        "transformation": "trivial_condition_removal",
+                        "resulting_condition": "(`test`.`t2`.`b` < `test`.`t1`.`c`)"
+                      }
+                    ] /* steps */
+                  } /* condition_processing */
+                },
+                {
+                  "ref_optimizer_key_uses": [
+                  ] /* ref_optimizer_key_uses */
+                },
+                {
+                  "records_estimation": [
+                    {
+                      "database": "test",
+                      "table": "t2",
+                      "table_scan": {
+                        "records": 3,
+                        "cost": 2
+                      } /* table_scan */
+                    },
+                    {
+                      "database": "test",
+                      "table": "t1",
+                      "table_scan": {
+                        "records": 2,
+                        "cost": 2
+                      } /* table_scan */
+                    }
+                  ] /* records_estimation */
+                },
+                {
+                  "considered_execution_plans": "..."
                 },
                 {
-                  "transformation": "constant_propagation",
-                  "resulting_condition": "(`test`.`t2`.`b` < `test`.`t1`.`c`)"
+                  "attaching_conditions_to_tables": {
+                    "original_condition": "(`test`.`t2`.`b` < `test`.`t1`.`c`)",
+                    "attached_conditions_computation": [
+                      {
+                        "database": "test",
+                        "table": "t2",
+                        "rechecking_index_usage": {
+                          "range_analysis": {
+                            "table_scan": {
+                              "records": 3,
+                              "cost": 5.6
+                            } /* table_scan */,
+                            "potential_range_indices": [
+                              {
+                                "index": "b",
+                                "usable": true,
+                                "key_parts": [
+                                  "b"
+                                ] /* key_parts */
+                              }
+                            ] /* potential_range_indices */,
+                            "best_covering_index_scan": {
+                              "index": "b",
+                              "cost": 1.6465,
+                              "chosen": true
+                            } /* best_covering_index_scan */,
+                            "setup_range_conditions": [
+                            ] /* setup_range_conditions */,
+                            "group_index_range": {
+                              "chosen": false,
+                              "cause": "not_single_table"
+                            } /* group_index_range */,
+                            "analyzing_range_alternatives": {
+                              "range_scan_alternatives": [
+                                {
+                                  "index": "b",
+                                  "index_only": true,
+                                  "records": 18446744073709551615,
+                                  "cost": 0,
+                                  "rowid_ordered": false,
+                                  "chosen": false,
+                                  "cause": "cost"
+                                }
+                              ] /* range_scan_alternatives */,
+                              "analyzing_roworder_intersect": {
+                                "usable": false,
+                                "cause": "too_few_roworder_scans"
+                              } /* analyzing_roworder_intersect */
+                            } /* analyzing_range_alternatives */
+                          } /* range_analysis */
+                        } /* rechecking_index_usage */
+                      }
+                    ] /* attached_conditions_computation */,
+                    "attached_conditions_summary": [
+                      {
+                        "database": "test",
+                        "table": "t1",
+                        "attached": null
+                      },
+                      {
+                        "database": "test",
+                        "table": "t2",
+                        "attached": "(`test`.`t2`.`b` < `test`.`t1`.`c`)"
+                      }
+                    ] /* attached_conditions_summary */
+                  } /* attaching_conditions_to_tables */
                 },
                 {
-                  "transformation": "trivial_condition_removal",
-                  "resulting_condition": "(`test`.`t2`.`b` < `test`.`t1`.`c`)"
+                  "refine_plan": [
+                    {
+                      "database": "test",
+                      "table": "t1",
+                      "scan_type": "table"
+                    },
+                    {
+                      "database": "test",
+                      "table": "t2",
+                      "scan_type": "table"
+                    }
+                  ] /* refine_plan */
                 }
               ] /* steps */
-            } /* condition_processing */
-          },
-          {
-            "ref_optimizer_key_uses": [
-            ] /* ref_optimizer_key_uses */
+            } /* join_optimization */
           },
           {
-            "records_estimation": [
-              {
-                "database": "test",
-                "table": "t2",
-                "table_scan": {
-                  "records": 3,
-                  "cost": 2
-                } /* table_scan */
-              },
-              {
-                "database": "test",
-                "table": "t1",
-                "table_scan": {
-                  "records": 2,
-                  "cost": 2
-                } /* table_scan */
-              }
-            ] /* records_estimation */
-          },
-          {
-            "considered_execution_plans": "..."
-          },
-          {
-            "attaching_conditions_to_tables": {
-              "original_condition": "(`test`.`t2`.`b` < `test`.`t1`.`c`)",
-              "attached_conditions_computation": [
+            "join_execution": {
+              "select#": 2,
+              "steps": [
                 {
-                  "database": "test",
-                  "table": "t2",
-                  "rechecking_index_usage": {
+                  "records_estimation_per_record": {
+                    "database": "test",
+                    "table": "t2",
                     "range_analysis": {
                       "table_scan": {
                         "records": 3,
-                        "cost": 5.6
+                        "cost": 4.7051
                       } /* table_scan */,
                       "potential_range_indices": [
                         {
@@ -3561,153 +3660,54 @@ EXPLAIN SELECT 1 FROM
                         "chosen": true
                       } /* best_covering_index_scan */,
                       "setup_range_conditions": [
+                        {
+                          "impossible_condition": {
+                            "cause": "comparison_with_null_always_false"
+                          } /* impossible_condition */
+                        }
                       ] /* setup_range_conditions */,
-                      "group_index_range": {
-                        "chosen": false,
-                        "cause": "not_single_table"
-                      } /* group_index_range */,
-                      "analyzing_range_alternatives": {
-                        "range_scan_alternatives": [
-                          {
-                            "index": "b",
-                            "index_only": true,
-                            "records": 18446744073709551615,
-                            "cost": 0,
-                            "rowid_ordered": false,
-                            "chosen": false,
-                            "cause": "cost"
-                          }
-                        ] /* range_scan_alternatives */,
-                        "analyzing_roworder_intersect": {
-                          "usable": false,
-                          "cause": "too_few_roworder_scans"
-                        } /* analyzing_roworder_intersect */
-                      } /* analyzing_range_alternatives */
+                      "impossible_range": true
                     } /* range_analysis */
-                  } /* rechecking_index_usage */
-                }
-              ] /* attached_conditions_computation */,
-              "attached_conditions_summary": [
-                {
-                  "database": "test",
-                  "table": "t1",
-                  "attached": null
+                  } /* records_estimation_per_record */
                 },
                 {
-                  "database": "test",
-                  "table": "t2",
-                  "attached": "(`test`.`t2`.`b` < `test`.`t1`.`c`)"
+                  "records_estimation_per_record": {
+                    "database": "test",
+                    "table": "t2",
+                    "range_analysis": {
+                      "table_scan": {
+                        "records": 3,
+                        "cost": 4.7051
+                      } /* table_scan */,
+                      "potential_range_indices": [
+                        {
+                          "index": "b",
+                          "usable": true,
+                          "key_parts": [
+                            "b"
+                          ] /* key_parts */
+                        }
+                      ] /* potential_range_indices */,
+                      "best_covering_index_scan": {
+                        "index": "b",
+                        "cost": 1.6465,
+                        "chosen": true
+                      } /* best_covering_index_scan */,
+                      "setup_range_conditions": [
+                        {
+                          "impossible_condition": {
+                            "cause": "comparison_with_null_always_false"
+                          } /* impossible_condition */
+                        }
+                      ] /* setup_range_conditions */,
+                      "impossible_range": true
+                    } /* range_analysis */
+                  } /* records_estimation_per_record */
                 }
-              ] /* attached_conditions_summary */
-            } /* attaching_conditions_to_tables */
-          },
-          {
-            "refine_plan": [
-              {
-                "database": "test",
-                "table": "t1",
-                "scan_type": "table"
-              },
-              {
-                "database": "test",
-                "table": "t2",
-                "scan_type": "table"
-              }
-            ] /* refine_plan */
-          }
-        ] /* steps */
-      } /* join_optimization */
-    },
-    {
-      "join_execution": {
-        "select#": 2,
-        "steps": [
-          {
-            "records_estimation_per_record": {
-              "database": "test",
-              "table": "t2",
-              "range_analysis": {
-                "table_scan": {
-                  "records": 3,
-                  "cost": 4.7051
-                } /* table_scan */,
-                "potential_range_indices": [
-                  {
-                    "index": "b",
-                    "usable": true,
-                    "key_parts": [
-                      "b"
-                    ] /* key_parts */
-                  }
-                ] /* potential_range_indices */,
-                "best_covering_index_scan": {
-                  "index": "b",
-                  "cost": 1.6465,
-                  "chosen": true
-                } /* best_covering_index_scan */,
-                "setup_range_conditions": [
-                  {
-                    "impossible_condition": {
-                      "cause": "comparison_with_null_always_false"
-                    } /* impossible_condition */
-                  }
-                ] /* setup_range_conditions */,
-                "impossible_range": true
-              } /* range_analysis */
-            } /* records_estimation_per_record */
+              ] /* steps */
+            } /* join_execution */
           },
           {
-            "records_estimation_per_record": {
-              "database": "test",
-              "table": "t2",
-              "range_analysis": {
-                "table_scan": {
-                  "records": 3,
-                  "cost": 4.7051
-                } /* table_scan */,
-                "potential_range_indices": [
-                  {
-                    "index": "b",
-                    "usable": true,
-                    "key_parts": [
-                      "b"
-                    ] /* key_parts */
-                  }
-                ] /* potential_range_indices */,
-                "best_covering_index_scan": {
-                  "index": "b",
-                  "cost": 1.6465,
-                  "chosen": true
-                } /* best_covering_index_scan */,
-                "setup_range_conditions": [
-                  {
-                    "impossible_condition": {
-                      "cause": "comparison_with_null_always_false"
-                    } /* impossible_condition */
-                  }
-                ] /* setup_range_conditions */,
-                "impossible_range": true
-              } /* range_analysis */
-            } /* records_estimation_per_record */
-          }
-        ] /* steps */
-      } /* join_execution */
-    },
-    {
-      "join_preparation": {
-        "select#": 1,
-        "steps": [
-          {
-            "expanded_query": "/* select#1 */ select 1 AS `1` from (/* select#2 */ select 1 AS `1` from `test`.`t2` join `test`.`t1` where (`test`.`t2`.`b` < `test`.`t1`.`c`) group by 1 limit 1) `d2`"
-          }
-        ] /* steps */
-      } /* join_preparation */
-    },
-    {
-      "join_optimization": {
-        "select#": 1,
-        "steps": [
-          {
             "records_estimation": [
               {
                 "database": "",
@@ -3775,68 +3775,167 @@ EXPLAIN SELECT 1 FROM
       } /* join_preparation */
     },
     {
+      "join_preparation": {
+        "select#": 1,
+        "steps": [
+          {
+            "expanded_query": "/* select#1 */ select 1 AS `1` from (/* select#2 */ select 1 AS `1` from `test`.`t2` join `test`.`t1` where (`test`.`t2`.`b` < `test`.`t1`.`c`) group by 1 limit 1) `d2`"
+          }
+        ] /* steps */
+      } /* join_preparation */
+    },
+    {
       "join_optimization": {
-        "select#": 2,
+        "select#": 1,
         "steps": [
           {
-            "condition_processing": {
-              "condition": "WHERE",
-              "original_condition": "(`test`.`t2`.`b` < `test`.`t1`.`c`)",
+            "join_optimization": {
+              "select#": 2,
               "steps": [
                 {
-                  "transformation": "equality_propagation",
-                  "resulting_condition": "(`test`.`t2`.`b` < `test`.`t1`.`c`)"
+                  "condition_processing": {
+                    "condition": "WHERE",
+                    "original_condition": "(`test`.`t2`.`b` < `test`.`t1`.`c`)",
+                    "steps": [
+                      {
+                        "transformation": "equality_propagation",
+                        "resulting_condition": "(`test`.`t2`.`b` < `test`.`t1`.`c`)"
+                      },
+                      {
+                        "transformation": "constant_propagation",
+                        "resulting_condition": "(`test`.`t2`.`b` < `test`.`t1`.`c`)"
+                      },
+                      {
+                        "transformation": "trivial_condition_removal",
+                        "resulting_condition": "(`test`.`t2`.`b` < `test`.`t1`.`c`)"
+                      }
+                    ] /* steps */
+                  } /* condition_processing */
                 },
                 {
-                  "transformation": "constant_propagation",
-                  "resulting_condition": "(`test`.`t2`.`b` < `test`.`t1`.`c`)"
+                  "ref_optimizer_key_uses": [
+                  ] /* ref_optimizer_key_uses */
                 },
                 {
-                  "transformation": "trivial_condition_removal",
-                  "resulting_condition": "(`test`.`t2`.`b` < `test`.`t1`.`c`)"
+                  "records_estimation": [
+                    {
+                      "database": "test",
+                      "table": "t2",
+                      "table_scan": {
+                        "records": 3,
+                        "cost": 2
+                      } /* table_scan */
+                    },
+                    {
+                      "database": "test",
+                      "table": "t1",
+                      "table_scan": {
+                        "records": 2,
+                        "cost": 2
+                      } /* table_scan */
+                    }
+                  ] /* records_estimation */
+                },
+                {
+                  "considered_execution_plans": "..."
+                },
+                {
+                  "attaching_conditions_to_tables": {
+                    "original_condition": "(`test`.`t2`.`b` < `test`.`t1`.`c`)",
+                    "attached_conditions_computation": [
+                      {
+                        "database": "test",
+                        "table": "t2",
+                        "rechecking_index_usage": {
+                          "range_analysis": {
+                            "table_scan": {
+                              "records": 3,
+                              "cost": 5.6
+                            } /* table_scan */,
+                            "potential_range_indices": [
+                              {
+                                "index": "b",
+                                "usable": true,
+                                "key_parts": [
+                                  "b"
+                                ] /* key_parts */
+                              }
+                            ] /* potential_range_indices */,
+                            "best_covering_index_scan": {
+                              "index": "b",
+                              "cost": 1.6465,
+                              "chosen": true
+                            } /* best_covering_index_scan */,
+                            "setup_range_conditions": [
+                            ] /* setup_range_conditions */,
+                            "group_index_range": {
+                              "chosen": false,
+                              "cause": "not_single_table"
+                            } /* group_index_range */,
+                            "analyzing_range_alternatives": {
+                              "range_scan_alternatives": [
+                                {
+                                  "index": "b",
+                                  "index_only": true,
+                                  "records": 18446744073709551615,
+                                  "cost": 0,
+                                  "rowid_ordered": false,
+                                  "chosen": false,
+                                  "cause": "cost"
+                                }
+                              ] /* range_scan_alternatives */,
+                              "analyzing_roworder_intersect": {
+                                "usable": false,
+                                "cause": "too_few_roworder_scans"
+                              } /* analyzing_roworder_intersect */
+                            } /* analyzing_range_alternatives */
+                          } /* range_analysis */
+                        } /* rechecking_index_usage */
+                      }
+                    ] /* attached_conditions_computation */,
+                    "attached_conditions_summary": [
+                      {
+                        "database": "test",
+                        "table": "t1",
+                        "attached": null
+                      },
+                      {
+                        "database": "test",
+                        "table": "t2",
+                        "attached": "(`test`.`t2`.`b` < `test`.`t1`.`c`)"
+                      }
+                    ] /* attached_conditions_summary */
+                  } /* attaching_conditions_to_tables */
+                },
+                {
+                  "refine_plan": [
+                    {
+                      "database": "test",
+                      "table": "t1",
+                      "scan_type": "table"
+                    },
+                    {
+                      "database": "test",
+                      "table": "t2",
+                      "scan_type": "table"
+                    }
+                  ] /* refine_plan */
                 }
               ] /* steps */
-            } /* condition_processing */
+            } /* join_optimization */
           },
           {
-            "ref_optimizer_key_uses": [
-            ] /* ref_optimizer_key_uses */
-          },
-          {
-            "records_estimation": [
-              {
-                "database": "test",
-                "table": "t2",
-                "table_scan": {
-                  "records": 3,
-                  "cost": 2
-                } /* table_scan */
-              },
-              {
-                "database": "test",
-                "table": "t1",
-                "table_scan": {
-                  "records": 2,
-                  "cost": 2
-                } /* table_scan */
-              }
-            ] /* records_estimation */
-          },
-          {
-            "considered_execution_plans": "..."
-          },
-          {
-            "attaching_conditions_to_tables": {
-              "original_condition": "(`test`.`t2`.`b` < `test`.`t1`.`c`)",
-              "attached_conditions_computation": [
+            "join_execution": {
+              "select#": 2,
+              "steps": [
                 {
-                  "database": "test",
-                  "table": "t2",
-                  "rechecking_index_usage": {
+                  "records_estimation_per_record": {
+                    "database": "test",
+                    "table": "t2",
                     "range_analysis": {
                       "table_scan": {
                         "records": 3,
-                        "cost": 5.6
+                        "cost": 4.7051
                       } /* table_scan */,
                       "potential_range_indices": [
                         {
@@ -3853,119 +3952,20 @@ EXPLAIN SELECT 1 FROM
                         "chosen": true
                       } /* best_covering_index_scan */,
                       "setup_range_conditions": [
+                        {
+                          "impossible_condition": {
+                            "cause": "comparison_with_null_always_false"
+                          } /* impossible_condition */
+                        }
                       ] /* setup_range_conditions */,
-                      "group_index_range": {
-                        "chosen": false,
-                        "cause": "not_single_table"
-                      } /* group_index_range */,
-                      "analyzing_range_alternatives": {
-                        "range_scan_alternatives": [
-                          {
-                            "index": "b",
-                            "index_only": true,
-                            "records": 18446744073709551615,
-                            "cost": 0,
-                            "rowid_ordered": false,
-                            "chosen": false,
-                            "cause": "cost"
-                          }
-                        ] /* range_scan_alternatives */,
-                        "analyzing_roworder_intersect": {
-                          "usable": false,
-                          "cause": "too_few_roworder_scans"
-                        } /* analyzing_roworder_intersect */
-                      } /* analyzing_range_alternatives */
+                      "impossible_range": true
                     } /* range_analysis */
-                  } /* rechecking_index_usage */
-                }
-              ] /* attached_conditions_computation */,
-              "attached_conditions_summary": [
-                {
-                  "database": "test",
-                  "table": "t1",
-                  "attached": null
-                },
-                {
-                  "database": "test",
-                  "table": "t2",
-                  "attached": "(`test`.`t2`.`b` < `test`.`t1`.`c`)"
+                  } /* records_estimation_per_record */
                 }
-              ] /* attached_conditions_summary */
-            } /* attaching_conditions_to_tables */
+              ] /* steps */
+            } /* join_execution */
           },
           {
-            "refine_plan": [
-              {
-                "database": "test",
-                "table": "t1",
-                "scan_type": "table"
-              },
-              {
-                "database": "test",
-                "table": "t2",
-                "scan_type": "table"
-              }
-            ] /* refine_plan */
-          }
-        ] /* steps */
-      } /* join_optimization */
-    },
-    {
-      "join_execution": {
-        "select#": 2,
-        "steps": [
-          {
-            "records_estimation_per_record": {
-              "database": "test",
-              "table": "t2",
-              "range_analysis": {
-                "table_scan": {
-                  "records": 3,
-                  "cost": 4.7051
-                } /* table_scan */,
-                "potential_range_indices": [
-                  {
-                    "index": "b",
-                    "usable": true,
-                    "key_parts": [
-                      "b"
-                    ] /* key_parts */
-                  }
-                ] /* potential_range_indices */,
-                "best_covering_index_scan": {
-                  "index": "b",
-                  "cost": 1.6465,
-                  "chosen": true
-                } /* best_covering_index_scan */,
-                "setup_range_conditions": [
-                  {
-                    "impossible_condition": {
-                      "cause": "comparison_with_null_always_false"
-                    } /* impossible_condition */
-                  }
-                ] /* setup_range_conditions */,
-                "impossible_range": true
-              } /* range_analysis */
-            } /* records_estimation_per_record */
-          }
-        ] /* steps */
-      } /* join_execution */
-    },
-    {
-      "join_preparation": {
-        "select#": 1,
-        "steps": [
-          {
-            "expanded_query": "/* select#1 */ select 1 AS `1` from (/* select#2 */ select 1 AS `1` from `test`.`t2` join `test`.`t1` where (`test`.`t2`.`b` < `test`.`t1`.`c`) group by 1 limit 1) `d2`"
-          }
-        ] /* steps */
-      } /* join_preparation */
-    },
-    {
-      "join_optimization": {
-        "select#": 1,
-        "steps": [
-          {
             "records_estimation": [
               {
                 "database": "",

=== modified file 'mysql-test/suite/opt_trace/r/range_ps_prot.result'
--- a/mysql-test/suite/opt_trace/r/range_ps_prot.result	2011-07-20 13:10:44 +0000
+++ b/mysql-test/suite/opt_trace/r/range_ps_prot.result	2011-07-22 09:53:44 +0000
@@ -3483,68 +3483,167 @@ EXPLAIN SELECT 1 FROM
       } /* join_preparation */
     },
     {
+      "join_preparation": {
+        "select#": 1,
+        "steps": [
+          {
+            "expanded_query": "/* select#1 */ select 1 AS `1` from (/* select#2 */ select 1 AS `1` from `test`.`t2` join `test`.`t1` where (`test`.`t2`.`b` < `test`.`t1`.`c`) group by 1 limit 1) `d2`"
+          }
+        ] /* steps */
+      } /* join_preparation */
+    },
+    {
       "join_optimization": {
-        "select#": 2,
+        "select#": 1,
         "steps": [
           {
-            "condition_processing": {
-              "condition": "WHERE",
-              "original_condition": "(`test`.`t2`.`b` < `test`.`t1`.`c`)",
+            "join_optimization": {
+              "select#": 2,
               "steps": [
                 {
-                  "transformation": "equality_propagation",
-                  "resulting_condition": "(`test`.`t2`.`b` < `test`.`t1`.`c`)"
+                  "condition_processing": {
+                    "condition": "WHERE",
+                    "original_condition": "(`test`.`t2`.`b` < `test`.`t1`.`c`)",
+                    "steps": [
+                      {
+                        "transformation": "equality_propagation",
+                        "resulting_condition": "(`test`.`t2`.`b` < `test`.`t1`.`c`)"
+                      },
+                      {
+                        "transformation": "constant_propagation",
+                        "resulting_condition": "(`test`.`t2`.`b` < `test`.`t1`.`c`)"
+                      },
+                      {
+                        "transformation": "trivial_condition_removal",
+                        "resulting_condition": "(`test`.`t2`.`b` < `test`.`t1`.`c`)"
+                      }
+                    ] /* steps */
+                  } /* condition_processing */
+                },
+                {
+                  "ref_optimizer_key_uses": [
+                  ] /* ref_optimizer_key_uses */
+                },
+                {
+                  "records_estimation": [
+                    {
+                      "database": "test",
+                      "table": "t2",
+                      "table_scan": {
+                        "records": 3,
+                        "cost": 2
+                      } /* table_scan */
+                    },
+                    {
+                      "database": "test",
+                      "table": "t1",
+                      "table_scan": {
+                        "records": 2,
+                        "cost": 2
+                      } /* table_scan */
+                    }
+                  ] /* records_estimation */
+                },
+                {
+                  "considered_execution_plans": "..."
                 },
                 {
-                  "transformation": "constant_propagation",
-                  "resulting_condition": "(`test`.`t2`.`b` < `test`.`t1`.`c`)"
+                  "attaching_conditions_to_tables": {
+                    "original_condition": "(`test`.`t2`.`b` < `test`.`t1`.`c`)",
+                    "attached_conditions_computation": [
+                      {
+                        "database": "test",
+                        "table": "t2",
+                        "rechecking_index_usage": {
+                          "range_analysis": {
+                            "table_scan": {
+                              "records": 3,
+                              "cost": 5.6
+                            } /* table_scan */,
+                            "potential_range_indices": [
+                              {
+                                "index": "b",
+                                "usable": true,
+                                "key_parts": [
+                                  "b"
+                                ] /* key_parts */
+                              }
+                            ] /* potential_range_indices */,
+                            "best_covering_index_scan": {
+                              "index": "b",
+                              "cost": 1.6465,
+                              "chosen": true
+                            } /* best_covering_index_scan */,
+                            "setup_range_conditions": [
+                            ] /* setup_range_conditions */,
+                            "group_index_range": {
+                              "chosen": false,
+                              "cause": "not_single_table"
+                            } /* group_index_range */,
+                            "analyzing_range_alternatives": {
+                              "range_scan_alternatives": [
+                                {
+                                  "index": "b",
+                                  "index_only": true,
+                                  "records": 18446744073709551615,
+                                  "cost": 0,
+                                  "rowid_ordered": false,
+                                  "chosen": false,
+                                  "cause": "cost"
+                                }
+                              ] /* range_scan_alternatives */,
+                              "analyzing_roworder_intersect": {
+                                "usable": false,
+                                "cause": "too_few_roworder_scans"
+                              } /* analyzing_roworder_intersect */
+                            } /* analyzing_range_alternatives */
+                          } /* range_analysis */
+                        } /* rechecking_index_usage */
+                      }
+                    ] /* attached_conditions_computation */,
+                    "attached_conditions_summary": [
+                      {
+                        "database": "test",
+                        "table": "t1",
+                        "attached": null
+                      },
+                      {
+                        "database": "test",
+                        "table": "t2",
+                        "attached": "(`test`.`t2`.`b` < `test`.`t1`.`c`)"
+                      }
+                    ] /* attached_conditions_summary */
+                  } /* attaching_conditions_to_tables */
                 },
                 {
-                  "transformation": "trivial_condition_removal",
-                  "resulting_condition": "(`test`.`t2`.`b` < `test`.`t1`.`c`)"
+                  "refine_plan": [
+                    {
+                      "database": "test",
+                      "table": "t1",
+                      "scan_type": "table"
+                    },
+                    {
+                      "database": "test",
+                      "table": "t2",
+                      "scan_type": "table"
+                    }
+                  ] /* refine_plan */
                 }
               ] /* steps */
-            } /* condition_processing */
-          },
-          {
-            "ref_optimizer_key_uses": [
-            ] /* ref_optimizer_key_uses */
+            } /* join_optimization */
           },
           {
-            "records_estimation": [
-              {
-                "database": "test",
-                "table": "t2",
-                "table_scan": {
-                  "records": 3,
-                  "cost": 2
-                } /* table_scan */
-              },
-              {
-                "database": "test",
-                "table": "t1",
-                "table_scan": {
-                  "records": 2,
-                  "cost": 2
-                } /* table_scan */
-              }
-            ] /* records_estimation */
-          },
-          {
-            "considered_execution_plans": "..."
-          },
-          {
-            "attaching_conditions_to_tables": {
-              "original_condition": "(`test`.`t2`.`b` < `test`.`t1`.`c`)",
-              "attached_conditions_computation": [
+            "join_execution": {
+              "select#": 2,
+              "steps": [
                 {
-                  "database": "test",
-                  "table": "t2",
-                  "rechecking_index_usage": {
+                  "records_estimation_per_record": {
+                    "database": "test",
+                    "table": "t2",
                     "range_analysis": {
                       "table_scan": {
                         "records": 3,
-                        "cost": 5.6
+                        "cost": 4.7051
                       } /* table_scan */,
                       "potential_range_indices": [
                         {
@@ -3561,153 +3660,54 @@ EXPLAIN SELECT 1 FROM
                         "chosen": true
                       } /* best_covering_index_scan */,
                       "setup_range_conditions": [
+                        {
+                          "impossible_condition": {
+                            "cause": "comparison_with_null_always_false"
+                          } /* impossible_condition */
+                        }
                       ] /* setup_range_conditions */,
-                      "group_index_range": {
-                        "chosen": false,
-                        "cause": "not_single_table"
-                      } /* group_index_range */,
-                      "analyzing_range_alternatives": {
-                        "range_scan_alternatives": [
-                          {
-                            "index": "b",
-                            "index_only": true,
-                            "records": 18446744073709551615,
-                            "cost": 0,
-                            "rowid_ordered": false,
-                            "chosen": false,
-                            "cause": "cost"
-                          }
-                        ] /* range_scan_alternatives */,
-                        "analyzing_roworder_intersect": {
-                          "usable": false,
-                          "cause": "too_few_roworder_scans"
-                        } /* analyzing_roworder_intersect */
-                      } /* analyzing_range_alternatives */
+                      "impossible_range": true
                     } /* range_analysis */
-                  } /* rechecking_index_usage */
-                }
-              ] /* attached_conditions_computation */,
-              "attached_conditions_summary": [
-                {
-                  "database": "test",
-                  "table": "t1",
-                  "attached": null
+                  } /* records_estimation_per_record */
                 },
                 {
-                  "database": "test",
-                  "table": "t2",
-                  "attached": "(`test`.`t2`.`b` < `test`.`t1`.`c`)"
+                  "records_estimation_per_record": {
+                    "database": "test",
+                    "table": "t2",
+                    "range_analysis": {
+                      "table_scan": {
+                        "records": 3,
+                        "cost": 4.7051
+                      } /* table_scan */,
+                      "potential_range_indices": [
+                        {
+                          "index": "b",
+                          "usable": true,
+                          "key_parts": [
+                            "b"
+                          ] /* key_parts */
+                        }
+                      ] /* potential_range_indices */,
+                      "best_covering_index_scan": {
+                        "index": "b",
+                        "cost": 1.6465,
+                        "chosen": true
+                      } /* best_covering_index_scan */,
+                      "setup_range_conditions": [
+                        {
+                          "impossible_condition": {
+                            "cause": "comparison_with_null_always_false"
+                          } /* impossible_condition */
+                        }
+                      ] /* setup_range_conditions */,
+                      "impossible_range": true
+                    } /* range_analysis */
+                  } /* records_estimation_per_record */
                 }
-              ] /* attached_conditions_summary */
-            } /* attaching_conditions_to_tables */
-          },
-          {
-            "refine_plan": [
-              {
-                "database": "test",
-                "table": "t1",
-                "scan_type": "table"
-              },
-              {
-                "database": "test",
-                "table": "t2",
-                "scan_type": "table"
-              }
-            ] /* refine_plan */
-          }
-        ] /* steps */
-      } /* join_optimization */
-    },
-    {
-      "join_execution": {
-        "select#": 2,
-        "steps": [
-          {
-            "records_estimation_per_record": {
-              "database": "test",
-              "table": "t2",
-              "range_analysis": {
-                "table_scan": {
-                  "records": 3,
-                  "cost": 4.7051
-                } /* table_scan */,
-                "potential_range_indices": [
-                  {
-                    "index": "b",
-                    "usable": true,
-                    "key_parts": [
-                      "b"
-                    ] /* key_parts */
-                  }
-                ] /* potential_range_indices */,
-                "best_covering_index_scan": {
-                  "index": "b",
-                  "cost": 1.6465,
-                  "chosen": true
-                } /* best_covering_index_scan */,
-                "setup_range_conditions": [
-                  {
-                    "impossible_condition": {
-                      "cause": "comparison_with_null_always_false"
-                    } /* impossible_condition */
-                  }
-                ] /* setup_range_conditions */,
-                "impossible_range": true
-              } /* range_analysis */
-            } /* records_estimation_per_record */
+              ] /* steps */
+            } /* join_execution */
           },
           {
-            "records_estimation_per_record": {
-              "database": "test",
-              "table": "t2",
-              "range_analysis": {
-                "table_scan": {
-                  "records": 3,
-                  "cost": 4.7051
-                } /* table_scan */,
-                "potential_range_indices": [
-                  {
-                    "index": "b",
-                    "usable": true,
-                    "key_parts": [
-                      "b"
-                    ] /* key_parts */
-                  }
-                ] /* potential_range_indices */,
-                "best_covering_index_scan": {
-                  "index": "b",
-                  "cost": 1.6465,
-                  "chosen": true
-                } /* best_covering_index_scan */,
-                "setup_range_conditions": [
-                  {
-                    "impossible_condition": {
-                      "cause": "comparison_with_null_always_false"
-                    } /* impossible_condition */
-                  }
-                ] /* setup_range_conditions */,
-                "impossible_range": true
-              } /* range_analysis */
-            } /* records_estimation_per_record */
-          }
-        ] /* steps */
-      } /* join_execution */
-    },
-    {
-      "join_preparation": {
-        "select#": 1,
-        "steps": [
-          {
-            "expanded_query": "/* select#1 */ select 1 AS `1` from (/* select#2 */ select 1 AS `1` from `test`.`t2` join `test`.`t1` where (`test`.`t2`.`b` < `test`.`t1`.`c`) group by 1 limit 1) `d2`"
-          }
-        ] /* steps */
-      } /* join_preparation */
-    },
-    {
-      "join_optimization": {
-        "select#": 1,
-        "steps": [
-          {
             "records_estimation": [
               {
                 "database": "",
@@ -3775,68 +3775,167 @@ EXPLAIN SELECT 1 FROM
       } /* join_preparation */
     },
     {
+      "join_preparation": {
+        "select#": 1,
+        "steps": [
+          {
+            "expanded_query": "/* select#1 */ select 1 AS `1` from (/* select#2 */ select 1 AS `1` from `test`.`t2` join `test`.`t1` where (`test`.`t2`.`b` < `test`.`t1`.`c`) group by 1 limit 1) `d2`"
+          }
+        ] /* steps */
+      } /* join_preparation */
+    },
+    {
       "join_optimization": {
-        "select#": 2,
+        "select#": 1,
         "steps": [
           {
-            "condition_processing": {
-              "condition": "WHERE",
-              "original_condition": "(`test`.`t2`.`b` < `test`.`t1`.`c`)",
+            "join_optimization": {
+              "select#": 2,
               "steps": [
                 {
-                  "transformation": "equality_propagation",
-                  "resulting_condition": "(`test`.`t2`.`b` < `test`.`t1`.`c`)"
+                  "condition_processing": {
+                    "condition": "WHERE",
+                    "original_condition": "(`test`.`t2`.`b` < `test`.`t1`.`c`)",
+                    "steps": [
+                      {
+                        "transformation": "equality_propagation",
+                        "resulting_condition": "(`test`.`t2`.`b` < `test`.`t1`.`c`)"
+                      },
+                      {
+                        "transformation": "constant_propagation",
+                        "resulting_condition": "(`test`.`t2`.`b` < `test`.`t1`.`c`)"
+                      },
+                      {
+                        "transformation": "trivial_condition_removal",
+                        "resulting_condition": "(`test`.`t2`.`b` < `test`.`t1`.`c`)"
+                      }
+                    ] /* steps */
+                  } /* condition_processing */
                 },
                 {
-                  "transformation": "constant_propagation",
-                  "resulting_condition": "(`test`.`t2`.`b` < `test`.`t1`.`c`)"
+                  "ref_optimizer_key_uses": [
+                  ] /* ref_optimizer_key_uses */
                 },
                 {
-                  "transformation": "trivial_condition_removal",
-                  "resulting_condition": "(`test`.`t2`.`b` < `test`.`t1`.`c`)"
+                  "records_estimation": [
+                    {
+                      "database": "test",
+                      "table": "t2",
+                      "table_scan": {
+                        "records": 3,
+                        "cost": 2
+                      } /* table_scan */
+                    },
+                    {
+                      "database": "test",
+                      "table": "t1",
+                      "table_scan": {
+                        "records": 2,
+                        "cost": 2
+                      } /* table_scan */
+                    }
+                  ] /* records_estimation */
+                },
+                {
+                  "considered_execution_plans": "..."
+                },
+                {
+                  "attaching_conditions_to_tables": {
+                    "original_condition": "(`test`.`t2`.`b` < `test`.`t1`.`c`)",
+                    "attached_conditions_computation": [
+                      {
+                        "database": "test",
+                        "table": "t2",
+                        "rechecking_index_usage": {
+                          "range_analysis": {
+                            "table_scan": {
+                              "records": 3,
+                              "cost": 5.6
+                            } /* table_scan */,
+                            "potential_range_indices": [
+                              {
+                                "index": "b",
+                                "usable": true,
+                                "key_parts": [
+                                  "b"
+                                ] /* key_parts */
+                              }
+                            ] /* potential_range_indices */,
+                            "best_covering_index_scan": {
+                              "index": "b",
+                              "cost": 1.6465,
+                              "chosen": true
+                            } /* best_covering_index_scan */,
+                            "setup_range_conditions": [
+                            ] /* setup_range_conditions */,
+                            "group_index_range": {
+                              "chosen": false,
+                              "cause": "not_single_table"
+                            } /* group_index_range */,
+                            "analyzing_range_alternatives": {
+                              "range_scan_alternatives": [
+                                {
+                                  "index": "b",
+                                  "index_only": true,
+                                  "records": 18446744073709551615,
+                                  "cost": 0,
+                                  "rowid_ordered": false,
+                                  "chosen": false,
+                                  "cause": "cost"
+                                }
+                              ] /* range_scan_alternatives */,
+                              "analyzing_roworder_intersect": {
+                                "usable": false,
+                                "cause": "too_few_roworder_scans"
+                              } /* analyzing_roworder_intersect */
+                            } /* analyzing_range_alternatives */
+                          } /* range_analysis */
+                        } /* rechecking_index_usage */
+                      }
+                    ] /* attached_conditions_computation */,
+                    "attached_conditions_summary": [
+                      {
+                        "database": "test",
+                        "table": "t1",
+                        "attached": null
+                      },
+                      {
+                        "database": "test",
+                        "table": "t2",
+                        "attached": "(`test`.`t2`.`b` < `test`.`t1`.`c`)"
+                      }
+                    ] /* attached_conditions_summary */
+                  } /* attaching_conditions_to_tables */
+                },
+                {
+                  "refine_plan": [
+                    {
+                      "database": "test",
+                      "table": "t1",
+                      "scan_type": "table"
+                    },
+                    {
+                      "database": "test",
+                      "table": "t2",
+                      "scan_type": "table"
+                    }
+                  ] /* refine_plan */
                 }
               ] /* steps */
-            } /* condition_processing */
+            } /* join_optimization */
           },
           {
-            "ref_optimizer_key_uses": [
-            ] /* ref_optimizer_key_uses */
-          },
-          {
-            "records_estimation": [
-              {
-                "database": "test",
-                "table": "t2",
-                "table_scan": {
-                  "records": 3,
-                  "cost": 2
-                } /* table_scan */
-              },
-              {
-                "database": "test",
-                "table": "t1",
-                "table_scan": {
-                  "records": 2,
-                  "cost": 2
-                } /* table_scan */
-              }
-            ] /* records_estimation */
-          },
-          {
-            "considered_execution_plans": "..."
-          },
-          {
-            "attaching_conditions_to_tables": {
-              "original_condition": "(`test`.`t2`.`b` < `test`.`t1`.`c`)",
-              "attached_conditions_computation": [
+            "join_execution": {
+              "select#": 2,
+              "steps": [
                 {
-                  "database": "test",
-                  "table": "t2",
-                  "rechecking_index_usage": {
+                  "records_estimation_per_record": {
+                    "database": "test",
+                    "table": "t2",
                     "range_analysis": {
                       "table_scan": {
                         "records": 3,
-                        "cost": 5.6
+                        "cost": 4.7051
                       } /* table_scan */,
                       "potential_range_indices": [
                         {
@@ -3853,119 +3952,20 @@ EXPLAIN SELECT 1 FROM
                         "chosen": true
                       } /* best_covering_index_scan */,
                       "setup_range_conditions": [
+                        {
+                          "impossible_condition": {
+                            "cause": "comparison_with_null_always_false"
+                          } /* impossible_condition */
+                        }
                       ] /* setup_range_conditions */,
-                      "group_index_range": {
-                        "chosen": false,
-                        "cause": "not_single_table"
-                      } /* group_index_range */,
-                      "analyzing_range_alternatives": {
-                        "range_scan_alternatives": [
-                          {
-                            "index": "b",
-                            "index_only": true,
-                            "records": 18446744073709551615,
-                            "cost": 0,
-                            "rowid_ordered": false,
-                            "chosen": false,
-                            "cause": "cost"
-                          }
-                        ] /* range_scan_alternatives */,
-                        "analyzing_roworder_intersect": {
-                          "usable": false,
-                          "cause": "too_few_roworder_scans"
-                        } /* analyzing_roworder_intersect */
-                      } /* analyzing_range_alternatives */
+                      "impossible_range": true
                     } /* range_analysis */
-                  } /* rechecking_index_usage */
-                }
-              ] /* attached_conditions_computation */,
-              "attached_conditions_summary": [
-                {
-                  "database": "test",
-                  "table": "t1",
-                  "attached": null
-                },
-                {
-                  "database": "test",
-                  "table": "t2",
-                  "attached": "(`test`.`t2`.`b` < `test`.`t1`.`c`)"
+                  } /* records_estimation_per_record */
                 }
-              ] /* attached_conditions_summary */
-            } /* attaching_conditions_to_tables */
+              ] /* steps */
+            } /* join_execution */
           },
           {
-            "refine_plan": [
-              {
-                "database": "test",
-                "table": "t1",
-                "scan_type": "table"
-              },
-              {
-                "database": "test",
-                "table": "t2",
-                "scan_type": "table"
-              }
-            ] /* refine_plan */
-          }
-        ] /* steps */
-      } /* join_optimization */
-    },
-    {
-      "join_execution": {
-        "select#": 2,
-        "steps": [
-          {
-            "records_estimation_per_record": {
-              "database": "test",
-              "table": "t2",
-              "range_analysis": {
-                "table_scan": {
-                  "records": 3,
-                  "cost": 4.7051
-                } /* table_scan */,
-                "potential_range_indices": [
-                  {
-                    "index": "b",
-                    "usable": true,
-                    "key_parts": [
-                      "b"
-                    ] /* key_parts */
-                  }
-                ] /* potential_range_indices */,
-                "best_covering_index_scan": {
-                  "index": "b",
-                  "cost": 1.6465,
-                  "chosen": true
-                } /* best_covering_index_scan */,
-                "setup_range_conditions": [
-                  {
-                    "impossible_condition": {
-                      "cause": "comparison_with_null_always_false"
-                    } /* impossible_condition */
-                  }
-                ] /* setup_range_conditions */,
-                "impossible_range": true
-              } /* range_analysis */
-            } /* records_estimation_per_record */
-          }
-        ] /* steps */
-      } /* join_execution */
-    },
-    {
-      "join_preparation": {
-        "select#": 1,
-        "steps": [
-          {
-            "expanded_query": "/* select#1 */ select 1 AS `1` from (/* select#2 */ select 1 AS `1` from `test`.`t2` join `test`.`t1` where (`test`.`t2`.`b` < `test`.`t1`.`c`) group by 1 limit 1) `d2`"
-          }
-        ] /* steps */
-      } /* join_preparation */
-    },
-    {
-      "join_optimization": {
-        "select#": 1,
-        "steps": [
-          {
             "records_estimation": [
               {
                 "database": "",

=== modified file 'mysql-test/suite/opt_trace/r/security_no_prot.result'
--- a/mysql-test/suite/opt_trace/r/security_no_prot.result	2011-07-20 13:10:44 +0000
+++ b/mysql-test/suite/opt_trace/r/security_no_prot.result	2011-07-22 09:53:44 +0000
@@ -888,7 +888,7 @@ a
 first
 select QUERY, length(TRACE), INSUFFICIENT_PRIVILEGES from information_schema.OPTIMIZER_TRACE;
 QUERY	length(TRACE)	INSUFFICIENT_PRIVILEGES
-select a from (select a from t1 where a like "f%") as tt where a like "fi%"	4790	0
+select a from (select a from t1 where a like "f%") as tt where a like "fi%"	6269	0
 
 # For routines, as they only use t1 and we added only one
 # privilege on t1, we have nothing to remove.

=== modified file 'mysql-test/suite/opt_trace/r/security_ps_prot.result'
--- a/mysql-test/suite/opt_trace/r/security_ps_prot.result	2011-07-20 13:10:44 +0000
+++ b/mysql-test/suite/opt_trace/r/security_ps_prot.result	2011-07-22 09:53:44 +0000
@@ -955,7 +955,7 @@ first
 select QUERY, length(TRACE), INSUFFICIENT_PRIVILEGES from information_schema.OPTIMIZER_TRACE;
 QUERY	length(TRACE)	INSUFFICIENT_PRIVILEGES
 select a from (select a from t1 where a like "f%") as tt where a like "fi%"	613	0
-select a from (select a from t1 where a like "f%") as tt where a like "fi%"	4790	0
+select a from (select a from t1 where a like "f%") as tt where a like "fi%"	6269	0
 
 # For routines, as they only use t1 and we added only one
 # privilege on t1, we have nothing to remove.

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk branch (evgeny.potemkin:3011 to 3012) Evgeny Potemkin22 Jul