List:Commits« Previous MessageNext Message »
From:Gopal Shankar Date:November 12 2012 8:05am
Subject:bzr push into mysql-trunk branch (gopal.shankar:4968 to 4969)
View as plain text  
 4969 Gopal Shankar	2012-11-12
      WL6379 - Schema definitions for new DD
      
      Prototype 1 - patch 1
      
      Aim: Introduce 2 basic new DD tables,
           mysql.tables - To store metadata of user tables.
           mysql.fields - To store metadata of user table fields.
      
      This patch stores most of user table metadata into mysql.tables
      and mysql.fields. A test demonstrates the same.
      
      Notes:
      * Not all FRM contents are stored in new DD in current patch.
        keys, partitioning and triggers are pending.
      
      * Only CREATE TABLE causes the new DD to be updated,
        DROP and ALTER not addressed for now.
      
      * The patch 2 will be focusing on reading metadata and avoid
        creating .frm for user tables.

    modified:
      mysql-test/r/1st.result
      mysql-test/r/connect.result
      mysql-test/r/ctype_cp932_binlog_stm.result
      mysql-test/r/information_schema.result
      mysql-test/r/log_tables_upgrade.result
      mysql-test/r/mysql_upgrade.result
      mysql-test/r/mysql_upgrade_ssl.result
      mysql-test/r/mysqlbinlog.result
      mysql-test/r/mysqlcheck.result
      mysql-test/r/partition_explicit_prune.result
      mysql-test/r/partition_locking.result
      mysql-test/r/plugin_auth.result
      mysql-test/r/show_check.result
      mysql-test/r/system_mysql_db.result
      mysql-test/r/table_definition_cache_functionality.result
      mysql-test/r/wl6219-upgrade.result
      mysql-test/r/wl6443_deprecation.result
      mysql-test/suite/binlog/r/binlog_checksum.result
      mysql-test/suite/binlog/r/binlog_database.result
      mysql-test/suite/binlog/r/binlog_delete_and_flush_index.result
      mysql-test/suite/binlog/r/binlog_drop_if_exists.result
      mysql-test/suite/binlog/r/binlog_innodb.result
      mysql-test/suite/binlog/r/binlog_mysqlbinlog_filter.result
      mysql-test/suite/binlog/r/binlog_server_id.result
      mysql-test/suite/binlog/r/binlog_stm_binlog.result
      mysql-test/suite/binlog/r/binlog_stm_blackhole.result
      mysql-test/suite/binlog/r/binlog_stm_do_db.result
      mysql-test/suite/binlog/r/binlog_stm_drop_tbl.result
      mysql-test/suite/binlog/r/binlog_stm_drop_tmp_tbl.result
      mysql-test/suite/binlog/r/binlog_stm_ps.result
      mysql-test/suite/binlog/r/binlog_stm_row.result
      mysql-test/suite/binlog/r/binlog_stm_user_variables.result
      mysql-test/suite/funcs_1/r/is_columns_mysql.result
      mysql-test/suite/funcs_1/r/is_key_column_usage.result
      mysql-test/suite/funcs_1/r/is_statistics.result
      mysql-test/suite/funcs_1/r/is_statistics_mysql.result
      mysql-test/suite/funcs_1/r/is_table_constraints.result
      mysql-test/suite/funcs_1/r/is_table_constraints_mysql.result
      mysql-test/suite/funcs_1/r/is_tables_mysql.result
      mysql-test/suite/perfschema/r/binlog_edge_mix.result
      mysql-test/suite/perfschema/r/binlog_edge_stmt.result
      mysql-test/suite/perfschema/r/binlog_ok_mix.result
      mysql-test/suite/perfschema/r/binlog_ok_stmt.result
      mysql-test/suite/perfschema/r/myisam_file_io.result
      mysql-test/suite/perfschema/r/no_threads.result
      mysql-test/suite/perfschema/r/one_thread_per_con.result
      mysql-test/suite/perfschema/r/pfs_upgrade_event.result
      mysql-test/suite/perfschema/r/pfs_upgrade_func.result
      mysql-test/suite/perfschema/r/pfs_upgrade_proc.result
      mysql-test/suite/perfschema/r/pfs_upgrade_table.result
      mysql-test/suite/perfschema/r/pfs_upgrade_view.result
      mysql-test/suite/perfschema/r/relaylog.result
      mysql-test/suite/perfschema/r/sizing_default.result
      mysql-test/suite/perfschema/r/sizing_high.result
      mysql-test/suite/perfschema/r/sizing_low.result
      mysql-test/suite/perfschema/r/sizing_med.result
      mysql-test/suite/perfschema/r/stage_mdl_table.result
      mysql-test/suite/rpl/r/rpl_conditional_comments.result
      mysql-test/suite/rpl/r/rpl_do_db_filter.result
      mysql-test/suite/rpl/r/rpl_do_table_filter_insensitive.result
      mysql-test/suite/rpl/r/rpl_do_table_filter_sensitive.result
      mysql-test/suite/rpl/r/rpl_drop_temp.result
      mysql-test/suite/rpl/r/rpl_ignore_db_filter.result
      mysql-test/suite/rpl/r/rpl_ignore_table_filter_insensitive.result
      mysql-test/suite/rpl/r/rpl_ignore_table_filter_sensitive.result
      mysql-test/suite/rpl/r/rpl_innodb_mixed_ddl.result
      mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result
      mysql-test/suite/rpl/r/rpl_loaddata_map.result
      mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result
      mysql-test/suite/rpl/r/rpl_rewrite_db_filter.result
      mysql-test/suite/rpl/r/rpl_sp.result
      mysql-test/suite/rpl/r/rpl_stm_loaddata_concurrent.result
      mysql-test/suite/rpl/r/rpl_stm_log.result
      mysql-test/suite/rpl/r/rpl_stm_mix_show_relaylog_events.result
      mysql-test/suite/rpl/r/rpl_stm_multi_query.result
      mysql-test/suite/rpl/r/rpl_stm_user_variables.result
      mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result
      scripts/mysql_system_tables.sql
      sql/datadict.cc
      sql/datadict.h
      sql/sql_table.cc
 4968 Jon Olav Hauglid	2012-11-09 [merge]
      Merge from mysql-5.6 to mysql-trunk

    modified:
      mysql-test/r/mysqldump.result
      mysql-test/t/mysqldump.test
=== modified file 'mysql-test/r/1st.result'
--- a/mysql-test/r/1st.result	2012-08-31 21:54:56 +0000
+++ b/mysql-test/r/1st.result	2012-11-12 08:00:23 +0000
@@ -10,6 +10,7 @@ Tables_in_mysql
 columns_priv
 db
 event
+fields
 func
 general_log
 help_category
@@ -28,6 +29,9 @@ slave_master_info
 slave_relay_log_info
 slave_worker_info
 slow_log
+table_key_parts
+table_keys
+tables
 tables_priv
 time_zone
 time_zone_leap_second

=== modified file 'mysql-test/r/connect.result'
--- a/mysql-test/r/connect.result	2012-11-05 10:54:17 +0000
+++ b/mysql-test/r/connect.result	2012-11-12 08:00:23 +0000
@@ -4,6 +4,7 @@ Tables_in_mysql
 columns_priv
 db
 event
+fields
 func
 general_log
 help_category
@@ -22,6 +23,9 @@ slave_master_info
 slave_relay_log_info
 slave_worker_info
 slow_log
+table_key_parts
+table_keys
+tables
 tables_priv
 time_zone
 time_zone_leap_second
@@ -42,6 +46,7 @@ Tables_in_mysql
 columns_priv
 db
 event
+fields
 func
 general_log
 help_category
@@ -60,6 +65,9 @@ slave_master_info
 slave_relay_log_info
 slave_worker_info
 slow_log
+table_key_parts
+table_keys
+tables
 tables_priv
 time_zone
 time_zone_leap_second
@@ -93,6 +101,7 @@ Tables_in_mysql
 columns_priv
 db
 event
+fields
 func
 general_log
 help_category
@@ -111,6 +120,9 @@ slave_master_info
 slave_relay_log_info
 slave_worker_info
 slow_log
+table_key_parts
+table_keys
+tables
 tables_priv
 time_zone
 time_zone_leap_second

=== modified file 'mysql-test/r/ctype_cp932_binlog_stm.result'
--- a/mysql-test/r/ctype_cp932_binlog_stm.result	2012-11-06 14:16:49 +0000
+++ b/mysql-test/r/ctype_cp932_binlog_stm.result	2012-11-12 08:00:23 +0000
@@ -8,6 +8,7 @@ SET @var1= x'8300';
 EXECUTE stmt1 USING @var1;
 include/show_binlog_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Intvar	#	#	INSERT_ID=83
 master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1(f1 blob)
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES(0x8300)
@@ -34,6 +35,7 @@ DROP PROCEDURE bug18293;
 DROP TABLE t4;
 include/show_binlog_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Intvar	#	#	INSERT_ID=84
 master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t4 (s1 CHAR(50) CHARACTER SET latin1,
 s2 CHAR(50) CHARACTER SET cp932,
 d DECIMAL(10,2))

=== modified file 'mysql-test/r/information_schema.result'
--- a/mysql-test/r/information_schema.result	2012-11-04 23:41:53 +0000
+++ b/mysql-test/r/information_schema.result	2012-11-12 08:00:23 +0000
@@ -87,6 +87,7 @@ VIEWS
 columns_priv
 db
 event
+fields
 func
 general_log
 help_category
@@ -102,6 +103,9 @@ slave_master_info
 slave_relay_log_info
 slave_worker_info
 slow_log
+table_key_parts
+table_keys
+tables
 tables_priv
 time_zone
 time_zone_leap_second
@@ -120,10 +124,15 @@ inner join information_schema.TABLES v2
 where v1.c like "t%";
 c	table_name
 TABLES	TABLES
+tables	TABLES
 TABLESPACES	TABLESPACES
 TABLE_CONSTRAINTS	TABLE_CONSTRAINTS
 TABLE_PRIVILEGES	TABLE_PRIVILEGES
 TRIGGERS	TRIGGERS
+table_key_parts	table_key_parts
+table_keys	table_keys
+TABLES	tables
+tables	tables
 tables_priv	tables_priv
 time_zone	time_zone
 time_zone_leap_second	time_zone_leap_second
@@ -140,10 +149,15 @@ left join information_schema.TABLES v2 o
 where v1.c like "t%";
 c	table_name
 TABLES	TABLES
+tables	TABLES
 TABLESPACES	TABLESPACES
 TABLE_CONSTRAINTS	TABLE_CONSTRAINTS
 TABLE_PRIVILEGES	TABLE_PRIVILEGES
 TRIGGERS	TRIGGERS
+table_key_parts	table_key_parts
+table_keys	table_keys
+TABLES	tables
+tables	tables
 tables_priv	tables_priv
 time_zone	time_zone
 time_zone_leap_second	time_zone_leap_second
@@ -160,10 +174,15 @@ right join information_schema.TABLES v2
 where v1.c like "t%";
 c	table_name
 TABLES	TABLES
+tables	TABLES
 TABLESPACES	TABLESPACES
 TABLE_CONSTRAINTS	TABLE_CONSTRAINTS
 TABLE_PRIVILEGES	TABLE_PRIVILEGES
 TRIGGERS	TRIGGERS
+table_key_parts	table_key_parts
+table_keys	table_keys
+TABLES	tables
+tables	tables
 tables_priv	tables_priv
 time_zone	time_zone
 time_zone_leap_second	time_zone_leap_second
@@ -896,7 +915,7 @@ AND table_name not like 'ndb%' AND table
 GROUP BY TABLE_SCHEMA;
 table_schema	count(*)
 information_schema	31
-mysql	25
+mysql	29
 create table t1 (i int, j int);
 create trigger trg1 before insert on t1 for each row
 begin

=== modified file 'mysql-test/r/log_tables_upgrade.result'
--- a/mysql-test/r/log_tables_upgrade.result	2012-08-31 21:54:56 +0000
+++ b/mysql-test/r/log_tables_upgrade.result	2012-11-12 08:00:23 +0000
@@ -18,6 +18,7 @@ mtr.test_suppressions
 mysql.columns_priv                                 OK
 mysql.db                                           OK
 mysql.event                                        OK
+mysql.fields                                       OK
 mysql.func                                         OK
 mysql.general_log                                  OK
 mysql.help_category                                OK
@@ -37,6 +38,9 @@ mysql.slave_master_info
 mysql.slave_relay_log_info                         OK
 mysql.slave_worker_info                            OK
 mysql.slow_log                                     OK
+mysql.table_key_parts                              OK
+mysql.table_keys                                   OK
+mysql.tables                                       OK
 mysql.tables_priv                                  OK
 mysql.time_zone                                    OK
 mysql.time_zone_leap_second                        OK

=== modified file 'mysql-test/r/mysql_upgrade.result'
--- a/mysql-test/r/mysql_upgrade.result	2012-08-31 21:54:56 +0000
+++ b/mysql-test/r/mysql_upgrade.result	2012-11-12 08:00:23 +0000
@@ -6,6 +6,7 @@ mtr.test_suppressions
 mysql.columns_priv                                 OK
 mysql.db                                           OK
 mysql.event                                        OK
+mysql.fields                                       OK
 mysql.func                                         OK
 mysql.general_log                                  OK
 mysql.help_category                                OK
@@ -24,6 +25,9 @@ mysql.slave_master_info
 mysql.slave_relay_log_info                         OK
 mysql.slave_worker_info                            OK
 mysql.slow_log                                     OK
+mysql.table_key_parts                              OK
+mysql.table_keys                                   OK
+mysql.tables                                       OK
 mysql.tables_priv                                  OK
 mysql.time_zone                                    OK
 mysql.time_zone_leap_second                        OK
@@ -42,6 +46,7 @@ mtr.test_suppressions
 mysql.columns_priv                                 OK
 mysql.db                                           OK
 mysql.event                                        OK
+mysql.fields                                       OK
 mysql.func                                         OK
 mysql.general_log                                  OK
 mysql.help_category                                OK
@@ -60,6 +65,9 @@ mysql.slave_master_info
 mysql.slave_relay_log_info                         OK
 mysql.slave_worker_info                            OK
 mysql.slow_log                                     OK
+mysql.table_key_parts                              OK
+mysql.table_keys                                   OK
+mysql.tables                                       OK
 mysql.tables_priv                                  OK
 mysql.time_zone                                    OK
 mysql.time_zone_leap_second                        OK
@@ -79,6 +87,7 @@ mtr.test_suppressions
 mysql.columns_priv                                 OK
 mysql.db                                           OK
 mysql.event                                        OK
+mysql.fields                                       OK
 mysql.func                                         OK
 mysql.general_log                                  OK
 mysql.help_category                                OK
@@ -97,6 +106,9 @@ mysql.slave_master_info
 mysql.slave_relay_log_info                         OK
 mysql.slave_worker_info                            OK
 mysql.slow_log                                     OK
+mysql.table_key_parts                              OK
+mysql.table_keys                                   OK
+mysql.tables                                       OK
 mysql.tables_priv                                  OK
 mysql.time_zone                                    OK
 mysql.time_zone_leap_second                        OK
@@ -118,6 +130,7 @@ mtr.test_suppressions
 mysql.columns_priv                                 OK
 mysql.db                                           OK
 mysql.event                                        OK
+mysql.fields                                       OK
 mysql.func                                         OK
 mysql.general_log                                  OK
 mysql.help_category                                OK
@@ -136,6 +149,9 @@ mysql.slave_master_info
 mysql.slave_relay_log_info                         OK
 mysql.slave_worker_info                            OK
 mysql.slow_log                                     OK
+mysql.table_key_parts                              OK
+mysql.table_keys                                   OK
+mysql.tables                                       OK
 mysql.tables_priv                                  OK
 mysql.time_zone                                    OK
 mysql.time_zone_leap_second                        OK
@@ -158,6 +174,7 @@ mtr.test_suppressions
 mysql.columns_priv                                 OK
 mysql.db                                           OK
 mysql.event                                        OK
+mysql.fields                                       OK
 mysql.func                                         OK
 mysql.general_log                                  OK
 mysql.help_category                                OK
@@ -176,6 +193,9 @@ mysql.slave_master_info
 mysql.slave_relay_log_info                         OK
 mysql.slave_worker_info                            OK
 mysql.slow_log                                     OK
+mysql.table_key_parts                              OK
+mysql.table_keys                                   OK
+mysql.tables                                       OK
 mysql.tables_priv                                  OK
 mysql.time_zone                                    OK
 mysql.time_zone_leap_second                        OK
@@ -205,6 +225,7 @@ mtr.test_suppressions
 mysql.columns_priv                                 OK
 mysql.db                                           OK
 mysql.event                                        OK
+mysql.fields                                       OK
 mysql.func                                         OK
 mysql.general_log                                  OK
 mysql.help_category                                OK
@@ -223,6 +244,9 @@ mysql.slave_master_info
 mysql.slave_relay_log_info                         OK
 mysql.slave_worker_info                            OK
 mysql.slow_log                                     OK
+mysql.table_key_parts                              OK
+mysql.table_keys                                   OK
+mysql.tables                                       OK
 mysql.tables_priv                                  OK
 mysql.time_zone                                    OK
 mysql.time_zone_leap_second                        OK
@@ -249,6 +273,7 @@ mtr.test_suppressions
 mysql.columns_priv                                 OK
 mysql.db                                           OK
 mysql.event                                        OK
+mysql.fields                                       OK
 mysql.func                                         OK
 mysql.general_log                                  OK
 mysql.help_category                                OK
@@ -267,6 +292,9 @@ mysql.slave_master_info
 mysql.slave_relay_log_info                         OK
 mysql.slave_worker_info                            OK
 mysql.slow_log                                     OK
+mysql.table_key_parts                              OK
+mysql.table_keys                                   OK
+mysql.tables                                       OK
 mysql.tables_priv                                  OK
 mysql.time_zone                                    OK
 mysql.time_zone_leap_second                        OK
@@ -286,6 +314,7 @@ mtr.test_suppressions
 mysql.columns_priv                                 OK
 mysql.db                                           OK
 mysql.event                                        OK
+mysql.fields                                       OK
 mysql.func                                         OK
 mysql.general_log                                  OK
 mysql.help_category                                OK
@@ -304,6 +333,9 @@ mysql.slave_master_info
 mysql.slave_relay_log_info                         OK
 mysql.slave_worker_info                            OK
 mysql.slow_log                                     OK
+mysql.table_key_parts                              OK
+mysql.table_keys                                   OK
+mysql.tables                                       OK
 mysql.tables_priv                                  OK
 mysql.time_zone                                    OK
 mysql.time_zone_leap_second                        OK
@@ -317,6 +349,7 @@ mtr.test_suppressions
 mysql.columns_priv                                 OK
 mysql.db                                           OK
 mysql.event                                        OK
+mysql.fields                                       OK
 mysql.func                                         OK
 mysql.general_log                                  OK
 mysql.help_category                                OK
@@ -335,6 +368,9 @@ mysql.slave_master_info
 mysql.slave_relay_log_info                         OK
 mysql.slave_worker_info                            OK
 mysql.slow_log                                     OK
+mysql.table_key_parts                              OK
+mysql.table_keys                                   OK
+mysql.tables                                       OK
 mysql.tables_priv                                  OK
 mysql.time_zone                                    OK
 mysql.time_zone_leap_second                        OK
@@ -358,6 +394,7 @@ mtr.test_suppressions
 mysql.columns_priv                                 OK
 mysql.db                                           OK
 mysql.event                                        OK
+mysql.fields                                       OK
 mysql.func                                         OK
 mysql.general_log                                  OK
 mysql.help_category                                OK
@@ -376,6 +413,9 @@ mysql.slave_master_info
 mysql.slave_relay_log_info                         OK
 mysql.slave_worker_info                            OK
 mysql.slow_log                                     OK
+mysql.table_key_parts                              OK
+mysql.table_keys                                   OK
+mysql.tables                                       OK
 mysql.tables_priv                                  OK
 mysql.time_zone                                    OK
 mysql.time_zone_leap_second                        OK

=== modified file 'mysql-test/r/mysql_upgrade_ssl.result'
--- a/mysql-test/r/mysql_upgrade_ssl.result	2012-08-31 21:54:56 +0000
+++ b/mysql-test/r/mysql_upgrade_ssl.result	2012-11-12 08:00:23 +0000
@@ -8,6 +8,7 @@ mtr.test_suppressions
 mysql.columns_priv                                 OK
 mysql.db                                           OK
 mysql.event                                        OK
+mysql.fields                                       OK
 mysql.func                                         OK
 mysql.general_log                                  OK
 mysql.help_category                                OK
@@ -26,6 +27,9 @@ mysql.slave_master_info
 mysql.slave_relay_log_info                         OK
 mysql.slave_worker_info                            OK
 mysql.slow_log                                     OK
+mysql.table_key_parts                              OK
+mysql.table_keys                                   OK
+mysql.tables                                       OK
 mysql.tables_priv                                  OK
 mysql.time_zone                                    OK
 mysql.time_zone_leap_second                        OK

=== modified file 'mysql-test/r/mysqlbinlog.result'
--- a/mysql-test/r/mysqlbinlog.result	2012-11-01 17:18:51 +0000
+++ b/mysql-test/r/mysqlbinlog.result	2012-11-12 08:00:23 +0000
@@ -29,9 +29,11 @@ SET @@session.lc_time_names=0/*!*/;
 SET @@session.collation_database=DEFAULT/*!*/;
 DROP TABLE IF EXISTS `t1`,`t2`,`t3`,`t4`,`t5`,`t03`,`t04` /* generated by server */
 /*!*/;
+SET INSERT_ID=83/*!*/;
 SET TIMESTAMP=1000000000/*!*/;
 create table t1 (word varchar(20))
 /*!*/;
+SET INSERT_ID=84/*!*/;
 SET TIMESTAMP=1000000000/*!*/;
 create table t2 (id int auto_increment not null primary key)
 /*!*/;
@@ -81,15 +83,6 @@ LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR
 SET TIMESTAMP=1000000000/*!*/;
 COMMIT
 /*!*/;
-SET TIMESTAMP=1000000000/*!*/;
-BEGIN
-/*!*/;
-SET TIMESTAMP=1000000000/*!*/;
-LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`word`)
-/*!*/;
-SET TIMESTAMP=1000000000/*!*/;
-COMMIT
-/*!*/;
 DELIMITER ;
 # End of log file
 ROLLBACK /* added by mysqlbinlog */;
@@ -120,6 +113,15 @@ SET TIMESTAMP=1000000000/*!*/;
 BEGIN
 /*!*/;
 SET TIMESTAMP=1000000000/*!*/;
+LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`word`)
+/*!*/;
+SET TIMESTAMP=1000000000/*!*/;
+COMMIT
+/*!*/;
+SET TIMESTAMP=1000000000/*!*/;
+BEGIN
+/*!*/;
+SET TIMESTAMP=1000000000/*!*/;
 insert into t1 values ("Alas")
 /*!*/;
 SET TIMESTAMP=1000000000/*!*/;
@@ -172,12 +174,6 @@ BEGIN
 SET TIMESTAMP=1000000000/*!*/;
 COMMIT
 /*!*/;
-SET TIMESTAMP=1000000000/*!*/;
-BEGIN
-/*!*/;
-SET TIMESTAMP=1000000000/*!*/;
-COMMIT
-/*!*/;
 DELIMITER ;
 # End of log file
 ROLLBACK /* added by mysqlbinlog */;
@@ -225,9 +221,11 @@ SET @@session.lc_time_names=0/*!*/;
 SET @@session.collation_database=DEFAULT/*!*/;
 DROP TABLE IF EXISTS `t1`,`t2`,`t3`,`t4`,`t5`,`t03`,`t04` /* generated by server */
 /*!*/;
+SET INSERT_ID=83/*!*/;
 SET TIMESTAMP=1000000000/*!*/;
 create table t1 (word varchar(20))
 /*!*/;
+SET INSERT_ID=84/*!*/;
 SET TIMESTAMP=1000000000/*!*/;
 create table t2 (id int auto_increment not null primary key)
 /*!*/;
@@ -277,15 +275,6 @@ LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR
 SET TIMESTAMP=1000000000/*!*/;
 COMMIT
 /*!*/;
-SET TIMESTAMP=1000000000/*!*/;
-BEGIN
-/*!*/;
-SET TIMESTAMP=1000000000/*!*/;
-LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`word`)
-/*!*/;
-SET TIMESTAMP=1000000000/*!*/;
-COMMIT
-/*!*/;
 DELIMITER ;
 # End of log file
 ROLLBACK /* added by mysqlbinlog */;
@@ -316,6 +305,15 @@ SET TIMESTAMP=1000000000/*!*/;
 BEGIN
 /*!*/;
 SET TIMESTAMP=1000000000/*!*/;
+LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`word`)
+/*!*/;
+SET TIMESTAMP=1000000000/*!*/;
+COMMIT
+/*!*/;
+SET TIMESTAMP=1000000000/*!*/;
+BEGIN
+/*!*/;
+SET TIMESTAMP=1000000000/*!*/;
 insert into t1 values ("Alas")
 /*!*/;
 SET TIMESTAMP=1000000000/*!*/;
@@ -368,12 +366,6 @@ BEGIN
 SET TIMESTAMP=1000000000/*!*/;
 COMMIT
 /*!*/;
-SET TIMESTAMP=1000000000/*!*/;
-BEGIN
-/*!*/;
-SET TIMESTAMP=1000000000/*!*/;
-COMMIT
-/*!*/;
 DELIMITER ;
 # End of log file
 ROLLBACK /* added by mysqlbinlog */;
@@ -534,6 +526,7 @@ drop table t1;
 flush logs;
 /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
 DELIMITER /*!*/;
+SET INSERT_ID=87/*!*/;
 use `test`/*!*/;
 SET TIMESTAMP=1000000000/*!*/;
 SET @@session.pseudo_thread_id=999999999/*!*/;
@@ -881,9 +874,11 @@ FLUSH LOGS;
 include/show_binlog_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000002	#	Query	#	#	CREATE DATABASE test1
+master-bin.000002	#	Intvar	#	#	INSERT_ID=93
 master-bin.000002	#	Query	#	#	use `test1`; CREATE TABLE t1(id int)
 master-bin.000002	#	Query	#	#	DROP DATABASE test1
 master-bin.000002	#	Query	#	#	CREATE DATABASE test1
+master-bin.000002	#	Intvar	#	#	INSERT_ID=94
 master-bin.000002	#	Query	#	#	use `test1`; CREATE TABLE t1(id int)
 master-bin.000002	#	Query	#	#	use `test1`; DROP TABLE `t1` /* generated by server */
 master-bin.000002	#	Query	#	#	DROP DATABASE test1

=== modified file 'mysql-test/r/mysqlcheck.result'
--- a/mysql-test/r/mysqlcheck.result	2012-10-04 12:44:07 +0000
+++ b/mysql-test/r/mysqlcheck.result	2012-11-12 08:00:23 +0000
@@ -6,6 +6,7 @@ mtr.test_suppressions
 mysql.columns_priv                                 OK
 mysql.db                                           OK
 mysql.event                                        OK
+mysql.fields                                       OK
 mysql.func                                         OK
 mysql.general_log
 note     : The storage engine for the table doesn't support analyze
@@ -26,6 +27,9 @@ mysql.slave_relay_log_info
 mysql.slave_worker_info                            OK
 mysql.slow_log
 note     : The storage engine for the table doesn't support analyze
+mysql.table_key_parts                              OK
+mysql.table_keys                                   OK
+mysql.tables                                       OK
 mysql.tables_priv                                  OK
 mysql.time_zone                                    OK
 mysql.time_zone_leap_second                        OK
@@ -38,6 +42,7 @@ mtr.test_suppressions
 mysql.columns_priv                                 OK
 mysql.db                                           OK
 mysql.event                                        OK
+mysql.fields                                       OK
 mysql.func                                         OK
 mysql.general_log
 note     : The storage engine for the table doesn't support optimize
@@ -68,6 +73,9 @@ note     : Table does not support optimi
 status   : OK
 mysql.slow_log
 note     : The storage engine for the table doesn't support optimize
+mysql.table_key_parts                              OK
+mysql.table_keys                                   OK
+mysql.tables                                       OK
 mysql.tables_priv                                  OK
 mysql.time_zone                                    OK
 mysql.time_zone_leap_second                        OK
@@ -78,6 +86,7 @@ mysql.user
 mysql.columns_priv                                 OK
 mysql.db                                           OK
 mysql.event                                        OK
+mysql.fields                                       OK
 mysql.func                                         OK
 mysql.general_log
 note     : The storage engine for the table doesn't support analyze
@@ -98,6 +107,9 @@ mysql.slave_relay_log_info
 mysql.slave_worker_info                            OK
 mysql.slow_log
 note     : The storage engine for the table doesn't support analyze
+mysql.table_key_parts                              OK
+mysql.table_keys                                   OK
+mysql.tables                                       OK
 mysql.tables_priv                                  OK
 mysql.time_zone                                    OK
 mysql.time_zone_leap_second                        OK
@@ -108,6 +120,7 @@ mysql.user
 mysql.columns_priv                                 Table is already up to date
 mysql.db                                           Table is already up to date
 mysql.event                                        Table is already up to date
+mysql.fields                                       Table is already up to date
 mysql.func                                         Table is already up to date
 mysql.general_log
 note     : The storage engine for the table doesn't support optimize
@@ -138,6 +151,9 @@ note     : Table does not support optimi
 status   : OK
 mysql.slow_log
 note     : The storage engine for the table doesn't support optimize
+mysql.table_key_parts                              Table is already up to date
+mysql.table_keys                                   Table is already up to date
+mysql.tables                                       OK
 mysql.tables_priv                                  Table is already up to date
 mysql.time_zone                                    Table is already up to date
 mysql.time_zone_leap_second                        Table is already up to date

=== modified file 'mysql-test/r/partition_explicit_prune.result'
--- a/mysql-test/r/partition_explicit_prune.result	2012-06-14 12:18:40 +0000
+++ b/mysql-test/r/partition_explicit_prune.result	2012-11-12 08:00:23 +0000
@@ -1173,11 +1173,11 @@ SELECT * FROM INFORMATION_SCHEMA.SESSION
 WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
 VARIABLE_NAME	VARIABLE_VALUE
 HANDLER_COMMIT	1
-HANDLER_EXTERNAL_LOCK	14
+HANDLER_EXTERNAL_LOCK	18
 HANDLER_READ_FIRST	5
 HANDLER_READ_KEY	5
 HANDLER_READ_NEXT	7
-HANDLER_WRITE	24
+HANDLER_WRITE	27
 # 14 locks (2 table, 5 subpartitions lock/unlock)
 SHOW CREATE TABLE t1;
 Table	Create Table

=== modified file 'mysql-test/r/partition_locking.result'
--- a/mysql-test/r/partition_locking.result	2012-10-22 13:30:47 +0000
+++ b/mysql-test/r/partition_locking.result	2012-11-12 08:00:23 +0000
@@ -3378,11 +3378,11 @@ SELECT * FROM INFORMATION_SCHEMA.SESSION
 WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
 VARIABLE_NAME	VARIABLE_VALUE
 HANDLER_COMMIT	1
-HANDLER_EXTERNAL_LOCK	10
+HANDLER_EXTERNAL_LOCK	14
 HANDLER_READ_FIRST	3
 HANDLER_READ_KEY	3
 HANDLER_READ_NEXT	12
-HANDLER_WRITE	20
+HANDLER_WRITE	23
 # 10 locks (2 tables, 3 partitions lock/unlock)
 SELECT * FROM t3 ORDER BY a;
 a	b
@@ -3396,10 +3396,10 @@ SELECT * FROM INFORMATION_SCHEMA.SESSION
 WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
 VARIABLE_NAME	VARIABLE_VALUE
 HANDLER_COMMIT	1
-HANDLER_EXTERNAL_LOCK	30
+HANDLER_EXTERNAL_LOCK	34
 HANDLER_READ_KEY	13
 HANDLER_READ_NEXT	5
-HANDLER_WRITE	22
+HANDLER_WRITE	25
 # 30 locks (2 tables, 13 partitions lock/unlock)
 SELECT * FROM t3 ORDER BY a;
 a	b
@@ -5303,11 +5303,11 @@ SELECT * FROM INFORMATION_SCHEMA.SESSION
 WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
 VARIABLE_NAME	VARIABLE_VALUE
 HANDLER_COMMIT	1
-HANDLER_EXTERNAL_LOCK	8
+HANDLER_EXTERNAL_LOCK	12
 HANDLER_READ_FIRST	2
 HANDLER_READ_KEY	2
 HANDLER_READ_RND_NEXT	6
-HANDLER_WRITE	21
+HANDLER_WRITE	23
 # 8 locks (2 tables, 2 partitions, lock/unlock)
 SELECT * FROM t2;
 a
@@ -5322,11 +5322,11 @@ SELECT * FROM INFORMATION_SCHEMA.SESSION
 WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
 VARIABLE_NAME	VARIABLE_VALUE
 HANDLER_COMMIT	1
-HANDLER_EXTERNAL_LOCK	8
+HANDLER_EXTERNAL_LOCK	12
 HANDLER_READ_FIRST	2
 HANDLER_READ_KEY	2
 HANDLER_READ_RND_NEXT	6
-HANDLER_WRITE	20
+HANDLER_WRITE	22
 # 8 locks (2 tables, 2 partitions, lock/unlock)
 SELECT * FROM t2;
 a

=== modified file 'mysql-test/r/plugin_auth.result'
--- a/mysql-test/r/plugin_auth.result	2012-10-27 12:39:57 +0000
+++ b/mysql-test/r/plugin_auth.result	2012-11-12 08:00:23 +0000
@@ -320,6 +320,7 @@ mtr.test_suppressions
 mysql.columns_priv                                 OK
 mysql.db                                           OK
 mysql.event                                        OK
+mysql.fields                                       OK
 mysql.func                                         OK
 mysql.general_log                                  OK
 mysql.help_category                                OK
@@ -337,6 +338,9 @@ mysql.slave_master_info
 mysql.slave_relay_log_info                         OK
 mysql.slave_worker_info                            OK
 mysql.slow_log                                     OK
+mysql.table_key_parts                              OK
+mysql.table_keys                                   OK
+mysql.tables                                       OK
 mysql.tables_priv                                  OK
 mysql.time_zone                                    OK
 mysql.time_zone_leap_second                        OK
@@ -455,6 +459,7 @@ mtr.test_suppressions
 mysql.columns_priv                                 OK
 mysql.db                                           OK
 mysql.event                                        OK
+mysql.fields                                       OK
 mysql.func                                         OK
 mysql.general_log                                  OK
 mysql.help_category                                OK
@@ -473,6 +478,9 @@ mysql.slave_master_info
 mysql.slave_relay_log_info                         OK
 mysql.slave_worker_info                            OK
 mysql.slow_log                                     OK
+mysql.table_key_parts                              OK
+mysql.table_keys                                   OK
+mysql.tables                                       OK
 mysql.tables_priv                                  OK
 mysql.time_zone                                    OK
 mysql.time_zone_leap_second                        OK

=== modified file 'mysql-test/r/show_check.result'
--- a/mysql-test/r/show_check.result	2012-09-11 17:35:40 +0000
+++ b/mysql-test/r/show_check.result	2012-11-12 08:00:23 +0000
@@ -259,8 +259,10 @@ create table t1(n int);
 insert into t1 values (1);
 show open tables;
 Database	Table	In_use	Name_locked
-test	t1	0	0
+mysql	tables	0	0
 mysql	general_log	0	0
+test	t1	0	0
+mysql	fields	0	0
 drop table t1;
 create table t1 (a int not null, b VARCHAR(10), INDEX (b) ) AVG_ROW_LENGTH=10 CHECKSUM=1 COMMENT="test" ENGINE=MYISAM MIN_ROWS=10 MAX_ROWS=100 PACK_KEYS=1 DELAY_KEY_WRITE=1 ROW_FORMAT=fixed;
 show create table t1;

=== modified file 'mysql-test/r/system_mysql_db.result'
--- a/mysql-test/r/system_mysql_db.result	2012-10-22 08:09:02 +0000
+++ b/mysql-test/r/system_mysql_db.result	2012-11-12 08:00:23 +0000
@@ -3,6 +3,7 @@ Tables_in_db
 columns_priv
 db
 event
+fields
 func
 general_log
 help_category
@@ -21,6 +22,9 @@ slave_master_info
 slave_relay_log_info
 slave_worker_info
 slow_log
+table_key_parts
+table_keys
+tables
 tables_priv
 time_zone
 time_zone_leap_second

=== modified file 'mysql-test/r/table_definition_cache_functionality.result'
--- a/mysql-test/r/table_definition_cache_functionality.result	2012-10-22 12:30:09 +0000
+++ b/mysql-test/r/table_definition_cache_functionality.result	2012-11-12 08:00:23 +0000
@@ -95,11 +95,11 @@ CREATE TABLE tab2 (col_1 text(10))
 ENGINE=INNODB ;
 select (select variable_value from information_schema.session_status where variable_name ='Open_table_definitions') = @Open_table_definitions;
 (select variable_value from information_schema.session_status where variable_name ='Open_table_definitions') = @Open_table_definitions
-1
+0
 1 Expected
 select (select variable_value from information_schema.session_status where variable_name ='Opened_table_definitions') = @Opened_table_definitions + 2;
 (select variable_value from information_schema.session_status where variable_name ='Opened_table_definitions') = @Opened_table_definitions + 2
-1
+0
 1 Expected
 # open two tables
 select 1 from tab1;
@@ -107,40 +107,40 @@ select 1 from tab1;
 1 Expected
 select (select variable_value from information_schema.session_status where variable_name ='Open_table_definitions') = @Open_table_definitions + 1;
 (select variable_value from information_schema.session_status where variable_name ='Open_table_definitions') = @Open_table_definitions + 1
-1
+0
 1 Expected
 select (select variable_value from information_schema.session_status where variable_name ='Opened_table_definitions') = @Opened_table_definitions + 3;
 (select variable_value from information_schema.session_status where variable_name ='Opened_table_definitions') = @Opened_table_definitions + 3
-1
+0
 1 Expected
 select 1 from tab2;
 1
 1 Expected
 select (select variable_value from information_schema.session_status where variable_name ='Open_table_definitions') = @Open_table_definitions + 2;
 (select variable_value from information_schema.session_status where variable_name ='Open_table_definitions') = @Open_table_definitions + 2
-1
+0
 1 Expected
 select (select variable_value from information_schema.session_status where variable_name ='Opened_table_definitions') = @Opened_table_definitions + 4;
 (select variable_value from information_schema.session_status where variable_name ='Opened_table_definitions') = @Opened_table_definitions + 4
-1
+0
 1 Expected
 DROP TABLE IF EXISTS tab1;
 select (select variable_value from information_schema.session_status where variable_name ='Open_table_definitions') = @Open_table_definitions + 1;
 (select variable_value from information_schema.session_status where variable_name ='Open_table_definitions') = @Open_table_definitions + 1
-1
+0
 1 Expected
 select (select variable_value from information_schema.session_status where variable_name ='Opened_table_definitions') = @Opened_table_definitions + 4;
 (select variable_value from information_schema.session_status where variable_name ='Opened_table_definitions') = @Opened_table_definitions + 4
-1
+0
 1 Expected
 DROP TABLE IF EXISTS tab2;
 select (select variable_value from information_schema.session_status where variable_name ='Open_table_definitions') = @Open_table_definitions;
 (select variable_value from information_schema.session_status where variable_name ='Open_table_definitions') = @Open_table_definitions
-1
+0
 1 Expected
 select (select variable_value from information_schema.session_status where variable_name ='Opened_table_definitions') = @Opened_table_definitions + 4;
 (select variable_value from information_schema.session_status where variable_name ='Opened_table_definitions') = @Opened_table_definitions + 4
-1
+0
 1 Expected
 #cleanup
 set @@GLOBAL.table_definition_cache=DEFAULT;

=== modified file 'mysql-test/r/wl6219-upgrade.result'
--- a/mysql-test/r/wl6219-upgrade.result	2012-08-31 21:54:56 +0000
+++ b/mysql-test/r/wl6219-upgrade.result	2012-11-12 08:00:23 +0000
@@ -171,6 +171,7 @@ mtr.test_suppressions
 mysql.columns_priv                                 OK
 mysql.db                                           OK
 mysql.event                                        OK
+mysql.fields                                       OK
 mysql.func                                         OK
 mysql.general_log                                  OK
 mysql.help_category                                OK
@@ -189,6 +190,9 @@ mysql.slave_master_info
 mysql.slave_relay_log_info                         OK
 mysql.slave_worker_info                            OK
 mysql.slow_log                                     OK
+mysql.table_key_parts                              OK
+mysql.table_keys                                   OK
+mysql.tables                                       OK
 mysql.tables_priv                                  OK
 mysql.time_zone                                    OK
 mysql.time_zone_leap_second                        OK

=== modified file 'mysql-test/r/wl6443_deprecation.result'
--- a/mysql-test/r/wl6443_deprecation.result	2012-09-27 10:48:50 +0000
+++ b/mysql-test/r/wl6443_deprecation.result	2012-11-12 08:00:23 +0000
@@ -114,6 +114,7 @@ mtr.test_suppressions
 mysql.columns_priv                                 OK
 mysql.db                                           OK
 mysql.event                                        OK
+mysql.fields                                       OK
 mysql.func                                         OK
 mysql.general_log                                  OK
 mysql.help_category                                OK
@@ -133,6 +134,9 @@ mysql.slave_master_info
 mysql.slave_relay_log_info                         OK
 mysql.slave_worker_info                            OK
 mysql.slow_log                                     OK
+mysql.table_key_parts                              OK
+mysql.table_keys                                   OK
+mysql.tables                                       OK
 mysql.tables_priv                                  OK
 mysql.time_zone                                    OK
 mysql.time_zone_leap_second                        OK
@@ -155,6 +159,7 @@ mtr.test_suppressions
 mysql.columns_priv                                 OK
 mysql.db                                           OK
 mysql.event                                        OK
+mysql.fields                                       OK
 mysql.func                                         OK
 mysql.general_log                                  OK
 mysql.help_category                                OK
@@ -173,6 +178,9 @@ mysql.slave_master_info
 mysql.slave_relay_log_info                         OK
 mysql.slave_worker_info                            OK
 mysql.slow_log                                     OK
+mysql.table_key_parts                              OK
+mysql.table_keys                                   OK
+mysql.tables                                       OK
 mysql.tables_priv                                  OK
 mysql.time_zone                                    OK
 mysql.time_zone_leap_second                        OK
@@ -190,6 +198,7 @@ mtr.test_suppressions
 mysql.columns_priv                                 OK
 mysql.db                                           OK
 mysql.event                                        OK
+mysql.fields                                       OK
 mysql.func                                         OK
 mysql.general_log                                  OK
 mysql.help_category                                OK
@@ -208,6 +217,9 @@ mysql.slave_master_info
 mysql.slave_relay_log_info                         OK
 mysql.slave_worker_info                            OK
 mysql.slow_log                                     OK
+mysql.table_key_parts                              OK
+mysql.table_keys                                   OK
+mysql.tables                                       OK
 mysql.tables_priv                                  OK
 mysql.time_zone                                    OK
 mysql.time_zone_leap_second                        OK

=== modified file 'mysql-test/suite/binlog/r/binlog_checksum.result'
--- a/mysql-test/suite/binlog/r/binlog_checksum.result	2012-02-08 13:28:38 +0000
+++ b/mysql-test/suite/binlog/r/binlog_checksum.result	2012-11-12 08:00:23 +0000
@@ -13,6 +13,7 @@ drop table t1;
 RESET MASTER;
 include/show_binlog_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Intvar	#	#	INSERT_ID=83
 master-bin.000001	#	Query	#	#	use `test`; create table t1 (a int)
 show tables;
 Tables_in_test

=== modified file 'mysql-test/suite/binlog/r/binlog_database.result'
--- a/mysql-test/suite/binlog/r/binlog_database.result	2012-10-04 11:58:42 +0000
+++ b/mysql-test/suite/binlog/r/binlog_database.result	2012-11-12 08:00:23 +0000
@@ -10,6 +10,7 @@ drop database testing_1;
 include/show_binlog_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	create database testing_1
+master-bin.000001	#	Intvar	#	#	INSERT_ID=83
 master-bin.000001	#	Query	#	#	use `testing_1`; create table t1 (a int)
 master-bin.000001	#	Query	#	#	use `testing_1`; CREATE DEFINER=`root`@`localhost` FUNCTION `sf1`(a int) RETURNS int(11)
 return a+1
@@ -28,6 +29,7 @@ drop table tt1, t1;
 include/show_binlog_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	use `test`; create temporary table tt1 (a int)
+master-bin.000001	#	Intvar	#	#	INSERT_ID=84
 master-bin.000001	#	Query	#	#	use `test`; create table t1 (a int)
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; insert into t1 values (1)
@@ -94,6 +96,7 @@ drop database testing_1;
 include/show_binlog_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	create database testing_1
+master-bin.000001	#	Intvar	#	#	INSERT_ID=90
 master-bin.000001	#	Query	#	#	use `testing_1`; create table t1 (a int)
 master-bin.000001	#	Query	#	#	use `testing_1`; CREATE DEFINER=`root`@`localhost` FUNCTION `sf1`(a int) RETURNS int(11)
 return a+1
@@ -112,6 +115,7 @@ drop table tt1, t1;
 include/show_binlog_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	use `test`; create temporary table tt1 (a int)
+master-bin.000001	#	Intvar	#	#	INSERT_ID=91
 master-bin.000001	#	Query	#	#	use `test`; create table t1 (a int)
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; insert into t1 values (1)

=== modified file 'mysql-test/suite/binlog/r/binlog_delete_and_flush_index.result'
--- a/mysql-test/suite/binlog/r/binlog_delete_and_flush_index.result	2012-02-08 13:28:38 +0000
+++ b/mysql-test/suite/binlog/r/binlog_delete_and_flush_index.result	2012-11-12 08:00:23 +0000
@@ -13,6 +13,7 @@ master-bin.000001	#
 ### assertion: binlog contents from regular entries
 include/show_binlog_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Intvar	#	#	INSERT_ID=83
 master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a int)
 FLUSH LOGS;
 ### assertion: index file contains renamed binlog and the new one
@@ -26,6 +27,7 @@ master-bin.000002
 ###            renamed and changed the index file 
 include/show_binlog_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin-b34582.000001	#	Intvar	#	#	INSERT_ID=83
 master-bin-b34582.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a int)
 ### assertion: user changed binlog index shows correct entries
 show binary logs;

=== modified file 'mysql-test/suite/binlog/r/binlog_drop_if_exists.result'
--- a/mysql-test/suite/binlog/r/binlog_drop_if_exists.result	2012-02-08 13:28:38 +0000
+++ b/mysql-test/suite/binlog/r/binlog_drop_if_exists.result	2012-11-12 08:00:23 +0000
@@ -42,6 +42,7 @@ master-bin.000001	#	Query	#	#	use `test`
 master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `db_bug_13684`.`t` /* generated by server */
 master-bin.000001	#	Query	#	#	DROP DATABASE IF EXISTS db_bug_13684
 master-bin.000001	#	Query	#	#	CREATE DATABASE db_bug_13684
+master-bin.000001	#	Intvar	#	#	INSERT_ID=84
 master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE db_bug_13684.t (a int)
 master-bin.000001	#	Query	#	#	use `test`; CREATE DEFINER=`root`@`localhost` EVENT db_bug_13684.e
 ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR
@@ -74,6 +75,7 @@ master-bin.000001	#	Query	#	#	use `test`
 master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `db_bug_13684`.`t` /* generated by server */
 master-bin.000001	#	Query	#	#	DROP DATABASE IF EXISTS db_bug_13684
 master-bin.000001	#	Query	#	#	CREATE DATABASE db_bug_13684
+master-bin.000001	#	Intvar	#	#	INSERT_ID=84
 master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE db_bug_13684.t (a int)
 master-bin.000001	#	Query	#	#	use `test`; CREATE DEFINER=`root`@`localhost` EVENT db_bug_13684.e
 ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR

=== modified file 'mysql-test/suite/binlog/r/binlog_innodb.result'
--- a/mysql-test/suite/binlog/r/binlog_innodb.result	2012-03-28 18:48:25 +0000
+++ b/mysql-test/suite/binlog/r/binlog_innodb.result	2012-11-12 08:00:23 +0000
@@ -65,6 +65,7 @@ UPDATE t1 SET b = 4*a WHERE a > 4;
 COMMIT;
 include/show_binlog_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Intvar	#	#	INSERT_ID=83
 master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=INNODB
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (1,1),(2,2),(3,3),(4,4),(5,5),(6,6)

=== modified file 'mysql-test/suite/binlog/r/binlog_mysqlbinlog_filter.result'
--- a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_filter.result	2012-02-08 13:28:38 +0000
+++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_filter.result	2012-11-12 08:00:23 +0000
@@ -11,6 +11,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `mtr`; INSERT INTO test_suppressions (pattern) VALUES ( NAME_CONST('pattern',_latin1'Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.' COLLATE 'latin1_swedish_ci'))
 master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Intvar	#	#	INSERT_ID=84
 master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE foo (i int, j int, bar int auto_increment, unique key (bar))
 engine= innodb
 master-bin.000001	#	Query	#	#	BEGIN

=== modified file 'mysql-test/suite/binlog/r/binlog_server_id.result'
--- a/mysql-test/suite/binlog/r/binlog_server_id.result	2012-01-20 18:20:59 +0000
+++ b/mysql-test/suite/binlog/r/binlog_server_id.result	2012-11-12 08:00:23 +0000
@@ -8,6 +8,7 @@ select @@server_id;
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	1	#	use `test`; DROP TABLE IF EXISTS `t1`,`t2`,`t3` /* generated by server */
+master-bin.000001	#	Intvar	1	#	INSERT_ID=85
 master-bin.000001	#	Query	1	#	use `test`; create table t1 (a int)
 set global server_id=2;
 create table t2 (b int);
@@ -17,7 +18,9 @@ select @@server_id;
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	1	#	use `test`; DROP TABLE IF EXISTS `t1`,`t2`,`t3` /* generated by server */
+master-bin.000001	#	Intvar	1	#	INSERT_ID=85
 master-bin.000001	#	Query	1	#	use `test`; create table t1 (a int)
+master-bin.000001	#	Intvar	2	#	INSERT_ID=86
 master-bin.000001	#	Query	2	#	use `test`; create table t2 (b int)
 set global server_id=3;
 create table t3 (c int);
@@ -27,8 +30,11 @@ select @@server_id;
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	1	#	use `test`; DROP TABLE IF EXISTS `t1`,`t2`,`t3` /* generated by server */
+master-bin.000001	#	Intvar	1	#	INSERT_ID=85
 master-bin.000001	#	Query	1	#	use `test`; create table t1 (a int)
+master-bin.000001	#	Intvar	2	#	INSERT_ID=86
 master-bin.000001	#	Query	2	#	use `test`; create table t2 (b int)
+master-bin.000001	#	Intvar	3	#	INSERT_ID=87
 master-bin.000001	#	Query	3	#	use `test`; create table t3 (c int)
 set global server_id=1;
 drop table t1,t2,t3;

=== modified file 'mysql-test/suite/binlog/r/binlog_stm_binlog.result'
--- a/mysql-test/suite/binlog/r/binlog_stm_binlog.result	2012-11-07 10:59:28 +0000
+++ b/mysql-test/suite/binlog/r/binlog_stm_binlog.result	2012-11-12 08:00:23 +0000
@@ -5,6 +5,7 @@ insert into t1 values (1,2);
 commit;
 include/show_binlog_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Intvar	#	#	INSERT_ID=83
 master-bin.000001	#	Query	#	#	use `test`; create table t1 (a int, b int) engine=innodb
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; insert into t1 values (1,2)
@@ -21,7 +22,9 @@ insert t2 values (5);
 commit;
 include/show_binlog_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Intvar	#	#	INSERT_ID=84
 master-bin.000001	#	Query	#	#	use `test`; create table t1 (a int) engine=innodb
+master-bin.000001	#	Intvar	#	#	INSERT_ID=85
 master-bin.000001	#	Query	#	#	use `test`; create table t2 (a int) engine=innodb
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; insert t1 values (5)
@@ -37,6 +40,7 @@ commit;
 drop table t1;
 include/show_binlog_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Intvar	#	#	INSERT_ID=86
 master-bin.000001	#	Query	#	#	use `test`; create table t1 (n int) engine=innodb
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(100 + 4)
@@ -156,6 +160,7 @@ commit;
 drop table t1;
 include/show_binlog_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Intvar	#	#	INSERT_ID=87
 master-bin.000001	#	Query	#	#	use `test`; create table t1(n int) engine=innodb
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; insert into t1 values (1)
@@ -176,6 +181,7 @@ Variable_name	Value
 Binlog_cache_use	1
 include/show_binlog_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Intvar	#	#	INSERT_ID=88
 master-bin.000001	#	Query	#	#	use `test`; create table t1 (a int, b char(255)) engine=innodb
 master-bin.000001	#	Query	#	#	use `test`; flush status
 master-bin.000001	#	Query	#	#	BEGIN
@@ -295,6 +301,7 @@ deallocate prepare stmt;
 drop table t1;
 include/show_binlog_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Intvar	#	#	INSERT_ID=89
 master-bin.000001	#	Query	#	#	use `test`; create table t1 (a bigint unsigned, b bigint(20) unsigned)
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; insert into t1 values (9999999999999999,14632475938453979136)
@@ -404,15 +411,19 @@ DELETE FROM user WHERE host='localhost'
 use test;
 include/show_binlog_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Intvar	#	#	INSERT_ID=95
 master-bin.000001	#	Query	#	#	use `test`; create table t1 (id tinyint auto_increment primary key)
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Intvar	#	#	INSERT_ID=127
 master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(null)
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `t1` /* generated by server */
+master-bin.000001	#	Intvar	#	#	INSERT_ID=96
 master-bin.000001	#	Query	#	#	use `test`; create table t1 (a int)
+master-bin.000001	#	Intvar	#	#	INSERT_ID=97
 master-bin.000001	#	Query	#	#	use `test`; create table if not exists t2 select * from t1
 master-bin.000001	#	Query	#	#	use `test`; create temporary table tt1 (a int)
+master-bin.000001	#	Intvar	#	#	INSERT_ID=98
 master-bin.000001	#	Query	#	#	use `test`; create table if not exists t3 like tt1
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `mysql`; INSERT INTO user SET host='localhost', user='@#@', password=password('Just a test')
@@ -460,6 +471,7 @@ BINLOG '
 SHOW BINLOG EVENTS;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 #	#	Format_desc	1	#	Server ver: #, Binlog ver: #
+#	#	Intvar	1	#	INSERT_ID=102
 #	#	Query	1	#	use `test`; CREATE TABLE t1 (a INT PRIMARY KEY)
 #	#	Query	1	#	BEGIN
 #	#	Query	1	#	use `test`; INSERT INTO t1 VALUES (1)

=== modified file 'mysql-test/suite/binlog/r/binlog_stm_blackhole.result'
--- a/mysql-test/suite/binlog/r/binlog_stm_blackhole.result	2012-10-11 14:16:25 +0000
+++ b/mysql-test/suite/binlog/r/binlog_stm_blackhole.result	2012-11-12 08:00:23 +0000
@@ -110,6 +110,7 @@ a
 include/show_binlog_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `t1`,`t2` /* generated by server */
+master-bin.000001	#	Intvar	#	#	INSERT_ID=94
 master-bin.000001	#	Query	#	#	use `test`; create table t1 (a int) engine=blackhole
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; delete from t1 where a=10
@@ -126,13 +127,17 @@ master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; replace into t1 values(100)
 master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Intvar	#	#	INSERT_ID=95
 master-bin.000001	#	Query	#	#	use `test`; create table t2 (a varchar(200)) engine=blackhole
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Begin_load_query	#	#	;file_id=#;block_len=#
 master-bin.000001	#	Execute_load_query	#	#	use `test`; LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE `t2` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`a`) ;file_id=#
 master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Intvar	#	#	INSERT_ID=96
 master-bin.000001	#	Query	#	#	use `test`; alter table t1 add b int
+master-bin.000001	#	Intvar	#	#	INSERT_ID=97
 master-bin.000001	#	Query	#	#	use `test`; alter table t1 drop b
+master-bin.000001	#	Intvar	#	#	INSERT_ID=98
 master-bin.000001	#	Query	#	#	use `test`; create table t3 like t1
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; insert into t1 select * from t3
@@ -172,6 +177,7 @@ set insert_id= 5;
 insert into t1 values (55), (NULL);
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Intvar	1	#	INSERT_ID=106
 master-bin.000001	#	Query	1	#	use `test`; create table t1 (a int auto_increment, primary key (a)) engine=blackhole
 master-bin.000001	#	Query	1	#	BEGIN
 master-bin.000001	#	Intvar	1	#	INSERT_ID=1

=== modified file 'mysql-test/suite/binlog/r/binlog_stm_do_db.result'
--- a/mysql-test/suite/binlog/r/binlog_stm_do_db.result	2012-02-08 13:28:38 +0000
+++ b/mysql-test/suite/binlog/r/binlog_stm_do_db.result	2012-11-12 08:00:23 +0000
@@ -35,7 +35,9 @@ COMMIT;
 include/show_binlog_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	CREATE DATABASE b42829
+master-bin.000001	#	Intvar	#	#	INSERT_ID=83
 master-bin.000001	#	Query	#	#	use `b42829`; CREATE TABLE t1 (x int, y int) engine=InnoDB
+master-bin.000001	#	Intvar	#	#	INSERT_ID=84
 master-bin.000001	#	Query	#	#	use `b42829`; CREATE TABLE t2 (x int, y int) engine=InnoDB
 DROP DATABASE b42829;
 DROP DATABASE b42829_filtered;

=== modified file 'mysql-test/suite/binlog/r/binlog_stm_drop_tbl.result'
--- a/mysql-test/suite/binlog/r/binlog_stm_drop_tbl.result	2012-02-08 13:28:38 +0000
+++ b/mysql-test/suite/binlog/r/binlog_stm_drop_tbl.result	2012-11-12 08:00:23 +0000
@@ -8,6 +8,7 @@ DROP TABLE t1;;
 COMMIT;
 include/show_binlog_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Intvar	#	#	INSERT_ID=88
 master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT)
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES(1)

=== modified file 'mysql-test/suite/binlog/r/binlog_stm_drop_tmp_tbl.result'
--- a/mysql-test/suite/binlog/r/binlog_stm_drop_tmp_tbl.result	2012-02-08 13:28:38 +0000
+++ b/mysql-test/suite/binlog/r/binlog_stm_drop_tmp_tbl.result	2012-11-12 08:00:23 +0000
@@ -33,6 +33,7 @@ master-bin.000001	#	Query	#	#	use `drop-
 master-bin.000001	#	Query	#	#	use `drop-temp+table-test`; CREATE TEMPORARY TABLE tmp1(c1 int)
 master-bin.000001	#	Query	#	#	use `drop-temp+table-test`; CREATE TEMPORARY TABLE tmp2(c1 int)
 master-bin.000001	#	Query	#	#	use `drop-temp+table-test`; CREATE TEMPORARY TABLE tmp3(c1 int)
+master-bin.000001	#	Intvar	#	#	INSERT_ID=89
 master-bin.000001	#	Query	#	#	use `drop-temp+table-test`; CREATE TABLE t(c1 int)
 master-bin.000001	#	Query	#	#	use `drop-temp+table-test`; DROP TEMPORARY TABLE IF EXISTS `tmp` /* generated by server */
 master-bin.000001	#	Query	#	#	use `drop-temp+table-test`; DROP TEMPORARY TABLE IF EXISTS `tmp` /* generated by server */
@@ -54,6 +55,7 @@ SELECT @@session.binlog_format;
 ROW
 include/show_binlog_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Intvar	#	#	INSERT_ID=90
 master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 ( i text )
 master-bin.000001	#	Query	#	#	use `test`; CREATE TEMPORARY TABLE ttmp1 ( i text )
 master-bin.000001	#	Query	#	#	BEGIN

=== modified file 'mysql-test/suite/binlog/r/binlog_stm_ps.result'
--- a/mysql-test/suite/binlog/r/binlog_stm_ps.result	2012-02-08 13:28:38 +0000
+++ b/mysql-test/suite/binlog/r/binlog_stm_ps.result	2012-11-12 08:00:23 +0000
@@ -14,6 +14,7 @@ Warnings:
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
 include/show_binlog_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Intvar	#	#	INSERT_ID=107
 master-bin.000001	#	Query	#	#	use `test`; create table t1 (a int)
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	User var	#	#	@`a`=98

=== modified file 'mysql-test/suite/binlog/r/binlog_stm_row.result'
--- a/mysql-test/suite/binlog/r/binlog_stm_row.result	2012-03-09 11:07:20 +0000
+++ b/mysql-test/suite/binlog/r/binlog_stm_row.result	2012-11-12 08:00:23 +0000
@@ -61,7 +61,9 @@ include/show_binlog_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */
 master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `t2` /* generated by server */
+master-bin.000001	#	Intvar	#	#	INSERT_ID=83
 master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT)
+master-bin.000001	#	Intvar	#	#	INSERT_ID=84
 master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t2 LIKE t1
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES(1)

=== modified file 'mysql-test/suite/binlog/r/binlog_stm_user_variables.result'
--- a/mysql-test/suite/binlog/r/binlog_stm_user_variables.result	2012-02-08 13:28:38 +0000
+++ b/mysql-test/suite/binlog/r/binlog_stm_user_variables.result	2012-11-12 08:00:23 +0000
@@ -39,6 +39,7 @@ INSERT INTO t1 VALUES (@positive,
 ## account the unsigned_flag
 include/show_binlog_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Intvar	#	#	INSERT_ID=108
 master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (`tinyint` TINYINT,
 `smallint` SMALLINT,
 `mediumint` MEDIUMINT,
@@ -98,6 +99,7 @@ INSERT INTO t1 VALUES (@negative,
 ## account the unsigned_flag
 include/show_binlog_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Intvar	#	#	INSERT_ID=108
 master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (`tinyint` TINYINT,
 `smallint` SMALLINT,
 `mediumint` MEDIUMINT,

=== modified file 'mysql-test/suite/funcs_1/r/is_columns_mysql.result'
--- a/mysql-test/suite/funcs_1/r/is_columns_mysql.result	2012-11-01 11:46:09 +0000
+++ b/mysql-test/suite/funcs_1/r/is_columns_mysql.result	2012-11-12 08:00:23 +0000
@@ -53,6 +53,18 @@ def	mysql	event	sql_mode	15		NO	set	478
 def	mysql	event	starts	11	NULL	YES	datetime	NULL	NULL	NULL	NULL	0	NULL	NULL	datetime			select,insert,update,references	
 def	mysql	event	status	13	ENABLED	NO	enum	18	54	NULL	NULL	NULL	utf8	utf8_general_ci	enum('ENABLED','DISABLED','SLAVESIDE_DISABLED')			select,insert,update,references	
 def	mysql	event	time_zone	18	SYSTEM	NO	char	64	64	NULL	NULL	NULL	latin1	latin1_swedish_ci	char(64)			select,insert,update,references	
+def	mysql	fields	comment	9	NULL	YES	text	65535	65535	NULL	NULL	NULL	utf8	utf8_bin	text			select,insert,update,references	
+def	mysql	fields	csid	8	NULL	YES	smallint	NULL	NULL	5	0	NULL	NULL	NULL	smallint(6)			select,insert,update,references	
+def	mysql	fields	field_length	4	NULL	YES	smallint	NULL	NULL	5	0	NULL	NULL	NULL	smallint(6)			select,insert,update,references	
+def	mysql	fields	flags	12	NULL	YES	smallint	NULL	NULL	5	0	NULL	NULL	NULL	smallint(6)			select,insert,update,references	
+def	mysql	fields	intervals	10	NULL	YES	text	65535	65535	NULL	NULL	NULL	utf8	utf8_bin	text			select,insert,update,references	
+def	mysql	fields	interval_parts	11	NULL	YES	smallint	NULL	NULL	5	0	NULL	NULL	NULL	smallint(6)			select,insert,update,references	
+def	mysql	fields	name	2	NULL	NO	char	64	192	NULL	NULL	NULL	utf8	utf8_bin	char(64)			select,insert,update,references	
+def	mysql	fields	pack_flag	7	NULL	YES	int	NULL	NULL	10	0	NULL	NULL	NULL	int(11)			select,insert,update,references	
+def	mysql	fields	recpos	6	NULL	YES	int	NULL	NULL	10	0	NULL	NULL	NULL	int(11)			select,insert,update,references	
+def	mysql	fields	table_id	1	NULL	NO	int	NULL	NULL	10	0	NULL	NULL	NULL	int(10) unsigned			select,insert,update,references	
+def	mysql	fields	type	3	NULL	YES	smallint	NULL	NULL	5	0	NULL	NULL	NULL	smallint(6)			select,insert,update,references	
+def	mysql	fields	unireg_type	5	NULL	YES	tinyint	NULL	NULL	3	0	NULL	NULL	NULL	tinyint(1)			select,insert,update,references	
 def	mysql	func	dl	3		NO	char	128	384	NULL	NULL	NULL	utf8	utf8_bin	char(128)			select,insert,update,references	
 def	mysql	func	name	1		NO	char	64	192	NULL	NULL	NULL	utf8	utf8_bin	char(64)	PRI		select,insert,update,references	
 def	mysql	func	ret	2	0	NO	tinyint	NULL	NULL	3	0	NULL	NULL	NULL	tinyint(1)			select,insert,update,references	
@@ -204,6 +216,28 @@ def	mysql	slow_log	sql_text	11	NULL	NO	m
 def	mysql	slow_log	start_time	1	CURRENT_TIMESTAMP	NO	timestamp	NULL	NULL	NULL	NULL	0	NULL	NULL	timestamp		on update CURRENT_TIMESTAMP	select,insert,update,references	
 def	mysql	slow_log	thread_id	12	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	NULL	bigint(21) unsigned			select,insert,update,references	
 def	mysql	slow_log	user_host	2	NULL	NO	mediumtext	16777215	16777215	NULL	NULL	NULL	utf8	utf8_general_ci	mediumtext			select,insert,update,references	
+def	mysql	tables	avg_row_length	10	NULL	YES	int	NULL	NULL	10	0	NULL	NULL	NULL	int(11)			select,insert,update,references	
+def	mysql	tables	comment	18	NULL	YES	text	65535	65535	NULL	NULL	NULL	utf8	utf8_bin	text			select,insert,update,references	
+def	mysql	tables	csid	11	NULL	YES	tinyint	NULL	NULL	3	0	NULL	NULL	NULL	tinyint(1)			select,insert,update,references	
+def	mysql	tables	db	1	NULL	NO	char	64	192	NULL	NULL	NULL	utf8	utf8_bin	char(64)			select,insert,update,references	
+def	mysql	tables	db_create_options	9	NULL	YES	smallint	NULL	NULL	5	0	NULL	NULL	NULL	smallint(6)			select,insert,update,references	
+def	mysql	tables	dd_version	8	NULL	YES	tinyint	NULL	NULL	3	0	NULL	NULL	NULL	tinyint(1)			select,insert,update,references	
+def	mysql	tables	default_part_db_type	16	NULL	YES	tinyint	NULL	NULL	3	0	NULL	NULL	NULL	tinyint(1)			select,insert,update,references	
+def	mysql	tables	field_count	19	NULL	YES	smallint	NULL	NULL	5	0	NULL	NULL	NULL	smallint(6)			select,insert,update,references	
+def	mysql	tables	id	3	NULL	NO	int	NULL	NULL	10	0	NULL	NULL	NULL	int(10) unsigned	PRI	auto_increment	select,insert,update,references	
+def	mysql	tables	key_block_size	17	NULL	YES	smallint	NULL	NULL	5	0	NULL	NULL	NULL	smallint(6)			select,insert,update,references	
+def	mysql	tables	legacy_db_type	4	NULL	YES	tinyint	NULL	NULL	3	0	NULL	NULL	NULL	tinyint(1)			select,insert,update,references	
+def	mysql	tables	max_rows	5	NULL	YES	int	NULL	NULL	10	0	NULL	NULL	NULL	int(11)			select,insert,update,references	
+def	mysql	tables	min_rows	6	NULL	YES	int	NULL	NULL	10	0	NULL	NULL	NULL	int(11)			select,insert,update,references	
+def	mysql	tables	mysql_version	15	NULL	YES	int	NULL	NULL	10	0	NULL	NULL	NULL	int(11)			select,insert,update,references	
+def	mysql	tables	name	2	NULL	NO	char	64	192	NULL	NULL	NULL	utf8	utf8_bin	char(64)			select,insert,update,references	
+def	mysql	tables	null_fields	20	NULL	YES	int	NULL	NULL	10	0	NULL	NULL	NULL	int(11)			select,insert,update,references	
+def	mysql	tables	row_type	12	NULL	YES	tinyint	NULL	NULL	3	0	NULL	NULL	NULL	tinyint(1)			select,insert,update,references	
+def	mysql	tables	stats_auto_recalc	14	NULL	YES	smallint	NULL	NULL	5	0	NULL	NULL	NULL	smallint(6)			select,insert,update,references	
+def	mysql	tables	stats_sample_pages	13	NULL	YES	smallint	NULL	NULL	5	0	NULL	NULL	NULL	smallint(6)			select,insert,update,references	
+def	mysql	tables	system	7	NULL	YES	tinyint	NULL	NULL	3	0	NULL	NULL	NULL	tinyint(1)			select,insert,update,references	
+def	mysql	tables	tablespace	22	NULL	YES	text	65535	65535	NULL	NULL	NULL	utf8	utf8_bin	text			select,insert,update,references	
+def	mysql	tables	table_keys	21	NULL	YES	smallint	NULL	NULL	5	0	NULL	NULL	NULL	smallint(6)			select,insert,update,references	
 def	mysql	tables_priv	Column_priv	8		NO	set	31	93	NULL	NULL	NULL	utf8	utf8_general_ci	set('Select','Insert','Update','References')			select,insert,update,references	
 def	mysql	tables_priv	Db	2		NO	char	64	192	NULL	NULL	NULL	utf8	utf8_bin	char(64)	PRI		select,insert,update,references	
 def	mysql	tables_priv	Grantor	5		NO	char	77	231	NULL	NULL	NULL	utf8	utf8_bin	char(77)	MUL		select,insert,update,references	
@@ -212,6 +246,23 @@ def	mysql	tables_priv	Table_name	4		NO	c
 def	mysql	tables_priv	Table_priv	7		NO	set	98	294	NULL	NULL	NULL	utf8	utf8_general_ci	set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger')			select,insert,update,references	
 def	mysql	tables_priv	Timestamp	6	CURRENT_TIMESTAMP	NO	timestamp	NULL	NULL	NULL	NULL	0	NULL	NULL	timestamp		on update CURRENT_TIMESTAMP	select,insert,update,references	
 def	mysql	tables_priv	User	3		NO	char	16	48	NULL	NULL	NULL	utf8	utf8_bin	char(16)	PRI		select,insert,update,references	
+def	mysql	table_keys	algorithm	7	NULL	YES	smallint	NULL	NULL	5	0	NULL	NULL	NULL	smallint(6)			select,insert,update,references	
+def	mysql	table_keys	block_size	8	NULL	YES	smallint	NULL	NULL	5	0	NULL	NULL	NULL	smallint(6)			select,insert,update,references	
+def	mysql	table_keys	comment	11	NULL	YES	text	65535	65535	NULL	NULL	NULL	utf8	utf8_bin	text			select,insert,update,references	
+def	mysql	table_keys	flags	4	NULL	YES	smallint	NULL	NULL	5	0	NULL	NULL	NULL	smallint(6)			select,insert,update,references	
+def	mysql	table_keys	id	1	NULL	NO	int	NULL	NULL	10	0	NULL	NULL	NULL	int(10) unsigned	PRI	auto_increment	select,insert,update,references	
+def	mysql	table_keys	key_length	6	NULL	YES	smallint	NULL	NULL	5	0	NULL	NULL	NULL	smallint(6)			select,insert,update,references	
+def	mysql	table_keys	key_parts	5	NULL	YES	smallint	NULL	NULL	5	0	NULL	NULL	NULL	smallint(6)			select,insert,update,references	
+def	mysql	table_keys	name	3	NULL	YES	char	64	192	NULL	NULL	NULL	utf8	utf8_bin	char(64)			select,insert,update,references	
+def	mysql	table_keys	parser	10	NULL	YES	text	65535	65535	NULL	NULL	NULL	utf8	utf8_bin	text			select,insert,update,references	
+def	mysql	table_keys	table_id	2	NULL	NO	int	NULL	NULL	10	0	NULL	NULL	NULL	int(10) unsigned			select,insert,update,references	
+def	mysql	table_keys	user_defined_key_parts	9	NULL	YES	int	NULL	NULL	10	0	NULL	NULL	NULL	int(11)			select,insert,update,references	
+def	mysql	table_key_parts	field_nr	2	NULL	NO	smallint	NULL	NULL	5	0	NULL	NULL	NULL	smallint(6)			select,insert,update,references	
+def	mysql	table_key_parts	key_id	1	NULL	NO	int	NULL	NULL	10	0	NULL	NULL	NULL	int(10) unsigned			select,insert,update,references	
+def	mysql	table_key_parts	key_part_flag	6	NULL	YES	smallint	NULL	NULL	5	0	NULL	NULL	NULL	smallint(6)			select,insert,update,references	
+def	mysql	table_key_parts	key_type	5	NULL	YES	smallint	NULL	NULL	5	0	NULL	NULL	NULL	smallint(6)			select,insert,update,references	
+def	mysql	table_key_parts	length	3	NULL	YES	smallint	NULL	NULL	5	0	NULL	NULL	NULL	smallint(6)			select,insert,update,references	
+def	mysql	table_key_parts	record_offset	4	NULL	YES	smallint	NULL	NULL	5	0	NULL	NULL	NULL	smallint(6)			select,insert,update,references	
 def	mysql	time_zone	Time_zone_id	1	NULL	NO	int	NULL	NULL	10	0	NULL	NULL	NULL	int(10) unsigned	PRI	auto_increment	select,insert,update,references	
 def	mysql	time_zone	Use_leap_seconds	2	N	NO	enum	1	3	NULL	NULL	NULL	utf8	utf8_general_ci	enum('Y','N')			select,insert,update,references	
 def	mysql	time_zone_leap_second	Correction	2	NULL	NO	int	NULL	NULL	10	0	NULL	NULL	NULL	int(11)			select,insert,update,references	
@@ -392,6 +443,18 @@ NULL	mysql	event	originator	int	NULL	NUL
 3.0000	mysql	event	collation_connection	char	32	96	utf8	utf8_bin	char(32)
 3.0000	mysql	event	db_collation	char	32	96	utf8	utf8_bin	char(32)
 1.0000	mysql	event	body_utf8	longblob	4294967295	4294967295	NULL	NULL	longblob
+NULL	mysql	fields	table_id	int	NULL	NULL	NULL	NULL	int(10) unsigned
+3.0000	mysql	fields	name	char	64	192	utf8	utf8_bin	char(64)
+NULL	mysql	fields	type	smallint	NULL	NULL	NULL	NULL	smallint(6)
+NULL	mysql	fields	field_length	smallint	NULL	NULL	NULL	NULL	smallint(6)
+NULL	mysql	fields	unireg_type	tinyint	NULL	NULL	NULL	NULL	tinyint(1)
+NULL	mysql	fields	recpos	int	NULL	NULL	NULL	NULL	int(11)
+NULL	mysql	fields	pack_flag	int	NULL	NULL	NULL	NULL	int(11)
+NULL	mysql	fields	csid	smallint	NULL	NULL	NULL	NULL	smallint(6)
+1.0000	mysql	fields	comment	text	65535	65535	utf8	utf8_bin	text
+1.0000	mysql	fields	intervals	text	65535	65535	utf8	utf8_bin	text
+NULL	mysql	fields	interval_parts	smallint	NULL	NULL	NULL	NULL	smallint(6)
+NULL	mysql	fields	flags	smallint	NULL	NULL	NULL	NULL	smallint(6)
 3.0000	mysql	func	name	char	64	192	utf8	utf8_bin	char(64)
 NULL	mysql	func	ret	tinyint	NULL	NULL	NULL	NULL	tinyint(1)
 3.0000	mysql	func	dl	char	128	384	utf8	utf8_bin	char(128)
@@ -543,6 +606,28 @@ NULL	mysql	slow_log	insert_id	int	NULL	N
 NULL	mysql	slow_log	server_id	int	NULL	NULL	NULL	NULL	int(10) unsigned
 1.0000	mysql	slow_log	sql_text	mediumtext	16777215	16777215	utf8	utf8_general_ci	mediumtext
 NULL	mysql	slow_log	thread_id	bigint	NULL	NULL	NULL	NULL	bigint(21) unsigned
+3.0000	mysql	tables	db	char	64	192	utf8	utf8_bin	char(64)
+3.0000	mysql	tables	name	char	64	192	utf8	utf8_bin	char(64)
+NULL	mysql	tables	id	int	NULL	NULL	NULL	NULL	int(10) unsigned
+NULL	mysql	tables	legacy_db_type	tinyint	NULL	NULL	NULL	NULL	tinyint(1)
+NULL	mysql	tables	max_rows	int	NULL	NULL	NULL	NULL	int(11)
+NULL	mysql	tables	min_rows	int	NULL	NULL	NULL	NULL	int(11)
+NULL	mysql	tables	system	tinyint	NULL	NULL	NULL	NULL	tinyint(1)
+NULL	mysql	tables	dd_version	tinyint	NULL	NULL	NULL	NULL	tinyint(1)
+NULL	mysql	tables	db_create_options	smallint	NULL	NULL	NULL	NULL	smallint(6)
+NULL	mysql	tables	avg_row_length	int	NULL	NULL	NULL	NULL	int(11)
+NULL	mysql	tables	csid	tinyint	NULL	NULL	NULL	NULL	tinyint(1)
+NULL	mysql	tables	row_type	tinyint	NULL	NULL	NULL	NULL	tinyint(1)
+NULL	mysql	tables	stats_sample_pages	smallint	NULL	NULL	NULL	NULL	smallint(6)
+NULL	mysql	tables	stats_auto_recalc	smallint	NULL	NULL	NULL	NULL	smallint(6)
+NULL	mysql	tables	mysql_version	int	NULL	NULL	NULL	NULL	int(11)
+NULL	mysql	tables	default_part_db_type	tinyint	NULL	NULL	NULL	NULL	tinyint(1)
+NULL	mysql	tables	key_block_size	smallint	NULL	NULL	NULL	NULL	smallint(6)
+1.0000	mysql	tables	comment	text	65535	65535	utf8	utf8_bin	text
+NULL	mysql	tables	field_count	smallint	NULL	NULL	NULL	NULL	smallint(6)
+NULL	mysql	tables	null_fields	int	NULL	NULL	NULL	NULL	int(11)
+NULL	mysql	tables	table_keys	smallint	NULL	NULL	NULL	NULL	smallint(6)
+1.0000	mysql	tables	tablespace	text	65535	65535	utf8	utf8_bin	text
 3.0000	mysql	tables_priv	Host	char	60	180	utf8	utf8_bin	char(60)
 3.0000	mysql	tables_priv	Db	char	64	192	utf8	utf8_bin	char(64)
 3.0000	mysql	tables_priv	User	char	16	48	utf8	utf8_bin	char(16)
@@ -551,6 +636,23 @@ NULL	mysql	slow_log	thread_id	bigint	NUL
 NULL	mysql	tables_priv	Timestamp	timestamp	NULL	NULL	NULL	NULL	timestamp
 3.0000	mysql	tables_priv	Table_priv	set	98	294	utf8	utf8_general_ci	set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger')
 3.0000	mysql	tables_priv	Column_priv	set	31	93	utf8	utf8_general_ci	set('Select','Insert','Update','References')
+NULL	mysql	table_keys	id	int	NULL	NULL	NULL	NULL	int(10) unsigned
+NULL	mysql	table_keys	table_id	int	NULL	NULL	NULL	NULL	int(10) unsigned
+3.0000	mysql	table_keys	name	char	64	192	utf8	utf8_bin	char(64)
+NULL	mysql	table_keys	flags	smallint	NULL	NULL	NULL	NULL	smallint(6)
+NULL	mysql	table_keys	key_parts	smallint	NULL	NULL	NULL	NULL	smallint(6)
+NULL	mysql	table_keys	key_length	smallint	NULL	NULL	NULL	NULL	smallint(6)
+NULL	mysql	table_keys	algorithm	smallint	NULL	NULL	NULL	NULL	smallint(6)
+NULL	mysql	table_keys	block_size	smallint	NULL	NULL	NULL	NULL	smallint(6)
+NULL	mysql	table_keys	user_defined_key_parts	int	NULL	NULL	NULL	NULL	int(11)
+1.0000	mysql	table_keys	parser	text	65535	65535	utf8	utf8_bin	text
+1.0000	mysql	table_keys	comment	text	65535	65535	utf8	utf8_bin	text
+NULL	mysql	table_key_parts	key_id	int	NULL	NULL	NULL	NULL	int(10) unsigned
+NULL	mysql	table_key_parts	field_nr	smallint	NULL	NULL	NULL	NULL	smallint(6)
+NULL	mysql	table_key_parts	length	smallint	NULL	NULL	NULL	NULL	smallint(6)
+NULL	mysql	table_key_parts	record_offset	smallint	NULL	NULL	NULL	NULL	smallint(6)
+NULL	mysql	table_key_parts	key_type	smallint	NULL	NULL	NULL	NULL	smallint(6)
+NULL	mysql	table_key_parts	key_part_flag	smallint	NULL	NULL	NULL	NULL	smallint(6)
 NULL	mysql	time_zone	Time_zone_id	int	NULL	NULL	NULL	NULL	int(10) unsigned
 3.0000	mysql	time_zone	Use_leap_seconds	enum	1	3	utf8	utf8_general_ci	enum('Y','N')
 NULL	mysql	time_zone_leap_second	Transition_time	bigint	NULL	NULL	NULL	NULL	bigint(20)

=== modified file 'mysql-test/suite/funcs_1/r/is_key_column_usage.result'
--- a/mysql-test/suite/funcs_1/r/is_key_column_usage.result	2012-08-31 21:54:56 +0000
+++ b/mysql-test/suite/funcs_1/r/is_key_column_usage.result	2012-11-12 08:00:23 +0000
@@ -121,6 +121,8 @@ def	mysql	PRIMARY	def	mysql	slave_master
 def	mysql	PRIMARY	def	mysql	slave_master_info	Port
 def	mysql	PRIMARY	def	mysql	slave_relay_log_info	Id
 def	mysql	PRIMARY	def	mysql	slave_worker_info	Id
+def	mysql	PRIMARY	def	mysql	table_keys	id
+def	mysql	PRIMARY	def	mysql	tables	id
 def	mysql	PRIMARY	def	mysql	tables_priv	Host
 def	mysql	PRIMARY	def	mysql	tables_priv	Db
 def	mysql	PRIMARY	def	mysql	tables_priv	User

=== modified file 'mysql-test/suite/funcs_1/r/is_statistics.result'
--- a/mysql-test/suite/funcs_1/r/is_statistics.result	2012-08-31 21:54:56 +0000
+++ b/mysql-test/suite/funcs_1/r/is_statistics.result	2012-11-12 08:00:23 +0000
@@ -134,6 +134,8 @@ def	mysql	slave_master_info	mysql	PRIMAR
 def	mysql	slave_master_info	mysql	PRIMARY
 def	mysql	slave_relay_log_info	mysql	PRIMARY
 def	mysql	slave_worker_info	mysql	PRIMARY
+def	mysql	table_keys	mysql	PRIMARY
+def	mysql	tables	mysql	PRIMARY
 def	mysql	tables_priv	mysql	PRIMARY
 def	mysql	tables_priv	mysql	PRIMARY
 def	mysql	tables_priv	mysql	PRIMARY

=== modified file 'mysql-test/suite/funcs_1/r/is_statistics_mysql.result'
--- a/mysql-test/suite/funcs_1/r/is_statistics_mysql.result	2012-08-31 21:54:56 +0000
+++ b/mysql-test/suite/funcs_1/r/is_statistics_mysql.result	2012-11-12 08:00:23 +0000
@@ -56,11 +56,13 @@ def	mysql	slave_master_info	0	mysql	PRIM
 def	mysql	slave_master_info	0	mysql	PRIMARY	2	Port	A	#CARD#	NULL	NULL		BTREE		
 def	mysql	slave_relay_log_info	0	mysql	PRIMARY	1	Id	A	#CARD#	NULL	NULL		BTREE		
 def	mysql	slave_worker_info	0	mysql	PRIMARY	1	Id	A	#CARD#	NULL	NULL		BTREE		
+def	mysql	tables	0	mysql	PRIMARY	1	id	A	#CARD#	NULL	NULL		BTREE		
 def	mysql	tables_priv	1	mysql	Grantor	1	Grantor	A	#CARD#	NULL	NULL		BTREE		
 def	mysql	tables_priv	0	mysql	PRIMARY	1	Host	A	#CARD#	NULL	NULL		BTREE		
 def	mysql	tables_priv	0	mysql	PRIMARY	2	Db	A	#CARD#	NULL	NULL		BTREE		
 def	mysql	tables_priv	0	mysql	PRIMARY	3	User	A	#CARD#	NULL	NULL		BTREE		
 def	mysql	tables_priv	0	mysql	PRIMARY	4	Table_name	A	#CARD#	NULL	NULL		BTREE		
+def	mysql	table_keys	0	mysql	PRIMARY	1	id	A	#CARD#	NULL	NULL		BTREE		
 def	mysql	time_zone	0	mysql	PRIMARY	1	Time_zone_id	A	#CARD#	NULL	NULL		BTREE		
 def	mysql	time_zone_leap_second	0	mysql	PRIMARY	1	Transition_time	A	#CARD#	NULL	NULL		BTREE		
 def	mysql	time_zone_name	0	mysql	PRIMARY	1	Name	A	#CARD#	NULL	NULL		BTREE		

=== modified file 'mysql-test/suite/funcs_1/r/is_table_constraints.result'
--- a/mysql-test/suite/funcs_1/r/is_table_constraints.result	2012-08-31 21:54:56 +0000
+++ b/mysql-test/suite/funcs_1/r/is_table_constraints.result	2012-11-12 08:00:23 +0000
@@ -79,6 +79,8 @@ def	mysql	PRIMARY	mysql	servers
 def	mysql	PRIMARY	mysql	slave_master_info
 def	mysql	PRIMARY	mysql	slave_relay_log_info
 def	mysql	PRIMARY	mysql	slave_worker_info
+def	mysql	PRIMARY	mysql	table_keys
+def	mysql	PRIMARY	mysql	tables
 def	mysql	PRIMARY	mysql	tables_priv
 def	mysql	PRIMARY	mysql	time_zone
 def	mysql	PRIMARY	mysql	time_zone_leap_second

=== modified file 'mysql-test/suite/funcs_1/r/is_table_constraints_mysql.result'
--- a/mysql-test/suite/funcs_1/r/is_table_constraints_mysql.result	2012-08-31 21:54:56 +0000
+++ b/mysql-test/suite/funcs_1/r/is_table_constraints_mysql.result	2012-11-12 08:00:23 +0000
@@ -29,7 +29,9 @@ def	mysql	PRIMARY	mysql	servers	PRIMARY
 def	mysql	PRIMARY	mysql	slave_master_info	PRIMARY KEY
 def	mysql	PRIMARY	mysql	slave_relay_log_info	PRIMARY KEY
 def	mysql	PRIMARY	mysql	slave_worker_info	PRIMARY KEY
+def	mysql	PRIMARY	mysql	tables	PRIMARY KEY
 def	mysql	PRIMARY	mysql	tables_priv	PRIMARY KEY
+def	mysql	PRIMARY	mysql	table_keys	PRIMARY KEY
 def	mysql	PRIMARY	mysql	time_zone	PRIMARY KEY
 def	mysql	PRIMARY	mysql	time_zone_leap_second	PRIMARY KEY
 def	mysql	PRIMARY	mysql	time_zone_name	PRIMARY KEY

=== modified file 'mysql-test/suite/funcs_1/r/is_tables_mysql.result'
--- a/mysql-test/suite/funcs_1/r/is_tables_mysql.result	2012-08-31 21:54:56 +0000
+++ b/mysql-test/suite/funcs_1/r/is_tables_mysql.result	2012-11-12 08:00:23 +0000
@@ -83,6 +83,29 @@ user_comment	Events
 Separator	-----------------------------------------------------
 TABLE_CATALOG	def
 TABLE_SCHEMA	mysql
+TABLE_NAME	fields
+TABLE_TYPE	BASE TABLE
+ENGINE	MyISAM
+VERSION	10
+ROW_FORMAT	Dynamic
+TABLE_ROWS	#TBLR#
+AVG_ROW_LENGTH	#ARL#
+DATA_LENGTH	#DL#
+MAX_DATA_LENGTH	#MDL#
+INDEX_LENGTH	#IL#
+DATA_FREE	#DF#
+AUTO_INCREMENT	NULL
+CREATE_TIME	#CRT#
+UPDATE_TIME	#UT#
+CHECK_TIME	#CT#
+TABLE_COLLATION	utf8_bin
+CHECKSUM	NULL
+CREATE_OPTIONS	#CO#
+TABLE_COMMENT	#TC#
+user_comment	
+Separator	-----------------------------------------------------
+TABLE_CATALOG	def
+TABLE_SCHEMA	mysql
 TABLE_NAME	func
 TABLE_TYPE	BASE TABLE
 ENGINE	MyISAM
@@ -497,6 +520,29 @@ user_comment	Slow log
 Separator	-----------------------------------------------------
 TABLE_CATALOG	def
 TABLE_SCHEMA	mysql
+TABLE_NAME	tables
+TABLE_TYPE	BASE TABLE
+ENGINE	MyISAM
+VERSION	10
+ROW_FORMAT	Dynamic
+TABLE_ROWS	#TBLR#
+AVG_ROW_LENGTH	#ARL#
+DATA_LENGTH	#DL#
+MAX_DATA_LENGTH	#MDL#
+INDEX_LENGTH	#IL#
+DATA_FREE	#DF#
+AUTO_INCREMENT	83
+CREATE_TIME	#CRT#
+UPDATE_TIME	#UT#
+CHECK_TIME	#CT#
+TABLE_COLLATION	utf8_bin
+CHECKSUM	NULL
+CREATE_OPTIONS	#CO#
+TABLE_COMMENT	#TC#
+user_comment	
+Separator	-----------------------------------------------------
+TABLE_CATALOG	def
+TABLE_SCHEMA	mysql
 TABLE_NAME	tables_priv
 TABLE_TYPE	BASE TABLE
 ENGINE	MyISAM
@@ -520,6 +566,52 @@ user_comment	Table privileges
 Separator	-----------------------------------------------------
 TABLE_CATALOG	def
 TABLE_SCHEMA	mysql
+TABLE_NAME	table_keys
+TABLE_TYPE	BASE TABLE
+ENGINE	MyISAM
+VERSION	10
+ROW_FORMAT	Dynamic
+TABLE_ROWS	#TBLR#
+AVG_ROW_LENGTH	#ARL#
+DATA_LENGTH	#DL#
+MAX_DATA_LENGTH	#MDL#
+INDEX_LENGTH	#IL#
+DATA_FREE	#DF#
+AUTO_INCREMENT	1
+CREATE_TIME	#CRT#
+UPDATE_TIME	#UT#
+CHECK_TIME	#CT#
+TABLE_COLLATION	utf8_bin
+CHECKSUM	NULL
+CREATE_OPTIONS	#CO#
+TABLE_COMMENT	#TC#
+user_comment	
+Separator	-----------------------------------------------------
+TABLE_CATALOG	def
+TABLE_SCHEMA	mysql
+TABLE_NAME	table_key_parts
+TABLE_TYPE	BASE TABLE
+ENGINE	MyISAM
+VERSION	10
+ROW_FORMAT	Fixed
+TABLE_ROWS	#TBLR#
+AVG_ROW_LENGTH	#ARL#
+DATA_LENGTH	#DL#
+MAX_DATA_LENGTH	#MDL#
+INDEX_LENGTH	#IL#
+DATA_FREE	#DF#
+AUTO_INCREMENT	NULL
+CREATE_TIME	#CRT#
+UPDATE_TIME	#UT#
+CHECK_TIME	#CT#
+TABLE_COLLATION	utf8_bin
+CHECKSUM	NULL
+CREATE_OPTIONS	#CO#
+TABLE_COMMENT	#TC#
+user_comment	
+Separator	-----------------------------------------------------
+TABLE_CATALOG	def
+TABLE_SCHEMA	mysql
 TABLE_NAME	time_zone
 TABLE_TYPE	BASE TABLE
 ENGINE	MyISAM

=== modified file 'mysql-test/suite/perfschema/r/binlog_edge_mix.result'
--- a/mysql-test/suite/perfschema/r/binlog_edge_mix.result	2012-11-08 21:40:31 +0000
+++ b/mysql-test/suite/perfschema/r/binlog_edge_mix.result	2012-11-12 08:00:23 +0000
@@ -145,8 +145,11 @@ include/show_binlog_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	drop database if exists my_replicated_db
 master-bin.000001	#	Query	#	#	create database my_replicated_db
+master-bin.000001	#	Intvar	#	#	INSERT_ID=83
 master-bin.000001	#	Query	#	#	use `test`; create table my_replicated_db.my_tx_table(a bigint) engine = innodb
+master-bin.000001	#	Intvar	#	#	INSERT_ID=84
 master-bin.000001	#	Query	#	#	use `test`; create table my_replicated_db.my_non_tx_table(a bigint) engine = myisam
+master-bin.000001	#	Intvar	#	#	INSERT_ID=85
 master-bin.000001	#	Query	#	#	use `test`; create table my_replicated_db.my_bh_table(a bigint) engine = blackhole
 master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `marker_start` /* generated by server */
 master-bin.000001	#	Query	#	#	BEGIN

=== modified file 'mysql-test/suite/perfschema/r/binlog_edge_stmt.result'
--- a/mysql-test/suite/perfschema/r/binlog_edge_stmt.result	2012-11-09 09:17:23 +0000
+++ b/mysql-test/suite/perfschema/r/binlog_edge_stmt.result	2012-11-12 08:00:23 +0000
@@ -163,8 +163,11 @@ include/show_binlog_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	drop database if exists my_replicated_db
 master-bin.000001	#	Query	#	#	create database my_replicated_db
+master-bin.000001	#	Intvar	#	#	INSERT_ID=86
 master-bin.000001	#	Query	#	#	use `test`; create table my_replicated_db.my_tx_table(a bigint) engine = innodb
+master-bin.000001	#	Intvar	#	#	INSERT_ID=87
 master-bin.000001	#	Query	#	#	use `test`; create table my_replicated_db.my_non_tx_table(a bigint) engine = myisam
+master-bin.000001	#	Intvar	#	#	INSERT_ID=88
 master-bin.000001	#	Query	#	#	use `test`; create table my_replicated_db.my_bh_table(a bigint) engine = blackhole
 master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `marker_start` /* generated by server */
 master-bin.000001	#	Query	#	#	BEGIN

=== modified file 'mysql-test/suite/perfschema/r/binlog_ok_mix.result'
--- a/mysql-test/suite/perfschema/r/binlog_ok_mix.result	2012-11-08 21:40:31 +0000
+++ b/mysql-test/suite/perfschema/r/binlog_ok_mix.result	2012-11-12 08:00:23 +0000
@@ -108,7 +108,9 @@ Note	1051	Unknown table 'test.marker_end
 drop database my_local_db;
 include/show_binlog_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Intvar	#	#	INSERT_ID=89
 master-bin.000001	#	Query	#	#	use `test`; create table my_local_db.my_tx_table(a bigint) engine = innodb
+master-bin.000001	#	Intvar	#	#	INSERT_ID=90
 master-bin.000001	#	Query	#	#	use `test`; create table my_local_db.my_non_tx_table(a bigint) engine = myisam
 master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `marker_start` /* generated by server */
 master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `marker_truncate` /* generated by server */

=== modified file 'mysql-test/suite/perfschema/r/binlog_ok_stmt.result'
--- a/mysql-test/suite/perfschema/r/binlog_ok_stmt.result	2012-11-08 21:40:31 +0000
+++ b/mysql-test/suite/perfschema/r/binlog_ok_stmt.result	2012-11-12 08:00:23 +0000
@@ -108,7 +108,9 @@ Note	1051	Unknown table 'test.marker_end
 drop database my_local_db;
 include/show_binlog_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Intvar	#	#	INSERT_ID=91
 master-bin.000001	#	Query	#	#	use `test`; create table my_local_db.my_tx_table(a bigint) engine = innodb
+master-bin.000001	#	Intvar	#	#	INSERT_ID=92
 master-bin.000001	#	Query	#	#	use `test`; create table my_local_db.my_non_tx_table(a bigint) engine = myisam
 master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `marker_start` /* generated by server */
 master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `marker_truncate` /* generated by server */

=== modified file 'mysql-test/suite/perfschema/r/myisam_file_io.result'
--- a/mysql-test/suite/perfschema/r/myisam_file_io.result	2012-05-31 15:15:33 +0000
+++ b/mysql-test/suite/perfschema/r/myisam_file_io.result	2012-11-12 08:00:23 +0000
@@ -29,6 +29,11 @@ wait/io/file/myisam/kfile	mi_open.c:	wri
 wait/io/file/myisam/kfile	mi_create.c:	chsize	1024	no_index_tab.MYI
 wait/io/file/myisam/dfile	mi_create.c:	close	NULL	no_index_tab.MYD
 wait/io/file/myisam/kfile	mi_create.c:	close	NULL	no_index_tab.MYI
+wait/io/file/myisam/dfile	mi_dynrec.c:	write	48	
+wait/io/file/myisam/dfile	mi_dynrec.c:	write	24	
+wait/io/file/myisam/dfile	mi_dynrec.c:	write	28	
+wait/io/file/myisam/kfile	mi_open.c:	write	140	
+wait/io/file/myisam/kfile	mi_open.c:	write	124	
 wait/io/file/myisam/kfile	mi_open.c:	open	NULL	no_index_tab.MYI
 wait/io/file/myisam/kfile	mi_open.c:	read	24	no_index_tab.MYI
 wait/io/file/myisam/kfile	mi_open.c:	seek	NULL	no_index_tab.MYI

=== modified file 'mysql-test/suite/perfschema/r/no_threads.result'
--- a/mysql-test/suite/perfschema/r/no_threads.result	2010-11-09 08:16:50 +0000
+++ b/mysql-test/suite/perfschema/r/no_threads.result	2012-11-12 08:00:23 +0000
@@ -29,16 +29,20 @@ select event_name, operation,
 left(source, locate(":", source)) as short_source
 from performance_schema.events_waits_current;
 event_name	operation	short_source
-wait/synch/mutex/mysys/THR_LOCK_myisam	lock	mi_create.c:
+wait/synch/mutex/mysys/THR_LOCK_myisam	lock	mi_open.c:
 select event_name, operation,
 left(source, locate(":", source)) as short_source
 from performance_schema.events_waits_history;
 event_name	operation	short_source
 wait/synch/mutex/mysys/THR_LOCK_myisam	lock	mi_create.c:
+wait/synch/mutex/mysys/THR_LOCK_myisam	lock	mi_open.c:
+wait/synch/mutex/mysys/THR_LOCK_myisam	lock	mi_open.c:
 select event_name, operation,
 left(source, locate(":", source)) as short_source
 from performance_schema.events_waits_history_long;
 event_name	operation	short_source
 wait/synch/mutex/mysys/THR_LOCK_myisam	lock	mi_create.c:
+wait/synch/mutex/mysys/THR_LOCK_myisam	lock	mi_open.c:
+wait/synch/mutex/mysys/THR_LOCK_myisam	lock	mi_open.c:
 update performance_schema.setup_instruments set enabled='YES';
 drop table test.t1;

=== modified file 'mysql-test/suite/perfschema/r/one_thread_per_con.result'
--- a/mysql-test/suite/perfschema/r/one_thread_per_con.result	2010-11-03 15:42:33 +0000
+++ b/mysql-test/suite/perfschema/r/one_thread_per_con.result	2012-11-12 08:00:23 +0000
@@ -17,6 +17,8 @@ create table test.t3(a int) engine=MYISA
 execute stmt_dump_events using @tid;
 event_name	short_source	operation	number_of_bytes
 wait/synch/mutex/mysys/THR_LOCK_myisam	mi_create.c:	lock	NULL
+wait/synch/mutex/mysys/THR_LOCK_myisam	mi_open.c:	lock	NULL
+wait/synch/mutex/mysys/THR_LOCK_myisam	mi_open.c:	lock	NULL
 execute stmt_dump_thread using @tid;
 name
 thread/sql/one_connection

=== modified file 'mysql-test/suite/perfschema/r/pfs_upgrade_event.result'
--- a/mysql-test/suite/perfschema/r/pfs_upgrade_event.result	2012-11-07 12:07:36 +0000
+++ b/mysql-test/suite/perfschema/r/pfs_upgrade_event.result	2012-11-12 08:00:23 +0000
@@ -6,59 +6,59 @@ update mysql.event set db='performance_s
 Warning: Using a password on the command line interface can be insecure.
 Warning: Using a password on the command line interface can be insecure.
 Warning: Using a password on the command line interface can be insecure.
-ERROR 1050 (42S01) at line 156: Table 'cond_instances' already exists
-ERROR 1050 (42S01) at line 181: Table 'events_waits_current' already exists
-ERROR 1050 (42S01) at line 206: Table 'events_waits_history' already exists
-ERROR 1050 (42S01) at line 231: Table 'events_waits_history_long' already exists
-ERROR 1050 (42S01) at line 244: Table 'events_waits_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 257: Table 'events_waits_summary_by_host_by_event_name' already exists
-ERROR 1050 (42S01) at line 270: Table 'events_waits_summary_by_user_by_event_name' already exists
-ERROR 1050 (42S01) at line 284: Table 'events_waits_summary_by_account_by_event_name' already exists
-ERROR 1050 (42S01) at line 297: Table 'events_waits_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 309: Table 'events_waits_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 318: Table 'file_instances' already exists
-ERROR 1050 (42S01) at line 347: Table 'file_summary_by_event_name' already exists
-ERROR 1050 (42S01) at line 378: Table 'file_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 391: Table 'socket_instances' already exists
-ERROR 1050 (42S01) at line 421: Table 'socket_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 450: Table 'socket_summary_by_event_name' already exists
-ERROR 1050 (42S01) at line 485: Table 'host_cache' already exists
-ERROR 1050 (42S01) at line 494: Table 'mutex_instances' already exists
-ERROR 1050 (42S01) at line 508: Table 'objects_summary_global_by_type' already exists
-ERROR 1050 (42S01) at line 518: Table 'performance_timers' already exists
-ERROR 1050 (42S01) at line 528: Table 'rwlock_instances' already exists
-ERROR 1050 (42S01) at line 537: Table 'setup_actors' already exists
-ERROR 1050 (42S01) at line 545: Table 'setup_consumers' already exists
-ERROR 1050 (42S01) at line 554: Table 'setup_instruments' already exists
-ERROR 1050 (42S01) at line 565: Table 'setup_objects' already exists
-ERROR 1050 (42S01) at line 573: Table 'setup_timers' already exists
-ERROR 1050 (42S01) at line 618: Table 'table_io_waits_summary_by_index_usage' already exists
-ERROR 1050 (42S01) at line 662: Table 'table_io_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 736: Table 'table_lock_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 756: Table 'threads' already exists
-ERROR 1050 (42S01) at line 772: Table 'events_stages_current' already exists
-ERROR 1050 (42S01) at line 788: Table 'events_stages_history' already exists
-ERROR 1050 (42S01) at line 804: Table 'events_stages_history_long' already exists
-ERROR 1050 (42S01) at line 817: Table 'events_stages_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 830: Table 'events_stages_summary_by_host_by_event_name' already exists
-ERROR 1050 (42S01) at line 843: Table 'events_stages_summary_by_user_by_event_name' already exists
-ERROR 1050 (42S01) at line 857: Table 'events_stages_summary_by_account_by_event_name' already exists
-ERROR 1050 (42S01) at line 869: Table 'events_stages_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 915: Table 'events_statements_current' already exists
-ERROR 1050 (42S01) at line 961: Table 'events_statements_history' already exists
-ERROR 1050 (42S01) at line 1007: Table 'events_statements_history_long' already exists
-ERROR 1050 (42S01) at line 1039: Table 'events_statements_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 1071: Table 'events_statements_summary_by_host_by_event_name' already exists
-ERROR 1050 (42S01) at line 1103: Table 'events_statements_summary_by_user_by_event_name' already exists
-ERROR 1050 (42S01) at line 1136: Table 'events_statements_summary_by_account_by_event_name' already exists
-ERROR 1050 (42S01) at line 1167: Table 'events_statements_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 1176: Table 'hosts' already exists
-ERROR 1050 (42S01) at line 1185: Table 'users' already exists
-ERROR 1050 (42S01) at line 1195: Table 'accounts' already exists
-ERROR 1050 (42S01) at line 1230: Table 'events_statements_summary_by_digest' already exists
-ERROR 1050 (42S01) at line 1240: Table 'session_connect_attrs' already exists
-ERROR 1050 (42S01) at line 1246: Table 'session_account_connect_attrs' already exists
-ERROR 1644 (HY000) at line 1983: Unexpected content found in the performance_schema database.
+ERROR 1050 (42S01) at line 160: Table 'cond_instances' already exists
+ERROR 1050 (42S01) at line 185: Table 'events_waits_current' already exists
+ERROR 1050 (42S01) at line 210: Table 'events_waits_history' already exists
+ERROR 1050 (42S01) at line 235: Table 'events_waits_history_long' already exists
+ERROR 1050 (42S01) at line 248: Table 'events_waits_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 261: Table 'events_waits_summary_by_host_by_event_name' already exists
+ERROR 1050 (42S01) at line 274: Table 'events_waits_summary_by_user_by_event_name' already exists
+ERROR 1050 (42S01) at line 288: Table 'events_waits_summary_by_account_by_event_name' already exists
+ERROR 1050 (42S01) at line 301: Table 'events_waits_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 313: Table 'events_waits_summary_global_by_event_name' already exists
+ERROR 1050 (42S01) at line 322: Table 'file_instances' already exists
+ERROR 1050 (42S01) at line 351: Table 'file_summary_by_event_name' already exists
+ERROR 1050 (42S01) at line 382: Table 'file_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 395: Table 'socket_instances' already exists
+ERROR 1050 (42S01) at line 425: Table 'socket_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 454: Table 'socket_summary_by_event_name' already exists
+ERROR 1050 (42S01) at line 489: Table 'host_cache' already exists
+ERROR 1050 (42S01) at line 498: Table 'mutex_instances' already exists
+ERROR 1050 (42S01) at line 512: Table 'objects_summary_global_by_type' already exists
+ERROR 1050 (42S01) at line 522: Table 'performance_timers' already exists
+ERROR 1050 (42S01) at line 532: Table 'rwlock_instances' already exists
+ERROR 1050 (42S01) at line 541: Table 'setup_actors' already exists
+ERROR 1050 (42S01) at line 549: Table 'setup_consumers' already exists
+ERROR 1050 (42S01) at line 558: Table 'setup_instruments' already exists
+ERROR 1050 (42S01) at line 569: Table 'setup_objects' already exists
+ERROR 1050 (42S01) at line 577: Table 'setup_timers' already exists
+ERROR 1050 (42S01) at line 622: Table 'table_io_waits_summary_by_index_usage' already exists
+ERROR 1050 (42S01) at line 666: Table 'table_io_waits_summary_by_table' already exists
+ERROR 1050 (42S01) at line 740: Table 'table_lock_waits_summary_by_table' already exists
+ERROR 1050 (42S01) at line 760: Table 'threads' already exists
+ERROR 1050 (42S01) at line 776: Table 'events_stages_current' already exists
+ERROR 1050 (42S01) at line 792: Table 'events_stages_history' already exists
+ERROR 1050 (42S01) at line 808: Table 'events_stages_history_long' already exists
+ERROR 1050 (42S01) at line 821: Table 'events_stages_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 834: Table 'events_stages_summary_by_host_by_event_name' already exists
+ERROR 1050 (42S01) at line 847: Table 'events_stages_summary_by_user_by_event_name' already exists
+ERROR 1050 (42S01) at line 861: Table 'events_stages_summary_by_account_by_event_name' already exists
+ERROR 1050 (42S01) at line 873: Table 'events_stages_summary_global_by_event_name' already exists
+ERROR 1050 (42S01) at line 919: Table 'events_statements_current' already exists
+ERROR 1050 (42S01) at line 965: Table 'events_statements_history' already exists
+ERROR 1050 (42S01) at line 1011: Table 'events_statements_history_long' already exists
+ERROR 1050 (42S01) at line 1043: Table 'events_statements_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 1075: Table 'events_statements_summary_by_host_by_event_name' already exists
+ERROR 1050 (42S01) at line 1107: Table 'events_statements_summary_by_user_by_event_name' already exists
+ERROR 1050 (42S01) at line 1140: Table 'events_statements_summary_by_account_by_event_name' already exists
+ERROR 1050 (42S01) at line 1171: Table 'events_statements_summary_global_by_event_name' already exists
+ERROR 1050 (42S01) at line 1180: Table 'hosts' already exists
+ERROR 1050 (42S01) at line 1189: Table 'users' already exists
+ERROR 1050 (42S01) at line 1199: Table 'accounts' already exists
+ERROR 1050 (42S01) at line 1234: Table 'events_statements_summary_by_digest' already exists
+ERROR 1050 (42S01) at line 1244: Table 'session_connect_attrs' already exists
+ERROR 1050 (42S01) at line 1250: Table 'session_account_connect_attrs' already exists
+ERROR 1644 (HY000) at line 1987: Unexpected content found in the performance_schema database.
 FATAL ERROR: Upgrade failed
 select name from mysql.event where db='performance_schema';
 name

=== modified file 'mysql-test/suite/perfschema/r/pfs_upgrade_func.result'
--- a/mysql-test/suite/perfschema/r/pfs_upgrade_func.result	2012-11-07 12:07:36 +0000
+++ b/mysql-test/suite/perfschema/r/pfs_upgrade_func.result	2012-11-12 08:00:23 +0000
@@ -6,59 +6,59 @@ update mysql.proc set db='performance_sc
 Warning: Using a password on the command line interface can be insecure.
 Warning: Using a password on the command line interface can be insecure.
 Warning: Using a password on the command line interface can be insecure.
-ERROR 1050 (42S01) at line 156: Table 'cond_instances' already exists
-ERROR 1050 (42S01) at line 181: Table 'events_waits_current' already exists
-ERROR 1050 (42S01) at line 206: Table 'events_waits_history' already exists
-ERROR 1050 (42S01) at line 231: Table 'events_waits_history_long' already exists
-ERROR 1050 (42S01) at line 244: Table 'events_waits_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 257: Table 'events_waits_summary_by_host_by_event_name' already exists
-ERROR 1050 (42S01) at line 270: Table 'events_waits_summary_by_user_by_event_name' already exists
-ERROR 1050 (42S01) at line 284: Table 'events_waits_summary_by_account_by_event_name' already exists
-ERROR 1050 (42S01) at line 297: Table 'events_waits_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 309: Table 'events_waits_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 318: Table 'file_instances' already exists
-ERROR 1050 (42S01) at line 347: Table 'file_summary_by_event_name' already exists
-ERROR 1050 (42S01) at line 378: Table 'file_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 391: Table 'socket_instances' already exists
-ERROR 1050 (42S01) at line 421: Table 'socket_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 450: Table 'socket_summary_by_event_name' already exists
-ERROR 1050 (42S01) at line 485: Table 'host_cache' already exists
-ERROR 1050 (42S01) at line 494: Table 'mutex_instances' already exists
-ERROR 1050 (42S01) at line 508: Table 'objects_summary_global_by_type' already exists
-ERROR 1050 (42S01) at line 518: Table 'performance_timers' already exists
-ERROR 1050 (42S01) at line 528: Table 'rwlock_instances' already exists
-ERROR 1050 (42S01) at line 537: Table 'setup_actors' already exists
-ERROR 1050 (42S01) at line 545: Table 'setup_consumers' already exists
-ERROR 1050 (42S01) at line 554: Table 'setup_instruments' already exists
-ERROR 1050 (42S01) at line 565: Table 'setup_objects' already exists
-ERROR 1050 (42S01) at line 573: Table 'setup_timers' already exists
-ERROR 1050 (42S01) at line 618: Table 'table_io_waits_summary_by_index_usage' already exists
-ERROR 1050 (42S01) at line 662: Table 'table_io_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 736: Table 'table_lock_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 756: Table 'threads' already exists
-ERROR 1050 (42S01) at line 772: Table 'events_stages_current' already exists
-ERROR 1050 (42S01) at line 788: Table 'events_stages_history' already exists
-ERROR 1050 (42S01) at line 804: Table 'events_stages_history_long' already exists
-ERROR 1050 (42S01) at line 817: Table 'events_stages_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 830: Table 'events_stages_summary_by_host_by_event_name' already exists
-ERROR 1050 (42S01) at line 843: Table 'events_stages_summary_by_user_by_event_name' already exists
-ERROR 1050 (42S01) at line 857: Table 'events_stages_summary_by_account_by_event_name' already exists
-ERROR 1050 (42S01) at line 869: Table 'events_stages_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 915: Table 'events_statements_current' already exists
-ERROR 1050 (42S01) at line 961: Table 'events_statements_history' already exists
-ERROR 1050 (42S01) at line 1007: Table 'events_statements_history_long' already exists
-ERROR 1050 (42S01) at line 1039: Table 'events_statements_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 1071: Table 'events_statements_summary_by_host_by_event_name' already exists
-ERROR 1050 (42S01) at line 1103: Table 'events_statements_summary_by_user_by_event_name' already exists
-ERROR 1050 (42S01) at line 1136: Table 'events_statements_summary_by_account_by_event_name' already exists
-ERROR 1050 (42S01) at line 1167: Table 'events_statements_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 1176: Table 'hosts' already exists
-ERROR 1050 (42S01) at line 1185: Table 'users' already exists
-ERROR 1050 (42S01) at line 1195: Table 'accounts' already exists
-ERROR 1050 (42S01) at line 1230: Table 'events_statements_summary_by_digest' already exists
-ERROR 1050 (42S01) at line 1240: Table 'session_connect_attrs' already exists
-ERROR 1050 (42S01) at line 1246: Table 'session_account_connect_attrs' already exists
-ERROR 1644 (HY000) at line 1983: Unexpected content found in the performance_schema database.
+ERROR 1050 (42S01) at line 160: Table 'cond_instances' already exists
+ERROR 1050 (42S01) at line 185: Table 'events_waits_current' already exists
+ERROR 1050 (42S01) at line 210: Table 'events_waits_history' already exists
+ERROR 1050 (42S01) at line 235: Table 'events_waits_history_long' already exists
+ERROR 1050 (42S01) at line 248: Table 'events_waits_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 261: Table 'events_waits_summary_by_host_by_event_name' already exists
+ERROR 1050 (42S01) at line 274: Table 'events_waits_summary_by_user_by_event_name' already exists
+ERROR 1050 (42S01) at line 288: Table 'events_waits_summary_by_account_by_event_name' already exists
+ERROR 1050 (42S01) at line 301: Table 'events_waits_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 313: Table 'events_waits_summary_global_by_event_name' already exists
+ERROR 1050 (42S01) at line 322: Table 'file_instances' already exists
+ERROR 1050 (42S01) at line 351: Table 'file_summary_by_event_name' already exists
+ERROR 1050 (42S01) at line 382: Table 'file_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 395: Table 'socket_instances' already exists
+ERROR 1050 (42S01) at line 425: Table 'socket_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 454: Table 'socket_summary_by_event_name' already exists
+ERROR 1050 (42S01) at line 489: Table 'host_cache' already exists
+ERROR 1050 (42S01) at line 498: Table 'mutex_instances' already exists
+ERROR 1050 (42S01) at line 512: Table 'objects_summary_global_by_type' already exists
+ERROR 1050 (42S01) at line 522: Table 'performance_timers' already exists
+ERROR 1050 (42S01) at line 532: Table 'rwlock_instances' already exists
+ERROR 1050 (42S01) at line 541: Table 'setup_actors' already exists
+ERROR 1050 (42S01) at line 549: Table 'setup_consumers' already exists
+ERROR 1050 (42S01) at line 558: Table 'setup_instruments' already exists
+ERROR 1050 (42S01) at line 569: Table 'setup_objects' already exists
+ERROR 1050 (42S01) at line 577: Table 'setup_timers' already exists
+ERROR 1050 (42S01) at line 622: Table 'table_io_waits_summary_by_index_usage' already exists
+ERROR 1050 (42S01) at line 666: Table 'table_io_waits_summary_by_table' already exists
+ERROR 1050 (42S01) at line 740: Table 'table_lock_waits_summary_by_table' already exists
+ERROR 1050 (42S01) at line 760: Table 'threads' already exists
+ERROR 1050 (42S01) at line 776: Table 'events_stages_current' already exists
+ERROR 1050 (42S01) at line 792: Table 'events_stages_history' already exists
+ERROR 1050 (42S01) at line 808: Table 'events_stages_history_long' already exists
+ERROR 1050 (42S01) at line 821: Table 'events_stages_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 834: Table 'events_stages_summary_by_host_by_event_name' already exists
+ERROR 1050 (42S01) at line 847: Table 'events_stages_summary_by_user_by_event_name' already exists
+ERROR 1050 (42S01) at line 861: Table 'events_stages_summary_by_account_by_event_name' already exists
+ERROR 1050 (42S01) at line 873: Table 'events_stages_summary_global_by_event_name' already exists
+ERROR 1050 (42S01) at line 919: Table 'events_statements_current' already exists
+ERROR 1050 (42S01) at line 965: Table 'events_statements_history' already exists
+ERROR 1050 (42S01) at line 1011: Table 'events_statements_history_long' already exists
+ERROR 1050 (42S01) at line 1043: Table 'events_statements_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 1075: Table 'events_statements_summary_by_host_by_event_name' already exists
+ERROR 1050 (42S01) at line 1107: Table 'events_statements_summary_by_user_by_event_name' already exists
+ERROR 1050 (42S01) at line 1140: Table 'events_statements_summary_by_account_by_event_name' already exists
+ERROR 1050 (42S01) at line 1171: Table 'events_statements_summary_global_by_event_name' already exists
+ERROR 1050 (42S01) at line 1180: Table 'hosts' already exists
+ERROR 1050 (42S01) at line 1189: Table 'users' already exists
+ERROR 1050 (42S01) at line 1199: Table 'accounts' already exists
+ERROR 1050 (42S01) at line 1234: Table 'events_statements_summary_by_digest' already exists
+ERROR 1050 (42S01) at line 1244: Table 'session_connect_attrs' already exists
+ERROR 1050 (42S01) at line 1250: Table 'session_account_connect_attrs' already exists
+ERROR 1644 (HY000) at line 1987: Unexpected content found in the performance_schema database.
 FATAL ERROR: Upgrade failed
 select name from mysql.proc where db='performance_schema';
 name

=== modified file 'mysql-test/suite/perfschema/r/pfs_upgrade_proc.result'
--- a/mysql-test/suite/perfschema/r/pfs_upgrade_proc.result	2012-11-07 12:07:36 +0000
+++ b/mysql-test/suite/perfschema/r/pfs_upgrade_proc.result	2012-11-12 08:00:23 +0000
@@ -6,59 +6,59 @@ update mysql.proc set db='performance_sc
 Warning: Using a password on the command line interface can be insecure.
 Warning: Using a password on the command line interface can be insecure.
 Warning: Using a password on the command line interface can be insecure.
-ERROR 1050 (42S01) at line 156: Table 'cond_instances' already exists
-ERROR 1050 (42S01) at line 181: Table 'events_waits_current' already exists
-ERROR 1050 (42S01) at line 206: Table 'events_waits_history' already exists
-ERROR 1050 (42S01) at line 231: Table 'events_waits_history_long' already exists
-ERROR 1050 (42S01) at line 244: Table 'events_waits_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 257: Table 'events_waits_summary_by_host_by_event_name' already exists
-ERROR 1050 (42S01) at line 270: Table 'events_waits_summary_by_user_by_event_name' already exists
-ERROR 1050 (42S01) at line 284: Table 'events_waits_summary_by_account_by_event_name' already exists
-ERROR 1050 (42S01) at line 297: Table 'events_waits_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 309: Table 'events_waits_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 318: Table 'file_instances' already exists
-ERROR 1050 (42S01) at line 347: Table 'file_summary_by_event_name' already exists
-ERROR 1050 (42S01) at line 378: Table 'file_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 391: Table 'socket_instances' already exists
-ERROR 1050 (42S01) at line 421: Table 'socket_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 450: Table 'socket_summary_by_event_name' already exists
-ERROR 1050 (42S01) at line 485: Table 'host_cache' already exists
-ERROR 1050 (42S01) at line 494: Table 'mutex_instances' already exists
-ERROR 1050 (42S01) at line 508: Table 'objects_summary_global_by_type' already exists
-ERROR 1050 (42S01) at line 518: Table 'performance_timers' already exists
-ERROR 1050 (42S01) at line 528: Table 'rwlock_instances' already exists
-ERROR 1050 (42S01) at line 537: Table 'setup_actors' already exists
-ERROR 1050 (42S01) at line 545: Table 'setup_consumers' already exists
-ERROR 1050 (42S01) at line 554: Table 'setup_instruments' already exists
-ERROR 1050 (42S01) at line 565: Table 'setup_objects' already exists
-ERROR 1050 (42S01) at line 573: Table 'setup_timers' already exists
-ERROR 1050 (42S01) at line 618: Table 'table_io_waits_summary_by_index_usage' already exists
-ERROR 1050 (42S01) at line 662: Table 'table_io_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 736: Table 'table_lock_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 756: Table 'threads' already exists
-ERROR 1050 (42S01) at line 772: Table 'events_stages_current' already exists
-ERROR 1050 (42S01) at line 788: Table 'events_stages_history' already exists
-ERROR 1050 (42S01) at line 804: Table 'events_stages_history_long' already exists
-ERROR 1050 (42S01) at line 817: Table 'events_stages_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 830: Table 'events_stages_summary_by_host_by_event_name' already exists
-ERROR 1050 (42S01) at line 843: Table 'events_stages_summary_by_user_by_event_name' already exists
-ERROR 1050 (42S01) at line 857: Table 'events_stages_summary_by_account_by_event_name' already exists
-ERROR 1050 (42S01) at line 869: Table 'events_stages_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 915: Table 'events_statements_current' already exists
-ERROR 1050 (42S01) at line 961: Table 'events_statements_history' already exists
-ERROR 1050 (42S01) at line 1007: Table 'events_statements_history_long' already exists
-ERROR 1050 (42S01) at line 1039: Table 'events_statements_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 1071: Table 'events_statements_summary_by_host_by_event_name' already exists
-ERROR 1050 (42S01) at line 1103: Table 'events_statements_summary_by_user_by_event_name' already exists
-ERROR 1050 (42S01) at line 1136: Table 'events_statements_summary_by_account_by_event_name' already exists
-ERROR 1050 (42S01) at line 1167: Table 'events_statements_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 1176: Table 'hosts' already exists
-ERROR 1050 (42S01) at line 1185: Table 'users' already exists
-ERROR 1050 (42S01) at line 1195: Table 'accounts' already exists
-ERROR 1050 (42S01) at line 1230: Table 'events_statements_summary_by_digest' already exists
-ERROR 1050 (42S01) at line 1240: Table 'session_connect_attrs' already exists
-ERROR 1050 (42S01) at line 1246: Table 'session_account_connect_attrs' already exists
-ERROR 1644 (HY000) at line 1983: Unexpected content found in the performance_schema database.
+ERROR 1050 (42S01) at line 160: Table 'cond_instances' already exists
+ERROR 1050 (42S01) at line 185: Table 'events_waits_current' already exists
+ERROR 1050 (42S01) at line 210: Table 'events_waits_history' already exists
+ERROR 1050 (42S01) at line 235: Table 'events_waits_history_long' already exists
+ERROR 1050 (42S01) at line 248: Table 'events_waits_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 261: Table 'events_waits_summary_by_host_by_event_name' already exists
+ERROR 1050 (42S01) at line 274: Table 'events_waits_summary_by_user_by_event_name' already exists
+ERROR 1050 (42S01) at line 288: Table 'events_waits_summary_by_account_by_event_name' already exists
+ERROR 1050 (42S01) at line 301: Table 'events_waits_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 313: Table 'events_waits_summary_global_by_event_name' already exists
+ERROR 1050 (42S01) at line 322: Table 'file_instances' already exists
+ERROR 1050 (42S01) at line 351: Table 'file_summary_by_event_name' already exists
+ERROR 1050 (42S01) at line 382: Table 'file_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 395: Table 'socket_instances' already exists
+ERROR 1050 (42S01) at line 425: Table 'socket_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 454: Table 'socket_summary_by_event_name' already exists
+ERROR 1050 (42S01) at line 489: Table 'host_cache' already exists
+ERROR 1050 (42S01) at line 498: Table 'mutex_instances' already exists
+ERROR 1050 (42S01) at line 512: Table 'objects_summary_global_by_type' already exists
+ERROR 1050 (42S01) at line 522: Table 'performance_timers' already exists
+ERROR 1050 (42S01) at line 532: Table 'rwlock_instances' already exists
+ERROR 1050 (42S01) at line 541: Table 'setup_actors' already exists
+ERROR 1050 (42S01) at line 549: Table 'setup_consumers' already exists
+ERROR 1050 (42S01) at line 558: Table 'setup_instruments' already exists
+ERROR 1050 (42S01) at line 569: Table 'setup_objects' already exists
+ERROR 1050 (42S01) at line 577: Table 'setup_timers' already exists
+ERROR 1050 (42S01) at line 622: Table 'table_io_waits_summary_by_index_usage' already exists
+ERROR 1050 (42S01) at line 666: Table 'table_io_waits_summary_by_table' already exists
+ERROR 1050 (42S01) at line 740: Table 'table_lock_waits_summary_by_table' already exists
+ERROR 1050 (42S01) at line 760: Table 'threads' already exists
+ERROR 1050 (42S01) at line 776: Table 'events_stages_current' already exists
+ERROR 1050 (42S01) at line 792: Table 'events_stages_history' already exists
+ERROR 1050 (42S01) at line 808: Table 'events_stages_history_long' already exists
+ERROR 1050 (42S01) at line 821: Table 'events_stages_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 834: Table 'events_stages_summary_by_host_by_event_name' already exists
+ERROR 1050 (42S01) at line 847: Table 'events_stages_summary_by_user_by_event_name' already exists
+ERROR 1050 (42S01) at line 861: Table 'events_stages_summary_by_account_by_event_name' already exists
+ERROR 1050 (42S01) at line 873: Table 'events_stages_summary_global_by_event_name' already exists
+ERROR 1050 (42S01) at line 919: Table 'events_statements_current' already exists
+ERROR 1050 (42S01) at line 965: Table 'events_statements_history' already exists
+ERROR 1050 (42S01) at line 1011: Table 'events_statements_history_long' already exists
+ERROR 1050 (42S01) at line 1043: Table 'events_statements_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 1075: Table 'events_statements_summary_by_host_by_event_name' already exists
+ERROR 1050 (42S01) at line 1107: Table 'events_statements_summary_by_user_by_event_name' already exists
+ERROR 1050 (42S01) at line 1140: Table 'events_statements_summary_by_account_by_event_name' already exists
+ERROR 1050 (42S01) at line 1171: Table 'events_statements_summary_global_by_event_name' already exists
+ERROR 1050 (42S01) at line 1180: Table 'hosts' already exists
+ERROR 1050 (42S01) at line 1189: Table 'users' already exists
+ERROR 1050 (42S01) at line 1199: Table 'accounts' already exists
+ERROR 1050 (42S01) at line 1234: Table 'events_statements_summary_by_digest' already exists
+ERROR 1050 (42S01) at line 1244: Table 'session_connect_attrs' already exists
+ERROR 1050 (42S01) at line 1250: Table 'session_account_connect_attrs' already exists
+ERROR 1644 (HY000) at line 1987: Unexpected content found in the performance_schema database.
 FATAL ERROR: Upgrade failed
 select name from mysql.proc where db='performance_schema';
 name

=== modified file 'mysql-test/suite/perfschema/r/pfs_upgrade_table.result'
--- a/mysql-test/suite/perfschema/r/pfs_upgrade_table.result	2012-11-07 12:07:36 +0000
+++ b/mysql-test/suite/perfschema/r/pfs_upgrade_table.result	2012-11-12 08:00:23 +0000
@@ -8,59 +8,59 @@ user_table
 Warning: Using a password on the command line interface can be insecure.
 Warning: Using a password on the command line interface can be insecure.
 Warning: Using a password on the command line interface can be insecure.
-ERROR 1050 (42S01) at line 156: Table 'cond_instances' already exists
-ERROR 1050 (42S01) at line 181: Table 'events_waits_current' already exists
-ERROR 1050 (42S01) at line 206: Table 'events_waits_history' already exists
-ERROR 1050 (42S01) at line 231: Table 'events_waits_history_long' already exists
-ERROR 1050 (42S01) at line 244: Table 'events_waits_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 257: Table 'events_waits_summary_by_host_by_event_name' already exists
-ERROR 1050 (42S01) at line 270: Table 'events_waits_summary_by_user_by_event_name' already exists
-ERROR 1050 (42S01) at line 284: Table 'events_waits_summary_by_account_by_event_name' already exists
-ERROR 1050 (42S01) at line 297: Table 'events_waits_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 309: Table 'events_waits_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 318: Table 'file_instances' already exists
-ERROR 1050 (42S01) at line 347: Table 'file_summary_by_event_name' already exists
-ERROR 1050 (42S01) at line 378: Table 'file_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 391: Table 'socket_instances' already exists
-ERROR 1050 (42S01) at line 421: Table 'socket_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 450: Table 'socket_summary_by_event_name' already exists
-ERROR 1050 (42S01) at line 485: Table 'host_cache' already exists
-ERROR 1050 (42S01) at line 494: Table 'mutex_instances' already exists
-ERROR 1050 (42S01) at line 508: Table 'objects_summary_global_by_type' already exists
-ERROR 1050 (42S01) at line 518: Table 'performance_timers' already exists
-ERROR 1050 (42S01) at line 528: Table 'rwlock_instances' already exists
-ERROR 1050 (42S01) at line 537: Table 'setup_actors' already exists
-ERROR 1050 (42S01) at line 545: Table 'setup_consumers' already exists
-ERROR 1050 (42S01) at line 554: Table 'setup_instruments' already exists
-ERROR 1050 (42S01) at line 565: Table 'setup_objects' already exists
-ERROR 1050 (42S01) at line 573: Table 'setup_timers' already exists
-ERROR 1050 (42S01) at line 618: Table 'table_io_waits_summary_by_index_usage' already exists
-ERROR 1050 (42S01) at line 662: Table 'table_io_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 736: Table 'table_lock_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 756: Table 'threads' already exists
-ERROR 1050 (42S01) at line 772: Table 'events_stages_current' already exists
-ERROR 1050 (42S01) at line 788: Table 'events_stages_history' already exists
-ERROR 1050 (42S01) at line 804: Table 'events_stages_history_long' already exists
-ERROR 1050 (42S01) at line 817: Table 'events_stages_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 830: Table 'events_stages_summary_by_host_by_event_name' already exists
-ERROR 1050 (42S01) at line 843: Table 'events_stages_summary_by_user_by_event_name' already exists
-ERROR 1050 (42S01) at line 857: Table 'events_stages_summary_by_account_by_event_name' already exists
-ERROR 1050 (42S01) at line 869: Table 'events_stages_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 915: Table 'events_statements_current' already exists
-ERROR 1050 (42S01) at line 961: Table 'events_statements_history' already exists
-ERROR 1050 (42S01) at line 1007: Table 'events_statements_history_long' already exists
-ERROR 1050 (42S01) at line 1039: Table 'events_statements_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 1071: Table 'events_statements_summary_by_host_by_event_name' already exists
-ERROR 1050 (42S01) at line 1103: Table 'events_statements_summary_by_user_by_event_name' already exists
-ERROR 1050 (42S01) at line 1136: Table 'events_statements_summary_by_account_by_event_name' already exists
-ERROR 1050 (42S01) at line 1167: Table 'events_statements_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 1176: Table 'hosts' already exists
-ERROR 1050 (42S01) at line 1185: Table 'users' already exists
-ERROR 1050 (42S01) at line 1195: Table 'accounts' already exists
-ERROR 1050 (42S01) at line 1230: Table 'events_statements_summary_by_digest' already exists
-ERROR 1050 (42S01) at line 1240: Table 'session_connect_attrs' already exists
-ERROR 1050 (42S01) at line 1246: Table 'session_account_connect_attrs' already exists
-ERROR 1644 (HY000) at line 1983: Unexpected content found in the performance_schema database.
+ERROR 1050 (42S01) at line 160: Table 'cond_instances' already exists
+ERROR 1050 (42S01) at line 185: Table 'events_waits_current' already exists
+ERROR 1050 (42S01) at line 210: Table 'events_waits_history' already exists
+ERROR 1050 (42S01) at line 235: Table 'events_waits_history_long' already exists
+ERROR 1050 (42S01) at line 248: Table 'events_waits_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 261: Table 'events_waits_summary_by_host_by_event_name' already exists
+ERROR 1050 (42S01) at line 274: Table 'events_waits_summary_by_user_by_event_name' already exists
+ERROR 1050 (42S01) at line 288: Table 'events_waits_summary_by_account_by_event_name' already exists
+ERROR 1050 (42S01) at line 301: Table 'events_waits_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 313: Table 'events_waits_summary_global_by_event_name' already exists
+ERROR 1050 (42S01) at line 322: Table 'file_instances' already exists
+ERROR 1050 (42S01) at line 351: Table 'file_summary_by_event_name' already exists
+ERROR 1050 (42S01) at line 382: Table 'file_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 395: Table 'socket_instances' already exists
+ERROR 1050 (42S01) at line 425: Table 'socket_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 454: Table 'socket_summary_by_event_name' already exists
+ERROR 1050 (42S01) at line 489: Table 'host_cache' already exists
+ERROR 1050 (42S01) at line 498: Table 'mutex_instances' already exists
+ERROR 1050 (42S01) at line 512: Table 'objects_summary_global_by_type' already exists
+ERROR 1050 (42S01) at line 522: Table 'performance_timers' already exists
+ERROR 1050 (42S01) at line 532: Table 'rwlock_instances' already exists
+ERROR 1050 (42S01) at line 541: Table 'setup_actors' already exists
+ERROR 1050 (42S01) at line 549: Table 'setup_consumers' already exists
+ERROR 1050 (42S01) at line 558: Table 'setup_instruments' already exists
+ERROR 1050 (42S01) at line 569: Table 'setup_objects' already exists
+ERROR 1050 (42S01) at line 577: Table 'setup_timers' already exists
+ERROR 1050 (42S01) at line 622: Table 'table_io_waits_summary_by_index_usage' already exists
+ERROR 1050 (42S01) at line 666: Table 'table_io_waits_summary_by_table' already exists
+ERROR 1050 (42S01) at line 740: Table 'table_lock_waits_summary_by_table' already exists
+ERROR 1050 (42S01) at line 760: Table 'threads' already exists
+ERROR 1050 (42S01) at line 776: Table 'events_stages_current' already exists
+ERROR 1050 (42S01) at line 792: Table 'events_stages_history' already exists
+ERROR 1050 (42S01) at line 808: Table 'events_stages_history_long' already exists
+ERROR 1050 (42S01) at line 821: Table 'events_stages_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 834: Table 'events_stages_summary_by_host_by_event_name' already exists
+ERROR 1050 (42S01) at line 847: Table 'events_stages_summary_by_user_by_event_name' already exists
+ERROR 1050 (42S01) at line 861: Table 'events_stages_summary_by_account_by_event_name' already exists
+ERROR 1050 (42S01) at line 873: Table 'events_stages_summary_global_by_event_name' already exists
+ERROR 1050 (42S01) at line 919: Table 'events_statements_current' already exists
+ERROR 1050 (42S01) at line 965: Table 'events_statements_history' already exists
+ERROR 1050 (42S01) at line 1011: Table 'events_statements_history_long' already exists
+ERROR 1050 (42S01) at line 1043: Table 'events_statements_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 1075: Table 'events_statements_summary_by_host_by_event_name' already exists
+ERROR 1050 (42S01) at line 1107: Table 'events_statements_summary_by_user_by_event_name' already exists
+ERROR 1050 (42S01) at line 1140: Table 'events_statements_summary_by_account_by_event_name' already exists
+ERROR 1050 (42S01) at line 1171: Table 'events_statements_summary_global_by_event_name' already exists
+ERROR 1050 (42S01) at line 1180: Table 'hosts' already exists
+ERROR 1050 (42S01) at line 1189: Table 'users' already exists
+ERROR 1050 (42S01) at line 1199: Table 'accounts' already exists
+ERROR 1050 (42S01) at line 1234: Table 'events_statements_summary_by_digest' already exists
+ERROR 1050 (42S01) at line 1244: Table 'session_connect_attrs' already exists
+ERROR 1050 (42S01) at line 1250: Table 'session_account_connect_attrs' already exists
+ERROR 1644 (HY000) at line 1987: Unexpected content found in the performance_schema database.
 FATAL ERROR: Upgrade failed
 show tables like "user_table";
 Tables_in_performance_schema (user_table)

=== modified file 'mysql-test/suite/perfschema/r/pfs_upgrade_view.result'
--- a/mysql-test/suite/perfschema/r/pfs_upgrade_view.result	2012-11-07 12:07:36 +0000
+++ b/mysql-test/suite/perfschema/r/pfs_upgrade_view.result	2012-11-12 08:00:23 +0000
@@ -8,59 +8,59 @@ user_view
 Warning: Using a password on the command line interface can be insecure.
 Warning: Using a password on the command line interface can be insecure.
 Warning: Using a password on the command line interface can be insecure.
-ERROR 1050 (42S01) at line 156: Table 'cond_instances' already exists
-ERROR 1050 (42S01) at line 181: Table 'events_waits_current' already exists
-ERROR 1050 (42S01) at line 206: Table 'events_waits_history' already exists
-ERROR 1050 (42S01) at line 231: Table 'events_waits_history_long' already exists
-ERROR 1050 (42S01) at line 244: Table 'events_waits_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 257: Table 'events_waits_summary_by_host_by_event_name' already exists
-ERROR 1050 (42S01) at line 270: Table 'events_waits_summary_by_user_by_event_name' already exists
-ERROR 1050 (42S01) at line 284: Table 'events_waits_summary_by_account_by_event_name' already exists
-ERROR 1050 (42S01) at line 297: Table 'events_waits_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 309: Table 'events_waits_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 318: Table 'file_instances' already exists
-ERROR 1050 (42S01) at line 347: Table 'file_summary_by_event_name' already exists
-ERROR 1050 (42S01) at line 378: Table 'file_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 391: Table 'socket_instances' already exists
-ERROR 1050 (42S01) at line 421: Table 'socket_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 450: Table 'socket_summary_by_event_name' already exists
-ERROR 1050 (42S01) at line 485: Table 'host_cache' already exists
-ERROR 1050 (42S01) at line 494: Table 'mutex_instances' already exists
-ERROR 1050 (42S01) at line 508: Table 'objects_summary_global_by_type' already exists
-ERROR 1050 (42S01) at line 518: Table 'performance_timers' already exists
-ERROR 1050 (42S01) at line 528: Table 'rwlock_instances' already exists
-ERROR 1050 (42S01) at line 537: Table 'setup_actors' already exists
-ERROR 1050 (42S01) at line 545: Table 'setup_consumers' already exists
-ERROR 1050 (42S01) at line 554: Table 'setup_instruments' already exists
-ERROR 1050 (42S01) at line 565: Table 'setup_objects' already exists
-ERROR 1050 (42S01) at line 573: Table 'setup_timers' already exists
-ERROR 1050 (42S01) at line 618: Table 'table_io_waits_summary_by_index_usage' already exists
-ERROR 1050 (42S01) at line 662: Table 'table_io_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 736: Table 'table_lock_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 756: Table 'threads' already exists
-ERROR 1050 (42S01) at line 772: Table 'events_stages_current' already exists
-ERROR 1050 (42S01) at line 788: Table 'events_stages_history' already exists
-ERROR 1050 (42S01) at line 804: Table 'events_stages_history_long' already exists
-ERROR 1050 (42S01) at line 817: Table 'events_stages_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 830: Table 'events_stages_summary_by_host_by_event_name' already exists
-ERROR 1050 (42S01) at line 843: Table 'events_stages_summary_by_user_by_event_name' already exists
-ERROR 1050 (42S01) at line 857: Table 'events_stages_summary_by_account_by_event_name' already exists
-ERROR 1050 (42S01) at line 869: Table 'events_stages_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 915: Table 'events_statements_current' already exists
-ERROR 1050 (42S01) at line 961: Table 'events_statements_history' already exists
-ERROR 1050 (42S01) at line 1007: Table 'events_statements_history_long' already exists
-ERROR 1050 (42S01) at line 1039: Table 'events_statements_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 1071: Table 'events_statements_summary_by_host_by_event_name' already exists
-ERROR 1050 (42S01) at line 1103: Table 'events_statements_summary_by_user_by_event_name' already exists
-ERROR 1050 (42S01) at line 1136: Table 'events_statements_summary_by_account_by_event_name' already exists
-ERROR 1050 (42S01) at line 1167: Table 'events_statements_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 1176: Table 'hosts' already exists
-ERROR 1050 (42S01) at line 1185: Table 'users' already exists
-ERROR 1050 (42S01) at line 1195: Table 'accounts' already exists
-ERROR 1050 (42S01) at line 1230: Table 'events_statements_summary_by_digest' already exists
-ERROR 1050 (42S01) at line 1240: Table 'session_connect_attrs' already exists
-ERROR 1050 (42S01) at line 1246: Table 'session_account_connect_attrs' already exists
-ERROR 1644 (HY000) at line 1983: Unexpected content found in the performance_schema database.
+ERROR 1050 (42S01) at line 160: Table 'cond_instances' already exists
+ERROR 1050 (42S01) at line 185: Table 'events_waits_current' already exists
+ERROR 1050 (42S01) at line 210: Table 'events_waits_history' already exists
+ERROR 1050 (42S01) at line 235: Table 'events_waits_history_long' already exists
+ERROR 1050 (42S01) at line 248: Table 'events_waits_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 261: Table 'events_waits_summary_by_host_by_event_name' already exists
+ERROR 1050 (42S01) at line 274: Table 'events_waits_summary_by_user_by_event_name' already exists
+ERROR 1050 (42S01) at line 288: Table 'events_waits_summary_by_account_by_event_name' already exists
+ERROR 1050 (42S01) at line 301: Table 'events_waits_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 313: Table 'events_waits_summary_global_by_event_name' already exists
+ERROR 1050 (42S01) at line 322: Table 'file_instances' already exists
+ERROR 1050 (42S01) at line 351: Table 'file_summary_by_event_name' already exists
+ERROR 1050 (42S01) at line 382: Table 'file_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 395: Table 'socket_instances' already exists
+ERROR 1050 (42S01) at line 425: Table 'socket_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 454: Table 'socket_summary_by_event_name' already exists
+ERROR 1050 (42S01) at line 489: Table 'host_cache' already exists
+ERROR 1050 (42S01) at line 498: Table 'mutex_instances' already exists
+ERROR 1050 (42S01) at line 512: Table 'objects_summary_global_by_type' already exists
+ERROR 1050 (42S01) at line 522: Table 'performance_timers' already exists
+ERROR 1050 (42S01) at line 532: Table 'rwlock_instances' already exists
+ERROR 1050 (42S01) at line 541: Table 'setup_actors' already exists
+ERROR 1050 (42S01) at line 549: Table 'setup_consumers' already exists
+ERROR 1050 (42S01) at line 558: Table 'setup_instruments' already exists
+ERROR 1050 (42S01) at line 569: Table 'setup_objects' already exists
+ERROR 1050 (42S01) at line 577: Table 'setup_timers' already exists
+ERROR 1050 (42S01) at line 622: Table 'table_io_waits_summary_by_index_usage' already exists
+ERROR 1050 (42S01) at line 666: Table 'table_io_waits_summary_by_table' already exists
+ERROR 1050 (42S01) at line 740: Table 'table_lock_waits_summary_by_table' already exists
+ERROR 1050 (42S01) at line 760: Table 'threads' already exists
+ERROR 1050 (42S01) at line 776: Table 'events_stages_current' already exists
+ERROR 1050 (42S01) at line 792: Table 'events_stages_history' already exists
+ERROR 1050 (42S01) at line 808: Table 'events_stages_history_long' already exists
+ERROR 1050 (42S01) at line 821: Table 'events_stages_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 834: Table 'events_stages_summary_by_host_by_event_name' already exists
+ERROR 1050 (42S01) at line 847: Table 'events_stages_summary_by_user_by_event_name' already exists
+ERROR 1050 (42S01) at line 861: Table 'events_stages_summary_by_account_by_event_name' already exists
+ERROR 1050 (42S01) at line 873: Table 'events_stages_summary_global_by_event_name' already exists
+ERROR 1050 (42S01) at line 919: Table 'events_statements_current' already exists
+ERROR 1050 (42S01) at line 965: Table 'events_statements_history' already exists
+ERROR 1050 (42S01) at line 1011: Table 'events_statements_history_long' already exists
+ERROR 1050 (42S01) at line 1043: Table 'events_statements_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 1075: Table 'events_statements_summary_by_host_by_event_name' already exists
+ERROR 1050 (42S01) at line 1107: Table 'events_statements_summary_by_user_by_event_name' already exists
+ERROR 1050 (42S01) at line 1140: Table 'events_statements_summary_by_account_by_event_name' already exists
+ERROR 1050 (42S01) at line 1171: Table 'events_statements_summary_global_by_event_name' already exists
+ERROR 1050 (42S01) at line 1180: Table 'hosts' already exists
+ERROR 1050 (42S01) at line 1189: Table 'users' already exists
+ERROR 1050 (42S01) at line 1199: Table 'accounts' already exists
+ERROR 1050 (42S01) at line 1234: Table 'events_statements_summary_by_digest' already exists
+ERROR 1050 (42S01) at line 1244: Table 'session_connect_attrs' already exists
+ERROR 1050 (42S01) at line 1250: Table 'session_account_connect_attrs' already exists
+ERROR 1644 (HY000) at line 1987: Unexpected content found in the performance_schema database.
 FATAL ERROR: Upgrade failed
 show tables like "user_view";
 Tables_in_performance_schema (user_view)

=== modified file 'mysql-test/suite/perfschema/r/relaylog.result'
--- a/mysql-test/suite/perfschema/r/relaylog.result	2012-09-18 12:32:43 +0000
+++ b/mysql-test/suite/perfschema/r/relaylog.result	2012-11-12 08:00:23 +0000
@@ -9,6 +9,7 @@ create table test.t1(a int);
 drop table test.t1;
 include/show_binlog_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+slave-bin.000001	#	Intvar	#	#	INSERT_ID=83
 slave-bin.000001	#	Query	#	#	use `test`; create table test.t1(a int)
 slave-bin.000001	#	Query	#	#	use `test`; DROP TABLE `t1` /* generated by server */
 "============ Performance schema on master ============"

=== modified file 'mysql-test/suite/perfschema/r/sizing_default.result'
--- a/mysql-test/suite/perfschema/r/sizing_default.result	2012-10-31 11:34:31 +0000
+++ b/mysql-test/suite/perfschema/r/sizing_default.result	2012-11-12 08:00:23 +0000
@@ -216,7 +216,7 @@ performance_schema	(setup_actor_hash).co
 performance_schema	(setup_actor_hash).size	100
 performance_schema	(setup_object_hash).count	4
 performance_schema	(setup_object_hash).size	100
-performance_schema	(table_share_hash).count	82
+performance_schema	(table_share_hash).count	86
 performance_schema	(table_share_hash).size	445
 performance_schema	(user_hash).count	2
 performance_schema	(user_hash).size	5

=== modified file 'mysql-test/suite/perfschema/r/sizing_high.result'
--- a/mysql-test/suite/perfschema/r/sizing_high.result	2012-10-31 11:34:31 +0000
+++ b/mysql-test/suite/perfschema/r/sizing_high.result	2012-11-12 08:00:23 +0000
@@ -216,7 +216,7 @@ performance_schema	(setup_actor_hash).co
 performance_schema	(setup_actor_hash).size	100
 performance_schema	(setup_object_hash).count	4
 performance_schema	(setup_object_hash).size	100
-performance_schema	(table_share_hash).count	82
+performance_schema	(table_share_hash).count	86
 performance_schema	(table_share_hash).size	12500
 performance_schema	(user_hash).count	2
 performance_schema	(user_hash).size	100

=== modified file 'mysql-test/suite/perfschema/r/sizing_low.result'
--- a/mysql-test/suite/perfschema/r/sizing_low.result	2012-10-31 11:34:31 +0000
+++ b/mysql-test/suite/perfschema/r/sizing_low.result	2012-11-12 08:00:23 +0000
@@ -216,7 +216,7 @@ performance_schema	(setup_actor_hash).co
 performance_schema	(setup_actor_hash).size	100
 performance_schema	(setup_object_hash).count	4
 performance_schema	(setup_object_hash).size	100
-performance_schema	(table_share_hash).count	82
+performance_schema	(table_share_hash).count	86
 performance_schema	(table_share_hash).size	445
 performance_schema	(user_hash).count	2
 performance_schema	(user_hash).size	5

=== modified file 'mysql-test/suite/perfschema/r/sizing_med.result'
--- a/mysql-test/suite/perfschema/r/sizing_med.result	2012-10-31 11:34:31 +0000
+++ b/mysql-test/suite/perfschema/r/sizing_med.result	2012-11-12 08:00:23 +0000
@@ -216,7 +216,7 @@ performance_schema	(setup_actor_hash).co
 performance_schema	(setup_actor_hash).size	100
 performance_schema	(setup_object_hash).count	4
 performance_schema	(setup_object_hash).size	100
-performance_schema	(table_share_hash).count	82
+performance_schema	(table_share_hash).count	86
 performance_schema	(table_share_hash).size	556
 performance_schema	(user_hash).count	2
 performance_schema	(user_hash).size	100

=== modified file 'mysql-test/suite/perfschema/r/stage_mdl_table.result'
--- a/mysql-test/suite/perfschema/r/stage_mdl_table.result	2012-02-01 11:43:43 +0000
+++ b/mysql-test/suite/perfschema/r/stage_mdl_table.result	2012-11-12 08:00:23 +0000
@@ -36,5 +36,7 @@ user2	stage/sql/init	STATEMENT
 user2	stage/sql/Opening tables	STATEMENT
 user2	stage/sql/setup	STATEMENT
 user2	stage/sql/creating table	STATEMENT
+user2	stage/sql/Opening tables	STATEMENT
+user2	stage/sql/System lock	STATEMENT
 user2	stage/sql/After create	STATEMENT
 commit;

=== modified file 'mysql-test/suite/rpl/r/rpl_conditional_comments.result'
--- a/mysql-test/suite/rpl/r/rpl_conditional_comments.result	2012-03-23 20:11:19 +0000
+++ b/mysql-test/suite/rpl/r/rpl_conditional_comments.result	2012-11-12 08:00:23 +0000
@@ -6,6 +6,7 @@ Note	####	Storing MySQL user name or pas
 CREATE TABLE t1(c1 INT);
 include/show_binlog_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Intvar	#	#	INSERT_ID=83
 master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1(c1 INT)
 
 # Case 1:
@@ -43,6 +44,7 @@ master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO /* 99999 blabla*/ t1 VALUES(60) /* 99999 ,(61)*/
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `t1` /* generated by server */
+master-bin.000001	#	Intvar	#	#	INSERT_ID=84
 master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1(c1 INT)
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO /* 99999 blabla*/ t1 VALUES(60) /* 99999 ,(61)*/
@@ -51,6 +53,7 @@ master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO /* 99999 blabla */ t1 VALUES(62) /* 99999 ,(63)*/
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `t1` /* generated by server */
+master-bin.000001	#	Intvar	#	#	INSERT_ID=85
 master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1(c1 INT)
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO /* 99999 blabla */ t1 VALUES(62) /* 99999 ,(63)*/

=== modified file 'mysql-test/suite/rpl/r/rpl_do_db_filter.result'
--- a/mysql-test/suite/rpl/r/rpl_do_db_filter.result	2012-03-23 20:11:19 +0000
+++ b/mysql-test/suite/rpl/r/rpl_do_db_filter.result	2012-11-12 08:00:23 +0000
@@ -13,7 +13,9 @@ INSERT INTO t2 VALUES (1);
 include/show_binlog_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	CREATE DATABASE mydb
+master-bin.000001	#	Intvar	#	#	INSERT_ID=91
 master-bin.000001	#	Query	#	#	use `mydb`; CREATE TABLE T1 (a INT) ENGINE= MYISAM
+master-bin.000001	#	Intvar	#	#	INSERT_ID=92
 master-bin.000001	#	Query	#	#	use `mydb`; CREATE TABLE t2 (a INT) ENGINE= MYISAM
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `mydb`; INSERT INTO T1 VALUES (1)

=== modified file 'mysql-test/suite/rpl/r/rpl_do_table_filter_insensitive.result'
--- a/mysql-test/suite/rpl/r/rpl_do_table_filter_insensitive.result	2012-03-23 20:11:19 +0000
+++ b/mysql-test/suite/rpl/r/rpl_do_table_filter_insensitive.result	2012-11-12 08:00:23 +0000
@@ -13,7 +13,9 @@ INSERT INTO t2 VALUES (1);
 include/show_binlog_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	CREATE DATABASE mydb
+master-bin.000001	#	Intvar	#	#	INSERT_ID=83
 master-bin.000001	#	Query	#	#	use `mydb`; CREATE TABLE T1 (a INT) ENGINE= MYISAM
+master-bin.000001	#	Intvar	#	#	INSERT_ID=84
 master-bin.000001	#	Query	#	#	use `mydb`; CREATE TABLE t2 (a INT) ENGINE= MYISAM
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `mydb`; INSERT INTO T1 VALUES (1)
@@ -25,6 +27,7 @@ master-bin.000001	#	Query	#	#	COMMIT
 include/show_binlog_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 slave-bin.000001	#	Query	#	#	CREATE DATABASE mydb
+slave-bin.000001	#	Intvar	#	#	INSERT_ID=84
 slave-bin.000001	#	Query	#	#	use `mydb`; CREATE TABLE t2 (a INT) ENGINE= MYISAM
 slave-bin.000001	#	Query	#	#	BEGIN
 slave-bin.000001	#	Query	#	#	use `mydb`; INSERT INTO t2 VALUES (1)

=== modified file 'mysql-test/suite/rpl/r/rpl_do_table_filter_sensitive.result'
--- a/mysql-test/suite/rpl/r/rpl_do_table_filter_sensitive.result	2012-03-23 20:11:19 +0000
+++ b/mysql-test/suite/rpl/r/rpl_do_table_filter_sensitive.result	2012-11-12 08:00:23 +0000
@@ -13,7 +13,9 @@ INSERT INTO t2 VALUES (1);
 include/show_binlog_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	CREATE DATABASE mydb
+master-bin.000001	#	Intvar	#	#	INSERT_ID=83
 master-bin.000001	#	Query	#	#	use `mydb`; CREATE TABLE T1 (a INT) ENGINE= MYISAM
+master-bin.000001	#	Intvar	#	#	INSERT_ID=84
 master-bin.000001	#	Query	#	#	use `mydb`; CREATE TABLE t2 (a INT) ENGINE= MYISAM
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `mydb`; INSERT INTO T1 VALUES (1)
@@ -25,6 +27,7 @@ master-bin.000001	#	Query	#	#	COMMIT
 include/show_binlog_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 slave-bin.000001	#	Query	#	#	CREATE DATABASE mydb
+slave-bin.000001	#	Intvar	#	#	INSERT_ID=84
 slave-bin.000001	#	Query	#	#	use `mydb`; CREATE TABLE t2 (a INT) ENGINE= MYISAM
 slave-bin.000001	#	Query	#	#	BEGIN
 slave-bin.000001	#	Query	#	#	use `mydb`; INSERT INTO t2 VALUES (1)

=== modified file 'mysql-test/suite/rpl/r/rpl_drop_temp.result'
--- a/mysql-test/suite/rpl/r/rpl_drop_temp.result	2012-03-23 20:11:19 +0000
+++ b/mysql-test/suite/rpl/r/rpl_drop_temp.result	2012-11-12 08:00:23 +0000
@@ -37,6 +37,7 @@ Variable_name	Value
 Slave_open_temp_tables	0
 include/show_binlog_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Intvar	#	#	INSERT_ID=93
 master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 ( i INT )
 master-bin.000001	#	Query	#	#	use `test`; CREATE TEMPORARY TABLE ttmp1 ( i INT )
 master-bin.000001	#	Query	#	#	use `test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `ttmp1`

=== modified file 'mysql-test/suite/rpl/r/rpl_ignore_db_filter.result'
--- a/mysql-test/suite/rpl/r/rpl_ignore_db_filter.result	2012-03-23 20:11:19 +0000
+++ b/mysql-test/suite/rpl/r/rpl_ignore_db_filter.result	2012-11-12 08:00:23 +0000
@@ -13,7 +13,9 @@ INSERT INTO t2 VALUES (1);
 include/show_binlog_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	CREATE DATABASE mydb
+master-bin.000001	#	Intvar	#	#	INSERT_ID=85
 master-bin.000001	#	Query	#	#	use `mydb`; CREATE TABLE T1 (a INT) ENGINE= MYISAM
+master-bin.000001	#	Intvar	#	#	INSERT_ID=86
 master-bin.000001	#	Query	#	#	use `mydb`; CREATE TABLE t2 (a INT) ENGINE= MYISAM
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `mydb`; INSERT INTO T1 VALUES (1)

=== modified file 'mysql-test/suite/rpl/r/rpl_ignore_table_filter_insensitive.result'
--- a/mysql-test/suite/rpl/r/rpl_ignore_table_filter_insensitive.result	2012-03-23 20:11:19 +0000
+++ b/mysql-test/suite/rpl/r/rpl_ignore_table_filter_insensitive.result	2012-11-12 08:00:23 +0000
@@ -13,7 +13,9 @@ INSERT INTO t2 VALUES (1);
 include/show_binlog_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	CREATE DATABASE mydb
+master-bin.000001	#	Intvar	#	#	INSERT_ID=83
 master-bin.000001	#	Query	#	#	use `mydb`; CREATE TABLE T1 (a INT) ENGINE= MYISAM
+master-bin.000001	#	Intvar	#	#	INSERT_ID=84
 master-bin.000001	#	Query	#	#	use `mydb`; CREATE TABLE t2 (a INT) ENGINE= MYISAM
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `mydb`; INSERT INTO T1 VALUES (1)
@@ -25,6 +27,7 @@ master-bin.000001	#	Query	#	#	COMMIT
 include/show_binlog_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 slave-bin.000001	#	Query	#	#	CREATE DATABASE mydb
+slave-bin.000001	#	Intvar	#	#	INSERT_ID=84
 slave-bin.000001	#	Query	#	#	use `mydb`; CREATE TABLE t2 (a INT) ENGINE= MYISAM
 slave-bin.000001	#	Query	#	#	BEGIN
 slave-bin.000001	#	Query	#	#	use `mydb`; INSERT INTO t2 VALUES (1)

=== modified file 'mysql-test/suite/rpl/r/rpl_ignore_table_filter_sensitive.result'
--- a/mysql-test/suite/rpl/r/rpl_ignore_table_filter_sensitive.result	2012-03-23 20:11:19 +0000
+++ b/mysql-test/suite/rpl/r/rpl_ignore_table_filter_sensitive.result	2012-11-12 08:00:23 +0000
@@ -13,7 +13,9 @@ INSERT INTO t2 VALUES (1);
 include/show_binlog_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	CREATE DATABASE mydb
+master-bin.000001	#	Intvar	#	#	INSERT_ID=83
 master-bin.000001	#	Query	#	#	use `mydb`; CREATE TABLE T1 (a INT) ENGINE= MYISAM
+master-bin.000001	#	Intvar	#	#	INSERT_ID=84
 master-bin.000001	#	Query	#	#	use `mydb`; CREATE TABLE t2 (a INT) ENGINE= MYISAM
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `mydb`; INSERT INTO T1 VALUES (1)
@@ -25,6 +27,7 @@ master-bin.000001	#	Query	#	#	COMMIT
 include/show_binlog_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 slave-bin.000001	#	Query	#	#	CREATE DATABASE mydb
+slave-bin.000001	#	Intvar	#	#	INSERT_ID=83
 slave-bin.000001	#	Query	#	#	use `mydb`; CREATE TABLE T1 (a INT) ENGINE= MYISAM
 slave-bin.000001	#	Query	#	#	BEGIN
 slave-bin.000001	#	Query	#	#	use `mydb`; INSERT INTO T1 VALUES (1)

=== modified file 'mysql-test/suite/rpl/r/rpl_innodb_mixed_ddl.result'
--- a/mysql-test/suite/rpl/r/rpl_innodb_mixed_ddl.result	2012-03-23 20:11:19 +0000
+++ b/mysql-test/suite/rpl/r/rpl_innodb_mixed_ddl.result	2012-11-12 08:00:23 +0000
@@ -144,16 +144,26 @@ master-bin.000001	#	Query	#	#	ALTER DATA
 master-bin.000001	#	Query	#	#	DROP DATABASE test_rpl_1
 master-bin.000001	#	Query	#	#	CREATE DATABASE test_rpl CHARACTER SET utf8 COLLATE utf8_general_ci
 master-bin.000001	#	Query	#	#	ALTER DATABASE test_rpl CHARACTER SET latin1 COLLATE latin1_swedish_ci
+master-bin.000001	#	Intvar	#	#	INSERT_ID=83
 master-bin.000001	#	Query	#	#	use `test_rpl`; CREATE TABLE t0 (a int auto_increment not null, c int not null, PRIMARY KEY(a), KEY index2 (c)) ENGINE=innodb
+master-bin.000001	#	Intvar	#	#	INSERT_ID=84
 master-bin.000001	#	Query	#	#	use `test_rpl`; ALTER TABLE t0 DROP INDEX index2
+master-bin.000001	#	Intvar	#	#	INSERT_ID=85
 master-bin.000001	#	Query	#	#	use `test_rpl`; ALTER TABLE t0 ADD COLUMN b char(254)
+master-bin.000001	#	Intvar	#	#	INSERT_ID=86
 master-bin.000001	#	Query	#	#	use `test_rpl`; ALTER TABLE t0 ADD INDEX index1 (b)
+master-bin.000001	#	Intvar	#	#	INSERT_ID=87
 master-bin.000001	#	Query	#	#	use `test_rpl`; ALTER TABLE t0 DROP COLUMN c
 master-bin.000001	#	Query	#	#	use `test_rpl`; RENAME TABLE t0 TO t1
+master-bin.000001	#	Intvar	#	#	INSERT_ID=88
 master-bin.000001	#	Query	#	#	use `test_rpl`; CREATE TABLE t2 LIKE t1
+master-bin.000001	#	Intvar	#	#	INSERT_ID=89
 master-bin.000001	#	Query	#	#	use `test_rpl`; ALTER TABLE t2 ADD COLUMN d datetime
+master-bin.000001	#	Intvar	#	#	INSERT_ID=90
 master-bin.000001	#	Query	#	#	use `test_rpl`; CREATE INDEX index2 on t2 (d)
+master-bin.000001	#	Intvar	#	#	INSERT_ID=91
 master-bin.000001	#	Query	#	#	use `test_rpl`; CREATE INDEX index3 on t2 (a, d)
+master-bin.000001	#	Intvar	#	#	INSERT_ID=92
 master-bin.000001	#	Query	#	#	use `test_rpl`; ALTER TABLE t2 DROP COLUMN d
 drop database test_rpl;
 include/rpl_end.inc

=== modified file 'mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result'
--- a/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result	2012-05-02 19:09:22 +0000
+++ b/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result	2012-11-12 08:00:23 +0000
@@ -832,7 +832,9 @@ DELETE FROM t2;
 include/show_binlog_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	CREATE DATABASE test_rpl
+master-bin.000001	#	Intvar	#	#	INSERT_ID=93
 master-bin.000001	#	Query	#	#	use `test_rpl`; CREATE TABLE t1 (a int auto_increment not null, b char(254), PRIMARY KEY(a)) ENGINE=innodb
+master-bin.000001	#	Intvar	#	#	INSERT_ID=94
 master-bin.000001	#	Query	#	#	use `test_rpl`; CREATE TABLE t2 (a int auto_increment not null, b char(254), PRIMARY KEY(a)) ENGINE=innodb
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test_rpl`; INSERT INTO t1 VALUES(1, 't1, text 1')
@@ -1020,6 +1022,7 @@ master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test_rpl`; INSERT INTO t1 VALUES(100, 'test')
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 master-bin.000001	#	Query	#	#	use `test_rpl`; ANALYZE TABLE t1
+master-bin.000001	#	Intvar	#	#	INSERT_ID=95
 master-bin.000001	#	Query	#	#	use `test_rpl`; OPTIMIZE TABLE t1
 master-bin.000001	#	Query	#	#	use `test_rpl`; REPAIR TABLE t1
 master-bin.000001	#	Query	#	#	use `test_rpl`; CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()

=== modified file 'mysql-test/suite/rpl/r/rpl_loaddata_map.result'
--- a/mysql-test/suite/rpl/r/rpl_loaddata_map.result	2012-03-23 20:11:19 +0000
+++ b/mysql-test/suite/rpl/r/rpl_loaddata_map.result	2012-11-12 08:00:23 +0000
@@ -15,6 +15,7 @@ count(*)
 5000
 include/show_binlog_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Intvar	#	#	INSERT_ID=84
 master-bin.000001	#	Query	#	#	use `test`; create table t2 (id int not null primary key auto_increment)
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Begin_load_query	#	#	;file_id=#;block_len=#

=== modified file 'mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result'
--- a/mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result	2012-04-11 12:33:47 +0000
+++ b/mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result	2012-11-12 08:00:23 +0000
@@ -9,6 +9,7 @@ INSERT INTO t1 VALUES (1,1), (2,2);
 INSERT INTO t1 VALUES (3,UUID()), (4,UUID());
 include/show_binlog_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Intvar	#	#	INSERT_ID=83
 master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT, b LONG)
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
@@ -20,6 +21,7 @@ master-bin.000001	#	Query	#	#	COMMIT
 **** On Slave ****
 include/show_binlog_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+slave-bin.000001	#	Intvar	#	#	INSERT_ID=83
 slave-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT, b LONG)
 slave-bin.000001	#	Query	#	#	BEGIN
 slave-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (1,1), (2,2)

=== modified file 'mysql-test/suite/rpl/r/rpl_rewrite_db_filter.result'
--- a/mysql-test/suite/rpl/r/rpl_rewrite_db_filter.result	2012-03-23 20:11:19 +0000
+++ b/mysql-test/suite/rpl/r/rpl_rewrite_db_filter.result	2012-11-12 08:00:23 +0000
@@ -14,7 +14,9 @@ INSERT INTO t2 VALUES (1);
 include/show_binlog_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	CREATE DATABASE mydb
+master-bin.000001	#	Intvar	#	#	INSERT_ID=87
 master-bin.000001	#	Query	#	#	use `mydb`; CREATE TABLE T1 (a INT) ENGINE= MYISAM
+master-bin.000001	#	Intvar	#	#	INSERT_ID=88
 master-bin.000001	#	Query	#	#	use `mydb`; CREATE TABLE t2 (a INT) ENGINE= MYISAM
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `mydb`; INSERT INTO T1 VALUES (1)
@@ -27,7 +29,9 @@ include/show_binlog_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 slave-bin.000001	#	Query	#	#	CREATE DATABASE rewrite
 slave-bin.000001	#	Query	#	#	CREATE DATABASE mydb
+slave-bin.000001	#	Intvar	#	#	INSERT_ID=87
 slave-bin.000001	#	Query	#	#	use `rewrite`; CREATE TABLE T1 (a INT) ENGINE= MYISAM
+slave-bin.000001	#	Intvar	#	#	INSERT_ID=88
 slave-bin.000001	#	Query	#	#	use `rewrite`; CREATE TABLE t2 (a INT) ENGINE= MYISAM
 slave-bin.000001	#	Query	#	#	BEGIN
 slave-bin.000001	#	Query	#	#	use `rewrite`; INSERT INTO T1 VALUES (1)

=== modified file 'mysql-test/suite/rpl/r/rpl_sp.result'
--- a/mysql-test/suite/rpl/r/rpl_sp.result	2012-11-07 10:59:28 +0000
+++ b/mysql-test/suite/rpl/r/rpl_sp.result	2012-11-12 08:00:23 +0000
@@ -411,6 +411,7 @@ include/show_binlog_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	drop database if exists mysqltest1
 master-bin.000001	#	Query	#	#	create database mysqltest1
+master-bin.000001	#	Intvar	#	#	INSERT_ID=83
 master-bin.000001	#	Query	#	#	use `mysqltest1`; create table t1 (a varchar(100))
 master-bin.000001	#	Query	#	#	use `mysqltest1`; CREATE DEFINER=`root`@`localhost` PROCEDURE `foo`()
 begin
@@ -432,7 +433,9 @@ master-bin.000001	#	Query	#	#	use `mysql
 select * from mysqltest1.t1
 master-bin.000001	#	Query	#	#	use `mysqltest1`; alter procedure foo2 contains sql
 master-bin.000001	#	Query	#	#	use `mysqltest1`; DROP TABLE `t1` /* generated by server */
+master-bin.000001	#	Intvar	#	#	INSERT_ID=84
 master-bin.000001	#	Query	#	#	use `mysqltest1`; create table t1 (a int)
+master-bin.000001	#	Intvar	#	#	INSERT_ID=85
 master-bin.000001	#	Query	#	#	use `mysqltest1`; create table t2 like t1
 master-bin.000001	#	Query	#	#	use `mysqltest1`; CREATE DEFINER=`root`@`localhost` PROCEDURE `foo3`()
     DETERMINISTIC
@@ -465,6 +468,7 @@ master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `mysqltest1`; delete from t2
 master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Intvar	#	#	INSERT_ID=86
 master-bin.000001	#	Query	#	#	use `mysqltest1`; alter table t2 add unique (a)
 master-bin.000001	#	Query	#	#	use `mysqltest1`; drop procedure foo4
 master-bin.000001	#	Query	#	#	use `mysqltest1`; CREATE DEFINER=`root`@`localhost` PROCEDURE `foo4`()
@@ -519,6 +523,7 @@ end
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `mysqltest1`; delete from t2
 master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Intvar	#	#	INSERT_ID=87
 master-bin.000001	#	Query	#	#	use `mysqltest1`; alter table t2 add unique (a)
 master-bin.000001	#	Query	#	#	use `mysqltest1`; drop function fn1
 master-bin.000001	#	Query	#	#	use `mysqltest1`; CREATE DEFINER=`root`@`localhost` FUNCTION `fn1`(x int) RETURNS int(11)
@@ -565,6 +570,7 @@ close c;
 return var;
 end
 master-bin.000001	#	Query	#	#	use `test`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 1 as a
+master-bin.000001	#	Intvar	#	#	INSERT_ID=88
 master-bin.000001	#	Query	#	#	use `test`; create table t1 (a int)
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; insert into t1 (a) values (f1())
@@ -573,6 +579,7 @@ master-bin.000001	#	Query	#	#	use `test`
 master-bin.000001	#	Query	#	#	use `test`; drop function f1
 master-bin.000001	#	Query	#	#	use `test`; DROP PROCEDURE IF EXISTS p1
 master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */
+master-bin.000001	#	Intvar	#	#	INSERT_ID=89
 master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1(col VARCHAR(10))
 master-bin.000001	#	Query	#	#	use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`(arg VARCHAR(10))
 INSERT INTO t1 VALUES(arg)
@@ -593,6 +600,7 @@ master-bin.000001	#	Query	#	#	drop datab
 master-bin.000001	#	Query	#	#	drop database if exists mysqltest2
 master-bin.000001	#	Query	#	#	create database mysqltest
 master-bin.000001	#	Query	#	#	create database mysqltest2
+master-bin.000001	#	Intvar	#	#	INSERT_ID=90
 master-bin.000001	#	Query	#	#	use `mysqltest2`; create table t ( t integer )
 master-bin.000001	#	Query	#	#	use `mysqltest2`; CREATE DEFINER=`root`@`localhost` PROCEDURE `mysqltest`.`test`()
 begin end
@@ -674,6 +682,7 @@ drop database if exists mysqltest1
 SET TIMESTAMP=t/*!*/;
 create database mysqltest1
 /*!*/;
+SET INSERT_ID=83/*!*/;
 use `mysqltest1`/*!*/;
 SET TIMESTAMP=t/*!*/;
 create table t1 (a varchar(100))
@@ -724,9 +733,11 @@ alter procedure foo2 contains sql
 SET TIMESTAMP=t/*!*/;
 DROP TABLE `t1` /* generated by server */
 /*!*/;
+SET INSERT_ID=84/*!*/;
 SET TIMESTAMP=t/*!*/;
 create table t1 (a int)
 /*!*/;
+SET INSERT_ID=85/*!*/;
 SET TIMESTAMP=t/*!*/;
 create table t2 like t1
 /*!*/;
@@ -809,6 +820,7 @@ delete from t2
 SET TIMESTAMP=t/*!*/;
 COMMIT
 /*!*/;
+SET INSERT_ID=86/*!*/;
 SET TIMESTAMP=t/*!*/;
 alter table t2 add unique (a)
 /*!*/;
@@ -929,6 +941,7 @@ delete from t2
 SET TIMESTAMP=t/*!*/;
 COMMIT
 /*!*/;
+SET INSERT_ID=87/*!*/;
 SET TIMESTAMP=t/*!*/;
 alter table t2 add unique (a)
 /*!*/;
@@ -1038,6 +1051,7 @@ end
 SET TIMESTAMP=t/*!*/;
 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 1 as a
 /*!*/;
+SET INSERT_ID=88/*!*/;
 SET TIMESTAMP=t/*!*/;
 create table t1 (a int)
 /*!*/;
@@ -1062,6 +1076,7 @@ DROP PROCEDURE IF EXISTS p1
 SET TIMESTAMP=t/*!*/;
 DROP TABLE IF EXISTS `t1` /* generated by server */
 /*!*/;
+SET INSERT_ID=89/*!*/;
 SET TIMESTAMP=t/*!*/;
 CREATE TABLE t1(col VARCHAR(10))
 /*!*/;
@@ -1116,6 +1131,7 @@ create database mysqltest
 SET TIMESTAMP=t/*!*/;
 create database mysqltest2
 /*!*/;
+SET INSERT_ID=90/*!*/;
 use `mysqltest2`/*!*/;
 SET TIMESTAMP=t/*!*/;
 create table t ( t integer )

=== modified file 'mysql-test/suite/rpl/r/rpl_stm_loaddata_concurrent.result'
--- a/mysql-test/suite/rpl/r/rpl_stm_loaddata_concurrent.result	2012-11-09 14:41:56 +0000
+++ b/mysql-test/suite/rpl/r/rpl_stm_loaddata_concurrent.result	2012-11-12 08:00:23 +0000
@@ -4,6 +4,7 @@ LOAD DATA INFILE '../../std_data/words.d
 LOAD DATA CONCURRENT INFILE '../../std_data/words.dat' INTO TABLE t1;
 include/show_binlog_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Intvar	#	#	INSERT_ID=83
 master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (c1 char(50)) ENGINE=MyISAM
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Begin_load_query	#	#	;file_id=#;block_len=#

=== modified file 'mysql-test/suite/rpl/r/rpl_stm_log.result'
--- a/mysql-test/suite/rpl/r/rpl_stm_log.result	2012-04-11 12:33:47 +0000
+++ b/mysql-test/suite/rpl/r/rpl_stm_log.result	2012-11-12 08:00:23 +0000
@@ -19,12 +19,14 @@ count(*)
 69
 include/show_binlog_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Intvar	#	#	INSERT_ID=83
 master-bin.000001	#	Query	#	#	use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Intvar	#	#	INSERT_ID=1
 master-bin.000001	#	Query	#	#	use `test`; insert into t1 values (NULL)
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `t1` /* generated by server */
+master-bin.000001	#	Intvar	#	#	INSERT_ID=84
 master-bin.000001	#	Query	#	#	use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Begin_load_query	#	#	;file_id=#;block_len=#
@@ -32,13 +34,13 @@ master-bin.000001	#	Execute_load_query	#
 master-bin.000001	#	Query	#	#	COMMIT
 include/show_binlog_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
+master-bin.000001	#	Intvar	#	#	INSERT_ID=83
 include/show_binlog_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	#	#	use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Intvar	#	#	INSERT_ID=1
 master-bin.000001	#	Query	#	#	use `test`; insert into t1 values (NULL)
-master-bin.000001	#	Query	#	#	COMMIT
 flush logs;
 create table t3 (a int)ENGINE=MyISAM;
 select * from t1 order by 1 asc;
@@ -190,12 +192,14 @@ create table t2 (n int)ENGINE=MyISAM;
 insert into t2 values (1);
 include/show_binlog_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Intvar	#	#	INSERT_ID=83
 master-bin.000001	#	Query	#	#	use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Intvar	#	#	INSERT_ID=1
 master-bin.000001	#	Query	#	#	use `test`; insert into t1 values (NULL)
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `t1` /* generated by server */
+master-bin.000001	#	Intvar	#	#	INSERT_ID=84
 master-bin.000001	#	Query	#	#	use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Begin_load_query	#	#	;file_id=#;block_len=#
@@ -204,7 +208,9 @@ master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Rotate	#	#	master-bin.000002;pos=POS
 include/show_binlog_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000002	#	Intvar	#	#	INSERT_ID=85
 master-bin.000002	#	Query	#	#	use `test`; create table t3 (a int)ENGINE=MyISAM
+master-bin.000002	#	Intvar	#	#	INSERT_ID=86
 master-bin.000002	#	Query	#	#	use `test`; create table t2 (n int)ENGINE=MyISAM
 master-bin.000002	#	Query	#	#	BEGIN
 master-bin.000002	#	Query	#	#	use `test`; insert into t2 values (1)
@@ -219,21 +225,25 @@ slave-bin.000001	#
 slave-bin.000002	#
 include/show_binlog_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+slave-bin.000001	#	Intvar	#	#	INSERT_ID=83
 slave-bin.000001	#	Query	#	#	use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
 slave-bin.000001	#	Query	#	#	BEGIN
 slave-bin.000001	#	Intvar	#	#	INSERT_ID=1
 slave-bin.000001	#	Query	#	#	use `test`; insert into t1 values (NULL)
 slave-bin.000001	#	Query	#	#	COMMIT
 slave-bin.000001	#	Query	#	#	use `test`; DROP TABLE `t1` /* generated by server */
+slave-bin.000001	#	Intvar	#	#	INSERT_ID=84
 slave-bin.000001	#	Query	#	#	use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
 slave-bin.000001	#	Query	#	#	BEGIN
 slave-bin.000001	#	Begin_load_query	#	#	;file_id=#;block_len=#
 slave-bin.000001	#	Execute_load_query	#	#	use `test`; LOAD DATA INFILE '../../tmp/SQL_LOAD-<SERVER UUID>-<MASTER server-id>-<file-id>.<extension>' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' IGNORE 1 LINES  (`word`) ;file_id=#
 slave-bin.000001	#	Query	#	#	COMMIT
+slave-bin.000001	#	Intvar	#	#	INSERT_ID=85
 slave-bin.000001	#	Query	#	#	use `test`; create table t3 (a int)ENGINE=MyISAM
 slave-bin.000001	#	Rotate	#	#	slave-bin.000002;pos=POS
 include/show_binlog_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+slave-bin.000002	#	Intvar	#	#	INSERT_ID=86
 slave-bin.000002	#	Query	#	#	use `test`; create table t2 (n int)ENGINE=MyISAM
 slave-bin.000002	#	Query	#	#	BEGIN
 slave-bin.000002	#	Query	#	#	use `test`; insert into t2 values (1)
@@ -251,6 +261,7 @@ set insert_id=5;
 insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id());
 include/show_binlog_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Intvar	#	#	INSERT_ID=87
 master-bin.000001	#	Query	#	#	use `test`; create table t1(a int auto_increment primary key, b int)
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Intvar	#	#	INSERT_ID=1

=== modified file 'mysql-test/suite/rpl/r/rpl_stm_mix_show_relaylog_events.result'
--- a/mysql-test/suite/rpl/r/rpl_stm_mix_show_relaylog_events.result	2012-03-23 20:11:19 +0000
+++ b/mysql-test/suite/rpl/r/rpl_stm_mix_show_relaylog_events.result	2012-11-12 08:00:23 +0000
@@ -11,6 +11,7 @@ INSERT INTO t1 VALUES (3);
 ******** [master] SHOW BINLOG EVENTS IN <FILE> ********
 include/show_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Intvar	#	#	INSERT_ID=86
 master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT)
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (1)
@@ -24,16 +25,17 @@ master-bin.000001	#	Query	#	#	COMMIT
 ******** [master] SHOW BINLOG EVENTS IN <FILE> LIMIT 1 ********
 include/show_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT)
+master-bin.000001	#	Intvar	#	#	INSERT_ID=86
 ******** [master] SHOW BINLOG EVENTS IN <FILE> LIMIT 1,3 ********
 include/show_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT)
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (1)
-master-bin.000001	#	Query	#	#	COMMIT
 ******** [master] SHOW BINLOG EVENTS  ********
 include/show_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Intvar	#	#	INSERT_ID=86
 master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT)
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (1)
@@ -47,6 +49,7 @@ master-bin.000001	#	Query	#	#	COMMIT
 ******** [slave] SHOW BINLOG EVENTS IN <FILE> ********
 include/show_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+slave-bin.000001	#	Intvar	#	#	INSERT_ID=86
 slave-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT)
 slave-bin.000001	#	Query	#	#	BEGIN
 slave-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (1)
@@ -60,16 +63,17 @@ slave-bin.000001	#	Query	#	#	COMMIT
 ******** [slave] SHOW BINLOG EVENTS IN <FILE> LIMIT 1 ********
 include/show_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-slave-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT)
+slave-bin.000001	#	Intvar	#	#	INSERT_ID=86
 ******** [slave] SHOW BINLOG EVENTS IN <FILE> LIMIT 1,3 ********
 include/show_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+slave-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT)
 slave-bin.000001	#	Query	#	#	BEGIN
 slave-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (1)
-slave-bin.000001	#	Query	#	#	COMMIT
 ******** [slave] SHOW BINLOG EVENTS  ********
 include/show_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+slave-bin.000001	#	Intvar	#	#	INSERT_ID=86
 slave-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT)
 slave-bin.000001	#	Query	#	#	BEGIN
 slave-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (1)
@@ -85,6 +89,7 @@ include/show_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 slave-relay-bin.000003	#	Rotate	#	#	master-bin.000001;pos=POS
 slave-relay-bin.000003	#	Format_desc	#	#	SERVER_VERSION, BINLOG_VERSION
+slave-relay-bin.000003	#	Intvar	#	#	INSERT_ID=86
 slave-relay-bin.000003	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT)
 slave-relay-bin.000003	#	Query	#	#	BEGIN
 slave-relay-bin.000003	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (1)
@@ -103,8 +108,8 @@ slave-relay-bin.000003	#	Rotate	#	#	mast
 include/show_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 slave-relay-bin.000003	#	Format_desc	#	#	SERVER_VERSION, BINLOG_VERSION
+slave-relay-bin.000003	#	Intvar	#	#	INSERT_ID=86
 slave-relay-bin.000003	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT)
-slave-relay-bin.000003	#	Query	#	#	BEGIN
 ******** [slave] SHOW RELAYLOG EVENTS  ********
 include/show_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
@@ -125,6 +130,7 @@ include/show_events.inc
 ******** [master] SHOW BINLOG EVENTS  ********
 include/show_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Intvar	#	#	INSERT_ID=86
 master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT)
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (1)
@@ -149,6 +155,7 @@ include/show_events.inc
 ******** [slave] SHOW BINLOG EVENTS  ********
 include/show_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+slave-bin.000001	#	Intvar	#	#	INSERT_ID=86
 slave-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT)
 slave-bin.000001	#	Query	#	#	BEGIN
 slave-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (1)

=== modified file 'mysql-test/suite/rpl/r/rpl_stm_multi_query.result'
--- a/mysql-test/suite/rpl/r/rpl_stm_multi_query.result	2012-03-23 20:11:19 +0000
+++ b/mysql-test/suite/rpl/r/rpl_stm_multi_query.result	2012-11-12 08:00:23 +0000
@@ -20,6 +20,7 @@ n
 include/show_binlog_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	create database mysqltest
+master-bin.000001	#	Intvar	#	#	INSERT_ID=87
 master-bin.000001	#	Query	#	#	use `test`; create table mysqltest.t1 ( n int)
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; insert into mysqltest.t1 values(1)

=== modified file 'mysql-test/suite/rpl/r/rpl_stm_user_variables.result'
--- a/mysql-test/suite/rpl/r/rpl_stm_user_variables.result	2012-03-23 20:11:19 +0000
+++ b/mysql-test/suite/rpl/r/rpl_stm_user_variables.result	2012-11-12 08:00:23 +0000
@@ -242,6 +242,7 @@ a	b
 # Show events and cleanup
 include/show_binlog_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Intvar	#	#	INSERT_ID=90
 master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT, b INT)
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	User var	#	#	@`var1`=0

=== modified file 'mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result'
--- a/mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result	2012-04-11 12:33:47 +0000
+++ b/mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result	2012-11-12 08:00:23 +0000
@@ -50,8 +50,11 @@ Slave_open_temp_tables	0
 DROP TABLE t3, t1;
 include/show_binlog_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+slave-bin.000001	#	Intvar	#	#	INSERT_ID=97
 slave-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a int)
+slave-bin.000001	#	Intvar	#	#	INSERT_ID=98
 slave-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t2 ( i1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (i1) )
+slave-bin.000001	#	Intvar	#	#	INSERT_ID=99
 slave-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t3 ( i1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (i1) )
 slave-bin.000001	#	Query	#	#	use `test`; CREATE DEFINER=`root`@`localhost` TRIGGER tr1 AFTER DELETE ON t2 FOR EACH ROW INSERT INTO t3 () VALUES ()
 slave-bin.000001	#	Query	#	#	use `test`; CREATE TEMPORARY TABLE t1_tmp (i1 int)

=== modified file 'scripts/mysql_system_tables.sql'
--- a/scripts/mysql_system_tables.sql	2012-11-07 12:05:17 +0000
+++ b/scripts/mysql_system_tables.sql	2012-11-12 08:00:23 +0000
@@ -20,6 +20,14 @@
 set sql_mode='';
 set storage_engine=myisam;
 
+CREATE TABLE IF NOT EXISTS tables (db char(64) NOT NULL, name char(64) NOT NULL, id INT UNSIGNED NOT NULl auto_increment, legacy_db_type TINYINT(1), max_rows INT, min_rows INT, system TINYINT(1), dd_version TINYINT(1), db_create_options SMALLINT, avg_row_length INT, csid TINYINT(1), row_type TINYINT(1), stats_sample_pages SMALLINT, stats_auto_recalc SMALLINT, mysql_version INT, default_part_db_type TINYINT(1), key_block_size SMALLINT, comment text, field_count SMALLINT, null_fields INT, table_keys SMALLINT, tablespace TEXT,  PRIMARY KEY pk_tableid (id)) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
+
+CREATE TABLE IF NOT EXISTS fields (table_id INT UNSIGNED NOT NULL, name char(64) NOT NULL, type SMALLINT, field_length SMALLINT, unireg_type TINYINT(1), recpos INT, pack_flag INT, csid SMALLINT, comment text, intervals text, interval_parts SMALLINT, flags SMALLINT) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
+
+CREATE TABLE IF NOT EXISTS table_keys (id INT UNSIGNED NOT NULL auto_increment, table_id INT UNSIGNED NOT NULL, name char(64), flags SMALLINT, key_parts SMALLINT, key_length SMALLINT, algorithm SMALLINT, block_size SMALLINT, user_defined_key_parts INT, parser text, comment text, PRIMARY KEY (id)) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
+
+CREATE TABLE IF NOT EXISTS table_key_parts (key_id INT UNSIGNED NOT NULL, field_nr SMALLINT NOT NULL, length SMALLINT, record_offset SMALLINT, key_type SMALLINT, key_part_flag SMALLINT) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
+
 CREATE TABLE IF NOT EXISTS db (   Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y'!
 ) COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Event_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY Host (Host,Db,User), KEY User (User) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Database privileges';
 
 -- Remember for later if db table already existed
@@ -30,7 +38,6 @@ CREATE TABLE IF NOT EXISTS user (   Host
 -- Remember for later if user table already existed
 set @had_user_table= @@warning_count != 0;
 
-
 CREATE TABLE IF NOT EXISTS func (  name char(64) binary DEFAULT '' NOT NULL, ret tinyint(1) DEFAULT '0' NOT NULL, dl char(128) DEFAULT '' NOT NULL, type enum ('function','aggregate') COLLATE utf8_general_ci NOT NULL, PRIMARY KEY (name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin   comment='User defined functions';
 
 

=== modified file 'sql/datadict.cc'
--- a/sql/datadict.cc	2012-10-12 12:47:28 +0000
+++ b/sql/datadict.cc	2012-11-12 08:00:23 +0000
@@ -18,6 +18,10 @@
 #include "sql_class.h"
 #include "sql_table.h"
 
+#include "unireg.h"
+#include "sql_base.h"
+#include "key.h"
+#include "lock.h"
 
 /**
   Check type of .frm if we are not going to parse it.
@@ -190,3 +194,433 @@ bool dd_recreate_table(THD *thd, const c
   DBUG_RETURN(error);
 }
 
+/*
+  New Data Dictionary Prototype
+*/
+
+// DD tables
+const char *mysql_dd_catalog[][2]= {
+  {"mysql", "tables"},
+  {"mysql", "fields"},
+  {"mysql", "table_keys"},
+  {"mysql", "table_key_parts"},
+  {(const char *)NULL, (const char *)NULL} /* This must be at the end */
+};
+
+// Check if db.name is one of DD table names
+bool is_dd_table(const char *db, const char *name)
+{
+  int i=0;
+  while (mysql_dd_catalog[i][0])
+  {
+    if (strcmp(mysql_dd_catalog[i][0], db) == 0 &&
+        strcmp(mysql_dd_catalog[i][1], name) == 0)
+      return true;
+    i++;
+  }
+
+  return false;
+}
+
+bool dd_create_fields(THD *thd, TABLE *table, long long id,
+                     List<Create_field> &create_fields);
+
+/**
+  Write new table into mysql.tables.
+
+  @param thd  Thread context.
+  @param sp   Stored routine object to store.
+
+  @retval false success
+  @retval true  error
+*/
+bool dd_create_table(THD *thd, const char *db, const char *name,
+                     HA_CREATE_INFO *create_info,
+                     List<Create_field> &create_fields,
+                     uint keys, KEY *key_info, handler *file)
+{
+  bool error= true;
+  TABLE_LIST table_list[2];
+  TABLE *tbl_tables;
+  TABLE *tbl_fields;
+  Open_tables_backup open_tables_state_backup;
+  Dummy_error_handler error_handler;
+  Query_tables_list query_table_list_backup;
+  bool store_failed= FALSE;
+  long long new_table_id=0;
+  bool save_binlog_row_based;
+
+  DBUG_ENTER("dd_create_table");
+
+  sql_mode_t saved_mode= thd->variables.sql_mode;
+  enum_check_fields saved_count_cuted_fields;
+
+  thd->push_internal_handler(&error_handler);
+  MDL_savepoint mdl_savepoint= thd->mdl_context.mdl_savepoint();
+  thd->lex->reset_n_backup_query_tables_list(&query_table_list_backup);
+  thd->reset_n_backup_open_tables_state(&open_tables_state_backup);
+
+  /*
+    This statement will be replicated as a statement, even when using
+    row-based replication.  The flag will be reset at the end of the
+    statement.
+  */
+  if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row()))
+    thd->clear_current_stmt_binlog_format_row();
+
+  // Grab an exclusive MDL lock. 
+  if (lock_object_name(thd, MDL_key::TABLE, db, name))
+  {
+    my_error(ER_CANT_CREATE_TABLE, MYF(0), name, 1);
+    goto done;
+  }
+
+  table_list[0].init_one_table("mysql", 5, "tables", 6, "tables", TL_WRITE);
+  table_list[1].init_one_table("mysql", 5, "fields", 6, "fields", TL_WRITE);
+  table_list[0].next_local= table_list[0].next_global= table_list + 1;
+
+  /* Reset sql_mode during data dictionary operations. */
+  thd->variables.sql_mode= 0;
+
+  saved_count_cuted_fields= thd->count_cuted_fields;
+  thd->count_cuted_fields= CHECK_FIELD_WARN;
+
+  if (open_and_lock_tables(thd, table_list, FALSE, MYSQL_LOCK_IGNORE_TIMEOUT))
+  {
+    my_error(ER_CANT_CREATE_TABLE, MYF(0), name, 1);
+    goto done;
+  }
+  else
+  {
+    int null_fields= 0;
+    tbl_tables= table_list[0].table;
+    restore_record(tbl_tables, s->default_values); // Get default values for fields
+    tbl_tables->next_number_field= tbl_tables->found_next_number_field;
+    tbl_tables->auto_increment_field_not_null= TRUE;
+
+    bitmap_set_all(tbl_tables->write_set);
+    bitmap_set_all(tbl_tables->read_set);
+    tbl_tables->field[MYSQL_DD_TABLES_FIELD_DB]->set_notnull();
+    store_failed= tbl_tables->field[MYSQL_DD_TABLES_FIELD_DB]->
+        store(db, strlen(db), system_charset_info);
+
+    tbl_tables->field[MYSQL_DD_TABLES_FIELD_NAME]->set_notnull();
+    store_failed= store_failed ||
+      tbl_tables->field[MYSQL_DD_TABLES_FIELD_NAME]->
+        store(name, strlen(name), system_charset_info);
+
+    if (thd->auto_inc_intervals_in_cur_stmt_for_binlog.nb_elements() > 0)
+    {
+      tbl_tables->field[MYSQL_DD_TABLES_FIELD_ID]->set_notnull();
+      if (tbl_tables->
+          field[MYSQL_DD_TABLES_FIELD_ID]->store(
+            thd->auto_inc_intervals_in_cur_stmt_for_binlog.minimum(), TRUE))
+        goto done;
+    }
+
+    tbl_tables->field[MYSQL_DD_TABLES_FIELD_LEGACY_DB_TYPE]->set_notnull();
+    store_failed= store_failed ||
+      tbl_tables->field[MYSQL_DD_TABLES_FIELD_LEGACY_DB_TYPE]->
+        store(ha_legacy_type(create_info->db_type), TRUE);
+
+    tbl_tables->field[MYSQL_DD_TABLES_FIELD_MAX_ROWS]->set_notnull();
+    store_failed= store_failed ||
+      tbl_tables->field[MYSQL_DD_TABLES_FIELD_MAX_ROWS]->
+        store(create_info->max_rows, TRUE);
+
+    tbl_tables->field[MYSQL_DD_TABLES_FIELD_MIN_ROWS]->set_notnull();
+    store_failed= store_failed ||
+      tbl_tables->field[MYSQL_DD_TABLES_FIELD_MIN_ROWS]->
+        store(create_info->min_rows, TRUE);
+
+    tbl_tables->field[MYSQL_DD_TABLES_FIELD_SYSTEM]->set_notnull();
+    uchar system= test((create_info->max_rows == 1) &&
+                       (create_info->min_rows == 1) && (keys == 0));
+    store_failed= store_failed ||
+      tbl_tables->field[MYSQL_DD_TABLES_FIELD_SYSTEM]->
+        store(system, TRUE);
+
+    tbl_tables->field[MYSQL_DD_TABLES_FIELD_DD_VERSION]->set_notnull();
+    store_failed= store_failed ||
+      tbl_tables->field[MYSQL_DD_TABLES_FIELD_DD_VERSION]->
+        store(FRM_VER + 3 + test(create_info->varchar), TRUE);
+
+    tbl_tables->field[MYSQL_DD_TABLES_FIELD_DD_CREATE_OPTIONS]->set_notnull();
+    store_failed= store_failed ||
+      tbl_tables->field[MYSQL_DD_TABLES_FIELD_DD_CREATE_OPTIONS]->
+        store(create_info->table_options|HA_OPTION_LONG_BLOB_PTR, TRUE);
+
+    tbl_tables->field[MYSQL_DD_TABLES_FIELD_AVG_ROW_LENGTH]->set_notnull();
+    store_failed= store_failed ||
+      tbl_tables->field[MYSQL_DD_TABLES_FIELD_AVG_ROW_LENGTH]->
+        store(create_info->avg_row_length, TRUE);
+
+    tbl_tables->field[MYSQL_DD_TABLES_FIELD_CSID]->set_notnull();
+    uint csid= (create_info->default_table_charset ?
+                create_info->default_table_charset->number : 0);
+    store_failed= store_failed ||
+      tbl_tables->field[MYSQL_DD_TABLES_FIELD_CSID]->
+        store(csid, TRUE);
+
+    tbl_tables->field[MYSQL_DD_TABLES_FIELD_ROW_TYPE]->set_notnull();
+    store_failed= store_failed ||
+      tbl_tables->field[MYSQL_DD_TABLES_FIELD_ROW_TYPE]->
+        store(create_info->row_type, TRUE);
+
+    tbl_tables->field[MYSQL_DD_TABLES_FIELD_STATS_SAMPLE_PAGES]->set_notnull();
+    store_failed= store_failed ||
+      tbl_tables->field[MYSQL_DD_TABLES_FIELD_STATS_SAMPLE_PAGES]->
+        store(create_info->stats_sample_pages & 0xffff, TRUE);
+
+    tbl_tables->field[MYSQL_DD_TABLES_FIELD_STATS_AUTO_RECALC]->set_notnull();
+    store_failed= store_failed ||
+      tbl_tables->field[MYSQL_DD_TABLES_FIELD_STATS_AUTO_RECALC]->
+        store(create_info->stats_auto_recalc, TRUE);
+
+    tbl_tables->field[MYSQL_DD_TABLES_FIELD_MYSQL_VERSION]->set_notnull();
+    store_failed= store_failed ||
+      tbl_tables->field[MYSQL_DD_TABLES_FIELD_MYSQL_VERSION]->
+        store(MYSQL_VERSION_ID, TRUE);
+
+    tbl_tables->field[MYSQL_DD_TABLES_FIELD_DEFAULT_PART_DB_TYPE]->set_notnull();
+    store_failed= store_failed ||
+      tbl_tables->field[MYSQL_DD_TABLES_FIELD_DEFAULT_PART_DB_TYPE]->
+        store(0, TRUE); //TODO - Handle when dealing with partitions
+
+    tbl_tables->field[MYSQL_DD_TABLES_FIELD_KEY_BLOCK_SIZE]->set_notnull();
+    store_failed= store_failed ||
+      tbl_tables->field[MYSQL_DD_TABLES_FIELD_KEY_BLOCK_SIZE]->
+        store(create_info->key_block_size, TRUE); 
+
+    tbl_tables->field[MYSQL_DD_TABLES_FIELD_COMMENT]->set_notnull();
+    store_failed= store_failed ||
+      tbl_tables->field[MYSQL_DD_TABLES_FIELD_COMMENT]->
+        store(create_info->comment.str, 
+              create_info->comment.length, system_charset_info);
+
+    tbl_tables->field[MYSQL_DD_TABLES_FIELD_FIELD_COUNT]->set_notnull();
+    store_failed= store_failed ||
+      tbl_tables->field[MYSQL_DD_TABLES_FIELD_FIELD_COUNT]->
+        store(create_fields.elements, TRUE);
+
+    List_iterator<Create_field> it(create_fields);
+    Create_field *field;
+    while ((field=it++)) 
+      if (f_maybe_null(field->pack_flag))
+          null_fields++;
+    tbl_tables->field[MYSQL_DD_TABLES_FIELD_NULL_FIELDS]->set_notnull();
+    store_failed= store_failed ||
+      tbl_tables->field[MYSQL_DD_TABLES_FIELD_NULL_FIELDS]->
+        store(null_fields, TRUE);
+
+    tbl_tables->field[MYSQL_DD_TABLES_FIELD_KEYS]->set_notnull();
+    store_failed= store_failed ||
+      tbl_tables->field[MYSQL_DD_TABLES_FIELD_KEYS]->
+        store(keys, TRUE);
+
+    if (create_info->tablespace)
+    {
+      tbl_tables->field[MYSQL_DD_TABLES_FIELD_TABLESPACE]->set_notnull();
+      store_failed= store_failed ||
+        tbl_tables->field[MYSQL_DD_TABLES_FIELD_TABLESPACE]->
+          store(create_info->tablespace, 
+                strlen(create_info->tablespace), system_charset_info);
+    }
+
+    if (store_failed)
+    {
+      my_error(ER_CANT_CREATE_TABLE, MYF(0), name, store_failed);
+      goto done;
+    }
+
+    // Store table definition in DD
+    if (tbl_tables->file->ha_write_row(tbl_tables->record[0]))
+    {
+      my_error(ER_TABLE_EXISTS_ERROR, MYF(0), name);
+      goto done;
+    }
+
+    // Store field definition in DD
+    tbl_fields= table_list[1].table;
+    bitmap_set_all(tbl_fields->write_set);
+    bitmap_set_all(tbl_fields->read_set);
+    new_table_id= tbl_tables->file->insert_id_for_cur_row + new_table_id;
+    dd_create_fields(thd, tbl_fields, new_table_id, create_fields);
+
+    error= false;
+  }
+
+done:
+  thd->count_cuted_fields= saved_count_cuted_fields;
+  thd->variables.sql_mode= saved_mode;
+  if (tbl_tables)
+  {
+    tbl_tables->auto_increment_field_not_null= FALSE;
+    tbl_tables->file->ha_release_auto_increment();
+    tbl_tables->next_number_field= NULL;
+  }
+
+  if (save_binlog_row_based)
+    thd->set_current_stmt_binlog_format_row();
+
+  thd->pop_internal_handler();
+  close_thread_tables(thd);
+  thd->mdl_context.rollback_to_savepoint(mdl_savepoint);
+  thd->lex->restore_backup_query_tables_list(&query_table_list_backup);
+  thd->restore_backup_open_tables_state(&open_tables_state_backup);
+  DBUG_RETURN(error);
+}
+
+/**
+  Write fields into mysql.fields.
+
+  @param thd  Thread context.
+  @param sp   Stored routine object to store.
+
+  @retval false success
+  @retval true  error
+*/
+
+bool dd_create_fields(THD *thd, TABLE *table, long long id,
+                     List<Create_field> &create_fields)
+{
+  bool error= true;
+  bool store_failed= FALSE;
+
+  DBUG_ENTER("dd_create_fields");
+
+  Create_field *field;
+  List_iterator<Create_field> it(create_fields);
+  while ((field=it++))
+  {
+    restore_record(table, s->default_values); // Get default values for fields
+
+    table->field[MYSQL_DD_FIELDS_FIELD_TABLE_ID]->set_notnull();
+    store_failed= table->field[MYSQL_DD_FIELDS_FIELD_TABLE_ID]->
+        store(id, TRUE);
+
+    table->field[MYSQL_DD_FIELDS_FIELD_NAME]->set_notnull();
+    store_failed= store_failed ||
+        table->field[MYSQL_DD_FIELDS_FIELD_NAME]->
+        store(field->field_name, strlen(field->field_name),
+              system_charset_info);
+
+    table->field[MYSQL_DD_FIELDS_FIELD_TYPE]->set_notnull();
+    store_failed= store_failed ||
+        table->field[MYSQL_DD_FIELDS_FIELD_TYPE]->
+        store(field->sql_type, TRUE);
+
+    table->field[MYSQL_DD_FIELDS_FIELD_FIELD_LENGTH]->set_notnull();
+    store_failed= store_failed ||
+        table->field[MYSQL_DD_FIELDS_FIELD_FIELD_LENGTH]->
+        store(field->length, TRUE);
+
+    table->field[MYSQL_DD_FIELDS_FIELD_UNIREG_TYPE]->set_notnull();
+    store_failed= store_failed ||
+        table->field[MYSQL_DD_FIELDS_FIELD_UNIREG_TYPE]->
+        store(field->unireg_check, TRUE);
+
+    table->field[MYSQL_DD_FIELDS_FIELD_RECORD_OFFSET]->set_notnull();
+    store_failed= store_failed ||
+        table->field[MYSQL_DD_FIELDS_FIELD_RECORD_OFFSET]->
+        store(field->offset, TRUE);
+
+    table->field[MYSQL_DD_FIELDS_FIELD_PACK_FLAG]->set_notnull();
+    store_failed= store_failed ||
+        table->field[MYSQL_DD_FIELDS_FIELD_PACK_FLAG]->
+        store(field->pack_flag, TRUE);
+
+    table->field[MYSQL_DD_FIELDS_FIELD_CSID]->set_notnull();
+    store_failed= store_failed ||
+        table->field[MYSQL_DD_FIELDS_FIELD_CSID]->
+        store(field->charset->number, TRUE);
+
+    table->field[MYSQL_DD_FIELDS_FIELD_COMMENT]->set_notnull();
+    store_failed= store_failed ||
+        table->field[MYSQL_DD_FIELDS_FIELD_COMMENT]->
+        store(field->comment.str, field->comment.length,
+              system_charset_info);
+
+    // Write intervals
+    if (field->interval)
+    {
+      uchar buff[MAX_FIELD_WIDTH];
+      unsigned char  sep= ',';
+      uint           i;
+      String tmp((char*) buff,sizeof(buff), &my_charset_bin);
+      tmp.length(0);
+      /*unsigned char  occ[256]; // NewDD - Why do we need this occ ??
+      unsigned char *val= NULL;
+
+      memset(occ, 0, sizeof(occ));
+
+      for (i=0; (val= (unsigned char*) field->interval->type_names[i]); i++)
+        for (uint j = 0; j < field->interval->type_lengths[i]; j++)
+          occ[(unsigned int) (val[j])]= 1;
+
+      if (!occ[(unsigned char)NAMES_SEP_CHAR])
+        sep= (unsigned char) NAMES_SEP_CHAR;
+      else if (!occ[(unsigned int)','])
+        sep= ',';
+      else
+      {
+        for (uint i=1; i<256; i++)
+        {
+          if(!occ[i])
+          {
+            sep= i;
+            break;
+          }
+        }
+
+        if(!sep)    // disaster, enum uses all characters, none left as separator 
+        {
+          my_message(ER_WRONG_FIELD_TERMINATORS,ER(ER_WRONG_FIELD_TERMINATORS),
+                     MYF(0));
+          DBUG_RETURN(1);
+        }
+      }*/
+
+      for (const char **pos=field->interval->type_names ; *pos ; pos++)
+      {
+        tmp.append(*pos);
+        if (*(pos+1))
+          tmp.append(sep);
+        i++;
+      }
+
+      table->field[MYSQL_DD_FIELDS_FIELD_INTERVAL]->set_notnull();
+      store_failed= store_failed ||
+        table->field[MYSQL_DD_FIELDS_FIELD_INTERVAL]->
+          store(tmp.ptr(), tmp.length(), system_charset_info);
+
+      table->field[MYSQL_DD_FIELDS_FIELD_INTERVAL_PARTS]->set_notnull();
+      store_failed= store_failed ||
+        table->field[MYSQL_DD_FIELDS_FIELD_INTERVAL_PARTS]->
+          store(i, TRUE);
+    }
+
+    table->field[MYSQL_DD_FIELDS_FIELD_FLAGS]->set_notnull();
+    store_failed= store_failed ||
+        table->field[MYSQL_DD_FIELDS_FIELD_FLAGS]->
+        store(field->flags, TRUE);
+
+    if (store_failed)
+    {
+        my_error(ER_CANT_CREATE_TABLE, MYF(0), field->field_name,
+                 store_failed);
+        goto err;
+    }
+
+    if (table->file->ha_write_row(table->record[0]))
+    {
+        my_error(ER_TABLE_EXISTS_ERROR, MYF(0), field->field_name);
+        goto err;
+    }
+  }
+  error= false;
+
+err:
+  DBUG_RETURN(error);
+}
+

=== modified file 'sql/datadict.h'
--- a/sql/datadict.h	2010-08-16 12:53:30 +0000
+++ b/sql/datadict.h	2012-11-12 08:00:23 +0000
@@ -16,6 +16,7 @@
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA */
 
 #include "handler.h"
+#include "sql_table.h"
 
 /*
   Data dictionary API.
@@ -39,4 +40,104 @@ bool dd_check_storage_engine_flag(THD *t
                                   bool *yes_no);
 bool dd_recreate_table(THD *thd, const char *db, const char *table_name);
 
+/*
+ New DD Prototype
+*/
+
+// Return codes from dd_create_*, dp_drop_*
+#define DD_OK                 0
+#define DD_KEY_NOT_FOUND     -1
+#define DD_OPEN_TABLE_FAILED -2
+#define DD_WRITE_ROW_FAILED  -3
+#define DD_DELETE_ROW_FAILED -4
+#define DD_GET_FIELD_FAILED  -5
+#define DD_PARSE_ERROR       -6
+#define DD_INTERNAL_ERROR    -7
+#define DD_NO_DB_ERROR       -8
+#define DD_BAD_IDENTIFIER    -9
+#define DD_BODY_TOO_LONG    -10
+#define DD_FLD_STORE_FAILED -11
+
+/* Fields in data dictionary table 'TABLES' */
+enum
+{
+  MYSQL_DD_TABLES_FIELD_DB = 0,
+  MYSQL_DD_TABLES_FIELD_NAME,
+  MYSQL_DD_TABLES_FIELD_ID,
+  MYSQL_DD_TABLES_FIELD_LEGACY_DB_TYPE,
+  MYSQL_DD_TABLES_FIELD_MAX_ROWS,
+  MYSQL_DD_TABLES_FIELD_MIN_ROWS,
+  MYSQL_DD_TABLES_FIELD_SYSTEM,
+  MYSQL_DD_TABLES_FIELD_DD_VERSION,
+  MYSQL_DD_TABLES_FIELD_DD_CREATE_OPTIONS,
+  MYSQL_DD_TABLES_FIELD_AVG_ROW_LENGTH,
+  MYSQL_DD_TABLES_FIELD_CSID,
+  MYSQL_DD_TABLES_FIELD_ROW_TYPE,
+  MYSQL_DD_TABLES_FIELD_STATS_SAMPLE_PAGES,
+  MYSQL_DD_TABLES_FIELD_STATS_AUTO_RECALC,
+  MYSQL_DD_TABLES_FIELD_MYSQL_VERSION,
+  MYSQL_DD_TABLES_FIELD_DEFAULT_PART_DB_TYPE,
+  MYSQL_DD_TABLES_FIELD_KEY_BLOCK_SIZE,
+  MYSQL_DD_TABLES_FIELD_COMMENT,
+  MYSQL_DD_TABLES_FIELD_FIELD_COUNT,
+  MYSQL_DD_TABLES_FIELD_NULL_FIELDS,
+  MYSQL_DD_TABLES_FIELD_KEYS,
+  MYSQL_DD_TABLES_FIELD_TABLESPACE,
+  MYSQL_DD_TABLES_FIELD_COUNT  // Total number of fields
+};
+
+/* Fields in data dictionary table 'FIELDS' */
+enum
+{
+  MYSQL_DD_FIELDS_FIELD_TABLE_ID= 0,
+  MYSQL_DD_FIELDS_FIELD_NAME,
+  MYSQL_DD_FIELDS_FIELD_TYPE,
+  MYSQL_DD_FIELDS_FIELD_FIELD_LENGTH,
+  MYSQL_DD_FIELDS_FIELD_UNIREG_TYPE,
+  MYSQL_DD_FIELDS_FIELD_RECORD_OFFSET,
+  MYSQL_DD_FIELDS_FIELD_PACK_FLAG,
+  MYSQL_DD_FIELDS_FIELD_CSID,
+  MYSQL_DD_FIELDS_FIELD_COMMENT,
+  MYSQL_DD_FIELDS_FIELD_INTERVAL,
+  MYSQL_DD_FIELDS_FIELD_INTERVAL_PARTS,
+  MYSQL_DD_FIELDS_FIELD_FLAGS,
+  MYSQL_DD_FIELDS_FIELD_COUNT  // Total number of fields
+};
+
+/* Fields in data dictionary table 'TABLE_KEYS' */
+enum
+{
+  MYSQL_DD_TABLE_KEYS_FIELD_ID= 0,
+  MYSQL_DD_TABLE_KEYS_FIELD_TABLE_ID,
+  MYSQL_DD_TABLE_KEYS_FIELD_NAME,
+  MYSQL_DD_TABLE_KEYS_FIELD_FLAGS,
+  MYSQL_DD_TABLE_KEYS_FIELD_KEY_PARTS,
+  MYSQL_DD_TABLE_KEYS_FIELD_KEY_LENGTH,
+  MYSQL_DD_TABLE_KEYS_FIELD_ALGORITHM,
+  MYSQL_DD_TABLE_KEYS_FIELD_BLOCK_SIZE,
+  MYSQL_DD_TABLE_KEYS_FIELD_USER_DEFINED_KEY_PARTS,
+  MYSQL_DD_TABLE_KEYS_FIELD_PARSER,
+  MYSQL_DD_TABLE_KEYS_FIELD_COMMENT,
+  MYSQL_DD_TABLE_KEYS_FIELD_COUNT  // Total number of fields
+};
+
+/* Fields in data dictionary table 'TABLE_KEY_PARTS' */
+enum
+{
+  MYSQL_DD_TABLE_KEY_PARTS_FIELD_KEY_ID= 0,
+  MYSQL_DD_TABLE_KEY_PARTS_FIELD_FIELD_NR,
+  MYSQL_DD_TABLE_KEY_PARTS_FIELD_LENGTH,
+  MYSQL_DD_TABLE_KEY_PARTS_FIELD_RECORD_OFFSET,
+  MYSQL_DD_TABLE_KEY_PARTS_FIELD_KEY_TYPE,
+  MYSQL_DD_TABLE_KEY_PARTS_FIELD_KEY_PART_FLAG,
+  MYSQL_DD_TABLE_KEY_PARTS_FIELD_COUNT  // Total number of fields
+};
+
+
+bool is_dd_table(const char *db, const char *name);
+bool dd_create_table(THD *thd, const char *db, const char *name,
+                     HA_CREATE_INFO *create_info,
+                     List<Create_field> &create_fields,
+                     uint keys, KEY *key_info, handler *file);
+
 #endif // DATADICT_INCLUDED

=== modified file 'sql/sql_table.cc'
--- a/sql/sql_table.cc	2012-11-07 12:05:17 +0000
+++ b/sql/sql_table.cc	2012-11-12 08:00:23 +0000
@@ -4747,6 +4747,15 @@ bool create_table_impl(THD *thd,
                        *key_count, *key_info, file, no_ha_table))
     goto err;
 
+  // Add table details into new DD
+  if (!(create_info->options & HA_LEX_CREATE_TMP_TABLE) &&
+      !thd->is_current_stmt_binlog_format_row() && //TODO We get core without
+                                                    // this condition for now
+      !is_dd_table(db, table_name))
+    dd_create_table(thd, db, table_name, create_info,
+                    alter_info->create_list, *key_count,
+                    *key_info, file);
+
   if (!no_ha_table && create_info->options & HA_LEX_CREATE_TMP_TABLE)
   {
     /*

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk branch (gopal.shankar:4968 to 4969) Gopal Shankar12 Nov