From: Tor Didriksen Date: January 17 2012 8:13am Subject: bzr push into mysql-trunk branch (tor.didriksen:3520 to 3522) List-Archive: http://lists.mysql.com/commits/142420 Message-Id: <201201170813.q0H8DFoI006622@acsmt358.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 3522 Tor Didriksen 2012-01-17 [merge] NULL merge trunk => opt-backporting 3521 Tor Didriksen 2012-01-17 [merge] merge trunk => opt-backporting added: include/byteorder/ include/byteorder/big_endian.h include/byteorder/byte_order_generic.h include/byteorder/byte_order_generic_x86.h include/byteorder/byte_order_generic_x86_64.h include/byteorder/little_endian.h include/my_byteorder.h mysql-test/r/mysqlimport.result mysql-test/suite/innodb/r/innodb_bug12400341.result mysql-test/suite/innodb/t/innodb_bug12400341-master.opt mysql-test/suite/innodb/t/innodb_bug12400341.test mysql-test/t/mysqlimport.test unittest/gunit/alignment-t.cc unittest/gunit/byteorder-t.cc modified: client/mysql.cc client/mysql_upgrade.c client/mysqladmin.cc client/mysqlbinlog.cc client/mysqlcheck.c client/mysqldump.c client/mysqlimport.c client/mysqlshow.c client/mysqlslap.c cmd-line-utils/libedit/chartype.h cmd-line-utils/libedit/eln.c cmd-line-utils/libedit/readline.c config.h.cmake include/CMakeLists.txt include/my_getopt.h include/my_global.h include/mysql/psi/mysql_socket.h include/mysql/psi/mysql_table.h include/mysql/psi/mysql_thread.h include/mysql/psi/psi.h include/mysql/psi/psi_abi_v0.h.pp include/mysql/psi/psi_abi_v1.h.pp include/mysql/psi/psi_abi_v2.h.pp libmysqld/emb_qcache.cc mysql-test/collections/default.experimental mysql-test/include/show_slave_status.inc mysql-test/r/func_set.result mysql-test/r/func_time.result mysql-test/r/key_cache.result mysql-test/r/log_tables_upgrade.result mysql-test/r/myisampack.result mysql-test/r/mysql.result mysql-test/r/mysql_upgrade.result mysql-test/r/mysql_upgrade_ssl.result mysql-test/r/mysqladmin.result mysql-test/r/mysqlbinlog.result mysql-test/r/mysqlcheck.result mysql-test/r/mysqldump.result mysql-test/r/mysqlshow.result mysql-test/r/mysqlslap.result mysql-test/r/partition_key_cache.result mysql-test/r/plugin_auth.result mysql-test/r/plugin_auth_qa_1.result mysql-test/r/plugin_auth_qa_2.result mysql-test/r/plugin_auth_qa_3.result mysql-test/suite/binlog/r/binlog_stm_unsafe_warning.result mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test mysql-test/suite/engines/funcs/r/tc_rename_error.result mysql-test/suite/federated/federated_debug.result mysql-test/suite/innodb_fts/r/innodb_fts_large_records.result mysql-test/suite/innodb_fts/t/disabled.def mysql-test/suite/innodb_fts/t/innodb_fts_large_records.test mysql-test/suite/perfschema/r/dml_handler.result mysql-test/suite/perfschema/r/innodb_table_io.result mysql-test/suite/perfschema/r/misc.result mysql-test/suite/perfschema/r/pfs_upgrade.result mysql-test/suite/perfschema/r/temp_table_io.result mysql-test/suite/perfschema/t/dml_handler.test mysql-test/suite/perfschema/t/misc.test mysql-test/suite/rpl/r/rpl_log_pos.result mysql-test/suite/rpl/r/rpl_manual_change_index_file.result mysql-test/suite/rpl/t/rpl_log_pos.test mysql-test/suite/rpl/t/rpl_manual_change_index_file.test mysql-test/suite/sys_vars/r/all_vars.result mysql-test/suite/sys_vars/t/all_vars.test mysql-test/suite/sys_vars/t/disabled.def mysql-test/t/func_set.test mysql-test/t/func_time.test mysql-test/t/key_cache.test mysql-test/t/myisampack.test mysql-test/t/mysql.test mysql-test/t/mysql_upgrade.test mysql-test/t/mysqladmin.test mysql-test/t/mysqlbinlog.test mysql-test/t/mysqlcheck.test mysql-test/t/mysqldump.test mysql-test/t/mysqlshow.test mysql-test/t/mysqlslap.test mysql-test/t/partition_key_cache.test mysys/default.c mysys/my_getopt.c mysys/psi_noop.c sql/binlog.cc sql/ha_partition.cc sql/handler.cc sql/item.cc sql/item_strfunc.h sql/item_timefunc.cc sql/log_event.cc sql/rpl_slave.cc sql/spatial.cc sql/sql_admin.cc sql/sql_db.cc sql/sql_join_buffer.h sql/sql_table.cc sql/unireg.cc storage/archive/ha_archive.cc storage/innobase/fts/fts0fts.cc storage/innobase/handler/ha_innodb.cc storage/innobase/include/os0sync.ic storage/innobase/include/sync0rw.ic storage/innobase/include/sync0sync.ic storage/innobase/include/trx0rseg.ic storage/innobase/include/trx0sys.h storage/innobase/row/row0mysql.cc storage/innobase/trx/trx0sys.cc storage/myisam/mi_preload.c storage/perfschema/pfs.cc storage/perfschema/pfs_instr.cc storage/perfschema/pfs_instr.h storage/perfschema/pfs_instr_class.cc storage/perfschema/pfs_server.cc storage/perfschema/pfs_stat.h storage/perfschema/table_events_waits.cc storage/perfschema/unittest/pfs-t.cc unittest/gunit/CMakeLists.txt 3520 Guilhem Bichot 2012-01-16 Fix for Bug#13591138 - ASSERTION NAME && !IS_AUTOGENERATED_NAME IN ITEM::PRINT_FOR_ORDER ON EXPLAIN EXT We didn't set is_autogenerated_name correctly for Item_direct_view_ref. @ sql/sql_base.cc The assertion which fired sets a reasonable expectation: 1) as ORDER::used_alias is true, it means that the ORDER BY or GROUP BY referred to the expression via an alias and this expression is in the SELECT list. 2) thus, this expression must have been given an alias with 'expr AS alias' 3) thus, the expression's "is_autogenerated_name" property must be "false" (name was not autogenerated, it was given by user with AS). However, with views, this breaks. Scenario of the bug follow. View is merged in top query. After that, JOIN::prepare() calls setup_fields(); it has a field "col_datetime_key AS field1" and searches it in view1 (find_field_in_view()). find_field_in_view() calls create_view_field() which creates a Item_direct_view_ref; that function has this: /* *ref != NULL means that *ref contains the item that we need to replace. If the item was aliased by the user, set the alias to the replacing item. We need to set alias on both ref itself and on ref real item. */ if (*ref && !(*ref)->is_autogenerated_name) { item->set_name((*ref)->name, (*ref)->name_length, system_charset_info); item->real_item()->set_name((*ref)->name, (*ref)->name_length, system_charset_info); } [cut some code] *ref= item; So it builds a new item, and because the original item had a non-auto-generated name (an alias: 'field1'), it gives the new item the same alias, but it forgets to note that this new item, after receiving its name, doesn't have an auto-generated name anymore. Fixed by adding item->is_autogenerated_name= false; in the code above. A similar fix is done in find_field_in_natural_join() because it has copy-pasted code from find_field_in_view(). modified: mysql-test/r/group_by.result mysql-test/t/group_by.test sql/sql_base.cc Diff too large for email (10787 lines, the limit is 10000). No bundle (reason: useless for push emails).