List:Commits« Previous MessageNext Message »
From:Jon Olav Hauglid Date:February 8 2012 5:07pm
Subject:bzr push into mysql-trunk-wl5534-stage branch (jon.hauglid:3826 to 3827)
View as plain text  
 3827 Jon Olav Hauglid	2012-02-08 [merge]
      Merge from mysql-trunk to mysql-trunk-wl5534-stage
      Text conflict in mysql-test/r/innodb_mysql_sync.result
      Text conflict in mysql-test/t/innodb_mysql_sync.test
      Text conflict in sql/sql_table.cc

    added:
      mysql-test/r/eq_range_idx_stat.result
      mysql-test/suite/innodb/r/innodb_bug11754376.result
      mysql-test/suite/innodb/t/innodb_bug11754376.test
      mysql-test/t/eq_range_idx_stat.test
      unittest/gunit/filesort_compare-t.cc
    modified:
      include/my_sys.h
      mysql-test/collections/default.experimental
      mysql-test/include/have_32bit.inc
      mysql-test/include/subquery.inc
      mysql-test/r/ctype_many.result
      mysql-test/r/group_by.result
      mysql-test/r/innodb_mysql_sync.result
      mysql-test/r/join_outer.result
      mysql-test/r/join_outer_bka.result
      mysql-test/r/join_outer_bka_nixbnl.result
      mysql-test/r/mix2_myisam.result
      mysql-test/r/myisam.result
      mysql-test/r/mysqld--help-notwin.result
      mysql-test/r/mysqld--help-win.result
      mysql-test/r/partition_windows.result
      mysql-test/r/subquery_all.result
      mysql-test/r/subquery_all_bka.result
      mysql-test/r/subquery_all_bka_nixbnl.result
      mysql-test/r/subquery_nomat_nosj.result
      mysql-test/r/subquery_nomat_nosj_bka.result
      mysql-test/r/subquery_nomat_nosj_bka_nixbnl.result
      mysql-test/r/subquery_none.result
      mysql-test/r/subquery_none_bka.result
      mysql-test/r/subquery_none_bka_nixbnl.result
      mysql-test/r/type_temporal_fractional.result
      mysql-test/suite/funcs_1/r/innodb_views.result
      mysql-test/suite/funcs_1/r/memory_views.result
      mysql-test/suite/funcs_1/views/views_master.inc
      mysql-test/suite/innodb/r/innodb.result
      mysql-test/suite/opt_trace/r/eq_range_statistics.result
      mysql-test/suite/opt_trace/t/eq_range_statistics.test
      mysql-test/suite/rpl/r/rpl_change_master.result
      mysql-test/suite/rpl/r/rpl_corruption.result
      mysql-test/suite/rpl/t/rpl_change_master.test
      mysql-test/suite/rpl/t/rpl_corruption.test
      mysql-test/t/innodb_mysql_sync.test
      mysql-test/t/join_outer.test
      mysql-test/valgrind.supp
      mysys/mf_radix.c
      mysys/mf_sort.c
      sql/filesort.cc
      sql/filesort_utils.cc
      sql/filesort_utils.h
      sql/handler.cc
      sql/item.h
      sql/item_cmpfunc.cc
      sql/item_cmpfunc.h
      sql/log_event.cc
      sql/opt_range.cc
      sql/partition_info.cc
      sql/sql_executor.cc
      sql/sql_lex.cc
      sql/sql_optimizer.cc
      sql/sql_parse.cc
      sql/sql_show.cc
      sql/sql_table.cc
      sql/sql_yacc.yy
      sql/sys_vars.cc
      sql/table.h
      storage/archive/ha_archive.cc
      storage/archive/ha_archive.h
      storage/innobase/handler/ha_innodb.cc
      storage/myisam/ha_myisam.cc
      storage/myisam/mi_dbug.c
      unittest/gunit/CMakeLists.txt
      unittest/gunit/dynarray-t.cc
 3826 Marko Mäkelä	2012-02-07
      Non-functional changes:
      
      btr_cur_del_mark_set_clust_rec_log(), btr_cur_del_mark_set_clust_rec():
      Remove constant parameters flags=BTR_NO_LOCKING_FLAG, val=TRUE.
      The redo log apply (btr_cur_parse_del_mark_set_clust_rec) is only
      interested in BTR_KEEP_SYS_FLAG, which was never set.
      
      Approved by Jimmy Yang on IM.

    modified:
      storage/innobase/btr/btr0cur.cc
      storage/innobase/include/btr0cur.h
      storage/innobase/row/row0upd.cc
=== modified file 'include/my_sys.h'
--- a/include/my_sys.h	2011-11-28 07:13:03 +0000
+++ b/include/my_sys.h	2012-02-07 11:56:30 +0000
@@ -719,6 +719,7 @@ extern int flush_write_cache(RECORD_CACH
 extern void handle_recived_signals(void);
 
 extern sig_handler my_set_alarm_variable(int signo);
+extern my_bool radixsort_is_appliccable(uint n_items, size_t size_of_element);
 extern void my_string_ptr_sort(uchar *base,uint items,size_t size);
 extern void radixsort_for_str_ptr(uchar* base[], uint number_of_elements,
 				  size_t size_of_element,uchar *buffer[]);

=== modified file 'mysql-test/collections/default.experimental'
--- a/mysql-test/collections/default.experimental	2012-02-01 08:59:14 +0000
+++ b/mysql-test/collections/default.experimental	2012-02-03 15:16:35 +0000
@@ -9,46 +9,47 @@ main.func_math @freebsd
 main.mysqlslap @windows                  # Bug#11761520 2010-08-10 alik mysqlslap fails sporadically starting from Dahlia
 main.signal_demo3 @solaris               # Bug#11753919 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun
 main.sp @solaris                         # Bug#11753919 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun
-main.subquery_sj_all_bka_nixbnl @solaris
-main.subquery_sj_all_bka @solaris
-main.subquery_sj_all_bkaunique @solaris
-main.subquery_sj_all @solaris
-main.subquery_sj_dupsweed_bka_nixbnl @solaris
-main.subquery_sj_dupsweed_bka @solaris
-main.subquery_sj_dupsweed_bkaunique @solaris
-main.subquery_sj_dupsweed @solaris
-main.subquery_sj_firstmatch_bka_nixbnl @solaris
-main.subquery_sj_firstmatch_bka @solaris
-main.subquery_sj_firstmatch_bkaunique @solaris
-main.subquery_sj_firstmatch @solaris
-main.subquery_sj_innodb_all_bka_nixbnl @solaris
-main.subquery_sj_innodb_all_bka @solaris
-main.subquery_sj_innodb_all_bkaunique @solaris
-main.subquery_sj_innodb_all @solaris
-main.subquery_sj_innodb_none_bka_nixbnl @solaris
-main.subquery_sj_innodb_none_bka @solaris
-main.subquery_sj_innodb_none_bkaunique @solaris
-main.subquery_sj_innodb_none @solaris
-main.subquery_sj_loosescan_bka_nixbnl @solaris
-main.subquery_sj_loosescan_bka @solaris
-main.subquery_sj_loosescan_bkaunique @solaris
-main.subquery_sj_loosescan @solaris
-main.subquery_sj_mat_bka_nixbnl @solaris
-main.subquery_sj_mat_bka @solaris
-main.subquery_sj_mat_bkaunique @solaris
-main.subquery_sj_mat_nosj @solaris
-main.subquery_sj_mat @solaris
-main.subquery_sj_none_bka_nixbnl @solaris
-main.subquery_sj_none_bka @solaris
-main.subquery_sj_none_bkaunique @solaris
-main.subquery_sj_none @solaris
+
+main.subquery_sj_all_bka_nixbnl @solaris         # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_all_bka @solaris                # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_all_bkaunique @solaris          # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_all @solaris                    # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_dupsweed_bka_nixbnl @solaris    # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_dupsweed_bka @solaris           # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_dupsweed_bkaunique @solaris     # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_dupsweed @solaris               # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_firstmatch_bka_nixbnl @solaris  # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_firstmatch_bka @solaris         # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_firstmatch_bkaunique @solaris   # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_firstmatch @solaris             # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_innodb_all_bka_nixbnl @solaris  # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_innodb_all_bka @solaris         # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_innodb_all_bkaunique @solaris   # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_innodb_all @solaris             # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_innodb_none_bka_nixbnl @solaris # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_innodb_none_bka @solaris        # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_innodb_none_bkaunique @solaris  # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_innodb_none @solaris            # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_loosescan_bka_nixbnl @solaris   # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_loosescan_bka @solaris          # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_loosescan_bkaunique @solaris    # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_loosescan @solaris              # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_mat_bka_nixbnl @solaris         # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_mat_bka @solaris                # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_mat_bkaunique @solaris          # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_mat_nosj @solaris               # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_mat @solaris                    # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_none_bka_nixbnl @solaris        # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_none_bka @solaris               # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_none_bkaunique @solaris         # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_none @solaris                   # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+
 main.kill @freebsd                       # Bug#12619719 2011-08-04 Occasional failure in PB2
 
 innodb.innodb_monitor                    # Bug#12320827 2011-08-04 Occasional failure in PB2
 
 rpl.rpl_change_master_dbug               # BUG#11933491 2011-06-13 Anitha  Test fails on redhat 
 rpl.rpl_delayed_slave                    # BUG#11764654 rpl_delayed_slave fails sporadically in pb
-rpl.rpl_heartbeat_basic                  # BUG#12403008 2011-04-27 sven fails sporadically
 rpl.rpl_innodb_bug28430                  # Bug#11754425
 rpl.rpl_row_sp011  @solaris              # Bug#11753919 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun
 rpl.rpl_seconds_behind_master            # BUG#11765124 2010-11-24 luis fails sporadically on pb2

=== modified file 'mysql-test/include/have_32bit.inc'
--- a/mysql-test/include/have_32bit.inc	2009-01-08 18:13:57 +0000
+++ b/mysql-test/include/have_32bit.inc	2012-02-03 13:49:32 +0000
@@ -3,10 +3,10 @@
 
 --disable_query_log
 --disable_warnings
-let $save = `SELECT @@global.sort_buffer_size`;
-SET @@global.sort_buffer_size = 4294967296;
-let $mach32 = `SELECT @@global.sort_buffer_size <= 4294967295`;
-eval SET @@global.sort_buffer_size = $save;
+let $save = `SELECT @@global.myisam_sort_buffer_size`;
+SET @@global.myisam_sort_buffer_size = 4294967296;
+let $mach32 = `SELECT @@global.myisam_sort_buffer_size <= 4294967295`;
+eval SET @@global.myisam_sort_buffer_size = $save;
 --enable_warnings
 --enable_query_log
 if (!$mach32)

=== modified file 'mysql-test/include/subquery.inc'
--- a/mysql-test/include/subquery.inc	2011-09-29 12:47:32 +0000
+++ b/mysql-test/include/subquery.inc	2012-02-07 14:50:31 +0000
@@ -5643,3 +5643,164 @@ WHERE (col_varchar_nokey, 'x') IN
 
 --echo
 DROP TABLE it, ot;
+
+--echo #
+--echo # Bug #11829691: Pure virtual method called in Item_bool_func2::fix...()
+--echo #
+
+CREATE TABLE t1(a INTEGER);
+CREATE TABLE t2(b INTEGER);
+
+PREPARE stmt FROM "
+SELECT SUM(b) FROM t2 GROUP BY b HAVING b IN (SELECT b FROM t1)";
+
+EXECUTE stmt;
+EXECUTE stmt;
+
+DEALLOCATE PREPARE stmt;
+
+DROP TABLE t1, t2;
+
+--echo #
+--echo # Bug #13595212 EXTRA ROWS RETURNED ON RIGHT JOIN WITH VIEW AND
+--echo # IN-SUBQUERY IN WHERE
+--echo #
+
+CREATE TABLE t1 (
+  pk int(11) NOT NULL AUTO_INCREMENT,
+  col_int_key int(11) NOT NULL,
+  col_varchar_key varchar(1) NOT NULL,
+  col_varchar_nokey varchar(1) NOT NULL,
+  PRIMARY KEY (pk),
+  KEY col_int_key (col_int_key),
+  KEY col_varchar_key (col_varchar_key,col_int_key)
+);
+
+INSERT INTO t1 VALUES (1,0,'j','j'),(2,8,'v','v'),
+(3,1,'c','c'),(4,8,'m','m'),(5,9,'d','d');
+
+CREATE VIEW v1 AS SELECT * FROM t1;
+
+# RIGHT JOIN
+
+let $query=
+SELECT alias2.col_varchar_nokey
+FROM v1 AS alias1
+  RIGHT JOIN t1 AS alias2 ON 1
+WHERE alias2.col_varchar_key IN (
+  SELECT sq2_alias1.col_varchar_nokey
+  FROM v1 AS sq2_alias1
+    LEFT JOIN t1 AS sq2_alias2
+    ON (sq2_alias2.col_int_key = sq2_alias1.pk)
+  WHERE sq2_alias1.pk != alias1.col_int_key
+    AND sq2_alias1.col_varchar_key > alias1.col_varchar_key
+)
+;
+
+eval EXPLAIN EXTENDED $query;
+--sorted_result
+eval $query;
+
+# Same, but in view:
+
+eval CREATE VIEW v2 AS $query;
+
+EXPLAIN EXTENDED SELECT * FROM v2;
+--sorted_result
+SELECT * FROM v2;
+
+# Same, with LEFT JOIN
+
+let $query=SELECT alias2.col_varchar_nokey
+FROM t1 AS alias2
+  LEFT JOIN v1 AS alias1 ON 1
+WHERE alias2.col_varchar_key IN (
+  SELECT sq2_alias1.col_varchar_nokey
+  FROM v1 AS sq2_alias1
+    LEFT JOIN t1 AS sq2_alias2
+    ON (sq2_alias2.col_int_key = sq2_alias1.pk)
+  WHERE sq2_alias1.pk != alias1.col_int_key
+    AND sq2_alias1.col_varchar_key > alias1.col_varchar_key
+);
+
+eval EXPLAIN EXTENDED $query;
+--sorted_result
+eval $query;
+
+DROP TABLE t1;
+DROP VIEW v1,v2;
+
+--echo #
+--echo # Bug#13651009 WRONG RESULT FROM DERIVED TABLE IF THE SUBQUERY
+--echo # HAS AN EMPTY RESULT
+--echo #
+
+CREATE TABLE t1 (
+  pk int NOT NULL,
+  col_int_nokey int NOT NULL,
+  col_int_key int NOT NULL,
+  col_time_key time NOT NULL,
+  col_varchar_key varchar(1) NOT NULL,
+  col_varchar_nokey varchar(1) NOT NULL,
+  PRIMARY KEY (pk),
+  KEY col_int_key (col_int_key),
+  KEY col_time_key (col_time_key),
+  KEY col_varchar_key (col_varchar_key,col_int_key)
+) ENGINE=MyISAM;
+
+CREATE TABLE t2 (
+  pk int NOT NULL AUTO_INCREMENT,
+  col_int_nokey int NOT NULL,
+  col_int_key int NOT NULL,
+  col_time_key time NOT NULL,
+  col_varchar_key varchar(1) NOT NULL,
+  col_varchar_nokey varchar(1) NOT NULL,
+  PRIMARY KEY (pk),
+  KEY col_int_key (col_int_key),
+  KEY col_time_key (col_time_key),
+  KEY col_varchar_key (col_varchar_key,col_int_key)
+) ENGINE=MyISAM;
+
+INSERT INTO t2 VALUES (1,4,4,'00:00:00','b','b');
+
+SET @var2:=4, @var3:=8;
+
+--echo
+--echo Testcase without inner subquery
+
+let $subq=
+SELECT @var3:=12, sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
+      sq4_alias1.col_varchar_key = @var3;
+
+eval EXPLAIN $subq;
+eval $subq;
+SELECT @var3;
+
+# Now as derived table:
+eval EXPLAIN SELECT * FROM ( $subq ) AS alias3;
+eval SELECT * FROM ( $subq ) AS alias3;
+SELECT @var3;
+
+--echo
+--echo Testcase with inner subquery; crashed WL#6095
+SET @var3=8;
+let $subq=
+SELECT sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
+      NOT IN
+      (SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
+              c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
+       FROM t2 AS c_sq1_alias1
+       WHERE (c_sq1_alias1.col_int_nokey != @var2
+              OR c_sq1_alias1.pk != @var3));
+
+eval EXPLAIN $subq;
+eval $subq;
+# Now as derived table:
+eval EXPLAIN SELECT * FROM ( $subq ) AS alias3;
+eval SELECT * FROM ( $subq ) AS alias3;
+
+DROP TABLE t1,t2;

=== modified file 'mysql-test/r/ctype_many.result'
--- a/mysql-test/r/ctype_many.result	2012-01-16 09:01:53 +0000
+++ b/mysql-test/r/ctype_many.result	2012-02-07 11:56:30 +0000
@@ -753,10 +753,10 @@ lower(utf8_f)
 �
 �
 �
-�
 �
 �
 �
+�
 �
 �
 �

=== added file 'mysql-test/r/eq_range_idx_stat.result'
--- a/mysql-test/r/eq_range_idx_stat.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/eq_range_idx_stat.result	2012-02-02 16:56:36 +0000
@@ -0,0 +1,125 @@
+SET eq_range_index_dive_limit=default;
+SELECT @@eq_range_index_dive_limit;
+@@eq_range_index_dive_limit
+10
+CREATE TABLE t1
+(
+/* Field names reflect value(rowid) distribution, st=STairs, swt= SaWTooth */
+st_a int,
+swt1a int,
+swt2a int,
+st_b int,
+swt1b int,
+swt2b int,
+key sta_swt12a(st_a,swt1a,swt2a),
+key sta_swt1a(st_a,swt1a),
+key sta_swt2a(st_a,swt2a),
+key sta_swt21a(st_a,swt2a,swt1a),
+key st_a(st_a),
+key stb_swt1a_2b(st_b,swt1b,swt2a),
+key stb_swt1b(st_b,swt1b),
+key st_b(st_b)
+) ;
+ALTER TABLE t1 DISABLE KEYS;
+#
+# Printing of many insert into t1 disabled.
+#
+ALTER TABLE t1 ENABLE KEYS;
+ANALYZE TABLE t1;
+Table	Op	Msg_type	Msg_text
+test.t1	analyze	status	Table is already up to date
+#
+# Run index_merge queries two times: 1) with index dives
+#                                    2) with index statistics
+#
+
+explain 
+select * from t1 
+where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1 and swt2b=1 limit 5;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	index_merge	sta_swt12a,sta_swt1a,sta_swt2a,sta_swt21a,st_a,stb_swt1a_2b,stb_swt1b,st_b	sta_swt12a,stb_swt1a_2b	15,15	NULL	3	Using intersect(sta_swt12a,stb_swt1a_2b); Using where
+select * from t1 
+where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1 and swt2b=1 limit 5;
+st_a	swt1a	swt2a	st_b	swt1b	swt2b
+1	1	1	1	1	1
+1	1	1	1	1	1
+1	1	1	1	1	1
+1	1	1	1	1	1
+1	1	1	1	1	1
+
+explain 
+select * from t1
+where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1 limit 5;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	index_merge	sta_swt12a,sta_swt1a,sta_swt2a,sta_swt21a,st_a,stb_swt1a_2b,stb_swt1b,st_b	sta_swt12a,stb_swt1a_2b	15,15	NULL	3	Using intersect(sta_swt12a,stb_swt1a_2b); Using where
+select * from t1
+where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1 limit 5;
+st_a	swt1a	swt2a	st_b	swt1b	swt2b
+1	1	1	1	1	1
+1	1	1	1	1	1
+1	1	1	1	1	1
+1	1	1	1	1	1
+1	1	1	1	1	1
+
+explain 
+select * from t1
+where st_a=1 and swt1a=1 and st_b=1 and swt1b=1 and swt1b=1 limit 5;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	ref	sta_swt12a,sta_swt1a,sta_swt2a,sta_swt21a,st_a,stb_swt1a_2b,stb_swt1b,st_b	sta_swt12a	10	const,const	89	Using where
+select * from t1
+where st_a=1 and swt1a=1 and st_b=1 and swt1b=1 and swt1b=1 limit 5;
+st_a	swt1a	swt2a	st_b	swt1b	swt2b
+1	1	1	1	1	1
+1	1	1	1	1	1
+1	1	1	1	1	1
+1	1	1	1	1	1
+1	1	1	1	1	1
+
+SET eq_range_index_dive_limit=1;
+SET SESSION DEBUG="+d,crash_records_in_range";
+
+explain 
+select * from t1 
+where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1 and swt2b=1 limit 5;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	index_merge	sta_swt12a,sta_swt1a,sta_swt2a,sta_swt21a,st_a,stb_swt1a_2b,stb_swt1b,st_b	sta_swt12a,stb_swt1a_2b	15,15	NULL	3	Using intersect(sta_swt12a,stb_swt1a_2b); Using where
+select * from t1 
+where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1 and swt2b=1 limit 5;
+st_a	swt1a	swt2a	st_b	swt1b	swt2b
+1	1	1	1	1	1
+1	1	1	1	1	1
+1	1	1	1	1	1
+1	1	1	1	1	1
+1	1	1	1	1	1
+
+explain 
+select * from t1
+where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1 limit 5;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	index_merge	sta_swt12a,sta_swt1a,sta_swt2a,sta_swt21a,st_a,stb_swt1a_2b,stb_swt1b,st_b	sta_swt12a,stb_swt1a_2b	15,15	NULL	3	Using intersect(sta_swt12a,stb_swt1a_2b); Using where
+select * from t1
+where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1 limit 5;
+st_a	swt1a	swt2a	st_b	swt1b	swt2b
+1	1	1	1	1	1
+1	1	1	1	1	1
+1	1	1	1	1	1
+1	1	1	1	1	1
+1	1	1	1	1	1
+
+explain 
+select * from t1
+where st_a=1 and swt1a=1 and st_b=1 and swt1b=1 and swt1b=1 limit 5;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	ref	sta_swt12a,sta_swt1a,sta_swt2a,sta_swt21a,st_a,stb_swt1a_2b,stb_swt1b,st_b	sta_swt12a	10	const,const	90	Using where
+select * from t1
+where st_a=1 and swt1a=1 and st_b=1 and swt1b=1 and swt1b=1 limit 5;
+st_a	swt1a	swt2a	st_b	swt1b	swt2b
+1	1	1	1	1	1
+1	1	1	1	1	1
+1	1	1	1	1	1
+1	1	1	1	1	1
+1	1	1	1	1	1
+
+SET eq_range_index_dive_limit=1;
+SET SESSION DEBUG="+d,crash_records_in_range";
+DROP TABLE t1;

=== modified file 'mysql-test/r/group_by.result'
--- a/mysql-test/r/group_by.result	2012-01-30 13:57:08 +0000
+++ b/mysql-test/r/group_by.result	2012-02-06 12:47:30 +0000
@@ -2110,6 +2110,7 @@ SELECT v1.pk
 FROM t1 LEFT JOIN v1 ON t1.i = v1.pk 
 GROUP BY v1.pk;
 pk
+NULL
 DROP VIEW v1;
 DROP TABLE t1,t2;
 # End of Bug#12798270

=== modified file 'mysql-test/r/innodb_mysql_sync.result'
--- a/mysql-test/r/innodb_mysql_sync.result	2012-02-01 11:43:43 +0000
+++ b/mysql-test/r/innodb_mysql_sync.result	2012-02-08 17:06:22 +0000
@@ -187,6 +187,32 @@ a	b
 2	23456
 DROP TABLE t1;
 #
+# Bug#13417754 ASSERT IN ROW_DROP_DATABASE_FOR_MYSQL DURING DROP SCHEMA
+#
+DROP TABLE IF EXISTS t1;
+DROP DATABASE IF EXISTS db1;
+CREATE TABLE t1(a int) engine=InnoDB;
+CREATE DATABASE db1;
+# Connection con1
+SET DEBUG_SYNC= 'after_innobase_rename_table SIGNAL locked WAIT_FOR continue';
+# Sending:
+ALTER TABLE t1 RENAME db1.t1;
+# Connection con2
+SET DEBUG_SYNC= 'now WAIT_FOR locked';
+# DROP DATABASE db1 should now be blocked by ALTER TABLE
+# Sending:
+DROP DATABASE db1;
+# Connection default
+# Check that DROP DATABASE is blocked by IX lock on db1
+# Resume ALTER TABLE
+SET DEBUG_SYNC= 'now SIGNAL continue';
+# Connection con1
+# Reaping: ALTER TABLE t1 RENAME db1.t1;
+# Connection con2
+# Reaping: DROP DATABASE db1
+# Connection default;
+SET DEBUG_SYNC= 'RESET';
+#
 # WL#5534 Online ALTER, Phase 1
 #
 # Multi thread tests.

=== modified file 'mysql-test/r/join_outer.result'
--- a/mysql-test/r/join_outer.result	2012-01-03 11:04:14 +0000
+++ b/mysql-test/r/join_outer.result	2012-02-06 12:47:30 +0000
@@ -1996,3 +1996,19 @@ id	select_type	table	type	possible_keys
 1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	1	Using where; Using join buffer (Block Nested Loop)
 1	SIMPLE	t6b	ALL	NULL	NULL	NULL	NULL	1	Using where; Using join buffer (Block Nested Loop)
 drop table t1,t2,t3,t4,t5,t6;
+#
+# Bug#13464334 SAME QUERY PRODUCES DIFFERENT RESULTS WHEN USED WITH AND
+# WITHOUT UNION ALL
+#
+CREATE TABLE t1 (p1 INT PRIMARY KEY, a CHAR(1));
+CREATE TABLE t2 (p2 INT PRIMARY KEY, b CHAR(1));
+INSERT INTO t1 VALUES (1,'a'),(2,'b'),(3,'c');
+INSERT INTO t2 VALUES (1,'h'),(2,'i'),(3,'j'),(4,'k');
+CREATE VIEW v1 AS SELECT * FROM t1;
+CREATE VIEW v2 AS SELECT * FROM t2;
+(SELECT p1 FROM v2 LEFT JOIN v1 ON b = a WHERE p2 = 1 GROUP BY p1 ORDER BY p1)
+UNION (SELECT NULL LIMIT 0);
+p1
+NULL
+DROP VIEW v1, v2;
+DROP TABLE t1, t2;

=== modified file 'mysql-test/r/join_outer_bka.result'
--- a/mysql-test/r/join_outer_bka.result	2012-01-03 11:04:14 +0000
+++ b/mysql-test/r/join_outer_bka.result	2012-02-06 12:47:30 +0000
@@ -1997,4 +1997,20 @@ id	select_type	table	type	possible_keys
 1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	1	Using where; Using join buffer (Block Nested Loop)
 1	SIMPLE	t6b	ALL	NULL	NULL	NULL	NULL	1	Using where; Using join buffer (Block Nested Loop)
 drop table t1,t2,t3,t4,t5,t6;
+#
+# Bug#13464334 SAME QUERY PRODUCES DIFFERENT RESULTS WHEN USED WITH AND
+# WITHOUT UNION ALL
+#
+CREATE TABLE t1 (p1 INT PRIMARY KEY, a CHAR(1));
+CREATE TABLE t2 (p2 INT PRIMARY KEY, b CHAR(1));
+INSERT INTO t1 VALUES (1,'a'),(2,'b'),(3,'c');
+INSERT INTO t2 VALUES (1,'h'),(2,'i'),(3,'j'),(4,'k');
+CREATE VIEW v1 AS SELECT * FROM t1;
+CREATE VIEW v2 AS SELECT * FROM t2;
+(SELECT p1 FROM v2 LEFT JOIN v1 ON b = a WHERE p2 = 1 GROUP BY p1 ORDER BY p1)
+UNION (SELECT NULL LIMIT 0);
+p1
+NULL
+DROP VIEW v1, v2;
+DROP TABLE t1, t2;
 set optimizer_switch=default;

=== modified file 'mysql-test/r/join_outer_bka_nixbnl.result'
--- a/mysql-test/r/join_outer_bka_nixbnl.result	2012-01-03 11:04:14 +0000
+++ b/mysql-test/r/join_outer_bka_nixbnl.result	2012-02-06 12:47:30 +0000
@@ -1997,4 +1997,20 @@ id	select_type	table	type	possible_keys
 1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	1	Using where
 1	SIMPLE	t6b	ALL	NULL	NULL	NULL	NULL	1	Using where
 drop table t1,t2,t3,t4,t5,t6;
+#
+# Bug#13464334 SAME QUERY PRODUCES DIFFERENT RESULTS WHEN USED WITH AND
+# WITHOUT UNION ALL
+#
+CREATE TABLE t1 (p1 INT PRIMARY KEY, a CHAR(1));
+CREATE TABLE t2 (p2 INT PRIMARY KEY, b CHAR(1));
+INSERT INTO t1 VALUES (1,'a'),(2,'b'),(3,'c');
+INSERT INTO t2 VALUES (1,'h'),(2,'i'),(3,'j'),(4,'k');
+CREATE VIEW v1 AS SELECT * FROM t1;
+CREATE VIEW v2 AS SELECT * FROM t2;
+(SELECT p1 FROM v2 LEFT JOIN v1 ON b = a WHERE p2 = 1 GROUP BY p1 ORDER BY p1)
+UNION (SELECT NULL LIMIT 0);
+p1
+NULL
+DROP VIEW v1, v2;
+DROP TABLE t1, t2;
 set optimizer_switch=default;

=== modified file 'mysql-test/r/mix2_myisam.result'
--- a/mysql-test/r/mix2_myisam.result	2010-12-06 13:12:51 +0000
+++ b/mysql-test/r/mix2_myisam.result	2012-02-07 11:56:30 +0000
@@ -1611,15 +1611,15 @@ i	10
 select sql_big_result v,count(c) from t1 group by v limit 10;
 v	count(c)
 a	1
-a 	10
-b     	10
-c    	10
-d   	10
-e  	10
-f     	10
-g    	10
+a	10
+b	10
+c	10
+d	10
+e	10
+f	10
+g	10
 h	10
-i     	10
+i	10
 select c,count(*) from t1 group by c limit 10;
 c	count(*)
 a	1

=== modified file 'mysql-test/r/myisam.result'
--- a/mysql-test/r/myisam.result	2012-02-02 09:03:02 +0000
+++ b/mysql-test/r/myisam.result	2012-02-07 11:56:30 +0000
@@ -1286,15 +1286,15 @@ i	10
 select sql_big_result v,count(c) from t1 group by v limit 10;
 v	count(c)
 a	1
-a 	10
-b     	10
-c    	10
-d   	10
-e  	10
-f     	10
-g    	10
+a	10
+b	10
+c	10
+d	10
+e	10
+f	10
+g	10
 h	10
-i     	10
+i	10
 select c,count(*) from t1 group by c limit 10;
 c	count(*)
 a	1

=== modified file 'mysql-test/r/mysqld--help-notwin.result'
--- a/mysql-test/r/mysqld--help-notwin.result	2012-01-31 10:40:02 +0000
+++ b/mysql-test/r/mysqld--help-notwin.result	2012-02-02 16:56:36 +0000
@@ -154,7 +154,8 @@ The following options may be given as th
  --eq-range-index-dive-limit=# 
  The optimizer will use existing index statistics instead
  of doing index dives for equality ranges if the number of
- equality ranges is larger than or equal to this number.
+ equality ranges for the index is larger than or equal to
+ this number.
  --event-scheduler[=name] 
  Enable the event scheduler. Possible values are ON, OFF,
  and DISABLED (keep the event scheduler completely

=== modified file 'mysql-test/r/mysqld--help-win.result'
--- a/mysql-test/r/mysqld--help-win.result	2012-01-31 10:40:02 +0000
+++ b/mysql-test/r/mysqld--help-win.result	2012-02-02 16:56:36 +0000
@@ -154,7 +154,8 @@ The following options may be given as th
  --eq-range-index-dive-limit=# 
  The optimizer will use existing index statistics instead
  of doing index dives for equality ranges if the number of
- equality ranges is larger than or equal to this number.
+ equality ranges for the index is larger than or equal to
+ this number.
  --event-scheduler[=name] 
  Enable the event scheduler. Possible values are ON, OFF,
  and DISABLED (keep the event scheduler completely

=== modified file 'mysql-test/r/partition_windows.result'
--- a/mysql-test/r/partition_windows.result	2008-10-26 17:05:24 +0000
+++ b/mysql-test/r/partition_windows.result	2012-02-07 23:33:54 +0000
@@ -26,5 +26,9 @@ ALTER TABLE t1 ADD PARTITION (PARTITION
 Warnings:
 Warning	1618	<DATA DIRECTORY> option ignored
 Warning	1618	<INDEX DIRECTORY> option ignored
+Warning	1618	<DATA DIRECTORY> option ignored
+Warning	1618	<INDEX DIRECTORY> option ignored
+Warning	1618	<DATA DIRECTORY> option ignored
+Warning	1618	<INDEX DIRECTORY> option ignored
 INSERT INTO t1 VALUES (NULL, "last", 4);
 DROP TABLE t1;

=== modified file 'mysql-test/r/subquery_all.result'
--- a/mysql-test/r/subquery_all.result	2012-01-30 13:13:15 +0000
+++ b/mysql-test/r/subquery_all.result	2012-02-07 14:50:31 +0000
@@ -6822,4 +6822,262 @@ Warnings:
 Note	1003	/* select#1 */ select '1' AS `col_int_nokey` from (`test`.`it`) where ((`test`.`it`.`col_varchar_key2` = 'x') and (`test`.`it`.`col_varchar_key` = 'x') and isnull(`test`.`it`.`col_int_key`))
 
 DROP TABLE it, ot;
+#
+# Bug #11829691: Pure virtual method called in Item_bool_func2::fix...()
+#
+CREATE TABLE t1(a INTEGER);
+CREATE TABLE t2(b INTEGER);
+PREPARE stmt FROM "
+SELECT SUM(b) FROM t2 GROUP BY b HAVING b IN (SELECT b FROM t1)";
+EXECUTE stmt;
+SUM(b)
+EXECUTE stmt;
+SUM(b)
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1, t2;
+#
+# Bug #13595212 EXTRA ROWS RETURNED ON RIGHT JOIN WITH VIEW AND
+# IN-SUBQUERY IN WHERE
+#
+CREATE TABLE t1 (
+pk int(11) NOT NULL AUTO_INCREMENT,
+col_int_key int(11) NOT NULL,
+col_varchar_key varchar(1) NOT NULL,
+col_varchar_nokey varchar(1) NOT NULL,
+PRIMARY KEY (pk),
+KEY col_int_key (col_int_key),
+KEY col_varchar_key (col_varchar_key,col_int_key)
+);
+INSERT INTO t1 VALUES (1,0,'j','j'),(2,8,'v','v'),
+(3,1,'c','c'),(4,8,'m','m'),(5,9,'d','d');
+CREATE VIEW v1 AS SELECT * FROM t1;
+EXPLAIN EXTENDED SELECT alias2.col_varchar_nokey
+FROM v1 AS alias1
+RIGHT JOIN t1 AS alias2 ON 1
+WHERE alias2.col_varchar_key IN (
+SELECT sq2_alias1.col_varchar_nokey
+FROM v1 AS sq2_alias1
+LEFT JOIN t1 AS sq2_alias2
+ON (sq2_alias2.col_int_key = sq2_alias1.pk)
+WHERE sq2_alias1.pk != alias1.col_int_key
+AND sq2_alias1.col_varchar_key > alias1.col_varchar_key
+)
+;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	PRIMARY	alias2	ALL	NULL	NULL	NULL	NULL	5	100.00	
+1	PRIMARY	t1	index	NULL	col_varchar_key	7	NULL	5	100.00	Using where; Using index; Using join buffer (Block Nested Loop)
+2	DEPENDENT SUBQUERY	t1	ALL	col_varchar_key	NULL	NULL	NULL	5	100.00	Using where
+2	DEPENDENT SUBQUERY	sq2_alias2	index	col_int_key	col_int_key	4	NULL	5	80.00	Using where; Using index; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1276	Field or reference 'alias1.col_int_key' of SELECT #2 was resolved in SELECT #1
+Note	1276	Field or reference 'alias1.col_varchar_key' of SELECT #2 was resolved in SELECT #1
+Note	1003	/* select#1 */ select `test`.`alias2`.`col_varchar_nokey` AS `col_varchar_nokey` from `test`.`t1` `alias2` left join (`test`.`t1`) on(1) where <in_optimizer>(`test`.`alias2`.`col_varchar_key`,<exists>(/* select#2 */ select 1 from `test`.`t1` left join `test`.`t1` `sq2_alias2` on((`test`.`sq2_alias2`.`col_int_key` = `test`.`t1`.`pk`)) where ((`test`.`t1`.`pk` <> `test`.`t1`.`col_int_key`) and (`test`.`t1`.`col_varchar_key` > `test`.`t1`.`col_varchar_key`) and (<cache>(`test`.`alias2`.`col_varchar_key`) = `test`.`t1`.`col_varchar_nokey`))))
+SELECT alias2.col_varchar_nokey
+FROM v1 AS alias1
+RIGHT JOIN t1 AS alias2 ON 1
+WHERE alias2.col_varchar_key IN (
+SELECT sq2_alias1.col_varchar_nokey
+FROM v1 AS sq2_alias1
+LEFT JOIN t1 AS sq2_alias2
+ON (sq2_alias2.col_int_key = sq2_alias1.pk)
+WHERE sq2_alias1.pk != alias1.col_int_key
+AND sq2_alias1.col_varchar_key > alias1.col_varchar_key
+)
+;
+col_varchar_nokey
+d
+j
+m
+m
+m
+v
+v
+v
+v
+CREATE VIEW v2 AS SELECT alias2.col_varchar_nokey
+FROM v1 AS alias1
+RIGHT JOIN t1 AS alias2 ON 1
+WHERE alias2.col_varchar_key IN (
+SELECT sq2_alias1.col_varchar_nokey
+FROM v1 AS sq2_alias1
+LEFT JOIN t1 AS sq2_alias2
+ON (sq2_alias2.col_int_key = sq2_alias1.pk)
+WHERE sq2_alias1.pk != alias1.col_int_key
+AND sq2_alias1.col_varchar_key > alias1.col_varchar_key
+)
+;
+EXPLAIN EXTENDED SELECT * FROM v2;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	PRIMARY	alias2	ALL	NULL	NULL	NULL	NULL	5	100.00	
+1	PRIMARY	t1	index	NULL	col_varchar_key	7	NULL	5	100.00	Using where; Using index; Using join buffer (Block Nested Loop)
+3	DEPENDENT SUBQUERY	t1	ALL	col_varchar_key	NULL	NULL	NULL	5	100.00	Using where
+3	DEPENDENT SUBQUERY	sq2_alias2	index	col_int_key	col_int_key	4	NULL	5	80.00	Using where; Using index; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1276	Field or reference 'alias1.col_int_key' of SELECT #3 was resolved in SELECT #1
+Note	1276	Field or reference 'alias1.col_varchar_key' of SELECT #3 was resolved in SELECT #1
+Note	1003	/* select#1 */ select `test`.`alias2`.`col_varchar_nokey` AS `col_varchar_nokey` from `test`.`t1` `alias2` left join (`test`.`t1`) on(1) where <in_optimizer>(`test`.`alias2`.`col_varchar_key`,<exists>(/* select#3 */ select 1 from `test`.`t1` left join `test`.`t1` `sq2_alias2` on((`sq2_alias2`.`col_int_key` = `test`.`t1`.`pk`)) where ((`test`.`t1`.`pk` <> `t1`.`col_int_key`) and (`test`.`t1`.`col_varchar_key` > `t1`.`col_varchar_key`) and (<cache>(`test`.`alias2`.`col_varchar_key`) = `test`.`t1`.`col_varchar_nokey`))))
+SELECT * FROM v2;
+col_varchar_nokey
+d
+j
+m
+m
+m
+v
+v
+v
+v
+EXPLAIN EXTENDED SELECT alias2.col_varchar_nokey
+FROM t1 AS alias2
+LEFT JOIN v1 AS alias1 ON 1
+WHERE alias2.col_varchar_key IN (
+SELECT sq2_alias1.col_varchar_nokey
+FROM v1 AS sq2_alias1
+LEFT JOIN t1 AS sq2_alias2
+ON (sq2_alias2.col_int_key = sq2_alias1.pk)
+WHERE sq2_alias1.pk != alias1.col_int_key
+AND sq2_alias1.col_varchar_key > alias1.col_varchar_key
+);
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	PRIMARY	alias2	ALL	NULL	NULL	NULL	NULL	5	100.00	
+1	PRIMARY	t1	index	NULL	col_varchar_key	7	NULL	5	100.00	Using where; Using index; Using join buffer (Block Nested Loop)
+2	DEPENDENT SUBQUERY	t1	ALL	col_varchar_key	NULL	NULL	NULL	5	100.00	Using where
+2	DEPENDENT SUBQUERY	sq2_alias2	index	col_int_key	col_int_key	4	NULL	5	80.00	Using where; Using index; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1276	Field or reference 'alias1.col_int_key' of SELECT #2 was resolved in SELECT #1
+Note	1276	Field or reference 'alias1.col_varchar_key' of SELECT #2 was resolved in SELECT #1
+Note	1003	/* select#1 */ select `test`.`alias2`.`col_varchar_nokey` AS `col_varchar_nokey` from `test`.`t1` `alias2` left join (`test`.`t1`) on(1) where <in_optimizer>(`test`.`alias2`.`col_varchar_key`,<exists>(/* select#2 */ select 1 from `test`.`t1` left join `test`.`t1` `sq2_alias2` on((`sq2_alias2`.`col_int_key` = `test`.`t1`.`pk`)) where ((`test`.`t1`.`pk` <> `t1`.`col_int_key`) and (`test`.`t1`.`col_varchar_key` > `t1`.`col_varchar_key`) and (<cache>(`test`.`alias2`.`col_varchar_key`) = `test`.`t1`.`col_varchar_nokey`))))
+SELECT alias2.col_varchar_nokey
+FROM t1 AS alias2
+LEFT JOIN v1 AS alias1 ON 1
+WHERE alias2.col_varchar_key IN (
+SELECT sq2_alias1.col_varchar_nokey
+FROM v1 AS sq2_alias1
+LEFT JOIN t1 AS sq2_alias2
+ON (sq2_alias2.col_int_key = sq2_alias1.pk)
+WHERE sq2_alias1.pk != alias1.col_int_key
+AND sq2_alias1.col_varchar_key > alias1.col_varchar_key
+);
+col_varchar_nokey
+d
+j
+m
+m
+m
+v
+v
+v
+v
+DROP TABLE t1;
+DROP VIEW v1,v2;
+#
+# Bug#13651009 WRONG RESULT FROM DERIVED TABLE IF THE SUBQUERY
+# HAS AN EMPTY RESULT
+#
+CREATE TABLE t1 (
+pk int NOT NULL,
+col_int_nokey int NOT NULL,
+col_int_key int NOT NULL,
+col_time_key time NOT NULL,
+col_varchar_key varchar(1) NOT NULL,
+col_varchar_nokey varchar(1) NOT NULL,
+PRIMARY KEY (pk),
+KEY col_int_key (col_int_key),
+KEY col_time_key (col_time_key),
+KEY col_varchar_key (col_varchar_key,col_int_key)
+) ENGINE=MyISAM;
+CREATE TABLE t2 (
+pk int NOT NULL AUTO_INCREMENT,
+col_int_nokey int NOT NULL,
+col_int_key int NOT NULL,
+col_time_key time NOT NULL,
+col_varchar_key varchar(1) NOT NULL,
+col_varchar_nokey varchar(1) NOT NULL,
+PRIMARY KEY (pk),
+KEY col_int_key (col_int_key),
+KEY col_time_key (col_time_key),
+KEY col_varchar_key (col_varchar_key,col_int_key)
+) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (1,4,4,'00:00:00','b','b');
+SET @var2:=4, @var3:=8;
+
+Testcase without inner subquery
+EXPLAIN SELECT @var3:=12, sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
+sq4_alias1.col_varchar_key = @var3;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE noticed after reading const tables
+SELECT @var3:=12, sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
+sq4_alias1.col_varchar_key = @var3;
+@var3:=12	pk	col_int_nokey	col_int_key	col_time_key	col_varchar_key	col_varchar_nokey
+SELECT @var3;
+@var3
+8
+EXPLAIN SELECT * FROM ( SELECT @var3:=12, sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
+sq4_alias1.col_varchar_key = @var3 ) AS alias3;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	PRIMARY	<derived2>	system	NULL	NULL	NULL	NULL	0	const row not found
+2	DERIVED	NULL	NULL	NULL	NULL	NULL	NULL	NULL	no matching row in const table
+SELECT * FROM ( SELECT @var3:=12, sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
+sq4_alias1.col_varchar_key = @var3 ) AS alias3;
+@var3:=12	pk	col_int_nokey	col_int_key	col_time_key	col_varchar_key	col_varchar_nokey
+SELECT @var3;
+@var3
+8
+
+Testcase with inner subquery; crashed WL#6095
+SET @var3=8;
+EXPLAIN SELECT sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
+NOT IN
+(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
+c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
+FROM t2 AS c_sq1_alias1
+WHERE (c_sq1_alias1.col_int_nokey != @var2
+OR c_sq1_alias1.pk != @var3));
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	PRIMARY	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE noticed after reading const tables
+2	DEPENDENT SUBQUERY	c_sq1_alias1	system	PRIMARY,col_varchar_key	NULL	NULL	NULL	1	
+SELECT sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
+NOT IN
+(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
+c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
+FROM t2 AS c_sq1_alias1
+WHERE (c_sq1_alias1.col_int_nokey != @var2
+OR c_sq1_alias1.pk != @var3));
+pk	col_int_nokey	col_int_key	col_time_key	col_varchar_key	col_varchar_nokey
+EXPLAIN SELECT * FROM ( SELECT sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
+NOT IN
+(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
+c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
+FROM t2 AS c_sq1_alias1
+WHERE (c_sq1_alias1.col_int_nokey != @var2
+OR c_sq1_alias1.pk != @var3)) ) AS alias3;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	PRIMARY	<derived2>	system	NULL	NULL	NULL	NULL	0	const row not found
+2	DERIVED	NULL	NULL	NULL	NULL	NULL	NULL	NULL	no matching row in const table
+3	DEPENDENT SUBQUERY	c_sq1_alias1	system	PRIMARY,col_varchar_key	NULL	NULL	NULL	1	
+SELECT * FROM ( SELECT sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
+NOT IN
+(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
+c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
+FROM t2 AS c_sq1_alias1
+WHERE (c_sq1_alias1.col_int_nokey != @var2
+OR c_sq1_alias1.pk != @var3)) ) AS alias3;
+pk	col_int_nokey	col_int_key	col_time_key	col_varchar_key	col_varchar_nokey
+DROP TABLE t1,t2;
 set optimizer_switch=default;

=== modified file 'mysql-test/r/subquery_all_bka.result'
--- a/mysql-test/r/subquery_all_bka.result	2012-01-30 13:13:15 +0000
+++ b/mysql-test/r/subquery_all_bka.result	2012-02-07 14:50:31 +0000
@@ -6823,5 +6823,263 @@ Warnings:
 Note	1003	/* select#1 */ select '1' AS `col_int_nokey` from (`test`.`it`) where ((`test`.`it`.`col_varchar_key2` = 'x') and (`test`.`it`.`col_varchar_key` = 'x') and isnull(`test`.`it`.`col_int_key`))
 
 DROP TABLE it, ot;
+#
+# Bug #11829691: Pure virtual method called in Item_bool_func2::fix...()
+#
+CREATE TABLE t1(a INTEGER);
+CREATE TABLE t2(b INTEGER);
+PREPARE stmt FROM "
+SELECT SUM(b) FROM t2 GROUP BY b HAVING b IN (SELECT b FROM t1)";
+EXECUTE stmt;
+SUM(b)
+EXECUTE stmt;
+SUM(b)
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1, t2;
+#
+# Bug #13595212 EXTRA ROWS RETURNED ON RIGHT JOIN WITH VIEW AND
+# IN-SUBQUERY IN WHERE
+#
+CREATE TABLE t1 (
+pk int(11) NOT NULL AUTO_INCREMENT,
+col_int_key int(11) NOT NULL,
+col_varchar_key varchar(1) NOT NULL,
+col_varchar_nokey varchar(1) NOT NULL,
+PRIMARY KEY (pk),
+KEY col_int_key (col_int_key),
+KEY col_varchar_key (col_varchar_key,col_int_key)
+);
+INSERT INTO t1 VALUES (1,0,'j','j'),(2,8,'v','v'),
+(3,1,'c','c'),(4,8,'m','m'),(5,9,'d','d');
+CREATE VIEW v1 AS SELECT * FROM t1;
+EXPLAIN EXTENDED SELECT alias2.col_varchar_nokey
+FROM v1 AS alias1
+RIGHT JOIN t1 AS alias2 ON 1
+WHERE alias2.col_varchar_key IN (
+SELECT sq2_alias1.col_varchar_nokey
+FROM v1 AS sq2_alias1
+LEFT JOIN t1 AS sq2_alias2
+ON (sq2_alias2.col_int_key = sq2_alias1.pk)
+WHERE sq2_alias1.pk != alias1.col_int_key
+AND sq2_alias1.col_varchar_key > alias1.col_varchar_key
+)
+;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	PRIMARY	alias2	ALL	NULL	NULL	NULL	NULL	5	100.00	
+1	PRIMARY	t1	index	NULL	col_varchar_key	7	NULL	5	100.00	Using where; Using index; Using join buffer (Block Nested Loop)
+2	DEPENDENT SUBQUERY	t1	ALL	col_varchar_key	NULL	NULL	NULL	5	100.00	Using where
+2	DEPENDENT SUBQUERY	sq2_alias2	index	col_int_key	col_int_key	4	NULL	5	80.00	Using where; Using index; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1276	Field or reference 'alias1.col_int_key' of SELECT #2 was resolved in SELECT #1
+Note	1276	Field or reference 'alias1.col_varchar_key' of SELECT #2 was resolved in SELECT #1
+Note	1003	/* select#1 */ select `test`.`alias2`.`col_varchar_nokey` AS `col_varchar_nokey` from `test`.`t1` `alias2` left join (`test`.`t1`) on(1) where <in_optimizer>(`test`.`alias2`.`col_varchar_key`,<exists>(/* select#2 */ select 1 from `test`.`t1` left join `test`.`t1` `sq2_alias2` on((`test`.`sq2_alias2`.`col_int_key` = `test`.`t1`.`pk`)) where ((`test`.`t1`.`pk` <> `test`.`t1`.`col_int_key`) and (`test`.`t1`.`col_varchar_key` > `test`.`t1`.`col_varchar_key`) and (<cache>(`test`.`alias2`.`col_varchar_key`) = `test`.`t1`.`col_varchar_nokey`))))
+SELECT alias2.col_varchar_nokey
+FROM v1 AS alias1
+RIGHT JOIN t1 AS alias2 ON 1
+WHERE alias2.col_varchar_key IN (
+SELECT sq2_alias1.col_varchar_nokey
+FROM v1 AS sq2_alias1
+LEFT JOIN t1 AS sq2_alias2
+ON (sq2_alias2.col_int_key = sq2_alias1.pk)
+WHERE sq2_alias1.pk != alias1.col_int_key
+AND sq2_alias1.col_varchar_key > alias1.col_varchar_key
+)
+;
+col_varchar_nokey
+d
+j
+m
+m
+m
+v
+v
+v
+v
+CREATE VIEW v2 AS SELECT alias2.col_varchar_nokey
+FROM v1 AS alias1
+RIGHT JOIN t1 AS alias2 ON 1
+WHERE alias2.col_varchar_key IN (
+SELECT sq2_alias1.col_varchar_nokey
+FROM v1 AS sq2_alias1
+LEFT JOIN t1 AS sq2_alias2
+ON (sq2_alias2.col_int_key = sq2_alias1.pk)
+WHERE sq2_alias1.pk != alias1.col_int_key
+AND sq2_alias1.col_varchar_key > alias1.col_varchar_key
+)
+;
+EXPLAIN EXTENDED SELECT * FROM v2;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	PRIMARY	alias2	ALL	NULL	NULL	NULL	NULL	5	100.00	
+1	PRIMARY	t1	index	NULL	col_varchar_key	7	NULL	5	100.00	Using where; Using index; Using join buffer (Block Nested Loop)
+3	DEPENDENT SUBQUERY	t1	ALL	col_varchar_key	NULL	NULL	NULL	5	100.00	Using where
+3	DEPENDENT SUBQUERY	sq2_alias2	index	col_int_key	col_int_key	4	NULL	5	80.00	Using where; Using index; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1276	Field or reference 'alias1.col_int_key' of SELECT #3 was resolved in SELECT #1
+Note	1276	Field or reference 'alias1.col_varchar_key' of SELECT #3 was resolved in SELECT #1
+Note	1003	/* select#1 */ select `test`.`alias2`.`col_varchar_nokey` AS `col_varchar_nokey` from `test`.`t1` `alias2` left join (`test`.`t1`) on(1) where <in_optimizer>(`test`.`alias2`.`col_varchar_key`,<exists>(/* select#3 */ select 1 from `test`.`t1` left join `test`.`t1` `sq2_alias2` on((`sq2_alias2`.`col_int_key` = `test`.`t1`.`pk`)) where ((`test`.`t1`.`pk` <> `t1`.`col_int_key`) and (`test`.`t1`.`col_varchar_key` > `t1`.`col_varchar_key`) and (<cache>(`test`.`alias2`.`col_varchar_key`) = `test`.`t1`.`col_varchar_nokey`))))
+SELECT * FROM v2;
+col_varchar_nokey
+d
+j
+m
+m
+m
+v
+v
+v
+v
+EXPLAIN EXTENDED SELECT alias2.col_varchar_nokey
+FROM t1 AS alias2
+LEFT JOIN v1 AS alias1 ON 1
+WHERE alias2.col_varchar_key IN (
+SELECT sq2_alias1.col_varchar_nokey
+FROM v1 AS sq2_alias1
+LEFT JOIN t1 AS sq2_alias2
+ON (sq2_alias2.col_int_key = sq2_alias1.pk)
+WHERE sq2_alias1.pk != alias1.col_int_key
+AND sq2_alias1.col_varchar_key > alias1.col_varchar_key
+);
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	PRIMARY	alias2	ALL	NULL	NULL	NULL	NULL	5	100.00	
+1	PRIMARY	t1	index	NULL	col_varchar_key	7	NULL	5	100.00	Using where; Using index; Using join buffer (Block Nested Loop)
+2	DEPENDENT SUBQUERY	t1	ALL	col_varchar_key	NULL	NULL	NULL	5	100.00	Using where
+2	DEPENDENT SUBQUERY	sq2_alias2	index	col_int_key	col_int_key	4	NULL	5	80.00	Using where; Using index; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1276	Field or reference 'alias1.col_int_key' of SELECT #2 was resolved in SELECT #1
+Note	1276	Field or reference 'alias1.col_varchar_key' of SELECT #2 was resolved in SELECT #1
+Note	1003	/* select#1 */ select `test`.`alias2`.`col_varchar_nokey` AS `col_varchar_nokey` from `test`.`t1` `alias2` left join (`test`.`t1`) on(1) where <in_optimizer>(`test`.`alias2`.`col_varchar_key`,<exists>(/* select#2 */ select 1 from `test`.`t1` left join `test`.`t1` `sq2_alias2` on((`sq2_alias2`.`col_int_key` = `test`.`t1`.`pk`)) where ((`test`.`t1`.`pk` <> `t1`.`col_int_key`) and (`test`.`t1`.`col_varchar_key` > `t1`.`col_varchar_key`) and (<cache>(`test`.`alias2`.`col_varchar_key`) = `test`.`t1`.`col_varchar_nokey`))))
+SELECT alias2.col_varchar_nokey
+FROM t1 AS alias2
+LEFT JOIN v1 AS alias1 ON 1
+WHERE alias2.col_varchar_key IN (
+SELECT sq2_alias1.col_varchar_nokey
+FROM v1 AS sq2_alias1
+LEFT JOIN t1 AS sq2_alias2
+ON (sq2_alias2.col_int_key = sq2_alias1.pk)
+WHERE sq2_alias1.pk != alias1.col_int_key
+AND sq2_alias1.col_varchar_key > alias1.col_varchar_key
+);
+col_varchar_nokey
+d
+j
+m
+m
+m
+v
+v
+v
+v
+DROP TABLE t1;
+DROP VIEW v1,v2;
+#
+# Bug#13651009 WRONG RESULT FROM DERIVED TABLE IF THE SUBQUERY
+# HAS AN EMPTY RESULT
+#
+CREATE TABLE t1 (
+pk int NOT NULL,
+col_int_nokey int NOT NULL,
+col_int_key int NOT NULL,
+col_time_key time NOT NULL,
+col_varchar_key varchar(1) NOT NULL,
+col_varchar_nokey varchar(1) NOT NULL,
+PRIMARY KEY (pk),
+KEY col_int_key (col_int_key),
+KEY col_time_key (col_time_key),
+KEY col_varchar_key (col_varchar_key,col_int_key)
+) ENGINE=MyISAM;
+CREATE TABLE t2 (
+pk int NOT NULL AUTO_INCREMENT,
+col_int_nokey int NOT NULL,
+col_int_key int NOT NULL,
+col_time_key time NOT NULL,
+col_varchar_key varchar(1) NOT NULL,
+col_varchar_nokey varchar(1) NOT NULL,
+PRIMARY KEY (pk),
+KEY col_int_key (col_int_key),
+KEY col_time_key (col_time_key),
+KEY col_varchar_key (col_varchar_key,col_int_key)
+) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (1,4,4,'00:00:00','b','b');
+SET @var2:=4, @var3:=8;
+
+Testcase without inner subquery
+EXPLAIN SELECT @var3:=12, sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
+sq4_alias1.col_varchar_key = @var3;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE noticed after reading const tables
+SELECT @var3:=12, sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
+sq4_alias1.col_varchar_key = @var3;
+@var3:=12	pk	col_int_nokey	col_int_key	col_time_key	col_varchar_key	col_varchar_nokey
+SELECT @var3;
+@var3
+8
+EXPLAIN SELECT * FROM ( SELECT @var3:=12, sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
+sq4_alias1.col_varchar_key = @var3 ) AS alias3;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	PRIMARY	<derived2>	system	NULL	NULL	NULL	NULL	0	const row not found
+2	DERIVED	NULL	NULL	NULL	NULL	NULL	NULL	NULL	no matching row in const table
+SELECT * FROM ( SELECT @var3:=12, sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
+sq4_alias1.col_varchar_key = @var3 ) AS alias3;
+@var3:=12	pk	col_int_nokey	col_int_key	col_time_key	col_varchar_key	col_varchar_nokey
+SELECT @var3;
+@var3
+8
+
+Testcase with inner subquery; crashed WL#6095
+SET @var3=8;
+EXPLAIN SELECT sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
+NOT IN
+(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
+c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
+FROM t2 AS c_sq1_alias1
+WHERE (c_sq1_alias1.col_int_nokey != @var2
+OR c_sq1_alias1.pk != @var3));
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	PRIMARY	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE noticed after reading const tables
+2	DEPENDENT SUBQUERY	c_sq1_alias1	system	PRIMARY,col_varchar_key	NULL	NULL	NULL	1	
+SELECT sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
+NOT IN
+(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
+c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
+FROM t2 AS c_sq1_alias1
+WHERE (c_sq1_alias1.col_int_nokey != @var2
+OR c_sq1_alias1.pk != @var3));
+pk	col_int_nokey	col_int_key	col_time_key	col_varchar_key	col_varchar_nokey
+EXPLAIN SELECT * FROM ( SELECT sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
+NOT IN
+(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
+c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
+FROM t2 AS c_sq1_alias1
+WHERE (c_sq1_alias1.col_int_nokey != @var2
+OR c_sq1_alias1.pk != @var3)) ) AS alias3;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	PRIMARY	<derived2>	system	NULL	NULL	NULL	NULL	0	const row not found
+2	DERIVED	NULL	NULL	NULL	NULL	NULL	NULL	NULL	no matching row in const table
+3	DEPENDENT SUBQUERY	c_sq1_alias1	system	PRIMARY,col_varchar_key	NULL	NULL	NULL	1	
+SELECT * FROM ( SELECT sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
+NOT IN
+(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
+c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
+FROM t2 AS c_sq1_alias1
+WHERE (c_sq1_alias1.col_int_nokey != @var2
+OR c_sq1_alias1.pk != @var3)) ) AS alias3;
+pk	col_int_nokey	col_int_key	col_time_key	col_varchar_key	col_varchar_nokey
+DROP TABLE t1,t2;
 set optimizer_switch=default;
 set optimizer_switch=default;

=== modified file 'mysql-test/r/subquery_all_bka_nixbnl.result'
--- a/mysql-test/r/subquery_all_bka_nixbnl.result	2011-12-01 11:30:35 +0000
+++ b/mysql-test/r/subquery_all_bka_nixbnl.result	2012-02-07 14:50:31 +0000
@@ -6823,5 +6823,263 @@ Warnings:
 Note	1003	/* select#1 */ select '1' AS `col_int_nokey` from (`test`.`it`) where ((`test`.`it`.`col_varchar_key2` = 'x') and (`test`.`it`.`col_varchar_key` = 'x') and isnull(`test`.`it`.`col_int_key`))
 
 DROP TABLE it, ot;
+#
+# Bug #11829691: Pure virtual method called in Item_bool_func2::fix...()
+#
+CREATE TABLE t1(a INTEGER);
+CREATE TABLE t2(b INTEGER);
+PREPARE stmt FROM "
+SELECT SUM(b) FROM t2 GROUP BY b HAVING b IN (SELECT b FROM t1)";
+EXECUTE stmt;
+SUM(b)
+EXECUTE stmt;
+SUM(b)
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1, t2;
+#
+# Bug #13595212 EXTRA ROWS RETURNED ON RIGHT JOIN WITH VIEW AND
+# IN-SUBQUERY IN WHERE
+#
+CREATE TABLE t1 (
+pk int(11) NOT NULL AUTO_INCREMENT,
+col_int_key int(11) NOT NULL,
+col_varchar_key varchar(1) NOT NULL,
+col_varchar_nokey varchar(1) NOT NULL,
+PRIMARY KEY (pk),
+KEY col_int_key (col_int_key),
+KEY col_varchar_key (col_varchar_key,col_int_key)
+);
+INSERT INTO t1 VALUES (1,0,'j','j'),(2,8,'v','v'),
+(3,1,'c','c'),(4,8,'m','m'),(5,9,'d','d');
+CREATE VIEW v1 AS SELECT * FROM t1;
+EXPLAIN EXTENDED SELECT alias2.col_varchar_nokey
+FROM v1 AS alias1
+RIGHT JOIN t1 AS alias2 ON 1
+WHERE alias2.col_varchar_key IN (
+SELECT sq2_alias1.col_varchar_nokey
+FROM v1 AS sq2_alias1
+LEFT JOIN t1 AS sq2_alias2
+ON (sq2_alias2.col_int_key = sq2_alias1.pk)
+WHERE sq2_alias1.pk != alias1.col_int_key
+AND sq2_alias1.col_varchar_key > alias1.col_varchar_key
+)
+;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	PRIMARY	alias2	ALL	NULL	NULL	NULL	NULL	5	100.00	
+1	PRIMARY	t1	index	NULL	col_varchar_key	7	NULL	5	100.00	Using where; Using index
+2	DEPENDENT SUBQUERY	t1	ALL	col_varchar_key	NULL	NULL	NULL	5	100.00	Using where
+2	DEPENDENT SUBQUERY	sq2_alias2	ref	col_int_key	col_int_key	4	test.t1.pk	2	100.00	Using index
+Warnings:
+Note	1276	Field or reference 'alias1.col_int_key' of SELECT #2 was resolved in SELECT #1
+Note	1276	Field or reference 'alias1.col_varchar_key' of SELECT #2 was resolved in SELECT #1
+Note	1003	/* select#1 */ select `test`.`alias2`.`col_varchar_nokey` AS `col_varchar_nokey` from `test`.`t1` `alias2` left join (`test`.`t1`) on(1) where <in_optimizer>(`test`.`alias2`.`col_varchar_key`,<exists>(/* select#2 */ select 1 from `test`.`t1` left join `test`.`t1` `sq2_alias2` on((`test`.`sq2_alias2`.`col_int_key` = `test`.`t1`.`pk`)) where ((`test`.`t1`.`pk` <> `test`.`t1`.`col_int_key`) and (`test`.`t1`.`col_varchar_key` > `test`.`t1`.`col_varchar_key`) and (<cache>(`test`.`alias2`.`col_varchar_key`) = `test`.`t1`.`col_varchar_nokey`))))
+SELECT alias2.col_varchar_nokey
+FROM v1 AS alias1
+RIGHT JOIN t1 AS alias2 ON 1
+WHERE alias2.col_varchar_key IN (
+SELECT sq2_alias1.col_varchar_nokey
+FROM v1 AS sq2_alias1
+LEFT JOIN t1 AS sq2_alias2
+ON (sq2_alias2.col_int_key = sq2_alias1.pk)
+WHERE sq2_alias1.pk != alias1.col_int_key
+AND sq2_alias1.col_varchar_key > alias1.col_varchar_key
+)
+;
+col_varchar_nokey
+d
+j
+m
+m
+m
+v
+v
+v
+v
+CREATE VIEW v2 AS SELECT alias2.col_varchar_nokey
+FROM v1 AS alias1
+RIGHT JOIN t1 AS alias2 ON 1
+WHERE alias2.col_varchar_key IN (
+SELECT sq2_alias1.col_varchar_nokey
+FROM v1 AS sq2_alias1
+LEFT JOIN t1 AS sq2_alias2
+ON (sq2_alias2.col_int_key = sq2_alias1.pk)
+WHERE sq2_alias1.pk != alias1.col_int_key
+AND sq2_alias1.col_varchar_key > alias1.col_varchar_key
+)
+;
+EXPLAIN EXTENDED SELECT * FROM v2;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	PRIMARY	alias2	ALL	NULL	NULL	NULL	NULL	5	100.00	
+1	PRIMARY	t1	index	NULL	col_varchar_key	7	NULL	5	100.00	Using where; Using index
+3	DEPENDENT SUBQUERY	t1	ALL	col_varchar_key	NULL	NULL	NULL	5	100.00	Using where
+3	DEPENDENT SUBQUERY	sq2_alias2	ref	col_int_key	col_int_key	4	test.t1.pk	2	100.00	Using index
+Warnings:
+Note	1276	Field or reference 'alias1.col_int_key' of SELECT #3 was resolved in SELECT #1
+Note	1276	Field or reference 'alias1.col_varchar_key' of SELECT #3 was resolved in SELECT #1
+Note	1003	/* select#1 */ select `test`.`alias2`.`col_varchar_nokey` AS `col_varchar_nokey` from `test`.`t1` `alias2` left join (`test`.`t1`) on(1) where <in_optimizer>(`test`.`alias2`.`col_varchar_key`,<exists>(/* select#3 */ select 1 from `test`.`t1` left join `test`.`t1` `sq2_alias2` on((`sq2_alias2`.`col_int_key` = `test`.`t1`.`pk`)) where ((`test`.`t1`.`pk` <> `t1`.`col_int_key`) and (`test`.`t1`.`col_varchar_key` > `t1`.`col_varchar_key`) and (<cache>(`test`.`alias2`.`col_varchar_key`) = `test`.`t1`.`col_varchar_nokey`))))
+SELECT * FROM v2;
+col_varchar_nokey
+d
+j
+m
+m
+m
+v
+v
+v
+v
+EXPLAIN EXTENDED SELECT alias2.col_varchar_nokey
+FROM t1 AS alias2
+LEFT JOIN v1 AS alias1 ON 1
+WHERE alias2.col_varchar_key IN (
+SELECT sq2_alias1.col_varchar_nokey
+FROM v1 AS sq2_alias1
+LEFT JOIN t1 AS sq2_alias2
+ON (sq2_alias2.col_int_key = sq2_alias1.pk)
+WHERE sq2_alias1.pk != alias1.col_int_key
+AND sq2_alias1.col_varchar_key > alias1.col_varchar_key
+);
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	PRIMARY	alias2	ALL	NULL	NULL	NULL	NULL	5	100.00	
+1	PRIMARY	t1	index	NULL	col_varchar_key	7	NULL	5	100.00	Using where; Using index
+2	DEPENDENT SUBQUERY	t1	ALL	col_varchar_key	NULL	NULL	NULL	5	100.00	Using where
+2	DEPENDENT SUBQUERY	sq2_alias2	ref	col_int_key	col_int_key	4	test.t1.pk	2	100.00	Using index
+Warnings:
+Note	1276	Field or reference 'alias1.col_int_key' of SELECT #2 was resolved in SELECT #1
+Note	1276	Field or reference 'alias1.col_varchar_key' of SELECT #2 was resolved in SELECT #1
+Note	1003	/* select#1 */ select `test`.`alias2`.`col_varchar_nokey` AS `col_varchar_nokey` from `test`.`t1` `alias2` left join (`test`.`t1`) on(1) where <in_optimizer>(`test`.`alias2`.`col_varchar_key`,<exists>(/* select#2 */ select 1 from `test`.`t1` left join `test`.`t1` `sq2_alias2` on((`sq2_alias2`.`col_int_key` = `test`.`t1`.`pk`)) where ((`test`.`t1`.`pk` <> `t1`.`col_int_key`) and (`test`.`t1`.`col_varchar_key` > `t1`.`col_varchar_key`) and (<cache>(`test`.`alias2`.`col_varchar_key`) = `test`.`t1`.`col_varchar_nokey`))))
+SELECT alias2.col_varchar_nokey
+FROM t1 AS alias2
+LEFT JOIN v1 AS alias1 ON 1
+WHERE alias2.col_varchar_key IN (
+SELECT sq2_alias1.col_varchar_nokey
+FROM v1 AS sq2_alias1
+LEFT JOIN t1 AS sq2_alias2
+ON (sq2_alias2.col_int_key = sq2_alias1.pk)
+WHERE sq2_alias1.pk != alias1.col_int_key
+AND sq2_alias1.col_varchar_key > alias1.col_varchar_key
+);
+col_varchar_nokey
+d
+j
+m
+m
+m
+v
+v
+v
+v
+DROP TABLE t1;
+DROP VIEW v1,v2;
+#
+# Bug#13651009 WRONG RESULT FROM DERIVED TABLE IF THE SUBQUERY
+# HAS AN EMPTY RESULT
+#
+CREATE TABLE t1 (
+pk int NOT NULL,
+col_int_nokey int NOT NULL,
+col_int_key int NOT NULL,
+col_time_key time NOT NULL,
+col_varchar_key varchar(1) NOT NULL,
+col_varchar_nokey varchar(1) NOT NULL,
+PRIMARY KEY (pk),
+KEY col_int_key (col_int_key),
+KEY col_time_key (col_time_key),
+KEY col_varchar_key (col_varchar_key,col_int_key)
+) ENGINE=MyISAM;
+CREATE TABLE t2 (
+pk int NOT NULL AUTO_INCREMENT,
+col_int_nokey int NOT NULL,
+col_int_key int NOT NULL,
+col_time_key time NOT NULL,
+col_varchar_key varchar(1) NOT NULL,
+col_varchar_nokey varchar(1) NOT NULL,
+PRIMARY KEY (pk),
+KEY col_int_key (col_int_key),
+KEY col_time_key (col_time_key),
+KEY col_varchar_key (col_varchar_key,col_int_key)
+) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (1,4,4,'00:00:00','b','b');
+SET @var2:=4, @var3:=8;
+
+Testcase without inner subquery
+EXPLAIN SELECT @var3:=12, sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
+sq4_alias1.col_varchar_key = @var3;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE noticed after reading const tables
+SELECT @var3:=12, sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
+sq4_alias1.col_varchar_key = @var3;
+@var3:=12	pk	col_int_nokey	col_int_key	col_time_key	col_varchar_key	col_varchar_nokey
+SELECT @var3;
+@var3
+8
+EXPLAIN SELECT * FROM ( SELECT @var3:=12, sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
+sq4_alias1.col_varchar_key = @var3 ) AS alias3;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	PRIMARY	<derived2>	system	NULL	NULL	NULL	NULL	0	const row not found
+2	DERIVED	NULL	NULL	NULL	NULL	NULL	NULL	NULL	no matching row in const table
+SELECT * FROM ( SELECT @var3:=12, sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
+sq4_alias1.col_varchar_key = @var3 ) AS alias3;
+@var3:=12	pk	col_int_nokey	col_int_key	col_time_key	col_varchar_key	col_varchar_nokey
+SELECT @var3;
+@var3
+8
+
+Testcase with inner subquery; crashed WL#6095
+SET @var3=8;
+EXPLAIN SELECT sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
+NOT IN
+(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
+c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
+FROM t2 AS c_sq1_alias1
+WHERE (c_sq1_alias1.col_int_nokey != @var2
+OR c_sq1_alias1.pk != @var3));
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	PRIMARY	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE noticed after reading const tables
+2	DEPENDENT SUBQUERY	c_sq1_alias1	system	PRIMARY,col_varchar_key	NULL	NULL	NULL	1	
+SELECT sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
+NOT IN
+(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
+c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
+FROM t2 AS c_sq1_alias1
+WHERE (c_sq1_alias1.col_int_nokey != @var2
+OR c_sq1_alias1.pk != @var3));
+pk	col_int_nokey	col_int_key	col_time_key	col_varchar_key	col_varchar_nokey
+EXPLAIN SELECT * FROM ( SELECT sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
+NOT IN
+(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
+c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
+FROM t2 AS c_sq1_alias1
+WHERE (c_sq1_alias1.col_int_nokey != @var2
+OR c_sq1_alias1.pk != @var3)) ) AS alias3;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	PRIMARY	<derived2>	system	NULL	NULL	NULL	NULL	0	const row not found
+2	DERIVED	NULL	NULL	NULL	NULL	NULL	NULL	NULL	no matching row in const table
+3	DEPENDENT SUBQUERY	c_sq1_alias1	system	PRIMARY,col_varchar_key	NULL	NULL	NULL	1	
+SELECT * FROM ( SELECT sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
+NOT IN
+(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
+c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
+FROM t2 AS c_sq1_alias1
+WHERE (c_sq1_alias1.col_int_nokey != @var2
+OR c_sq1_alias1.pk != @var3)) ) AS alias3;
+pk	col_int_nokey	col_int_key	col_time_key	col_varchar_key	col_varchar_nokey
+DROP TABLE t1,t2;
 set optimizer_switch=default;
 set optimizer_switch=default;

=== modified file 'mysql-test/r/subquery_nomat_nosj.result'
--- a/mysql-test/r/subquery_nomat_nosj.result	2011-11-01 11:52:24 +0000
+++ b/mysql-test/r/subquery_nomat_nosj.result	2012-02-07 14:50:31 +0000
@@ -6822,4 +6822,262 @@ Warnings:
 Note	1003	/* select#1 */ select '1' AS `col_int_nokey` from dual where <in_optimizer>(('x','x'),<exists>(<index_lookup>(<cache>('x') in it on idx_cvk_cvk2_cik where (isnull(`test`.`it`.`col_int_key`) and (<cache>('x') = `test`.`it`.`col_varchar_key`) and (<cache>('x') = `test`.`it`.`col_varchar_key2`)))))
 
 DROP TABLE it, ot;
+#
+# Bug #11829691: Pure virtual method called in Item_bool_func2::fix...()
+#
+CREATE TABLE t1(a INTEGER);
+CREATE TABLE t2(b INTEGER);
+PREPARE stmt FROM "
+SELECT SUM(b) FROM t2 GROUP BY b HAVING b IN (SELECT b FROM t1)";
+EXECUTE stmt;
+SUM(b)
+EXECUTE stmt;
+SUM(b)
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1, t2;
+#
+# Bug #13595212 EXTRA ROWS RETURNED ON RIGHT JOIN WITH VIEW AND
+# IN-SUBQUERY IN WHERE
+#
+CREATE TABLE t1 (
+pk int(11) NOT NULL AUTO_INCREMENT,
+col_int_key int(11) NOT NULL,
+col_varchar_key varchar(1) NOT NULL,
+col_varchar_nokey varchar(1) NOT NULL,
+PRIMARY KEY (pk),
+KEY col_int_key (col_int_key),
+KEY col_varchar_key (col_varchar_key,col_int_key)
+);
+INSERT INTO t1 VALUES (1,0,'j','j'),(2,8,'v','v'),
+(3,1,'c','c'),(4,8,'m','m'),(5,9,'d','d');
+CREATE VIEW v1 AS SELECT * FROM t1;
+EXPLAIN EXTENDED SELECT alias2.col_varchar_nokey
+FROM v1 AS alias1
+RIGHT JOIN t1 AS alias2 ON 1
+WHERE alias2.col_varchar_key IN (
+SELECT sq2_alias1.col_varchar_nokey
+FROM v1 AS sq2_alias1
+LEFT JOIN t1 AS sq2_alias2
+ON (sq2_alias2.col_int_key = sq2_alias1.pk)
+WHERE sq2_alias1.pk != alias1.col_int_key
+AND sq2_alias1.col_varchar_key > alias1.col_varchar_key
+)
+;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	PRIMARY	alias2	ALL	NULL	NULL	NULL	NULL	5	100.00	
+1	PRIMARY	t1	index	NULL	col_varchar_key	7	NULL	5	100.00	Using where; Using index; Using join buffer (Block Nested Loop)
+2	DEPENDENT SUBQUERY	t1	ALL	col_varchar_key	NULL	NULL	NULL	5	100.00	Using where
+2	DEPENDENT SUBQUERY	sq2_alias2	index	col_int_key	col_int_key	4	NULL	5	80.00	Using where; Using index; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1276	Field or reference 'alias1.col_int_key' of SELECT #2 was resolved in SELECT #1
+Note	1276	Field or reference 'alias1.col_varchar_key' of SELECT #2 was resolved in SELECT #1
+Note	1003	/* select#1 */ select `test`.`alias2`.`col_varchar_nokey` AS `col_varchar_nokey` from `test`.`t1` `alias2` left join (`test`.`t1`) on(1) where <in_optimizer>(`test`.`alias2`.`col_varchar_key`,<exists>(/* select#2 */ select 1 from `test`.`t1` left join `test`.`t1` `sq2_alias2` on((`test`.`sq2_alias2`.`col_int_key` = `test`.`t1`.`pk`)) where ((`test`.`t1`.`pk` <> `test`.`t1`.`col_int_key`) and (`test`.`t1`.`col_varchar_key` > `test`.`t1`.`col_varchar_key`) and (<cache>(`test`.`alias2`.`col_varchar_key`) = `test`.`t1`.`col_varchar_nokey`))))
+SELECT alias2.col_varchar_nokey
+FROM v1 AS alias1
+RIGHT JOIN t1 AS alias2 ON 1
+WHERE alias2.col_varchar_key IN (
+SELECT sq2_alias1.col_varchar_nokey
+FROM v1 AS sq2_alias1
+LEFT JOIN t1 AS sq2_alias2
+ON (sq2_alias2.col_int_key = sq2_alias1.pk)
+WHERE sq2_alias1.pk != alias1.col_int_key
+AND sq2_alias1.col_varchar_key > alias1.col_varchar_key
+)
+;
+col_varchar_nokey
+d
+j
+m
+m
+m
+v
+v
+v
+v
+CREATE VIEW v2 AS SELECT alias2.col_varchar_nokey
+FROM v1 AS alias1
+RIGHT JOIN t1 AS alias2 ON 1
+WHERE alias2.col_varchar_key IN (
+SELECT sq2_alias1.col_varchar_nokey
+FROM v1 AS sq2_alias1
+LEFT JOIN t1 AS sq2_alias2
+ON (sq2_alias2.col_int_key = sq2_alias1.pk)
+WHERE sq2_alias1.pk != alias1.col_int_key
+AND sq2_alias1.col_varchar_key > alias1.col_varchar_key
+)
+;
+EXPLAIN EXTENDED SELECT * FROM v2;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	PRIMARY	alias2	ALL	NULL	NULL	NULL	NULL	5	100.00	
+1	PRIMARY	t1	index	NULL	col_varchar_key	7	NULL	5	100.00	Using where; Using index; Using join buffer (Block Nested Loop)
+3	DEPENDENT SUBQUERY	t1	ALL	col_varchar_key	NULL	NULL	NULL	5	100.00	Using where
+3	DEPENDENT SUBQUERY	sq2_alias2	index	col_int_key	col_int_key	4	NULL	5	80.00	Using where; Using index; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1276	Field or reference 'alias1.col_int_key' of SELECT #3 was resolved in SELECT #1
+Note	1276	Field or reference 'alias1.col_varchar_key' of SELECT #3 was resolved in SELECT #1
+Note	1003	/* select#1 */ select `test`.`alias2`.`col_varchar_nokey` AS `col_varchar_nokey` from `test`.`t1` `alias2` left join (`test`.`t1`) on(1) where <in_optimizer>(`test`.`alias2`.`col_varchar_key`,<exists>(/* select#3 */ select 1 from `test`.`t1` left join `test`.`t1` `sq2_alias2` on((`sq2_alias2`.`col_int_key` = `test`.`t1`.`pk`)) where ((`test`.`t1`.`pk` <> `t1`.`col_int_key`) and (`test`.`t1`.`col_varchar_key` > `t1`.`col_varchar_key`) and (<cache>(`test`.`alias2`.`col_varchar_key`) = `test`.`t1`.`col_varchar_nokey`))))
+SELECT * FROM v2;
+col_varchar_nokey
+d
+j
+m
+m
+m
+v
+v
+v
+v
+EXPLAIN EXTENDED SELECT alias2.col_varchar_nokey
+FROM t1 AS alias2
+LEFT JOIN v1 AS alias1 ON 1
+WHERE alias2.col_varchar_key IN (
+SELECT sq2_alias1.col_varchar_nokey
+FROM v1 AS sq2_alias1
+LEFT JOIN t1 AS sq2_alias2
+ON (sq2_alias2.col_int_key = sq2_alias1.pk)
+WHERE sq2_alias1.pk != alias1.col_int_key
+AND sq2_alias1.col_varchar_key > alias1.col_varchar_key
+);
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	PRIMARY	alias2	ALL	NULL	NULL	NULL	NULL	5	100.00	
+1	PRIMARY	t1	index	NULL	col_varchar_key	7	NULL	5	100.00	Using where; Using index; Using join buffer (Block Nested Loop)
+2	DEPENDENT SUBQUERY	t1	ALL	col_varchar_key	NULL	NULL	NULL	5	100.00	Using where
+2	DEPENDENT SUBQUERY	sq2_alias2	index	col_int_key	col_int_key	4	NULL	5	80.00	Using where; Using index; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1276	Field or reference 'alias1.col_int_key' of SELECT #2 was resolved in SELECT #1
+Note	1276	Field or reference 'alias1.col_varchar_key' of SELECT #2 was resolved in SELECT #1
+Note	1003	/* select#1 */ select `test`.`alias2`.`col_varchar_nokey` AS `col_varchar_nokey` from `test`.`t1` `alias2` left join (`test`.`t1`) on(1) where <in_optimizer>(`test`.`alias2`.`col_varchar_key`,<exists>(/* select#2 */ select 1 from `test`.`t1` left join `test`.`t1` `sq2_alias2` on((`sq2_alias2`.`col_int_key` = `test`.`t1`.`pk`)) where ((`test`.`t1`.`pk` <> `t1`.`col_int_key`) and (`test`.`t1`.`col_varchar_key` > `t1`.`col_varchar_key`) and (<cache>(`test`.`alias2`.`col_varchar_key`) = `test`.`t1`.`col_varchar_nokey`))))
+SELECT alias2.col_varchar_nokey
+FROM t1 AS alias2
+LEFT JOIN v1 AS alias1 ON 1
+WHERE alias2.col_varchar_key IN (
+SELECT sq2_alias1.col_varchar_nokey
+FROM v1 AS sq2_alias1
+LEFT JOIN t1 AS sq2_alias2
+ON (sq2_alias2.col_int_key = sq2_alias1.pk)
+WHERE sq2_alias1.pk != alias1.col_int_key
+AND sq2_alias1.col_varchar_key > alias1.col_varchar_key
+);
+col_varchar_nokey
+d
+j
+m
+m
+m
+v
+v
+v
+v
+DROP TABLE t1;
+DROP VIEW v1,v2;
+#
+# Bug#13651009 WRONG RESULT FROM DERIVED TABLE IF THE SUBQUERY
+# HAS AN EMPTY RESULT
+#
+CREATE TABLE t1 (
+pk int NOT NULL,
+col_int_nokey int NOT NULL,
+col_int_key int NOT NULL,
+col_time_key time NOT NULL,
+col_varchar_key varchar(1) NOT NULL,
+col_varchar_nokey varchar(1) NOT NULL,
+PRIMARY KEY (pk),
+KEY col_int_key (col_int_key),
+KEY col_time_key (col_time_key),
+KEY col_varchar_key (col_varchar_key,col_int_key)
+) ENGINE=MyISAM;
+CREATE TABLE t2 (
+pk int NOT NULL AUTO_INCREMENT,
+col_int_nokey int NOT NULL,
+col_int_key int NOT NULL,
+col_time_key time NOT NULL,
+col_varchar_key varchar(1) NOT NULL,
+col_varchar_nokey varchar(1) NOT NULL,
+PRIMARY KEY (pk),
+KEY col_int_key (col_int_key),
+KEY col_time_key (col_time_key),
+KEY col_varchar_key (col_varchar_key,col_int_key)
+) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (1,4,4,'00:00:00','b','b');
+SET @var2:=4, @var3:=8;
+
+Testcase without inner subquery
+EXPLAIN SELECT @var3:=12, sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
+sq4_alias1.col_varchar_key = @var3;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE noticed after reading const tables
+SELECT @var3:=12, sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
+sq4_alias1.col_varchar_key = @var3;
+@var3:=12	pk	col_int_nokey	col_int_key	col_time_key	col_varchar_key	col_varchar_nokey
+SELECT @var3;
+@var3
+8
+EXPLAIN SELECT * FROM ( SELECT @var3:=12, sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
+sq4_alias1.col_varchar_key = @var3 ) AS alias3;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	PRIMARY	<derived2>	system	NULL	NULL	NULL	NULL	0	const row not found
+2	DERIVED	NULL	NULL	NULL	NULL	NULL	NULL	NULL	no matching row in const table
+SELECT * FROM ( SELECT @var3:=12, sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
+sq4_alias1.col_varchar_key = @var3 ) AS alias3;
+@var3:=12	pk	col_int_nokey	col_int_key	col_time_key	col_varchar_key	col_varchar_nokey
+SELECT @var3;
+@var3
+8
+
+Testcase with inner subquery; crashed WL#6095
+SET @var3=8;
+EXPLAIN SELECT sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
+NOT IN
+(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
+c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
+FROM t2 AS c_sq1_alias1
+WHERE (c_sq1_alias1.col_int_nokey != @var2
+OR c_sq1_alias1.pk != @var3));
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	PRIMARY	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE noticed after reading const tables
+2	DEPENDENT SUBQUERY	c_sq1_alias1	system	PRIMARY,col_varchar_key	NULL	NULL	NULL	1	
+SELECT sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
+NOT IN
+(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
+c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
+FROM t2 AS c_sq1_alias1
+WHERE (c_sq1_alias1.col_int_nokey != @var2
+OR c_sq1_alias1.pk != @var3));
+pk	col_int_nokey	col_int_key	col_time_key	col_varchar_key	col_varchar_nokey
+EXPLAIN SELECT * FROM ( SELECT sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
+NOT IN
+(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
+c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
+FROM t2 AS c_sq1_alias1
+WHERE (c_sq1_alias1.col_int_nokey != @var2
+OR c_sq1_alias1.pk != @var3)) ) AS alias3;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	PRIMARY	<derived2>	system	NULL	NULL	NULL	NULL	0	const row not found
+2	DERIVED	NULL	NULL	NULL	NULL	NULL	NULL	NULL	no matching row in const table
+3	DEPENDENT SUBQUERY	c_sq1_alias1	system	PRIMARY,col_varchar_key	NULL	NULL	NULL	1	
+SELECT * FROM ( SELECT sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
+NOT IN
+(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
+c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
+FROM t2 AS c_sq1_alias1
+WHERE (c_sq1_alias1.col_int_nokey != @var2
+OR c_sq1_alias1.pk != @var3)) ) AS alias3;
+pk	col_int_nokey	col_int_key	col_time_key	col_varchar_key	col_varchar_nokey
+DROP TABLE t1,t2;
 set optimizer_switch=default;

=== modified file 'mysql-test/r/subquery_nomat_nosj_bka.result'
--- a/mysql-test/r/subquery_nomat_nosj_bka.result	2011-11-01 11:52:24 +0000
+++ b/mysql-test/r/subquery_nomat_nosj_bka.result	2012-02-07 14:50:31 +0000
@@ -6823,5 +6823,263 @@ Warnings:
 Note	1003	/* select#1 */ select '1' AS `col_int_nokey` from dual where <in_optimizer>(('x','x'),<exists>(<index_lookup>(<cache>('x') in it on idx_cvk_cvk2_cik where (isnull(`test`.`it`.`col_int_key`) and (<cache>('x') = `test`.`it`.`col_varchar_key`) and (<cache>('x') = `test`.`it`.`col_varchar_key2`)))))
 
 DROP TABLE it, ot;
+#
+# Bug #11829691: Pure virtual method called in Item_bool_func2::fix...()
+#
+CREATE TABLE t1(a INTEGER);
+CREATE TABLE t2(b INTEGER);
+PREPARE stmt FROM "
+SELECT SUM(b) FROM t2 GROUP BY b HAVING b IN (SELECT b FROM t1)";
+EXECUTE stmt;
+SUM(b)
+EXECUTE stmt;
+SUM(b)
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1, t2;
+#
+# Bug #13595212 EXTRA ROWS RETURNED ON RIGHT JOIN WITH VIEW AND
+# IN-SUBQUERY IN WHERE
+#
+CREATE TABLE t1 (
+pk int(11) NOT NULL AUTO_INCREMENT,
+col_int_key int(11) NOT NULL,
+col_varchar_key varchar(1) NOT NULL,
+col_varchar_nokey varchar(1) NOT NULL,
+PRIMARY KEY (pk),
+KEY col_int_key (col_int_key),
+KEY col_varchar_key (col_varchar_key,col_int_key)
+);
+INSERT INTO t1 VALUES (1,0,'j','j'),(2,8,'v','v'),
+(3,1,'c','c'),(4,8,'m','m'),(5,9,'d','d');
+CREATE VIEW v1 AS SELECT * FROM t1;
+EXPLAIN EXTENDED SELECT alias2.col_varchar_nokey
+FROM v1 AS alias1
+RIGHT JOIN t1 AS alias2 ON 1
+WHERE alias2.col_varchar_key IN (
+SELECT sq2_alias1.col_varchar_nokey
+FROM v1 AS sq2_alias1
+LEFT JOIN t1 AS sq2_alias2
+ON (sq2_alias2.col_int_key = sq2_alias1.pk)
+WHERE sq2_alias1.pk != alias1.col_int_key
+AND sq2_alias1.col_varchar_key > alias1.col_varchar_key
+)
+;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	PRIMARY	alias2	ALL	NULL	NULL	NULL	NULL	5	100.00	
+1	PRIMARY	t1	index	NULL	col_varchar_key	7	NULL	5	100.00	Using where; Using index; Using join buffer (Block Nested Loop)
+2	DEPENDENT SUBQUERY	t1	ALL	col_varchar_key	NULL	NULL	NULL	5	100.00	Using where
+2	DEPENDENT SUBQUERY	sq2_alias2	index	col_int_key	col_int_key	4	NULL	5	80.00	Using where; Using index; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1276	Field or reference 'alias1.col_int_key' of SELECT #2 was resolved in SELECT #1
+Note	1276	Field or reference 'alias1.col_varchar_key' of SELECT #2 was resolved in SELECT #1
+Note	1003	/* select#1 */ select `test`.`alias2`.`col_varchar_nokey` AS `col_varchar_nokey` from `test`.`t1` `alias2` left join (`test`.`t1`) on(1) where <in_optimizer>(`test`.`alias2`.`col_varchar_key`,<exists>(/* select#2 */ select 1 from `test`.`t1` left join `test`.`t1` `sq2_alias2` on((`test`.`sq2_alias2`.`col_int_key` = `test`.`t1`.`pk`)) where ((`test`.`t1`.`pk` <> `test`.`t1`.`col_int_key`) and (`test`.`t1`.`col_varchar_key` > `test`.`t1`.`col_varchar_key`) and (<cache>(`test`.`alias2`.`col_varchar_key`) = `test`.`t1`.`col_varchar_nokey`))))
+SELECT alias2.col_varchar_nokey
+FROM v1 AS alias1
+RIGHT JOIN t1 AS alias2 ON 1
+WHERE alias2.col_varchar_key IN (
+SELECT sq2_alias1.col_varchar_nokey
+FROM v1 AS sq2_alias1
+LEFT JOIN t1 AS sq2_alias2
+ON (sq2_alias2.col_int_key = sq2_alias1.pk)
+WHERE sq2_alias1.pk != alias1.col_int_key
+AND sq2_alias1.col_varchar_key > alias1.col_varchar_key
+)
+;
+col_varchar_nokey
+d
+j
+m
+m
+m
+v
+v
+v
+v
+CREATE VIEW v2 AS SELECT alias2.col_varchar_nokey
+FROM v1 AS alias1
+RIGHT JOIN t1 AS alias2 ON 1
+WHERE alias2.col_varchar_key IN (
+SELECT sq2_alias1.col_varchar_nokey
+FROM v1 AS sq2_alias1
+LEFT JOIN t1 AS sq2_alias2
+ON (sq2_alias2.col_int_key = sq2_alias1.pk)
+WHERE sq2_alias1.pk != alias1.col_int_key
+AND sq2_alias1.col_varchar_key > alias1.col_varchar_key
+)
+;
+EXPLAIN EXTENDED SELECT * FROM v2;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	PRIMARY	alias2	ALL	NULL	NULL	NULL	NULL	5	100.00	
+1	PRIMARY	t1	index	NULL	col_varchar_key	7	NULL	5	100.00	Using where; Using index; Using join buffer (Block Nested Loop)
+3	DEPENDENT SUBQUERY	t1	ALL	col_varchar_key	NULL	NULL	NULL	5	100.00	Using where
+3	DEPENDENT SUBQUERY	sq2_alias2	index	col_int_key	col_int_key	4	NULL	5	80.00	Using where; Using index; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1276	Field or reference 'alias1.col_int_key' of SELECT #3 was resolved in SELECT #1
+Note	1276	Field or reference 'alias1.col_varchar_key' of SELECT #3 was resolved in SELECT #1
+Note	1003	/* select#1 */ select `test`.`alias2`.`col_varchar_nokey` AS `col_varchar_nokey` from `test`.`t1` `alias2` left join (`test`.`t1`) on(1) where <in_optimizer>(`test`.`alias2`.`col_varchar_key`,<exists>(/* select#3 */ select 1 from `test`.`t1` left join `test`.`t1` `sq2_alias2` on((`sq2_alias2`.`col_int_key` = `test`.`t1`.`pk`)) where ((`test`.`t1`.`pk` <> `t1`.`col_int_key`) and (`test`.`t1`.`col_varchar_key` > `t1`.`col_varchar_key`) and (<cache>(`test`.`alias2`.`col_varchar_key`) = `test`.`t1`.`col_varchar_nokey`))))
+SELECT * FROM v2;
+col_varchar_nokey
+d
+j
+m
+m
+m
+v
+v
+v
+v
+EXPLAIN EXTENDED SELECT alias2.col_varchar_nokey
+FROM t1 AS alias2
+LEFT JOIN v1 AS alias1 ON 1
+WHERE alias2.col_varchar_key IN (
+SELECT sq2_alias1.col_varchar_nokey
+FROM v1 AS sq2_alias1
+LEFT JOIN t1 AS sq2_alias2
+ON (sq2_alias2.col_int_key = sq2_alias1.pk)
+WHERE sq2_alias1.pk != alias1.col_int_key
+AND sq2_alias1.col_varchar_key > alias1.col_varchar_key
+);
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	PRIMARY	alias2	ALL	NULL	NULL	NULL	NULL	5	100.00	
+1	PRIMARY	t1	index	NULL	col_varchar_key	7	NULL	5	100.00	Using where; Using index; Using join buffer (Block Nested Loop)
+2	DEPENDENT SUBQUERY	t1	ALL	col_varchar_key	NULL	NULL	NULL	5	100.00	Using where
+2	DEPENDENT SUBQUERY	sq2_alias2	index	col_int_key	col_int_key	4	NULL	5	80.00	Using where; Using index; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1276	Field or reference 'alias1.col_int_key' of SELECT #2 was resolved in SELECT #1
+Note	1276	Field or reference 'alias1.col_varchar_key' of SELECT #2 was resolved in SELECT #1
+Note	1003	/* select#1 */ select `test`.`alias2`.`col_varchar_nokey` AS `col_varchar_nokey` from `test`.`t1` `alias2` left join (`test`.`t1`) on(1) where <in_optimizer>(`test`.`alias2`.`col_varchar_key`,<exists>(/* select#2 */ select 1 from `test`.`t1` left join `test`.`t1` `sq2_alias2` on((`sq2_alias2`.`col_int_key` = `test`.`t1`.`pk`)) where ((`test`.`t1`.`pk` <> `t1`.`col_int_key`) and (`test`.`t1`.`col_varchar_key` > `t1`.`col_varchar_key`) and (<cache>(`test`.`alias2`.`col_varchar_key`) = `test`.`t1`.`col_varchar_nokey`))))
+SELECT alias2.col_varchar_nokey
+FROM t1 AS alias2
+LEFT JOIN v1 AS alias1 ON 1
+WHERE alias2.col_varchar_key IN (
+SELECT sq2_alias1.col_varchar_nokey
+FROM v1 AS sq2_alias1
+LEFT JOIN t1 AS sq2_alias2
+ON (sq2_alias2.col_int_key = sq2_alias1.pk)
+WHERE sq2_alias1.pk != alias1.col_int_key
+AND sq2_alias1.col_varchar_key > alias1.col_varchar_key
+);
+col_varchar_nokey
+d
+j
+m
+m
+m
+v
+v
+v
+v
+DROP TABLE t1;
+DROP VIEW v1,v2;
+#
+# Bug#13651009 WRONG RESULT FROM DERIVED TABLE IF THE SUBQUERY
+# HAS AN EMPTY RESULT
+#
+CREATE TABLE t1 (
+pk int NOT NULL,
+col_int_nokey int NOT NULL,
+col_int_key int NOT NULL,
+col_time_key time NOT NULL,
+col_varchar_key varchar(1) NOT NULL,
+col_varchar_nokey varchar(1) NOT NULL,
+PRIMARY KEY (pk),
+KEY col_int_key (col_int_key),
+KEY col_time_key (col_time_key),
+KEY col_varchar_key (col_varchar_key,col_int_key)
+) ENGINE=MyISAM;
+CREATE TABLE t2 (
+pk int NOT NULL AUTO_INCREMENT,
+col_int_nokey int NOT NULL,
+col_int_key int NOT NULL,
+col_time_key time NOT NULL,
+col_varchar_key varchar(1) NOT NULL,
+col_varchar_nokey varchar(1) NOT NULL,
+PRIMARY KEY (pk),
+KEY col_int_key (col_int_key),
+KEY col_time_key (col_time_key),
+KEY col_varchar_key (col_varchar_key,col_int_key)
+) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (1,4,4,'00:00:00','b','b');
+SET @var2:=4, @var3:=8;
+
+Testcase without inner subquery
+EXPLAIN SELECT @var3:=12, sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
+sq4_alias1.col_varchar_key = @var3;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE noticed after reading const tables
+SELECT @var3:=12, sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
+sq4_alias1.col_varchar_key = @var3;
+@var3:=12	pk	col_int_nokey	col_int_key	col_time_key	col_varchar_key	col_varchar_nokey
+SELECT @var3;
+@var3
+8
+EXPLAIN SELECT * FROM ( SELECT @var3:=12, sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
+sq4_alias1.col_varchar_key = @var3 ) AS alias3;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	PRIMARY	<derived2>	system	NULL	NULL	NULL	NULL	0	const row not found
+2	DERIVED	NULL	NULL	NULL	NULL	NULL	NULL	NULL	no matching row in const table
+SELECT * FROM ( SELECT @var3:=12, sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
+sq4_alias1.col_varchar_key = @var3 ) AS alias3;
+@var3:=12	pk	col_int_nokey	col_int_key	col_time_key	col_varchar_key	col_varchar_nokey
+SELECT @var3;
+@var3
+8
+
+Testcase with inner subquery; crashed WL#6095
+SET @var3=8;
+EXPLAIN SELECT sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
+NOT IN
+(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
+c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
+FROM t2 AS c_sq1_alias1
+WHERE (c_sq1_alias1.col_int_nokey != @var2
+OR c_sq1_alias1.pk != @var3));
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	PRIMARY	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE noticed after reading const tables
+2	DEPENDENT SUBQUERY	c_sq1_alias1	system	PRIMARY,col_varchar_key	NULL	NULL	NULL	1	
+SELECT sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
+NOT IN
+(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
+c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
+FROM t2 AS c_sq1_alias1
+WHERE (c_sq1_alias1.col_int_nokey != @var2
+OR c_sq1_alias1.pk != @var3));
+pk	col_int_nokey	col_int_key	col_time_key	col_varchar_key	col_varchar_nokey
+EXPLAIN SELECT * FROM ( SELECT sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
+NOT IN
+(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
+c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
+FROM t2 AS c_sq1_alias1
+WHERE (c_sq1_alias1.col_int_nokey != @var2
+OR c_sq1_alias1.pk != @var3)) ) AS alias3;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	PRIMARY	<derived2>	system	NULL	NULL	NULL	NULL	0	const row not found
+2	DERIVED	NULL	NULL	NULL	NULL	NULL	NULL	NULL	no matching row in const table
+3	DEPENDENT SUBQUERY	c_sq1_alias1	system	PRIMARY,col_varchar_key	NULL	NULL	NULL	1	
+SELECT * FROM ( SELECT sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
+NOT IN
+(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
+c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
+FROM t2 AS c_sq1_alias1
+WHERE (c_sq1_alias1.col_int_nokey != @var2
+OR c_sq1_alias1.pk != @var3)) ) AS alias3;
+pk	col_int_nokey	col_int_key	col_time_key	col_varchar_key	col_varchar_nokey
+DROP TABLE t1,t2;
 set optimizer_switch=default;
 set optimizer_switch=default;

=== modified file 'mysql-test/r/subquery_nomat_nosj_bka_nixbnl.result'
--- a/mysql-test/r/subquery_nomat_nosj_bka_nixbnl.result	2011-11-01 11:52:24 +0000
+++ b/mysql-test/r/subquery_nomat_nosj_bka_nixbnl.result	2012-02-07 14:50:31 +0000
@@ -6823,5 +6823,263 @@ Warnings:
 Note	1003	/* select#1 */ select '1' AS `col_int_nokey` from dual where <in_optimizer>(('x','x'),<exists>(<index_lookup>(<cache>('x') in it on idx_cvk_cvk2_cik where (isnull(`test`.`it`.`col_int_key`) and (<cache>('x') = `test`.`it`.`col_varchar_key`) and (<cache>('x') = `test`.`it`.`col_varchar_key2`)))))
 
 DROP TABLE it, ot;
+#
+# Bug #11829691: Pure virtual method called in Item_bool_func2::fix...()
+#
+CREATE TABLE t1(a INTEGER);
+CREATE TABLE t2(b INTEGER);
+PREPARE stmt FROM "
+SELECT SUM(b) FROM t2 GROUP BY b HAVING b IN (SELECT b FROM t1)";
+EXECUTE stmt;
+SUM(b)
+EXECUTE stmt;
+SUM(b)
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1, t2;
+#
+# Bug #13595212 EXTRA ROWS RETURNED ON RIGHT JOIN WITH VIEW AND
+# IN-SUBQUERY IN WHERE
+#
+CREATE TABLE t1 (
+pk int(11) NOT NULL AUTO_INCREMENT,
+col_int_key int(11) NOT NULL,
+col_varchar_key varchar(1) NOT NULL,
+col_varchar_nokey varchar(1) NOT NULL,
+PRIMARY KEY (pk),
+KEY col_int_key (col_int_key),
+KEY col_varchar_key (col_varchar_key,col_int_key)
+);
+INSERT INTO t1 VALUES (1,0,'j','j'),(2,8,'v','v'),
+(3,1,'c','c'),(4,8,'m','m'),(5,9,'d','d');
+CREATE VIEW v1 AS SELECT * FROM t1;
+EXPLAIN EXTENDED SELECT alias2.col_varchar_nokey
+FROM v1 AS alias1
+RIGHT JOIN t1 AS alias2 ON 1
+WHERE alias2.col_varchar_key IN (
+SELECT sq2_alias1.col_varchar_nokey
+FROM v1 AS sq2_alias1
+LEFT JOIN t1 AS sq2_alias2
+ON (sq2_alias2.col_int_key = sq2_alias1.pk)
+WHERE sq2_alias1.pk != alias1.col_int_key
+AND sq2_alias1.col_varchar_key > alias1.col_varchar_key
+)
+;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	PRIMARY	alias2	ALL	NULL	NULL	NULL	NULL	5	100.00	
+1	PRIMARY	t1	index	NULL	col_varchar_key	7	NULL	5	100.00	Using where; Using index
+2	DEPENDENT SUBQUERY	t1	ALL	col_varchar_key	NULL	NULL	NULL	5	100.00	Using where
+2	DEPENDENT SUBQUERY	sq2_alias2	ref	col_int_key	col_int_key	4	test.t1.pk	2	100.00	Using index
+Warnings:
+Note	1276	Field or reference 'alias1.col_int_key' of SELECT #2 was resolved in SELECT #1
+Note	1276	Field or reference 'alias1.col_varchar_key' of SELECT #2 was resolved in SELECT #1
+Note	1003	/* select#1 */ select `test`.`alias2`.`col_varchar_nokey` AS `col_varchar_nokey` from `test`.`t1` `alias2` left join (`test`.`t1`) on(1) where <in_optimizer>(`test`.`alias2`.`col_varchar_key`,<exists>(/* select#2 */ select 1 from `test`.`t1` left join `test`.`t1` `sq2_alias2` on((`test`.`sq2_alias2`.`col_int_key` = `test`.`t1`.`pk`)) where ((`test`.`t1`.`pk` <> `test`.`t1`.`col_int_key`) and (`test`.`t1`.`col_varchar_key` > `test`.`t1`.`col_varchar_key`) and (<cache>(`test`.`alias2`.`col_varchar_key`) = `test`.`t1`.`col_varchar_nokey`))))
+SELECT alias2.col_varchar_nokey
+FROM v1 AS alias1
+RIGHT JOIN t1 AS alias2 ON 1
+WHERE alias2.col_varchar_key IN (
+SELECT sq2_alias1.col_varchar_nokey
+FROM v1 AS sq2_alias1
+LEFT JOIN t1 AS sq2_alias2
+ON (sq2_alias2.col_int_key = sq2_alias1.pk)
+WHERE sq2_alias1.pk != alias1.col_int_key
+AND sq2_alias1.col_varchar_key > alias1.col_varchar_key
+)
+;
+col_varchar_nokey
+d
+j
+m
+m
+m
+v
+v
+v
+v
+CREATE VIEW v2 AS SELECT alias2.col_varchar_nokey
+FROM v1 AS alias1
+RIGHT JOIN t1 AS alias2 ON 1
+WHERE alias2.col_varchar_key IN (
+SELECT sq2_alias1.col_varchar_nokey
+FROM v1 AS sq2_alias1
+LEFT JOIN t1 AS sq2_alias2
+ON (sq2_alias2.col_int_key = sq2_alias1.pk)
+WHERE sq2_alias1.pk != alias1.col_int_key
+AND sq2_alias1.col_varchar_key > alias1.col_varchar_key
+)
+;
+EXPLAIN EXTENDED SELECT * FROM v2;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	PRIMARY	alias2	ALL	NULL	NULL	NULL	NULL	5	100.00	
+1	PRIMARY	t1	index	NULL	col_varchar_key	7	NULL	5	100.00	Using where; Using index
+3	DEPENDENT SUBQUERY	t1	ALL	col_varchar_key	NULL	NULL	NULL	5	100.00	Using where
+3	DEPENDENT SUBQUERY	sq2_alias2	ref	col_int_key	col_int_key	4	test.t1.pk	2	100.00	Using index
+Warnings:
+Note	1276	Field or reference 'alias1.col_int_key' of SELECT #3 was resolved in SELECT #1
+Note	1276	Field or reference 'alias1.col_varchar_key' of SELECT #3 was resolved in SELECT #1
+Note	1003	/* select#1 */ select `test`.`alias2`.`col_varchar_nokey` AS `col_varchar_nokey` from `test`.`t1` `alias2` left join (`test`.`t1`) on(1) where <in_optimizer>(`test`.`alias2`.`col_varchar_key`,<exists>(/* select#3 */ select 1 from `test`.`t1` left join `test`.`t1` `sq2_alias2` on((`sq2_alias2`.`col_int_key` = `test`.`t1`.`pk`)) where ((`test`.`t1`.`pk` <> `t1`.`col_int_key`) and (`test`.`t1`.`col_varchar_key` > `t1`.`col_varchar_key`) and (<cache>(`test`.`alias2`.`col_varchar_key`) = `test`.`t1`.`col_varchar_nokey`))))
+SELECT * FROM v2;
+col_varchar_nokey
+d
+j
+m
+m
+m
+v
+v
+v
+v
+EXPLAIN EXTENDED SELECT alias2.col_varchar_nokey
+FROM t1 AS alias2
+LEFT JOIN v1 AS alias1 ON 1
+WHERE alias2.col_varchar_key IN (
+SELECT sq2_alias1.col_varchar_nokey
+FROM v1 AS sq2_alias1
+LEFT JOIN t1 AS sq2_alias2
+ON (sq2_alias2.col_int_key = sq2_alias1.pk)
+WHERE sq2_alias1.pk != alias1.col_int_key
+AND sq2_alias1.col_varchar_key > alias1.col_varchar_key
+);
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	PRIMARY	alias2	ALL	NULL	NULL	NULL	NULL	5	100.00	
+1	PRIMARY	t1	index	NULL	col_varchar_key	7	NULL	5	100.00	Using where; Using index
+2	DEPENDENT SUBQUERY	t1	ALL	col_varchar_key	NULL	NULL	NULL	5	100.00	Using where
+2	DEPENDENT SUBQUERY	sq2_alias2	ref	col_int_key	col_int_key	4	test.t1.pk	2	100.00	Using index
+Warnings:
+Note	1276	Field or reference 'alias1.col_int_key' of SELECT #2 was resolved in SELECT #1
+Note	1276	Field or reference 'alias1.col_varchar_key' of SELECT #2 was resolved in SELECT #1
+Note	1003	/* select#1 */ select `test`.`alias2`.`col_varchar_nokey` AS `col_varchar_nokey` from `test`.`t1` `alias2` left join (`test`.`t1`) on(1) where <in_optimizer>(`test`.`alias2`.`col_varchar_key`,<exists>(/* select#2 */ select 1 from `test`.`t1` left join `test`.`t1` `sq2_alias2` on((`sq2_alias2`.`col_int_key` = `test`.`t1`.`pk`)) where ((`test`.`t1`.`pk` <> `t1`.`col_int_key`) and (`test`.`t1`.`col_varchar_key` > `t1`.`col_varchar_key`) and (<cache>(`test`.`alias2`.`col_varchar_key`) = `test`.`t1`.`col_varchar_nokey`))))
+SELECT alias2.col_varchar_nokey
+FROM t1 AS alias2
+LEFT JOIN v1 AS alias1 ON 1
+WHERE alias2.col_varchar_key IN (
+SELECT sq2_alias1.col_varchar_nokey
+FROM v1 AS sq2_alias1
+LEFT JOIN t1 AS sq2_alias2
+ON (sq2_alias2.col_int_key = sq2_alias1.pk)
+WHERE sq2_alias1.pk != alias1.col_int_key
+AND sq2_alias1.col_varchar_key > alias1.col_varchar_key
+);
+col_varchar_nokey
+d
+j
+m
+m
+m
+v
+v
+v
+v
+DROP TABLE t1;
+DROP VIEW v1,v2;
+#
+# Bug#13651009 WRONG RESULT FROM DERIVED TABLE IF THE SUBQUERY
+# HAS AN EMPTY RESULT
+#
+CREATE TABLE t1 (
+pk int NOT NULL,
+col_int_nokey int NOT NULL,
+col_int_key int NOT NULL,
+col_time_key time NOT NULL,
+col_varchar_key varchar(1) NOT NULL,
+col_varchar_nokey varchar(1) NOT NULL,
+PRIMARY KEY (pk),
+KEY col_int_key (col_int_key),
+KEY col_time_key (col_time_key),
+KEY col_varchar_key (col_varchar_key,col_int_key)
+) ENGINE=MyISAM;
+CREATE TABLE t2 (
+pk int NOT NULL AUTO_INCREMENT,
+col_int_nokey int NOT NULL,
+col_int_key int NOT NULL,
+col_time_key time NOT NULL,
+col_varchar_key varchar(1) NOT NULL,
+col_varchar_nokey varchar(1) NOT NULL,
+PRIMARY KEY (pk),
+KEY col_int_key (col_int_key),
+KEY col_time_key (col_time_key),
+KEY col_varchar_key (col_varchar_key,col_int_key)
+) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (1,4,4,'00:00:00','b','b');
+SET @var2:=4, @var3:=8;
+
+Testcase without inner subquery
+EXPLAIN SELECT @var3:=12, sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
+sq4_alias1.col_varchar_key = @var3;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE noticed after reading const tables
+SELECT @var3:=12, sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
+sq4_alias1.col_varchar_key = @var3;
+@var3:=12	pk	col_int_nokey	col_int_key	col_time_key	col_varchar_key	col_varchar_nokey
+SELECT @var3;
+@var3
+8
+EXPLAIN SELECT * FROM ( SELECT @var3:=12, sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
+sq4_alias1.col_varchar_key = @var3 ) AS alias3;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	PRIMARY	<derived2>	system	NULL	NULL	NULL	NULL	0	const row not found
+2	DERIVED	NULL	NULL	NULL	NULL	NULL	NULL	NULL	no matching row in const table
+SELECT * FROM ( SELECT @var3:=12, sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
+sq4_alias1.col_varchar_key = @var3 ) AS alias3;
+@var3:=12	pk	col_int_nokey	col_int_key	col_time_key	col_varchar_key	col_varchar_nokey
+SELECT @var3;
+@var3
+8
+
+Testcase with inner subquery; crashed WL#6095
+SET @var3=8;
+EXPLAIN SELECT sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
+NOT IN
+(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
+c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
+FROM t2 AS c_sq1_alias1
+WHERE (c_sq1_alias1.col_int_nokey != @var2
+OR c_sq1_alias1.pk != @var3));
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	PRIMARY	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE noticed after reading const tables
+2	DEPENDENT SUBQUERY	c_sq1_alias1	system	PRIMARY,col_varchar_key	NULL	NULL	NULL	1	
+SELECT sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
+NOT IN
+(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
+c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
+FROM t2 AS c_sq1_alias1
+WHERE (c_sq1_alias1.col_int_nokey != @var2
+OR c_sq1_alias1.pk != @var3));
+pk	col_int_nokey	col_int_key	col_time_key	col_varchar_key	col_varchar_nokey
+EXPLAIN SELECT * FROM ( SELECT sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
+NOT IN
+(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
+c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
+FROM t2 AS c_sq1_alias1
+WHERE (c_sq1_alias1.col_int_nokey != @var2
+OR c_sq1_alias1.pk != @var3)) ) AS alias3;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	PRIMARY	<derived2>	system	NULL	NULL	NULL	NULL	0	const row not found
+2	DERIVED	NULL	NULL	NULL	NULL	NULL	NULL	NULL	no matching row in const table
+3	DEPENDENT SUBQUERY	c_sq1_alias1	system	PRIMARY,col_varchar_key	NULL	NULL	NULL	1	
+SELECT * FROM ( SELECT sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
+NOT IN
+(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
+c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
+FROM t2 AS c_sq1_alias1
+WHERE (c_sq1_alias1.col_int_nokey != @var2
+OR c_sq1_alias1.pk != @var3)) ) AS alias3;
+pk	col_int_nokey	col_int_key	col_time_key	col_varchar_key	col_varchar_nokey
+DROP TABLE t1,t2;
 set optimizer_switch=default;
 set optimizer_switch=default;

=== modified file 'mysql-test/r/subquery_none.result'
--- a/mysql-test/r/subquery_none.result	2011-11-01 11:52:24 +0000
+++ b/mysql-test/r/subquery_none.result	2012-02-07 14:50:31 +0000
@@ -6821,4 +6821,262 @@ Warnings:
 Note	1003	/* select#1 */ select '1' AS `col_int_nokey` from dual where <in_optimizer>(('x','x'),<exists>(<index_lookup>(<cache>('x') in it on idx_cvk_cvk2_cik where (isnull(`test`.`it`.`col_int_key`) and (<cache>('x') = `test`.`it`.`col_varchar_key`) and (<cache>('x') = `test`.`it`.`col_varchar_key2`)))))
 
 DROP TABLE it, ot;
+#
+# Bug #11829691: Pure virtual method called in Item_bool_func2::fix...()
+#
+CREATE TABLE t1(a INTEGER);
+CREATE TABLE t2(b INTEGER);
+PREPARE stmt FROM "
+SELECT SUM(b) FROM t2 GROUP BY b HAVING b IN (SELECT b FROM t1)";
+EXECUTE stmt;
+SUM(b)
+EXECUTE stmt;
+SUM(b)
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1, t2;
+#
+# Bug #13595212 EXTRA ROWS RETURNED ON RIGHT JOIN WITH VIEW AND
+# IN-SUBQUERY IN WHERE
+#
+CREATE TABLE t1 (
+pk int(11) NOT NULL AUTO_INCREMENT,
+col_int_key int(11) NOT NULL,
+col_varchar_key varchar(1) NOT NULL,
+col_varchar_nokey varchar(1) NOT NULL,
+PRIMARY KEY (pk),
+KEY col_int_key (col_int_key),
+KEY col_varchar_key (col_varchar_key,col_int_key)
+);
+INSERT INTO t1 VALUES (1,0,'j','j'),(2,8,'v','v'),
+(3,1,'c','c'),(4,8,'m','m'),(5,9,'d','d');
+CREATE VIEW v1 AS SELECT * FROM t1;
+EXPLAIN EXTENDED SELECT alias2.col_varchar_nokey
+FROM v1 AS alias1
+RIGHT JOIN t1 AS alias2 ON 1
+WHERE alias2.col_varchar_key IN (
+SELECT sq2_alias1.col_varchar_nokey
+FROM v1 AS sq2_alias1
+LEFT JOIN t1 AS sq2_alias2
+ON (sq2_alias2.col_int_key = sq2_alias1.pk)
+WHERE sq2_alias1.pk != alias1.col_int_key
+AND sq2_alias1.col_varchar_key > alias1.col_varchar_key
+)
+;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	PRIMARY	alias2	ALL	NULL	NULL	NULL	NULL	5	100.00	
+1	PRIMARY	t1	index	NULL	col_varchar_key	7	NULL	5	100.00	Using where; Using index; Using join buffer (Block Nested Loop)
+2	DEPENDENT SUBQUERY	t1	ALL	col_varchar_key	NULL	NULL	NULL	5	100.00	Using where
+2	DEPENDENT SUBQUERY	sq2_alias2	index	col_int_key	col_int_key	4	NULL	5	80.00	Using where; Using index; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1276	Field or reference 'alias1.col_int_key' of SELECT #2 was resolved in SELECT #1
+Note	1276	Field or reference 'alias1.col_varchar_key' of SELECT #2 was resolved in SELECT #1
+Note	1003	/* select#1 */ select `test`.`alias2`.`col_varchar_nokey` AS `col_varchar_nokey` from `test`.`t1` `alias2` left join (`test`.`t1`) on(1) where <in_optimizer>(`test`.`alias2`.`col_varchar_key`,<exists>(/* select#2 */ select 1 from `test`.`t1` left join `test`.`t1` `sq2_alias2` on((`test`.`sq2_alias2`.`col_int_key` = `test`.`t1`.`pk`)) where ((`test`.`t1`.`pk` <> `test`.`t1`.`col_int_key`) and (`test`.`t1`.`col_varchar_key` > `test`.`t1`.`col_varchar_key`) and (<cache>(`test`.`alias2`.`col_varchar_key`) = `test`.`t1`.`col_varchar_nokey`))))
+SELECT alias2.col_varchar_nokey
+FROM v1 AS alias1
+RIGHT JOIN t1 AS alias2 ON 1
+WHERE alias2.col_varchar_key IN (
+SELECT sq2_alias1.col_varchar_nokey
+FROM v1 AS sq2_alias1
+LEFT JOIN t1 AS sq2_alias2
+ON (sq2_alias2.col_int_key = sq2_alias1.pk)
+WHERE sq2_alias1.pk != alias1.col_int_key
+AND sq2_alias1.col_varchar_key > alias1.col_varchar_key
+)
+;
+col_varchar_nokey
+d
+j
+m
+m
+m
+v
+v
+v
+v
+CREATE VIEW v2 AS SELECT alias2.col_varchar_nokey
+FROM v1 AS alias1
+RIGHT JOIN t1 AS alias2 ON 1
+WHERE alias2.col_varchar_key IN (
+SELECT sq2_alias1.col_varchar_nokey
+FROM v1 AS sq2_alias1
+LEFT JOIN t1 AS sq2_alias2
+ON (sq2_alias2.col_int_key = sq2_alias1.pk)
+WHERE sq2_alias1.pk != alias1.col_int_key
+AND sq2_alias1.col_varchar_key > alias1.col_varchar_key
+)
+;
+EXPLAIN EXTENDED SELECT * FROM v2;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	PRIMARY	alias2	ALL	NULL	NULL	NULL	NULL	5	100.00	
+1	PRIMARY	t1	index	NULL	col_varchar_key	7	NULL	5	100.00	Using where; Using index; Using join buffer (Block Nested Loop)
+3	DEPENDENT SUBQUERY	t1	ALL	col_varchar_key	NULL	NULL	NULL	5	100.00	Using where
+3	DEPENDENT SUBQUERY	sq2_alias2	index	col_int_key	col_int_key	4	NULL	5	80.00	Using where; Using index; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1276	Field or reference 'alias1.col_int_key' of SELECT #3 was resolved in SELECT #1
+Note	1276	Field or reference 'alias1.col_varchar_key' of SELECT #3 was resolved in SELECT #1
+Note	1003	/* select#1 */ select `test`.`alias2`.`col_varchar_nokey` AS `col_varchar_nokey` from `test`.`t1` `alias2` left join (`test`.`t1`) on(1) where <in_optimizer>(`test`.`alias2`.`col_varchar_key`,<exists>(/* select#3 */ select 1 from `test`.`t1` left join `test`.`t1` `sq2_alias2` on((`sq2_alias2`.`col_int_key` = `test`.`t1`.`pk`)) where ((`test`.`t1`.`pk` <> `t1`.`col_int_key`) and (`test`.`t1`.`col_varchar_key` > `t1`.`col_varchar_key`) and (<cache>(`test`.`alias2`.`col_varchar_key`) = `test`.`t1`.`col_varchar_nokey`))))
+SELECT * FROM v2;
+col_varchar_nokey
+d
+j
+m
+m
+m
+v
+v
+v
+v
+EXPLAIN EXTENDED SELECT alias2.col_varchar_nokey
+FROM t1 AS alias2
+LEFT JOIN v1 AS alias1 ON 1
+WHERE alias2.col_varchar_key IN (
+SELECT sq2_alias1.col_varchar_nokey
+FROM v1 AS sq2_alias1
+LEFT JOIN t1 AS sq2_alias2
+ON (sq2_alias2.col_int_key = sq2_alias1.pk)
+WHERE sq2_alias1.pk != alias1.col_int_key
+AND sq2_alias1.col_varchar_key > alias1.col_varchar_key
+);
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	PRIMARY	alias2	ALL	NULL	NULL	NULL	NULL	5	100.00	
+1	PRIMARY	t1	index	NULL	col_varchar_key	7	NULL	5	100.00	Using where; Using index; Using join buffer (Block Nested Loop)
+2	DEPENDENT SUBQUERY	t1	ALL	col_varchar_key	NULL	NULL	NULL	5	100.00	Using where
+2	DEPENDENT SUBQUERY	sq2_alias2	index	col_int_key	col_int_key	4	NULL	5	80.00	Using where; Using index; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1276	Field or reference 'alias1.col_int_key' of SELECT #2 was resolved in SELECT #1
+Note	1276	Field or reference 'alias1.col_varchar_key' of SELECT #2 was resolved in SELECT #1
+Note	1003	/* select#1 */ select `test`.`alias2`.`col_varchar_nokey` AS `col_varchar_nokey` from `test`.`t1` `alias2` left join (`test`.`t1`) on(1) where <in_optimizer>(`test`.`alias2`.`col_varchar_key`,<exists>(/* select#2 */ select 1 from `test`.`t1` left join `test`.`t1` `sq2_alias2` on((`sq2_alias2`.`col_int_key` = `test`.`t1`.`pk`)) where ((`test`.`t1`.`pk` <> `t1`.`col_int_key`) and (`test`.`t1`.`col_varchar_key` > `t1`.`col_varchar_key`) and (<cache>(`test`.`alias2`.`col_varchar_key`) = `test`.`t1`.`col_varchar_nokey`))))
+SELECT alias2.col_varchar_nokey
+FROM t1 AS alias2
+LEFT JOIN v1 AS alias1 ON 1
+WHERE alias2.col_varchar_key IN (
+SELECT sq2_alias1.col_varchar_nokey
+FROM v1 AS sq2_alias1
+LEFT JOIN t1 AS sq2_alias2
+ON (sq2_alias2.col_int_key = sq2_alias1.pk)
+WHERE sq2_alias1.pk != alias1.col_int_key
+AND sq2_alias1.col_varchar_key > alias1.col_varchar_key
+);
+col_varchar_nokey
+d
+j
+m
+m
+m
+v
+v
+v
+v
+DROP TABLE t1;
+DROP VIEW v1,v2;
+#
+# Bug#13651009 WRONG RESULT FROM DERIVED TABLE IF THE SUBQUERY
+# HAS AN EMPTY RESULT
+#
+CREATE TABLE t1 (
+pk int NOT NULL,
+col_int_nokey int NOT NULL,
+col_int_key int NOT NULL,
+col_time_key time NOT NULL,
+col_varchar_key varchar(1) NOT NULL,
+col_varchar_nokey varchar(1) NOT NULL,
+PRIMARY KEY (pk),
+KEY col_int_key (col_int_key),
+KEY col_time_key (col_time_key),
+KEY col_varchar_key (col_varchar_key,col_int_key)
+) ENGINE=MyISAM;
+CREATE TABLE t2 (
+pk int NOT NULL AUTO_INCREMENT,
+col_int_nokey int NOT NULL,
+col_int_key int NOT NULL,
+col_time_key time NOT NULL,
+col_varchar_key varchar(1) NOT NULL,
+col_varchar_nokey varchar(1) NOT NULL,
+PRIMARY KEY (pk),
+KEY col_int_key (col_int_key),
+KEY col_time_key (col_time_key),
+KEY col_varchar_key (col_varchar_key,col_int_key)
+) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (1,4,4,'00:00:00','b','b');
+SET @var2:=4, @var3:=8;
+
+Testcase without inner subquery
+EXPLAIN SELECT @var3:=12, sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
+sq4_alias1.col_varchar_key = @var3;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE noticed after reading const tables
+SELECT @var3:=12, sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
+sq4_alias1.col_varchar_key = @var3;
+@var3:=12	pk	col_int_nokey	col_int_key	col_time_key	col_varchar_key	col_varchar_nokey
+SELECT @var3;
+@var3
+8
+EXPLAIN SELECT * FROM ( SELECT @var3:=12, sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
+sq4_alias1.col_varchar_key = @var3 ) AS alias3;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	PRIMARY	<derived2>	system	NULL	NULL	NULL	NULL	0	const row not found
+2	DERIVED	NULL	NULL	NULL	NULL	NULL	NULL	NULL	no matching row in const table
+SELECT * FROM ( SELECT @var3:=12, sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
+sq4_alias1.col_varchar_key = @var3 ) AS alias3;
+@var3:=12	pk	col_int_nokey	col_int_key	col_time_key	col_varchar_key	col_varchar_nokey
+SELECT @var3;
+@var3
+8
+
+Testcase with inner subquery; crashed WL#6095
+SET @var3=8;
+EXPLAIN SELECT sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
+NOT IN
+(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
+c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
+FROM t2 AS c_sq1_alias1
+WHERE (c_sq1_alias1.col_int_nokey != @var2
+OR c_sq1_alias1.pk != @var3));
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	PRIMARY	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE noticed after reading const tables
+2	DEPENDENT SUBQUERY	c_sq1_alias1	system	PRIMARY,col_varchar_key	NULL	NULL	NULL	1	
+SELECT sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
+NOT IN
+(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
+c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
+FROM t2 AS c_sq1_alias1
+WHERE (c_sq1_alias1.col_int_nokey != @var2
+OR c_sq1_alias1.pk != @var3));
+pk	col_int_nokey	col_int_key	col_time_key	col_varchar_key	col_varchar_nokey
+EXPLAIN SELECT * FROM ( SELECT sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
+NOT IN
+(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
+c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
+FROM t2 AS c_sq1_alias1
+WHERE (c_sq1_alias1.col_int_nokey != @var2
+OR c_sq1_alias1.pk != @var3)) ) AS alias3;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	PRIMARY	<derived2>	system	NULL	NULL	NULL	NULL	0	const row not found
+2	DERIVED	NULL	NULL	NULL	NULL	NULL	NULL	NULL	no matching row in const table
+3	DEPENDENT SUBQUERY	c_sq1_alias1	system	PRIMARY,col_varchar_key	NULL	NULL	NULL	1	
+SELECT * FROM ( SELECT sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
+NOT IN
+(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
+c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
+FROM t2 AS c_sq1_alias1
+WHERE (c_sq1_alias1.col_int_nokey != @var2
+OR c_sq1_alias1.pk != @var3)) ) AS alias3;
+pk	col_int_nokey	col_int_key	col_time_key	col_varchar_key	col_varchar_nokey
+DROP TABLE t1,t2;
 set optimizer_switch=default;

=== modified file 'mysql-test/r/subquery_none_bka.result'
--- a/mysql-test/r/subquery_none_bka.result	2011-11-01 11:52:24 +0000
+++ b/mysql-test/r/subquery_none_bka.result	2012-02-07 14:50:31 +0000
@@ -6822,5 +6822,263 @@ Warnings:
 Note	1003	/* select#1 */ select '1' AS `col_int_nokey` from dual where <in_optimizer>(('x','x'),<exists>(<index_lookup>(<cache>('x') in it on idx_cvk_cvk2_cik where (isnull(`test`.`it`.`col_int_key`) and (<cache>('x') = `test`.`it`.`col_varchar_key`) and (<cache>('x') = `test`.`it`.`col_varchar_key2`)))))
 
 DROP TABLE it, ot;
+#
+# Bug #11829691: Pure virtual method called in Item_bool_func2::fix...()
+#
+CREATE TABLE t1(a INTEGER);
+CREATE TABLE t2(b INTEGER);
+PREPARE stmt FROM "
+SELECT SUM(b) FROM t2 GROUP BY b HAVING b IN (SELECT b FROM t1)";
+EXECUTE stmt;
+SUM(b)
+EXECUTE stmt;
+SUM(b)
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1, t2;
+#
+# Bug #13595212 EXTRA ROWS RETURNED ON RIGHT JOIN WITH VIEW AND
+# IN-SUBQUERY IN WHERE
+#
+CREATE TABLE t1 (
+pk int(11) NOT NULL AUTO_INCREMENT,
+col_int_key int(11) NOT NULL,
+col_varchar_key varchar(1) NOT NULL,
+col_varchar_nokey varchar(1) NOT NULL,
+PRIMARY KEY (pk),
+KEY col_int_key (col_int_key),
+KEY col_varchar_key (col_varchar_key,col_int_key)
+);
+INSERT INTO t1 VALUES (1,0,'j','j'),(2,8,'v','v'),
+(3,1,'c','c'),(4,8,'m','m'),(5,9,'d','d');
+CREATE VIEW v1 AS SELECT * FROM t1;
+EXPLAIN EXTENDED SELECT alias2.col_varchar_nokey
+FROM v1 AS alias1
+RIGHT JOIN t1 AS alias2 ON 1
+WHERE alias2.col_varchar_key IN (
+SELECT sq2_alias1.col_varchar_nokey
+FROM v1 AS sq2_alias1
+LEFT JOIN t1 AS sq2_alias2
+ON (sq2_alias2.col_int_key = sq2_alias1.pk)
+WHERE sq2_alias1.pk != alias1.col_int_key
+AND sq2_alias1.col_varchar_key > alias1.col_varchar_key
+)
+;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	PRIMARY	alias2	ALL	NULL	NULL	NULL	NULL	5	100.00	
+1	PRIMARY	t1	index	NULL	col_varchar_key	7	NULL	5	100.00	Using where; Using index; Using join buffer (Block Nested Loop)
+2	DEPENDENT SUBQUERY	t1	ALL	col_varchar_key	NULL	NULL	NULL	5	100.00	Using where
+2	DEPENDENT SUBQUERY	sq2_alias2	index	col_int_key	col_int_key	4	NULL	5	80.00	Using where; Using index; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1276	Field or reference 'alias1.col_int_key' of SELECT #2 was resolved in SELECT #1
+Note	1276	Field or reference 'alias1.col_varchar_key' of SELECT #2 was resolved in SELECT #1
+Note	1003	/* select#1 */ select `test`.`alias2`.`col_varchar_nokey` AS `col_varchar_nokey` from `test`.`t1` `alias2` left join (`test`.`t1`) on(1) where <in_optimizer>(`test`.`alias2`.`col_varchar_key`,<exists>(/* select#2 */ select 1 from `test`.`t1` left join `test`.`t1` `sq2_alias2` on((`test`.`sq2_alias2`.`col_int_key` = `test`.`t1`.`pk`)) where ((`test`.`t1`.`pk` <> `test`.`t1`.`col_int_key`) and (`test`.`t1`.`col_varchar_key` > `test`.`t1`.`col_varchar_key`) and (<cache>(`test`.`alias2`.`col_varchar_key`) = `test`.`t1`.`col_varchar_nokey`))))
+SELECT alias2.col_varchar_nokey
+FROM v1 AS alias1
+RIGHT JOIN t1 AS alias2 ON 1
+WHERE alias2.col_varchar_key IN (
+SELECT sq2_alias1.col_varchar_nokey
+FROM v1 AS sq2_alias1
+LEFT JOIN t1 AS sq2_alias2
+ON (sq2_alias2.col_int_key = sq2_alias1.pk)
+WHERE sq2_alias1.pk != alias1.col_int_key
+AND sq2_alias1.col_varchar_key > alias1.col_varchar_key
+)
+;
+col_varchar_nokey
+d
+j
+m
+m
+m
+v
+v
+v
+v
+CREATE VIEW v2 AS SELECT alias2.col_varchar_nokey
+FROM v1 AS alias1
+RIGHT JOIN t1 AS alias2 ON 1
+WHERE alias2.col_varchar_key IN (
+SELECT sq2_alias1.col_varchar_nokey
+FROM v1 AS sq2_alias1
+LEFT JOIN t1 AS sq2_alias2
+ON (sq2_alias2.col_int_key = sq2_alias1.pk)
+WHERE sq2_alias1.pk != alias1.col_int_key
+AND sq2_alias1.col_varchar_key > alias1.col_varchar_key
+)
+;
+EXPLAIN EXTENDED SELECT * FROM v2;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	PRIMARY	alias2	ALL	NULL	NULL	NULL	NULL	5	100.00	
+1	PRIMARY	t1	index	NULL	col_varchar_key	7	NULL	5	100.00	Using where; Using index; Using join buffer (Block Nested Loop)
+3	DEPENDENT SUBQUERY	t1	ALL	col_varchar_key	NULL	NULL	NULL	5	100.00	Using where
+3	DEPENDENT SUBQUERY	sq2_alias2	index	col_int_key	col_int_key	4	NULL	5	80.00	Using where; Using index; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1276	Field or reference 'alias1.col_int_key' of SELECT #3 was resolved in SELECT #1
+Note	1276	Field or reference 'alias1.col_varchar_key' of SELECT #3 was resolved in SELECT #1
+Note	1003	/* select#1 */ select `test`.`alias2`.`col_varchar_nokey` AS `col_varchar_nokey` from `test`.`t1` `alias2` left join (`test`.`t1`) on(1) where <in_optimizer>(`test`.`alias2`.`col_varchar_key`,<exists>(/* select#3 */ select 1 from `test`.`t1` left join `test`.`t1` `sq2_alias2` on((`sq2_alias2`.`col_int_key` = `test`.`t1`.`pk`)) where ((`test`.`t1`.`pk` <> `t1`.`col_int_key`) and (`test`.`t1`.`col_varchar_key` > `t1`.`col_varchar_key`) and (<cache>(`test`.`alias2`.`col_varchar_key`) = `test`.`t1`.`col_varchar_nokey`))))
+SELECT * FROM v2;
+col_varchar_nokey
+d
+j
+m
+m
+m
+v
+v
+v
+v
+EXPLAIN EXTENDED SELECT alias2.col_varchar_nokey
+FROM t1 AS alias2
+LEFT JOIN v1 AS alias1 ON 1
+WHERE alias2.col_varchar_key IN (
+SELECT sq2_alias1.col_varchar_nokey
+FROM v1 AS sq2_alias1
+LEFT JOIN t1 AS sq2_alias2
+ON (sq2_alias2.col_int_key = sq2_alias1.pk)
+WHERE sq2_alias1.pk != alias1.col_int_key
+AND sq2_alias1.col_varchar_key > alias1.col_varchar_key
+);
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	PRIMARY	alias2	ALL	NULL	NULL	NULL	NULL	5	100.00	
+1	PRIMARY	t1	index	NULL	col_varchar_key	7	NULL	5	100.00	Using where; Using index; Using join buffer (Block Nested Loop)
+2	DEPENDENT SUBQUERY	t1	ALL	col_varchar_key	NULL	NULL	NULL	5	100.00	Using where
+2	DEPENDENT SUBQUERY	sq2_alias2	index	col_int_key	col_int_key	4	NULL	5	80.00	Using where; Using index; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1276	Field or reference 'alias1.col_int_key' of SELECT #2 was resolved in SELECT #1
+Note	1276	Field or reference 'alias1.col_varchar_key' of SELECT #2 was resolved in SELECT #1
+Note	1003	/* select#1 */ select `test`.`alias2`.`col_varchar_nokey` AS `col_varchar_nokey` from `test`.`t1` `alias2` left join (`test`.`t1`) on(1) where <in_optimizer>(`test`.`alias2`.`col_varchar_key`,<exists>(/* select#2 */ select 1 from `test`.`t1` left join `test`.`t1` `sq2_alias2` on((`sq2_alias2`.`col_int_key` = `test`.`t1`.`pk`)) where ((`test`.`t1`.`pk` <> `t1`.`col_int_key`) and (`test`.`t1`.`col_varchar_key` > `t1`.`col_varchar_key`) and (<cache>(`test`.`alias2`.`col_varchar_key`) = `test`.`t1`.`col_varchar_nokey`))))
+SELECT alias2.col_varchar_nokey
+FROM t1 AS alias2
+LEFT JOIN v1 AS alias1 ON 1
+WHERE alias2.col_varchar_key IN (
+SELECT sq2_alias1.col_varchar_nokey
+FROM v1 AS sq2_alias1
+LEFT JOIN t1 AS sq2_alias2
+ON (sq2_alias2.col_int_key = sq2_alias1.pk)
+WHERE sq2_alias1.pk != alias1.col_int_key
+AND sq2_alias1.col_varchar_key > alias1.col_varchar_key
+);
+col_varchar_nokey
+d
+j
+m
+m
+m
+v
+v
+v
+v
+DROP TABLE t1;
+DROP VIEW v1,v2;
+#
+# Bug#13651009 WRONG RESULT FROM DERIVED TABLE IF THE SUBQUERY
+# HAS AN EMPTY RESULT
+#
+CREATE TABLE t1 (
+pk int NOT NULL,
+col_int_nokey int NOT NULL,
+col_int_key int NOT NULL,
+col_time_key time NOT NULL,
+col_varchar_key varchar(1) NOT NULL,
+col_varchar_nokey varchar(1) NOT NULL,
+PRIMARY KEY (pk),
+KEY col_int_key (col_int_key),
+KEY col_time_key (col_time_key),
+KEY col_varchar_key (col_varchar_key,col_int_key)
+) ENGINE=MyISAM;
+CREATE TABLE t2 (
+pk int NOT NULL AUTO_INCREMENT,
+col_int_nokey int NOT NULL,
+col_int_key int NOT NULL,
+col_time_key time NOT NULL,
+col_varchar_key varchar(1) NOT NULL,
+col_varchar_nokey varchar(1) NOT NULL,
+PRIMARY KEY (pk),
+KEY col_int_key (col_int_key),
+KEY col_time_key (col_time_key),
+KEY col_varchar_key (col_varchar_key,col_int_key)
+) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (1,4,4,'00:00:00','b','b');
+SET @var2:=4, @var3:=8;
+
+Testcase without inner subquery
+EXPLAIN SELECT @var3:=12, sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
+sq4_alias1.col_varchar_key = @var3;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE noticed after reading const tables
+SELECT @var3:=12, sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
+sq4_alias1.col_varchar_key = @var3;
+@var3:=12	pk	col_int_nokey	col_int_key	col_time_key	col_varchar_key	col_varchar_nokey
+SELECT @var3;
+@var3
+8
+EXPLAIN SELECT * FROM ( SELECT @var3:=12, sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
+sq4_alias1.col_varchar_key = @var3 ) AS alias3;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	PRIMARY	<derived2>	system	NULL	NULL	NULL	NULL	0	const row not found
+2	DERIVED	NULL	NULL	NULL	NULL	NULL	NULL	NULL	no matching row in const table
+SELECT * FROM ( SELECT @var3:=12, sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
+sq4_alias1.col_varchar_key = @var3 ) AS alias3;
+@var3:=12	pk	col_int_nokey	col_int_key	col_time_key	col_varchar_key	col_varchar_nokey
+SELECT @var3;
+@var3
+8
+
+Testcase with inner subquery; crashed WL#6095
+SET @var3=8;
+EXPLAIN SELECT sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
+NOT IN
+(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
+c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
+FROM t2 AS c_sq1_alias1
+WHERE (c_sq1_alias1.col_int_nokey != @var2
+OR c_sq1_alias1.pk != @var3));
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	PRIMARY	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE noticed after reading const tables
+2	DEPENDENT SUBQUERY	c_sq1_alias1	system	PRIMARY,col_varchar_key	NULL	NULL	NULL	1	
+SELECT sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
+NOT IN
+(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
+c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
+FROM t2 AS c_sq1_alias1
+WHERE (c_sq1_alias1.col_int_nokey != @var2
+OR c_sq1_alias1.pk != @var3));
+pk	col_int_nokey	col_int_key	col_time_key	col_varchar_key	col_varchar_nokey
+EXPLAIN SELECT * FROM ( SELECT sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
+NOT IN
+(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
+c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
+FROM t2 AS c_sq1_alias1
+WHERE (c_sq1_alias1.col_int_nokey != @var2
+OR c_sq1_alias1.pk != @var3)) ) AS alias3;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	PRIMARY	<derived2>	system	NULL	NULL	NULL	NULL	0	const row not found
+2	DERIVED	NULL	NULL	NULL	NULL	NULL	NULL	NULL	no matching row in const table
+3	DEPENDENT SUBQUERY	c_sq1_alias1	system	PRIMARY,col_varchar_key	NULL	NULL	NULL	1	
+SELECT * FROM ( SELECT sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
+NOT IN
+(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
+c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
+FROM t2 AS c_sq1_alias1
+WHERE (c_sq1_alias1.col_int_nokey != @var2
+OR c_sq1_alias1.pk != @var3)) ) AS alias3;
+pk	col_int_nokey	col_int_key	col_time_key	col_varchar_key	col_varchar_nokey
+DROP TABLE t1,t2;
 set optimizer_switch=default;
 set optimizer_switch=default;

=== modified file 'mysql-test/r/subquery_none_bka_nixbnl.result'
--- a/mysql-test/r/subquery_none_bka_nixbnl.result	2011-11-01 11:52:24 +0000
+++ b/mysql-test/r/subquery_none_bka_nixbnl.result	2012-02-07 14:50:31 +0000
@@ -6822,5 +6822,263 @@ Warnings:
 Note	1003	/* select#1 */ select '1' AS `col_int_nokey` from dual where <in_optimizer>(('x','x'),<exists>(<index_lookup>(<cache>('x') in it on idx_cvk_cvk2_cik where (isnull(`test`.`it`.`col_int_key`) and (<cache>('x') = `test`.`it`.`col_varchar_key`) and (<cache>('x') = `test`.`it`.`col_varchar_key2`)))))
 
 DROP TABLE it, ot;
+#
+# Bug #11829691: Pure virtual method called in Item_bool_func2::fix...()
+#
+CREATE TABLE t1(a INTEGER);
+CREATE TABLE t2(b INTEGER);
+PREPARE stmt FROM "
+SELECT SUM(b) FROM t2 GROUP BY b HAVING b IN (SELECT b FROM t1)";
+EXECUTE stmt;
+SUM(b)
+EXECUTE stmt;
+SUM(b)
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1, t2;
+#
+# Bug #13595212 EXTRA ROWS RETURNED ON RIGHT JOIN WITH VIEW AND
+# IN-SUBQUERY IN WHERE
+#
+CREATE TABLE t1 (
+pk int(11) NOT NULL AUTO_INCREMENT,
+col_int_key int(11) NOT NULL,
+col_varchar_key varchar(1) NOT NULL,
+col_varchar_nokey varchar(1) NOT NULL,
+PRIMARY KEY (pk),
+KEY col_int_key (col_int_key),
+KEY col_varchar_key (col_varchar_key,col_int_key)
+);
+INSERT INTO t1 VALUES (1,0,'j','j'),(2,8,'v','v'),
+(3,1,'c','c'),(4,8,'m','m'),(5,9,'d','d');
+CREATE VIEW v1 AS SELECT * FROM t1;
+EXPLAIN EXTENDED SELECT alias2.col_varchar_nokey
+FROM v1 AS alias1
+RIGHT JOIN t1 AS alias2 ON 1
+WHERE alias2.col_varchar_key IN (
+SELECT sq2_alias1.col_varchar_nokey
+FROM v1 AS sq2_alias1
+LEFT JOIN t1 AS sq2_alias2
+ON (sq2_alias2.col_int_key = sq2_alias1.pk)
+WHERE sq2_alias1.pk != alias1.col_int_key
+AND sq2_alias1.col_varchar_key > alias1.col_varchar_key
+)
+;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	PRIMARY	alias2	ALL	NULL	NULL	NULL	NULL	5	100.00	
+1	PRIMARY	t1	index	NULL	col_varchar_key	7	NULL	5	100.00	Using where; Using index
+2	DEPENDENT SUBQUERY	t1	ALL	col_varchar_key	NULL	NULL	NULL	5	100.00	Using where
+2	DEPENDENT SUBQUERY	sq2_alias2	ref	col_int_key	col_int_key	4	test.t1.pk	2	100.00	Using index
+Warnings:
+Note	1276	Field or reference 'alias1.col_int_key' of SELECT #2 was resolved in SELECT #1
+Note	1276	Field or reference 'alias1.col_varchar_key' of SELECT #2 was resolved in SELECT #1
+Note	1003	/* select#1 */ select `test`.`alias2`.`col_varchar_nokey` AS `col_varchar_nokey` from `test`.`t1` `alias2` left join (`test`.`t1`) on(1) where <in_optimizer>(`test`.`alias2`.`col_varchar_key`,<exists>(/* select#2 */ select 1 from `test`.`t1` left join `test`.`t1` `sq2_alias2` on((`test`.`sq2_alias2`.`col_int_key` = `test`.`t1`.`pk`)) where ((`test`.`t1`.`pk` <> `test`.`t1`.`col_int_key`) and (`test`.`t1`.`col_varchar_key` > `test`.`t1`.`col_varchar_key`) and (<cache>(`test`.`alias2`.`col_varchar_key`) = `test`.`t1`.`col_varchar_nokey`))))
+SELECT alias2.col_varchar_nokey
+FROM v1 AS alias1
+RIGHT JOIN t1 AS alias2 ON 1
+WHERE alias2.col_varchar_key IN (
+SELECT sq2_alias1.col_varchar_nokey
+FROM v1 AS sq2_alias1
+LEFT JOIN t1 AS sq2_alias2
+ON (sq2_alias2.col_int_key = sq2_alias1.pk)
+WHERE sq2_alias1.pk != alias1.col_int_key
+AND sq2_alias1.col_varchar_key > alias1.col_varchar_key
+)
+;
+col_varchar_nokey
+d
+j
+m
+m
+m
+v
+v
+v
+v
+CREATE VIEW v2 AS SELECT alias2.col_varchar_nokey
+FROM v1 AS alias1
+RIGHT JOIN t1 AS alias2 ON 1
+WHERE alias2.col_varchar_key IN (
+SELECT sq2_alias1.col_varchar_nokey
+FROM v1 AS sq2_alias1
+LEFT JOIN t1 AS sq2_alias2
+ON (sq2_alias2.col_int_key = sq2_alias1.pk)
+WHERE sq2_alias1.pk != alias1.col_int_key
+AND sq2_alias1.col_varchar_key > alias1.col_varchar_key
+)
+;
+EXPLAIN EXTENDED SELECT * FROM v2;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	PRIMARY	alias2	ALL	NULL	NULL	NULL	NULL	5	100.00	
+1	PRIMARY	t1	index	NULL	col_varchar_key	7	NULL	5	100.00	Using where; Using index
+3	DEPENDENT SUBQUERY	t1	ALL	col_varchar_key	NULL	NULL	NULL	5	100.00	Using where
+3	DEPENDENT SUBQUERY	sq2_alias2	ref	col_int_key	col_int_key	4	test.t1.pk	2	100.00	Using index
+Warnings:
+Note	1276	Field or reference 'alias1.col_int_key' of SELECT #3 was resolved in SELECT #1
+Note	1276	Field or reference 'alias1.col_varchar_key' of SELECT #3 was resolved in SELECT #1
+Note	1003	/* select#1 */ select `test`.`alias2`.`col_varchar_nokey` AS `col_varchar_nokey` from `test`.`t1` `alias2` left join (`test`.`t1`) on(1) where <in_optimizer>(`test`.`alias2`.`col_varchar_key`,<exists>(/* select#3 */ select 1 from `test`.`t1` left join `test`.`t1` `sq2_alias2` on((`sq2_alias2`.`col_int_key` = `test`.`t1`.`pk`)) where ((`test`.`t1`.`pk` <> `t1`.`col_int_key`) and (`test`.`t1`.`col_varchar_key` > `t1`.`col_varchar_key`) and (<cache>(`test`.`alias2`.`col_varchar_key`) = `test`.`t1`.`col_varchar_nokey`))))
+SELECT * FROM v2;
+col_varchar_nokey
+d
+j
+m
+m
+m
+v
+v
+v
+v
+EXPLAIN EXTENDED SELECT alias2.col_varchar_nokey
+FROM t1 AS alias2
+LEFT JOIN v1 AS alias1 ON 1
+WHERE alias2.col_varchar_key IN (
+SELECT sq2_alias1.col_varchar_nokey
+FROM v1 AS sq2_alias1
+LEFT JOIN t1 AS sq2_alias2
+ON (sq2_alias2.col_int_key = sq2_alias1.pk)
+WHERE sq2_alias1.pk != alias1.col_int_key
+AND sq2_alias1.col_varchar_key > alias1.col_varchar_key
+);
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	PRIMARY	alias2	ALL	NULL	NULL	NULL	NULL	5	100.00	
+1	PRIMARY	t1	index	NULL	col_varchar_key	7	NULL	5	100.00	Using where; Using index
+2	DEPENDENT SUBQUERY	t1	ALL	col_varchar_key	NULL	NULL	NULL	5	100.00	Using where
+2	DEPENDENT SUBQUERY	sq2_alias2	ref	col_int_key	col_int_key	4	test.t1.pk	2	100.00	Using index
+Warnings:
+Note	1276	Field or reference 'alias1.col_int_key' of SELECT #2 was resolved in SELECT #1
+Note	1276	Field or reference 'alias1.col_varchar_key' of SELECT #2 was resolved in SELECT #1
+Note	1003	/* select#1 */ select `test`.`alias2`.`col_varchar_nokey` AS `col_varchar_nokey` from `test`.`t1` `alias2` left join (`test`.`t1`) on(1) where <in_optimizer>(`test`.`alias2`.`col_varchar_key`,<exists>(/* select#2 */ select 1 from `test`.`t1` left join `test`.`t1` `sq2_alias2` on((`sq2_alias2`.`col_int_key` = `test`.`t1`.`pk`)) where ((`test`.`t1`.`pk` <> `t1`.`col_int_key`) and (`test`.`t1`.`col_varchar_key` > `t1`.`col_varchar_key`) and (<cache>(`test`.`alias2`.`col_varchar_key`) = `test`.`t1`.`col_varchar_nokey`))))
+SELECT alias2.col_varchar_nokey
+FROM t1 AS alias2
+LEFT JOIN v1 AS alias1 ON 1
+WHERE alias2.col_varchar_key IN (
+SELECT sq2_alias1.col_varchar_nokey
+FROM v1 AS sq2_alias1
+LEFT JOIN t1 AS sq2_alias2
+ON (sq2_alias2.col_int_key = sq2_alias1.pk)
+WHERE sq2_alias1.pk != alias1.col_int_key
+AND sq2_alias1.col_varchar_key > alias1.col_varchar_key
+);
+col_varchar_nokey
+d
+j
+m
+m
+m
+v
+v
+v
+v
+DROP TABLE t1;
+DROP VIEW v1,v2;
+#
+# Bug#13651009 WRONG RESULT FROM DERIVED TABLE IF THE SUBQUERY
+# HAS AN EMPTY RESULT
+#
+CREATE TABLE t1 (
+pk int NOT NULL,
+col_int_nokey int NOT NULL,
+col_int_key int NOT NULL,
+col_time_key time NOT NULL,
+col_varchar_key varchar(1) NOT NULL,
+col_varchar_nokey varchar(1) NOT NULL,
+PRIMARY KEY (pk),
+KEY col_int_key (col_int_key),
+KEY col_time_key (col_time_key),
+KEY col_varchar_key (col_varchar_key,col_int_key)
+) ENGINE=MyISAM;
+CREATE TABLE t2 (
+pk int NOT NULL AUTO_INCREMENT,
+col_int_nokey int NOT NULL,
+col_int_key int NOT NULL,
+col_time_key time NOT NULL,
+col_varchar_key varchar(1) NOT NULL,
+col_varchar_nokey varchar(1) NOT NULL,
+PRIMARY KEY (pk),
+KEY col_int_key (col_int_key),
+KEY col_time_key (col_time_key),
+KEY col_varchar_key (col_varchar_key,col_int_key)
+) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (1,4,4,'00:00:00','b','b');
+SET @var2:=4, @var3:=8;
+
+Testcase without inner subquery
+EXPLAIN SELECT @var3:=12, sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
+sq4_alias1.col_varchar_key = @var3;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE noticed after reading const tables
+SELECT @var3:=12, sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
+sq4_alias1.col_varchar_key = @var3;
+@var3:=12	pk	col_int_nokey	col_int_key	col_time_key	col_varchar_key	col_varchar_nokey
+SELECT @var3;
+@var3
+8
+EXPLAIN SELECT * FROM ( SELECT @var3:=12, sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
+sq4_alias1.col_varchar_key = @var3 ) AS alias3;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	PRIMARY	<derived2>	system	NULL	NULL	NULL	NULL	0	const row not found
+2	DERIVED	NULL	NULL	NULL	NULL	NULL	NULL	NULL	no matching row in const table
+SELECT * FROM ( SELECT @var3:=12, sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
+sq4_alias1.col_varchar_key = @var3 ) AS alias3;
+@var3:=12	pk	col_int_nokey	col_int_key	col_time_key	col_varchar_key	col_varchar_nokey
+SELECT @var3;
+@var3
+8
+
+Testcase with inner subquery; crashed WL#6095
+SET @var3=8;
+EXPLAIN SELECT sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
+NOT IN
+(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
+c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
+FROM t2 AS c_sq1_alias1
+WHERE (c_sq1_alias1.col_int_nokey != @var2
+OR c_sq1_alias1.pk != @var3));
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	PRIMARY	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE noticed after reading const tables
+2	DEPENDENT SUBQUERY	c_sq1_alias1	system	PRIMARY,col_varchar_key	NULL	NULL	NULL	1	
+SELECT sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
+NOT IN
+(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
+c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
+FROM t2 AS c_sq1_alias1
+WHERE (c_sq1_alias1.col_int_nokey != @var2
+OR c_sq1_alias1.pk != @var3));
+pk	col_int_nokey	col_int_key	col_time_key	col_varchar_key	col_varchar_nokey
+EXPLAIN SELECT * FROM ( SELECT sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
+NOT IN
+(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
+c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
+FROM t2 AS c_sq1_alias1
+WHERE (c_sq1_alias1.col_int_nokey != @var2
+OR c_sq1_alias1.pk != @var3)) ) AS alias3;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	PRIMARY	<derived2>	system	NULL	NULL	NULL	NULL	0	const row not found
+2	DERIVED	NULL	NULL	NULL	NULL	NULL	NULL	NULL	no matching row in const table
+3	DEPENDENT SUBQUERY	c_sq1_alias1	system	PRIMARY,col_varchar_key	NULL	NULL	NULL	1	
+SELECT * FROM ( SELECT sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
+NOT IN
+(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
+c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
+FROM t2 AS c_sq1_alias1
+WHERE (c_sq1_alias1.col_int_nokey != @var2
+OR c_sq1_alias1.pk != @var3)) ) AS alias3;
+pk	col_int_nokey	col_int_key	col_time_key	col_varchar_key	col_varchar_nokey
+DROP TABLE t1,t2;
 set optimizer_switch=default;
 set optimizer_switch=default;

=== modified file 'mysql-test/r/type_temporal_fractional.result'
--- a/mysql-test/r/type_temporal_fractional.result	2012-02-02 10:58:18 +0000
+++ b/mysql-test/r/type_temporal_fractional.result	2012-02-07 20:32:47 +0000
@@ -1014,8 +1014,8 @@ a6	t6	HEX(WEIGHT_STRING(t6))
 -00:00:00.000003	-00:00:00.000003	7FFFFFFFFFFD
 -00:00:00.000002	-00:00:00.000002	7FFFFFFFFFFE
 -00:00:00.000001	-00:00:00.000001	7FFFFFFFFFFF
--00:00:00.000000	00:00:00.000000	800000000000
 00:00:00.000000	00:00:00.000000	800000000000
+-00:00:00.000000	00:00:00.000000	800000000000
 00:00:00.000001	00:00:00.000001	800000000001
 00:00:00.000002	00:00:00.000002	800000000002
 00:00:00.000003	00:00:00.000003	800000000003

=== modified file 'mysql-test/suite/funcs_1/r/innodb_views.result'
--- a/mysql-test/suite/funcs_1/r/innodb_views.result	2010-08-31 06:28:15 +0000
+++ b/mysql-test/suite/funcs_1/r/innodb_views.result	2012-02-07 11:56:30 +0000
@@ -15222,456 +15222,456 @@ DELETE FROM t1;
 DROP VIEW v3;
 DROP VIEW v2;
 DROP VIEW v1;
-SELECT * FROM t1_results ORDER BY v3_to_v1_options;
+SELECT * FROM t1_results ORDER BY v3_to_v1_options, statement, v3_to_v1_violation, errno;
 v3_to_v1_options	statement	v3_to_v1_violation	errno
-        <nothing>          -         <nothing>          -         <nothing>         	UPDATE	  _v2_  	0
-        <nothing>          -         <nothing>          -         <nothing>         	INSERT	  _v2_  	0
+        <nothing>          -         <nothing>          -         <nothing>         	INSERT	  _  _  	0
         <nothing>          -         <nothing>          -         <nothing>         	INSERT	  _  _v1	0
+        <nothing>          -         <nothing>          -         <nothing>         	INSERT	  _v2_  	0
         <nothing>          -         <nothing>          -         <nothing>         	UPDATE	  _  _  	0
         <nothing>          -         <nothing>          -         <nothing>         	UPDATE	  _  _v1	0
+        <nothing>          -         <nothing>          -         <nothing>         	UPDATE	  _v2_  	0
         <nothing>          -         <nothing>          -         <nothing>         	UPDATE	v3_  _  	0
-        <nothing>          -         <nothing>          -         <nothing>         	INSERT	  _  _  	0
-        <nothing>          -         <nothing>          - WITH          CHECK OPTION	UPDATE	  _v2_  	0
         <nothing>          -         <nothing>          - WITH          CHECK OPTION	INSERT	  _  _  	0
-        <nothing>          -         <nothing>          - WITH          CHECK OPTION	UPDATE	  _  _v1	0
+        <nothing>          -         <nothing>          - WITH          CHECK OPTION	INSERT	  _  _v1	0
+        <nothing>          -         <nothing>          - WITH          CHECK OPTION	INSERT	  _v2_  	0
         <nothing>          -         <nothing>          - WITH          CHECK OPTION	UPDATE	  _  _  	0
+        <nothing>          -         <nothing>          - WITH          CHECK OPTION	UPDATE	  _  _v1	0
+        <nothing>          -         <nothing>          - WITH          CHECK OPTION	UPDATE	  _v2_  	0
         <nothing>          -         <nothing>          - WITH          CHECK OPTION	UPDATE	v3_  _  	0
-        <nothing>          -         <nothing>          - WITH          CHECK OPTION	INSERT	  _v2_  	0
-        <nothing>          -         <nothing>          - WITH          CHECK OPTION	INSERT	  _  _v1	0
-        <nothing>          -         <nothing>          - WITH CASCADED CHECK OPTION	INSERT	  _v2_  	0
         <nothing>          -         <nothing>          - WITH CASCADED CHECK OPTION	INSERT	  _  _  	0
         <nothing>          -         <nothing>          - WITH CASCADED CHECK OPTION	INSERT	  _  _v1	0
+        <nothing>          -         <nothing>          - WITH CASCADED CHECK OPTION	INSERT	  _v2_  	0
         <nothing>          -         <nothing>          - WITH CASCADED CHECK OPTION	UPDATE	  _  _  	0
         <nothing>          -         <nothing>          - WITH CASCADED CHECK OPTION	UPDATE	  _  _v1	0
         <nothing>          -         <nothing>          - WITH CASCADED CHECK OPTION	UPDATE	  _v2_  	0
         <nothing>          -         <nothing>          - WITH CASCADED CHECK OPTION	UPDATE	v3_  _  	0
-        <nothing>          -         <nothing>          - WITH LOCAL    CHECK OPTION	UPDATE	  _  _v1	0
-        <nothing>          -         <nothing>          - WITH LOCAL    CHECK OPTION	INSERT	  _v2_  	0
-        <nothing>          -         <nothing>          - WITH LOCAL    CHECK OPTION	INSERT	  _  _v1	0
         <nothing>          -         <nothing>          - WITH LOCAL    CHECK OPTION	INSERT	  _  _  	0
-        <nothing>          -         <nothing>          - WITH LOCAL    CHECK OPTION	UPDATE	v3_  _  	0
-        <nothing>          -         <nothing>          - WITH LOCAL    CHECK OPTION	UPDATE	  _v2_  	0
+        <nothing>          -         <nothing>          - WITH LOCAL    CHECK OPTION	INSERT	  _  _v1	0
+        <nothing>          -         <nothing>          - WITH LOCAL    CHECK OPTION	INSERT	  _v2_  	0
         <nothing>          -         <nothing>          - WITH LOCAL    CHECK OPTION	UPDATE	  _  _  	0
-        <nothing>          - WITH          CHECK OPTION -         <nothing>         	UPDATE	  _v2_  	0
+        <nothing>          -         <nothing>          - WITH LOCAL    CHECK OPTION	UPDATE	  _  _v1	0
+        <nothing>          -         <nothing>          - WITH LOCAL    CHECK OPTION	UPDATE	  _v2_  	0
+        <nothing>          -         <nothing>          - WITH LOCAL    CHECK OPTION	UPDATE	v3_  _  	0
+        <nothing>          - WITH          CHECK OPTION -         <nothing>         	INSERT	  _  _  	0
+        <nothing>          - WITH          CHECK OPTION -         <nothing>         	INSERT	  _  _v1	0
         <nothing>          - WITH          CHECK OPTION -         <nothing>         	INSERT	  _v2_  	0
-        <nothing>          - WITH          CHECK OPTION -         <nothing>         	UPDATE	v3_  _  	0
-        <nothing>          - WITH          CHECK OPTION -         <nothing>         	UPDATE	  _  _v1	0
         <nothing>          - WITH          CHECK OPTION -         <nothing>         	UPDATE	  _  _  	0
-        <nothing>          - WITH          CHECK OPTION -         <nothing>         	INSERT	  _  _v1	0
-        <nothing>          - WITH          CHECK OPTION -         <nothing>         	INSERT	  _  _  	0
-        <nothing>          - WITH          CHECK OPTION - WITH          CHECK OPTION	UPDATE	v3_  _  	0
-        <nothing>          - WITH          CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _v2_  	0
-        <nothing>          - WITH          CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _  	0
+        <nothing>          - WITH          CHECK OPTION -         <nothing>         	UPDATE	  _  _v1	0
+        <nothing>          - WITH          CHECK OPTION -         <nothing>         	UPDATE	  _v2_  	0
+        <nothing>          - WITH          CHECK OPTION -         <nothing>         	UPDATE	v3_  _  	0
+        <nothing>          - WITH          CHECK OPTION - WITH          CHECK OPTION	INSERT	  _  _  	0
         <nothing>          - WITH          CHECK OPTION - WITH          CHECK OPTION	INSERT	  _  _v1	0
         <nothing>          - WITH          CHECK OPTION - WITH          CHECK OPTION	INSERT	  _v2_  	0
-        <nothing>          - WITH          CHECK OPTION - WITH          CHECK OPTION	INSERT	  _  _  	0
+        <nothing>          - WITH          CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _  	0
         <nothing>          - WITH          CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _v1	0
+        <nothing>          - WITH          CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _v2_  	0
+        <nothing>          - WITH          CHECK OPTION - WITH          CHECK OPTION	UPDATE	v3_  _  	0
         <nothing>          - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _  	0
-        <nothing>          - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _v2_  	0
-        <nothing>          - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _v1	0
-        <nothing>          - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _  	0
         <nothing>          - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _v1	0
         <nothing>          - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _v2_  	0
+        <nothing>          - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _  	0
+        <nothing>          - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _v1	0
+        <nothing>          - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _v2_  	0
         <nothing>          - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	v3_  _  	0
-        <nothing>          - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	v3_  _  	0
         <nothing>          - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _  _  	0
-        <nothing>          - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _v2_  	0
         <nothing>          - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _  _v1	0
+        <nothing>          - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _v2_  	0
         <nothing>          - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _  	0
         <nothing>          - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _v1	0
         <nothing>          - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _v2_  	0
+        <nothing>          - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	v3_  _  	0
+        <nothing>          - WITH CASCADED CHECK OPTION -         <nothing>         	INSERT	  _  _  	0
         <nothing>          - WITH CASCADED CHECK OPTION -         <nothing>         	INSERT	  _  _v1	0
+        <nothing>          - WITH CASCADED CHECK OPTION -         <nothing>         	INSERT	  _v2_  	0
+        <nothing>          - WITH CASCADED CHECK OPTION -         <nothing>         	UPDATE	  _  _  	0
         <nothing>          - WITH CASCADED CHECK OPTION -         <nothing>         	UPDATE	  _  _v1	0
         <nothing>          - WITH CASCADED CHECK OPTION -         <nothing>         	UPDATE	  _v2_  	0
-        <nothing>          - WITH CASCADED CHECK OPTION -         <nothing>         	UPDATE	  _  _  	0
         <nothing>          - WITH CASCADED CHECK OPTION -         <nothing>         	UPDATE	v3_  _  	0
-        <nothing>          - WITH CASCADED CHECK OPTION -         <nothing>         	INSERT	  _  _  	0
-        <nothing>          - WITH CASCADED CHECK OPTION -         <nothing>         	INSERT	  _v2_  	0
-        <nothing>          - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	INSERT	  _  _v1	0
-        <nothing>          - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _v1	0
         <nothing>          - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	INSERT	  _  _  	0
+        <nothing>          - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	INSERT	  _  _v1	0
         <nothing>          - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	INSERT	  _v2_  	0
-        <nothing>          - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	UPDATE	v3_  _  	0
         <nothing>          - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _  	0
+        <nothing>          - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _v1	0
         <nothing>          - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _v2_  	0
-        <nothing>          - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	v3_  _  	0
-        <nothing>          - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _v2_  	0
-        <nothing>          - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _v1	0
+        <nothing>          - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	UPDATE	v3_  _  	0
         <nothing>          - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _  	0
-        <nothing>          - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _  	0
-        <nothing>          - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _v2_  	0
         <nothing>          - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _v1	0
-        <nothing>          - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _  _v1	0
+        <nothing>          - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _v2_  	0
+        <nothing>          - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _  	0
+        <nothing>          - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _v1	0
+        <nothing>          - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _v2_  	0
+        <nothing>          - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	v3_  _  	0
         <nothing>          - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _  _  	0
+        <nothing>          - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _  _v1	0
+        <nothing>          - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _v2_  	0
         <nothing>          - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _  	0
         <nothing>          - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _v1	0
         <nothing>          - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _v2_  	0
         <nothing>          - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	v3_  _  	0
-        <nothing>          - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _v2_  	0
-        <nothing>          - WITH LOCAL    CHECK OPTION -         <nothing>         	UPDATE	v3_  _  	0
         <nothing>          - WITH LOCAL    CHECK OPTION -         <nothing>         	INSERT	  _  _  	0
-        <nothing>          - WITH LOCAL    CHECK OPTION -         <nothing>         	INSERT	  _v2_  	0
         <nothing>          - WITH LOCAL    CHECK OPTION -         <nothing>         	INSERT	  _  _v1	0
+        <nothing>          - WITH LOCAL    CHECK OPTION -         <nothing>         	INSERT	  _v2_  	0
         <nothing>          - WITH LOCAL    CHECK OPTION -         <nothing>         	UPDATE	  _  _  	0
         <nothing>          - WITH LOCAL    CHECK OPTION -         <nothing>         	UPDATE	  _  _v1	0
         <nothing>          - WITH LOCAL    CHECK OPTION -         <nothing>         	UPDATE	  _v2_  	0
-        <nothing>          - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	UPDATE	v3_  _  	0
-        <nothing>          - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _v2_  	0
-        <nothing>          - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _  	0
-        <nothing>          - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	INSERT	  _v2_  	0
-        <nothing>          - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _v1	0
+        <nothing>          - WITH LOCAL    CHECK OPTION -         <nothing>         	UPDATE	v3_  _  	0
         <nothing>          - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	INSERT	  _  _  	0
         <nothing>          - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	INSERT	  _  _v1	0
-        <nothing>          - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _v1	0
-        <nothing>          - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _  	0
-        <nothing>          - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	v3_  _  	0
+        <nothing>          - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	INSERT	  _v2_  	0
+        <nothing>          - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _  	0
+        <nothing>          - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _v1	0
+        <nothing>          - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _v2_  	0
+        <nothing>          - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	UPDATE	v3_  _  	0
         <nothing>          - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _  	0
+        <nothing>          - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _v1	0
         <nothing>          - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _v2_  	0
+        <nothing>          - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _  	0
         <nothing>          - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _v1	0
         <nothing>          - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _v2_  	0
-        <nothing>          - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	v3_  _  	0
-        <nothing>          - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _v2_  	0
-        <nothing>          - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _  	0
+        <nothing>          - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	v3_  _  	0
+        <nothing>          - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _  _  	0
         <nothing>          - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _  _v1	0
         <nothing>          - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _v2_  	0
-        <nothing>          - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _  _  	0
+        <nothing>          - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _  	0
         <nothing>          - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _v1	0
-WITH          CHECK OPTION -         <nothing>          -         <nothing>         	UPDATE	v3_  _  	1369
+        <nothing>          - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _v2_  	0
+        <nothing>          - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	v3_  _  	0
 WITH          CHECK OPTION -         <nothing>          -         <nothing>         	INSERT	  _  _  	0
-WITH          CHECK OPTION -         <nothing>          -         <nothing>         	INSERT	  _v2_  	1369
 WITH          CHECK OPTION -         <nothing>          -         <nothing>         	INSERT	  _  _v1	1369
-WITH          CHECK OPTION -         <nothing>          -         <nothing>         	UPDATE	  _v2_  	1369
-WITH          CHECK OPTION -         <nothing>          -         <nothing>         	UPDATE	  _  _v1	1369
+WITH          CHECK OPTION -         <nothing>          -         <nothing>         	INSERT	  _v2_  	1369
 WITH          CHECK OPTION -         <nothing>          -         <nothing>         	UPDATE	  _  _  	0
-WITH          CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	UPDATE	  _v2_  	1369
-WITH          CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	UPDATE	v3_  _  	1369
-WITH          CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	INSERT	  _v2_  	1369
+WITH          CHECK OPTION -         <nothing>          -         <nothing>         	UPDATE	  _  _v1	1369
+WITH          CHECK OPTION -         <nothing>          -         <nothing>         	UPDATE	  _v2_  	1369
+WITH          CHECK OPTION -         <nothing>          -         <nothing>         	UPDATE	v3_  _  	1369
+WITH          CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	INSERT	  _  _  	0
 WITH          CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	INSERT	  _  _v1	1369
+WITH          CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	INSERT	  _v2_  	1369
 WITH          CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	UPDATE	  _  _  	0
 WITH          CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	UPDATE	  _  _v1	1369
-WITH          CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	INSERT	  _  _  	0
-WITH          CHECK OPTION -         <nothing>          - WITH CASCADED CHECK OPTION	UPDATE	v3_  _  	1369
+WITH          CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	UPDATE	  _v2_  	1369
+WITH          CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	UPDATE	v3_  _  	1369
 WITH          CHECK OPTION -         <nothing>          - WITH CASCADED CHECK OPTION	INSERT	  _  _  	0
-WITH          CHECK OPTION -         <nothing>          - WITH CASCADED CHECK OPTION	UPDATE	  _v2_  	1369
-WITH          CHECK OPTION -         <nothing>          - WITH CASCADED CHECK OPTION	INSERT	  _v2_  	1369
 WITH          CHECK OPTION -         <nothing>          - WITH CASCADED CHECK OPTION	INSERT	  _  _v1	1369
+WITH          CHECK OPTION -         <nothing>          - WITH CASCADED CHECK OPTION	INSERT	  _v2_  	1369
 WITH          CHECK OPTION -         <nothing>          - WITH CASCADED CHECK OPTION	UPDATE	  _  _  	0
 WITH          CHECK OPTION -         <nothing>          - WITH CASCADED CHECK OPTION	UPDATE	  _  _v1	1369
+WITH          CHECK OPTION -         <nothing>          - WITH CASCADED CHECK OPTION	UPDATE	  _v2_  	1369
+WITH          CHECK OPTION -         <nothing>          - WITH CASCADED CHECK OPTION	UPDATE	v3_  _  	1369
 WITH          CHECK OPTION -         <nothing>          - WITH LOCAL    CHECK OPTION	INSERT	  _  _  	0
-WITH          CHECK OPTION -         <nothing>          - WITH LOCAL    CHECK OPTION	UPDATE	  _v2_  	1369
-WITH          CHECK OPTION -         <nothing>          - WITH LOCAL    CHECK OPTION	UPDATE	  _  _v1	1369
-WITH          CHECK OPTION -         <nothing>          - WITH LOCAL    CHECK OPTION	UPDATE	  _  _  	0
 WITH          CHECK OPTION -         <nothing>          - WITH LOCAL    CHECK OPTION	INSERT	  _  _v1	1369
 WITH          CHECK OPTION -         <nothing>          - WITH LOCAL    CHECK OPTION	INSERT	  _v2_  	1369
+WITH          CHECK OPTION -         <nothing>          - WITH LOCAL    CHECK OPTION	UPDATE	  _  _  	0
+WITH          CHECK OPTION -         <nothing>          - WITH LOCAL    CHECK OPTION	UPDATE	  _  _v1	1369
+WITH          CHECK OPTION -         <nothing>          - WITH LOCAL    CHECK OPTION	UPDATE	  _v2_  	1369
 WITH          CHECK OPTION -         <nothing>          - WITH LOCAL    CHECK OPTION	UPDATE	v3_  _  	1369
-WITH          CHECK OPTION - WITH          CHECK OPTION -         <nothing>         	UPDATE	  _  _  	0
+WITH          CHECK OPTION - WITH          CHECK OPTION -         <nothing>         	INSERT	  _  _  	0
 WITH          CHECK OPTION - WITH          CHECK OPTION -         <nothing>         	INSERT	  _  _v1	1369
 WITH          CHECK OPTION - WITH          CHECK OPTION -         <nothing>         	INSERT	  _v2_  	1369
-WITH          CHECK OPTION - WITH          CHECK OPTION -         <nothing>         	INSERT	  _  _  	0
+WITH          CHECK OPTION - WITH          CHECK OPTION -         <nothing>         	UPDATE	  _  _  	0
 WITH          CHECK OPTION - WITH          CHECK OPTION -         <nothing>         	UPDATE	  _  _v1	1369
-WITH          CHECK OPTION - WITH          CHECK OPTION -         <nothing>         	UPDATE	v3_  _  	1369
 WITH          CHECK OPTION - WITH          CHECK OPTION -         <nothing>         	UPDATE	  _v2_  	1369
+WITH          CHECK OPTION - WITH          CHECK OPTION -         <nothing>         	UPDATE	v3_  _  	1369
+WITH          CHECK OPTION - WITH          CHECK OPTION - WITH          CHECK OPTION	INSERT	  _  _  	0
+WITH          CHECK OPTION - WITH          CHECK OPTION - WITH          CHECK OPTION	INSERT	  _  _v1	1369
 WITH          CHECK OPTION - WITH          CHECK OPTION - WITH          CHECK OPTION	INSERT	  _v2_  	1369
+WITH          CHECK OPTION - WITH          CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _  	0
+WITH          CHECK OPTION - WITH          CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _v1	1369
 WITH          CHECK OPTION - WITH          CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _v2_  	1369
 WITH          CHECK OPTION - WITH          CHECK OPTION - WITH          CHECK OPTION	UPDATE	v3_  _  	1369
-WITH          CHECK OPTION - WITH          CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _v1	1369
-WITH          CHECK OPTION - WITH          CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _  	0
-WITH          CHECK OPTION - WITH          CHECK OPTION - WITH          CHECK OPTION	INSERT	  _  _v1	1369
-WITH          CHECK OPTION - WITH          CHECK OPTION - WITH          CHECK OPTION	INSERT	  _  _  	0
+WITH          CHECK OPTION - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _  	0
 WITH          CHECK OPTION - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _v1	1369
+WITH          CHECK OPTION - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _v2_  	1369
+WITH          CHECK OPTION - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _  	0
+WITH          CHECK OPTION - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _v1	1369
 WITH          CHECK OPTION - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _v2_  	1369
 WITH          CHECK OPTION - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	v3_  _  	1369
-WITH          CHECK OPTION - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _  	0
-WITH          CHECK OPTION - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _v1	1369
-WITH          CHECK OPTION - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _  	0
-WITH          CHECK OPTION - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _v2_  	1369
-WITH          CHECK OPTION - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _v2_  	1369
+WITH          CHECK OPTION - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _  _  	0
 WITH          CHECK OPTION - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _  _v1	1369
-WITH          CHECK OPTION - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _v2_  	1369
+WITH          CHECK OPTION - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _v2_  	1369
 WITH          CHECK OPTION - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _  	0
 WITH          CHECK OPTION - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _v1	1369
-WITH          CHECK OPTION - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _  _  	0
+WITH          CHECK OPTION - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _v2_  	1369
 WITH          CHECK OPTION - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	v3_  _  	1369
-WITH          CHECK OPTION - WITH CASCADED CHECK OPTION -         <nothing>         	UPDATE	v3_  _  	1369
-WITH          CHECK OPTION - WITH CASCADED CHECK OPTION -         <nothing>         	UPDATE	  _v2_  	1369
-WITH          CHECK OPTION - WITH CASCADED CHECK OPTION -         <nothing>         	UPDATE	  _  _v1	1369
-WITH          CHECK OPTION - WITH CASCADED CHECK OPTION -         <nothing>         	UPDATE	  _  _  	0
+WITH          CHECK OPTION - WITH CASCADED CHECK OPTION -         <nothing>         	INSERT	  _  _  	0
 WITH          CHECK OPTION - WITH CASCADED CHECK OPTION -         <nothing>         	INSERT	  _  _v1	1369
 WITH          CHECK OPTION - WITH CASCADED CHECK OPTION -         <nothing>         	INSERT	  _v2_  	1369
-WITH          CHECK OPTION - WITH CASCADED CHECK OPTION -         <nothing>         	INSERT	  _  _  	0
-WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	UPDATE	v3_  _  	1369
-WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _v2_  	1369
-WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _v1	1369
-WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _  	0
+WITH          CHECK OPTION - WITH CASCADED CHECK OPTION -         <nothing>         	UPDATE	  _  _  	0
+WITH          CHECK OPTION - WITH CASCADED CHECK OPTION -         <nothing>         	UPDATE	  _  _v1	1369
+WITH          CHECK OPTION - WITH CASCADED CHECK OPTION -         <nothing>         	UPDATE	  _v2_  	1369
+WITH          CHECK OPTION - WITH CASCADED CHECK OPTION -         <nothing>         	UPDATE	v3_  _  	1369
+WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	INSERT	  _  _  	0
 WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	INSERT	  _  _v1	1369
 WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	INSERT	  _v2_  	1369
-WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	INSERT	  _  _  	0
-WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	v3_  _  	1369
-WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _v2_  	1369
+WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _  	0
+WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _v1	1369
+WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _v2_  	1369
+WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	UPDATE	v3_  _  	1369
+WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _  	0
 WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _v1	1369
+WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _v2_  	1369
 WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _  	0
 WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _v1	1369
 WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _v2_  	1369
-WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _  	0
+WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	v3_  _  	1369
+WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _  _  	0
+WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _  _v1	1369
 WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _v2_  	1369
-WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	v3_  _  	1369
-WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _v2_  	1369
-WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _v1	1369
 WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _  	0
-WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _  _v1	1369
-WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _  _  	0
+WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _v1	1369
+WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _v2_  	1369
+WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	v3_  _  	1369
+WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION -         <nothing>         	INSERT	  _  _  	0
 WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION -         <nothing>         	INSERT	  _  _v1	1369
+WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION -         <nothing>         	INSERT	  _v2_  	1369
 WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION -         <nothing>         	UPDATE	  _  _  	0
 WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION -         <nothing>         	UPDATE	  _  _v1	1369
-WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION -         <nothing>         	INSERT	  _  _  	0
-WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION -         <nothing>         	INSERT	  _v2_  	1369
 WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION -         <nothing>         	UPDATE	  _v2_  	1369
 WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION -         <nothing>         	UPDATE	v3_  _  	1369
 WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	INSERT	  _  _  	0
 WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	INSERT	  _  _v1	1369
-WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	UPDATE	v3_  _  	1369
+WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	INSERT	  _v2_  	1369
+WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _  	0
 WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _v1	1369
 WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _v2_  	1369
-WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _  	0
-WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	INSERT	  _v2_  	1369
-WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _v2_  	1369
+WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	UPDATE	v3_  _  	1369
+WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _  	0
 WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _v1	1369
+WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _v2_  	1369
 WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _  	0
 WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _v1	1369
-WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _  	0
-WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	v3_  _  	1369
 WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _v2_  	1369
-WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _  	0
+WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	v3_  _  	1369
+WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _  _  	0
 WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _  _v1	1369
-WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	v3_  _  	1369
-WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _v2_  	1369
 WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _v2_  	1369
-WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _  _  	0
+WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _  	0
 WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _v1	1369
-WITH CASCADED CHECK OPTION -         <nothing>          -         <nothing>         	INSERT	  _v2_  	1369
+WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _v2_  	1369
+WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	v3_  _  	1369
 WITH CASCADED CHECK OPTION -         <nothing>          -         <nothing>         	INSERT	  _  _  	0
+WITH CASCADED CHECK OPTION -         <nothing>          -         <nothing>         	INSERT	  _  _v1	1369
+WITH CASCADED CHECK OPTION -         <nothing>          -         <nothing>         	INSERT	  _v2_  	1369
 WITH CASCADED CHECK OPTION -         <nothing>          -         <nothing>         	UPDATE	  _  _  	0
 WITH CASCADED CHECK OPTION -         <nothing>          -         <nothing>         	UPDATE	  _  _v1	1369
 WITH CASCADED CHECK OPTION -         <nothing>          -         <nothing>         	UPDATE	  _v2_  	1369
 WITH CASCADED CHECK OPTION -         <nothing>          -         <nothing>         	UPDATE	v3_  _  	1369
-WITH CASCADED CHECK OPTION -         <nothing>          -         <nothing>         	INSERT	  _  _v1	1369
+WITH CASCADED CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	INSERT	  _  _  	0
+WITH CASCADED CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	INSERT	  _  _v1	1369
 WITH CASCADED CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	INSERT	  _v2_  	1369
-WITH CASCADED CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	UPDATE	v3_  _  	1369
-WITH CASCADED CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	UPDATE	  _v2_  	1369
-WITH CASCADED CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	UPDATE	  _  _v1	1369
 WITH CASCADED CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	UPDATE	  _  _  	0
-WITH CASCADED CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	INSERT	  _  _v1	1369
-WITH CASCADED CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	INSERT	  _  _  	0
-WITH CASCADED CHECK OPTION -         <nothing>          - WITH CASCADED CHECK OPTION	UPDATE	v3_  _  	1369
-WITH CASCADED CHECK OPTION -         <nothing>          - WITH CASCADED CHECK OPTION	UPDATE	  _v2_  	1369
-WITH CASCADED CHECK OPTION -         <nothing>          - WITH CASCADED CHECK OPTION	UPDATE	  _  _v1	1369
-WITH CASCADED CHECK OPTION -         <nothing>          - WITH CASCADED CHECK OPTION	UPDATE	  _  _  	0
-WITH CASCADED CHECK OPTION -         <nothing>          - WITH CASCADED CHECK OPTION	INSERT	  _v2_  	1369
+WITH CASCADED CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	UPDATE	  _  _v1	1369
+WITH CASCADED CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	UPDATE	  _v2_  	1369
+WITH CASCADED CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	UPDATE	v3_  _  	1369
 WITH CASCADED CHECK OPTION -         <nothing>          - WITH CASCADED CHECK OPTION	INSERT	  _  _  	0
 WITH CASCADED CHECK OPTION -         <nothing>          - WITH CASCADED CHECK OPTION	INSERT	  _  _v1	1369
-WITH CASCADED CHECK OPTION -         <nothing>          - WITH LOCAL    CHECK OPTION	UPDATE	  _v2_  	1369
+WITH CASCADED CHECK OPTION -         <nothing>          - WITH CASCADED CHECK OPTION	INSERT	  _v2_  	1369
+WITH CASCADED CHECK OPTION -         <nothing>          - WITH CASCADED CHECK OPTION	UPDATE	  _  _  	0
+WITH CASCADED CHECK OPTION -         <nothing>          - WITH CASCADED CHECK OPTION	UPDATE	  _  _v1	1369
+WITH CASCADED CHECK OPTION -         <nothing>          - WITH CASCADED CHECK OPTION	UPDATE	  _v2_  	1369
+WITH CASCADED CHECK OPTION -         <nothing>          - WITH CASCADED CHECK OPTION	UPDATE	v3_  _  	1369
 WITH CASCADED CHECK OPTION -         <nothing>          - WITH LOCAL    CHECK OPTION	INSERT	  _  _  	0
+WITH CASCADED CHECK OPTION -         <nothing>          - WITH LOCAL    CHECK OPTION	INSERT	  _  _v1	1369
 WITH CASCADED CHECK OPTION -         <nothing>          - WITH LOCAL    CHECK OPTION	INSERT	  _v2_  	1369
 WITH CASCADED CHECK OPTION -         <nothing>          - WITH LOCAL    CHECK OPTION	UPDATE	  _  _  	0
 WITH CASCADED CHECK OPTION -         <nothing>          - WITH LOCAL    CHECK OPTION	UPDATE	  _  _v1	1369
+WITH CASCADED CHECK OPTION -         <nothing>          - WITH LOCAL    CHECK OPTION	UPDATE	  _v2_  	1369
 WITH CASCADED CHECK OPTION -         <nothing>          - WITH LOCAL    CHECK OPTION	UPDATE	v3_  _  	1369
-WITH CASCADED CHECK OPTION -         <nothing>          - WITH LOCAL    CHECK OPTION	INSERT	  _  _v1	1369
-WITH CASCADED CHECK OPTION - WITH          CHECK OPTION -         <nothing>         	UPDATE	  _v2_  	1369
-WITH CASCADED CHECK OPTION - WITH          CHECK OPTION -         <nothing>         	UPDATE	v3_  _  	1369
-WITH CASCADED CHECK OPTION - WITH          CHECK OPTION -         <nothing>         	UPDATE	  _  _v1	1369
+WITH CASCADED CHECK OPTION - WITH          CHECK OPTION -         <nothing>         	INSERT	  _  _  	0
+WITH CASCADED CHECK OPTION - WITH          CHECK OPTION -         <nothing>         	INSERT	  _  _v1	1369
 WITH CASCADED CHECK OPTION - WITH          CHECK OPTION -         <nothing>         	INSERT	  _v2_  	1369
 WITH CASCADED CHECK OPTION - WITH          CHECK OPTION -         <nothing>         	UPDATE	  _  _  	0
-WITH CASCADED CHECK OPTION - WITH          CHECK OPTION -         <nothing>         	INSERT	  _  _v1	1369
-WITH CASCADED CHECK OPTION - WITH          CHECK OPTION -         <nothing>         	INSERT	  _  _  	0
-WITH CASCADED CHECK OPTION - WITH          CHECK OPTION - WITH          CHECK OPTION	UPDATE	v3_  _  	1369
+WITH CASCADED CHECK OPTION - WITH          CHECK OPTION -         <nothing>         	UPDATE	  _  _v1	1369
+WITH CASCADED CHECK OPTION - WITH          CHECK OPTION -         <nothing>         	UPDATE	  _v2_  	1369
+WITH CASCADED CHECK OPTION - WITH          CHECK OPTION -         <nothing>         	UPDATE	v3_  _  	1369
 WITH CASCADED CHECK OPTION - WITH          CHECK OPTION - WITH          CHECK OPTION	INSERT	  _  _  	0
-WITH CASCADED CHECK OPTION - WITH          CHECK OPTION - WITH          CHECK OPTION	INSERT	  _v2_  	1369
 WITH CASCADED CHECK OPTION - WITH          CHECK OPTION - WITH          CHECK OPTION	INSERT	  _  _v1	1369
+WITH CASCADED CHECK OPTION - WITH          CHECK OPTION - WITH          CHECK OPTION	INSERT	  _v2_  	1369
 WITH CASCADED CHECK OPTION - WITH          CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _  	0
 WITH CASCADED CHECK OPTION - WITH          CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _v1	1369
 WITH CASCADED CHECK OPTION - WITH          CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _v2_  	1369
+WITH CASCADED CHECK OPTION - WITH          CHECK OPTION - WITH          CHECK OPTION	UPDATE	v3_  _  	1369
 WITH CASCADED CHECK OPTION - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _  	0
-WITH CASCADED CHECK OPTION - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	v3_  _  	1369
+WITH CASCADED CHECK OPTION - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _v1	1369
 WITH CASCADED CHECK OPTION - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _v2_  	1369
-WITH CASCADED CHECK OPTION - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _v2_  	1369
-WITH CASCADED CHECK OPTION - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _v1	1369
 WITH CASCADED CHECK OPTION - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _  	0
-WITH CASCADED CHECK OPTION - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _v1	1369
+WITH CASCADED CHECK OPTION - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _v1	1369
+WITH CASCADED CHECK OPTION - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _v2_  	1369
+WITH CASCADED CHECK OPTION - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	v3_  _  	1369
+WITH CASCADED CHECK OPTION - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _  _  	0
 WITH CASCADED CHECK OPTION - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _  _v1	1369
-WITH CASCADED CHECK OPTION - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	v3_  _  	1369
 WITH CASCADED CHECK OPTION - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _v2_  	1369
-WITH CASCADED CHECK OPTION - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _  _  	0
-WITH CASCADED CHECK OPTION - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _v2_  	1369
-WITH CASCADED CHECK OPTION - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _v1	1369
 WITH CASCADED CHECK OPTION - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _  	0
-WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION -         <nothing>         	UPDATE	  _v2_  	1369
-WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION -         <nothing>         	UPDATE	v3_  _  	1369
-WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION -         <nothing>         	INSERT	  _v2_  	1369
+WITH CASCADED CHECK OPTION - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _v1	1369
+WITH CASCADED CHECK OPTION - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _v2_  	1369
+WITH CASCADED CHECK OPTION - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	v3_  _  	1369
+WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION -         <nothing>         	INSERT	  _  _  	0
 WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION -         <nothing>         	INSERT	  _  _v1	1369
+WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION -         <nothing>         	INSERT	  _v2_  	1369
 WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION -         <nothing>         	UPDATE	  _  _  	0
 WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION -         <nothing>         	UPDATE	  _  _v1	1369
-WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION -         <nothing>         	INSERT	  _  _  	0
-WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _  	0
+WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION -         <nothing>         	UPDATE	  _v2_  	1369
+WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION -         <nothing>         	UPDATE	v3_  _  	1369
 WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	INSERT	  _  _  	0
-WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _v1	1369
-WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	INSERT	  _v2_  	1369
 WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	INSERT	  _  _v1	1369
+WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	INSERT	  _v2_  	1369
+WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _  	0
+WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _v1	1369
 WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _v2_  	1369
 WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	UPDATE	v3_  _  	1369
+WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _  	0
+WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _v1	1369
 WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _v2_  	1369
-WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _v2_  	1369
-WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _v1	1369
 WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _  	0
-WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _v1	1369
-WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _  	0
+WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _v1	1369
+WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _v2_  	1369
 WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	v3_  _  	1369
-WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _v2_  	1369
 WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _  _  	0
-WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _v1	1369
-WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _  	0
 WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _  _v1	1369
 WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _v2_  	1369
+WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _  	0
+WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _v1	1369
+WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _v2_  	1369
 WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	v3_  _  	1369
-WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION -         <nothing>         	UPDATE	  _v2_  	1369
-WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION -         <nothing>         	UPDATE	v3_  _  	1369
-WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION -         <nothing>         	UPDATE	  _  _v1	1369
-WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION -         <nothing>         	UPDATE	  _  _  	0
+WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION -         <nothing>         	INSERT	  _  _  	0
 WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION -         <nothing>         	INSERT	  _  _v1	1369
 WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION -         <nothing>         	INSERT	  _v2_  	1369
-WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION -         <nothing>         	INSERT	  _  _  	0
+WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION -         <nothing>         	UPDATE	  _  _  	0
+WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION -         <nothing>         	UPDATE	  _  _v1	1369
+WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION -         <nothing>         	UPDATE	  _v2_  	1369
+WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION -         <nothing>         	UPDATE	v3_  _  	1369
 WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	INSERT	  _  _  	0
-WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	INSERT	  _v2_  	1369
-WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	UPDATE	v3_  _  	1369
-WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _v2_  	1369
-WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _v1	1369
 WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	INSERT	  _  _v1	1369
+WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	INSERT	  _v2_  	1369
 WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _  	0
+WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _v1	1369
+WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _v2_  	1369
+WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	UPDATE	v3_  _  	1369
 WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _  	0
+WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _v1	1369
 WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _v2_  	1369
 WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _  	0
 WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _v1	1369
 WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _v2_  	1369
-WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _v1	1369
 WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	v3_  _  	1369
-WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _v1	1369
 WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _  _  	0
-WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _v2_  	1369
-WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	v3_  _  	1369
-WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _v2_  	1369
 WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _  _v1	1369
+WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _v2_  	1369
 WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _  	0
+WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _v1	1369
+WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _v2_  	1369
+WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	v3_  _  	1369
 WITH LOCAL    CHECK OPTION -         <nothing>          -         <nothing>         	INSERT	  _  _  	0
-WITH LOCAL    CHECK OPTION -         <nothing>          -         <nothing>         	UPDATE	  _v2_  	0
-WITH LOCAL    CHECK OPTION -         <nothing>          -         <nothing>         	UPDATE	  _  _v1	0
-WITH LOCAL    CHECK OPTION -         <nothing>          -         <nothing>         	UPDATE	  _  _  	0
 WITH LOCAL    CHECK OPTION -         <nothing>          -         <nothing>         	INSERT	  _  _v1	0
 WITH LOCAL    CHECK OPTION -         <nothing>          -         <nothing>         	INSERT	  _v2_  	0
+WITH LOCAL    CHECK OPTION -         <nothing>          -         <nothing>         	UPDATE	  _  _  	0
+WITH LOCAL    CHECK OPTION -         <nothing>          -         <nothing>         	UPDATE	  _  _v1	0
+WITH LOCAL    CHECK OPTION -         <nothing>          -         <nothing>         	UPDATE	  _v2_  	0
 WITH LOCAL    CHECK OPTION -         <nothing>          -         <nothing>         	UPDATE	v3_  _  	1369
-WITH LOCAL    CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	UPDATE	  _  _  	0
-WITH LOCAL    CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	UPDATE	v3_  _  	1369
-WITH LOCAL    CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	UPDATE	  _v2_  	0
-WITH LOCAL    CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	UPDATE	  _  _v1	0
+WITH LOCAL    CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	INSERT	  _  _  	0
 WITH LOCAL    CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	INSERT	  _  _v1	0
 WITH LOCAL    CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	INSERT	  _v2_  	0
-WITH LOCAL    CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	INSERT	  _  _  	0
-WITH LOCAL    CHECK OPTION -         <nothing>          - WITH CASCADED CHECK OPTION	INSERT	  _v2_  	0
+WITH LOCAL    CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	UPDATE	  _  _  	0
+WITH LOCAL    CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	UPDATE	  _  _v1	0
+WITH LOCAL    CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	UPDATE	  _v2_  	0
+WITH LOCAL    CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	UPDATE	v3_  _  	1369
 WITH LOCAL    CHECK OPTION -         <nothing>          - WITH CASCADED CHECK OPTION	INSERT	  _  _  	0
 WITH LOCAL    CHECK OPTION -         <nothing>          - WITH CASCADED CHECK OPTION	INSERT	  _  _v1	0
-WITH LOCAL    CHECK OPTION -         <nothing>          - WITH CASCADED CHECK OPTION	UPDATE	v3_  _  	1369
-WITH LOCAL    CHECK OPTION -         <nothing>          - WITH CASCADED CHECK OPTION	UPDATE	  _v2_  	0
-WITH LOCAL    CHECK OPTION -         <nothing>          - WITH CASCADED CHECK OPTION	UPDATE	  _  _v1	0
+WITH LOCAL    CHECK OPTION -         <nothing>          - WITH CASCADED CHECK OPTION	INSERT	  _v2_  	0
 WITH LOCAL    CHECK OPTION -         <nothing>          - WITH CASCADED CHECK OPTION	UPDATE	  _  _  	0
+WITH LOCAL    CHECK OPTION -         <nothing>          - WITH CASCADED CHECK OPTION	UPDATE	  _  _v1	0
+WITH LOCAL    CHECK OPTION -         <nothing>          - WITH CASCADED CHECK OPTION	UPDATE	  _v2_  	0
+WITH LOCAL    CHECK OPTION -         <nothing>          - WITH CASCADED CHECK OPTION	UPDATE	v3_  _  	1369
 WITH LOCAL    CHECK OPTION -         <nothing>          - WITH LOCAL    CHECK OPTION	INSERT	  _  _  	0
-WITH LOCAL    CHECK OPTION -         <nothing>          - WITH LOCAL    CHECK OPTION	INSERT	  _v2_  	0
 WITH LOCAL    CHECK OPTION -         <nothing>          - WITH LOCAL    CHECK OPTION	INSERT	  _  _v1	0
+WITH LOCAL    CHECK OPTION -         <nothing>          - WITH LOCAL    CHECK OPTION	INSERT	  _v2_  	0
 WITH LOCAL    CHECK OPTION -         <nothing>          - WITH LOCAL    CHECK OPTION	UPDATE	  _  _  	0
 WITH LOCAL    CHECK OPTION -         <nothing>          - WITH LOCAL    CHECK OPTION	UPDATE	  _  _v1	0
 WITH LOCAL    CHECK OPTION -         <nothing>          - WITH LOCAL    CHECK OPTION	UPDATE	  _v2_  	0
 WITH LOCAL    CHECK OPTION -         <nothing>          - WITH LOCAL    CHECK OPTION	UPDATE	v3_  _  	1369
-WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION -         <nothing>         	UPDATE	  _v2_  	0
-WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION -         <nothing>         	UPDATE	v3_  _  	1369
-WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION -         <nothing>         	UPDATE	  _  _  	0
 WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION -         <nothing>         	INSERT	  _  _  	0
-WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION -         <nothing>         	INSERT	  _v2_  	0
 WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION -         <nothing>         	INSERT	  _  _v1	0
+WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION -         <nothing>         	INSERT	  _v2_  	0
+WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION -         <nothing>         	UPDATE	  _  _  	0
 WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION -         <nothing>         	UPDATE	  _  _v1	0
-WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _v2_  	0
-WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION - WITH          CHECK OPTION	UPDATE	v3_  _  	1369
+WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION -         <nothing>         	UPDATE	  _v2_  	0
+WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION -         <nothing>         	UPDATE	v3_  _  	1369
 WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION - WITH          CHECK OPTION	INSERT	  _  _  	0
-WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION - WITH          CHECK OPTION	INSERT	  _v2_  	0
-WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _v1	0
 WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION - WITH          CHECK OPTION	INSERT	  _  _v1	0
+WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION - WITH          CHECK OPTION	INSERT	  _v2_  	0
 WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _  	0
-WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _v2_  	0
-WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _v1	0
-WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _  	0
+WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _v1	0
+WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _v2_  	0
+WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION - WITH          CHECK OPTION	UPDATE	v3_  _  	1369
+WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _  	0
 WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _v1	0
 WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _v2_  	0
-WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _  	0
+WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _  	0
+WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _v1	0
+WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _v2_  	0
 WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	v3_  _  	1369
 WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _  _  	0
-WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _v2_  	0
 WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _  _v1	0
+WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _v2_  	0
 WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _  	0
 WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _v1	0
-WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	v3_  _  	1369
 WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _v2_  	0
-WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION -         <nothing>         	INSERT	  _v2_  	0
+WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	v3_  _  	1369
+WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION -         <nothing>         	INSERT	  _  _  	0
 WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION -         <nothing>         	INSERT	  _  _v1	0
+WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION -         <nothing>         	INSERT	  _v2_  	0
 WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION -         <nothing>         	UPDATE	  _  _  	0
 WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION -         <nothing>         	UPDATE	  _  _v1	0
 WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION -         <nothing>         	UPDATE	  _v2_  	0
 WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION -         <nothing>         	UPDATE	v3_  _  	1369
-WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION -         <nothing>         	INSERT	  _  _  	0
 WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	INSERT	  _  _  	0
-WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	UPDATE	v3_  _  	1369
-WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _v1	0
-WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	INSERT	  _v2_  	0
-WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _v2_  	0
 WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	INSERT	  _  _v1	0
+WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	INSERT	  _v2_  	0
 WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _  	0
-WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _v2_  	0
-WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _v1	0
+WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _v1	0
+WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _v2_  	0
+WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	UPDATE	v3_  _  	1369
 WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _  	0
+WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _v1	0
+WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _v2_  	0
 WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _  	0
 WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _v1	0
 WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _v2_  	0
 WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	v3_  _  	1369
-WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	v3_  _  	1369
-WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _  	0
 WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _  _  	0
-WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _v2_  	0
-WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _v2_  	0
 WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _  _v1	0
+WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _v2_  	0
+WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _  	0
 WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _v1	0
-WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION -         <nothing>         	UPDATE	  _  _  	0
-WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION -         <nothing>         	INSERT	  _  _v1	0
+WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _v2_  	0
+WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	v3_  _  	1369
 WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION -         <nothing>         	INSERT	  _  _  	0
+WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION -         <nothing>         	INSERT	  _  _v1	0
+WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION -         <nothing>         	INSERT	  _v2_  	0
+WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION -         <nothing>         	UPDATE	  _  _  	0
 WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION -         <nothing>         	UPDATE	  _  _v1	0
 WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION -         <nothing>         	UPDATE	  _v2_  	0
 WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION -         <nothing>         	UPDATE	v3_  _  	1369
-WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION -         <nothing>         	INSERT	  _v2_  	0
-WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _  	0
 WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	INSERT	  _  _  	0
 WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	INSERT	  _  _v1	0
 WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	INSERT	  _v2_  	0
+WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _  	0
 WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _v1	0
 WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _v2_  	0
 WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	UPDATE	v3_  _  	1369
-WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _v1	0
 WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _  	0
-WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _v2_  	0
 WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _v1	0
+WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _v2_  	0
 WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _  	0
-WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	v3_  _  	1369
+WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _v1	0
 WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _v2_  	0
-WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _v2_  	0
-WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _v1	0
-WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _  	0
-WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _  _v1	0
+WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	v3_  _  	1369
 WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _  _  	0
-WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	v3_  _  	1369
+WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _  _v1	0
 WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _v2_  	0
+WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _  	0
+WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _v1	0
+WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _v2_  	0
+WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	v3_  _  	1369
 
 Plausibility checks for INSERTs and UPDATEs ( 4. and 5. above).
 All following SELECTs must give ROW NOT FOUND 

=== modified file 'mysql-test/suite/funcs_1/r/memory_views.result'
--- a/mysql-test/suite/funcs_1/r/memory_views.result	2010-08-31 06:28:15 +0000
+++ b/mysql-test/suite/funcs_1/r/memory_views.result	2012-02-07 11:56:30 +0000
@@ -15224,456 +15224,456 @@ DELETE FROM t1;
 DROP VIEW v3;
 DROP VIEW v2;
 DROP VIEW v1;
-SELECT * FROM t1_results ORDER BY v3_to_v1_options;
+SELECT * FROM t1_results ORDER BY v3_to_v1_options, statement, v3_to_v1_violation, errno;
 v3_to_v1_options	statement	v3_to_v1_violation	errno
-        <nothing>          -         <nothing>          -         <nothing>         	UPDATE	  _v2_  	0
-        <nothing>          -         <nothing>          -         <nothing>         	INSERT	  _v2_  	0
+        <nothing>          -         <nothing>          -         <nothing>         	INSERT	  _  _  	0
         <nothing>          -         <nothing>          -         <nothing>         	INSERT	  _  _v1	0
+        <nothing>          -         <nothing>          -         <nothing>         	INSERT	  _v2_  	0
         <nothing>          -         <nothing>          -         <nothing>         	UPDATE	  _  _  	0
         <nothing>          -         <nothing>          -         <nothing>         	UPDATE	  _  _v1	0
+        <nothing>          -         <nothing>          -         <nothing>         	UPDATE	  _v2_  	0
         <nothing>          -         <nothing>          -         <nothing>         	UPDATE	v3_  _  	0
-        <nothing>          -         <nothing>          -         <nothing>         	INSERT	  _  _  	0
-        <nothing>          -         <nothing>          - WITH          CHECK OPTION	UPDATE	  _v2_  	0
         <nothing>          -         <nothing>          - WITH          CHECK OPTION	INSERT	  _  _  	0
-        <nothing>          -         <nothing>          - WITH          CHECK OPTION	UPDATE	  _  _v1	0
+        <nothing>          -         <nothing>          - WITH          CHECK OPTION	INSERT	  _  _v1	0
+        <nothing>          -         <nothing>          - WITH          CHECK OPTION	INSERT	  _v2_  	0
         <nothing>          -         <nothing>          - WITH          CHECK OPTION	UPDATE	  _  _  	0
+        <nothing>          -         <nothing>          - WITH          CHECK OPTION	UPDATE	  _  _v1	0
+        <nothing>          -         <nothing>          - WITH          CHECK OPTION	UPDATE	  _v2_  	0
         <nothing>          -         <nothing>          - WITH          CHECK OPTION	UPDATE	v3_  _  	0
-        <nothing>          -         <nothing>          - WITH          CHECK OPTION	INSERT	  _v2_  	0
-        <nothing>          -         <nothing>          - WITH          CHECK OPTION	INSERT	  _  _v1	0
-        <nothing>          -         <nothing>          - WITH CASCADED CHECK OPTION	INSERT	  _v2_  	0
         <nothing>          -         <nothing>          - WITH CASCADED CHECK OPTION	INSERT	  _  _  	0
         <nothing>          -         <nothing>          - WITH CASCADED CHECK OPTION	INSERT	  _  _v1	0
+        <nothing>          -         <nothing>          - WITH CASCADED CHECK OPTION	INSERT	  _v2_  	0
         <nothing>          -         <nothing>          - WITH CASCADED CHECK OPTION	UPDATE	  _  _  	0
         <nothing>          -         <nothing>          - WITH CASCADED CHECK OPTION	UPDATE	  _  _v1	0
         <nothing>          -         <nothing>          - WITH CASCADED CHECK OPTION	UPDATE	  _v2_  	0
         <nothing>          -         <nothing>          - WITH CASCADED CHECK OPTION	UPDATE	v3_  _  	0
-        <nothing>          -         <nothing>          - WITH LOCAL    CHECK OPTION	UPDATE	  _  _v1	0
-        <nothing>          -         <nothing>          - WITH LOCAL    CHECK OPTION	INSERT	  _v2_  	0
-        <nothing>          -         <nothing>          - WITH LOCAL    CHECK OPTION	INSERT	  _  _v1	0
         <nothing>          -         <nothing>          - WITH LOCAL    CHECK OPTION	INSERT	  _  _  	0
-        <nothing>          -         <nothing>          - WITH LOCAL    CHECK OPTION	UPDATE	v3_  _  	0
-        <nothing>          -         <nothing>          - WITH LOCAL    CHECK OPTION	UPDATE	  _v2_  	0
+        <nothing>          -         <nothing>          - WITH LOCAL    CHECK OPTION	INSERT	  _  _v1	0
+        <nothing>          -         <nothing>          - WITH LOCAL    CHECK OPTION	INSERT	  _v2_  	0
         <nothing>          -         <nothing>          - WITH LOCAL    CHECK OPTION	UPDATE	  _  _  	0
-        <nothing>          - WITH          CHECK OPTION -         <nothing>         	UPDATE	  _v2_  	0
+        <nothing>          -         <nothing>          - WITH LOCAL    CHECK OPTION	UPDATE	  _  _v1	0
+        <nothing>          -         <nothing>          - WITH LOCAL    CHECK OPTION	UPDATE	  _v2_  	0
+        <nothing>          -         <nothing>          - WITH LOCAL    CHECK OPTION	UPDATE	v3_  _  	0
+        <nothing>          - WITH          CHECK OPTION -         <nothing>         	INSERT	  _  _  	0
+        <nothing>          - WITH          CHECK OPTION -         <nothing>         	INSERT	  _  _v1	0
         <nothing>          - WITH          CHECK OPTION -         <nothing>         	INSERT	  _v2_  	0
-        <nothing>          - WITH          CHECK OPTION -         <nothing>         	UPDATE	v3_  _  	0
-        <nothing>          - WITH          CHECK OPTION -         <nothing>         	UPDATE	  _  _v1	0
         <nothing>          - WITH          CHECK OPTION -         <nothing>         	UPDATE	  _  _  	0
-        <nothing>          - WITH          CHECK OPTION -         <nothing>         	INSERT	  _  _v1	0
-        <nothing>          - WITH          CHECK OPTION -         <nothing>         	INSERT	  _  _  	0
-        <nothing>          - WITH          CHECK OPTION - WITH          CHECK OPTION	UPDATE	v3_  _  	0
-        <nothing>          - WITH          CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _v2_  	0
-        <nothing>          - WITH          CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _  	0
+        <nothing>          - WITH          CHECK OPTION -         <nothing>         	UPDATE	  _  _v1	0
+        <nothing>          - WITH          CHECK OPTION -         <nothing>         	UPDATE	  _v2_  	0
+        <nothing>          - WITH          CHECK OPTION -         <nothing>         	UPDATE	v3_  _  	0
+        <nothing>          - WITH          CHECK OPTION - WITH          CHECK OPTION	INSERT	  _  _  	0
         <nothing>          - WITH          CHECK OPTION - WITH          CHECK OPTION	INSERT	  _  _v1	0
         <nothing>          - WITH          CHECK OPTION - WITH          CHECK OPTION	INSERT	  _v2_  	0
-        <nothing>          - WITH          CHECK OPTION - WITH          CHECK OPTION	INSERT	  _  _  	0
+        <nothing>          - WITH          CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _  	0
         <nothing>          - WITH          CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _v1	0
+        <nothing>          - WITH          CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _v2_  	0
+        <nothing>          - WITH          CHECK OPTION - WITH          CHECK OPTION	UPDATE	v3_  _  	0
         <nothing>          - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _  	0
-        <nothing>          - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _v2_  	0
-        <nothing>          - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _v1	0
-        <nothing>          - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _  	0
         <nothing>          - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _v1	0
         <nothing>          - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _v2_  	0
+        <nothing>          - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _  	0
+        <nothing>          - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _v1	0
+        <nothing>          - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _v2_  	0
         <nothing>          - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	v3_  _  	0
-        <nothing>          - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	v3_  _  	0
         <nothing>          - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _  _  	0
-        <nothing>          - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _v2_  	0
         <nothing>          - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _  _v1	0
+        <nothing>          - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _v2_  	0
         <nothing>          - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _  	0
         <nothing>          - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _v1	0
         <nothing>          - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _v2_  	0
+        <nothing>          - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	v3_  _  	0
+        <nothing>          - WITH CASCADED CHECK OPTION -         <nothing>         	INSERT	  _  _  	0
         <nothing>          - WITH CASCADED CHECK OPTION -         <nothing>         	INSERT	  _  _v1	0
+        <nothing>          - WITH CASCADED CHECK OPTION -         <nothing>         	INSERT	  _v2_  	0
+        <nothing>          - WITH CASCADED CHECK OPTION -         <nothing>         	UPDATE	  _  _  	0
         <nothing>          - WITH CASCADED CHECK OPTION -         <nothing>         	UPDATE	  _  _v1	0
         <nothing>          - WITH CASCADED CHECK OPTION -         <nothing>         	UPDATE	  _v2_  	0
-        <nothing>          - WITH CASCADED CHECK OPTION -         <nothing>         	UPDATE	  _  _  	0
         <nothing>          - WITH CASCADED CHECK OPTION -         <nothing>         	UPDATE	v3_  _  	0
-        <nothing>          - WITH CASCADED CHECK OPTION -         <nothing>         	INSERT	  _  _  	0
-        <nothing>          - WITH CASCADED CHECK OPTION -         <nothing>         	INSERT	  _v2_  	0
-        <nothing>          - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	INSERT	  _  _v1	0
-        <nothing>          - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _v1	0
         <nothing>          - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	INSERT	  _  _  	0
+        <nothing>          - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	INSERT	  _  _v1	0
         <nothing>          - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	INSERT	  _v2_  	0
-        <nothing>          - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	UPDATE	v3_  _  	0
         <nothing>          - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _  	0
+        <nothing>          - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _v1	0
         <nothing>          - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _v2_  	0
-        <nothing>          - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	v3_  _  	0
-        <nothing>          - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _v2_  	0
-        <nothing>          - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _v1	0
+        <nothing>          - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	UPDATE	v3_  _  	0
         <nothing>          - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _  	0
-        <nothing>          - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _  	0
-        <nothing>          - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _v2_  	0
         <nothing>          - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _v1	0
-        <nothing>          - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _  _v1	0
+        <nothing>          - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _v2_  	0
+        <nothing>          - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _  	0
+        <nothing>          - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _v1	0
+        <nothing>          - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _v2_  	0
+        <nothing>          - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	v3_  _  	0
         <nothing>          - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _  _  	0
+        <nothing>          - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _  _v1	0
+        <nothing>          - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _v2_  	0
         <nothing>          - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _  	0
         <nothing>          - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _v1	0
         <nothing>          - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _v2_  	0
         <nothing>          - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	v3_  _  	0
-        <nothing>          - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _v2_  	0
-        <nothing>          - WITH LOCAL    CHECK OPTION -         <nothing>         	UPDATE	v3_  _  	0
         <nothing>          - WITH LOCAL    CHECK OPTION -         <nothing>         	INSERT	  _  _  	0
-        <nothing>          - WITH LOCAL    CHECK OPTION -         <nothing>         	INSERT	  _v2_  	0
         <nothing>          - WITH LOCAL    CHECK OPTION -         <nothing>         	INSERT	  _  _v1	0
+        <nothing>          - WITH LOCAL    CHECK OPTION -         <nothing>         	INSERT	  _v2_  	0
         <nothing>          - WITH LOCAL    CHECK OPTION -         <nothing>         	UPDATE	  _  _  	0
         <nothing>          - WITH LOCAL    CHECK OPTION -         <nothing>         	UPDATE	  _  _v1	0
         <nothing>          - WITH LOCAL    CHECK OPTION -         <nothing>         	UPDATE	  _v2_  	0
-        <nothing>          - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	UPDATE	v3_  _  	0
-        <nothing>          - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _v2_  	0
-        <nothing>          - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _  	0
-        <nothing>          - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	INSERT	  _v2_  	0
-        <nothing>          - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _v1	0
+        <nothing>          - WITH LOCAL    CHECK OPTION -         <nothing>         	UPDATE	v3_  _  	0
         <nothing>          - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	INSERT	  _  _  	0
         <nothing>          - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	INSERT	  _  _v1	0
-        <nothing>          - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _v1	0
-        <nothing>          - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _  	0
-        <nothing>          - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	v3_  _  	0
+        <nothing>          - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	INSERT	  _v2_  	0
+        <nothing>          - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _  	0
+        <nothing>          - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _v1	0
+        <nothing>          - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _v2_  	0
+        <nothing>          - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	UPDATE	v3_  _  	0
         <nothing>          - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _  	0
+        <nothing>          - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _v1	0
         <nothing>          - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _v2_  	0
+        <nothing>          - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _  	0
         <nothing>          - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _v1	0
         <nothing>          - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _v2_  	0
-        <nothing>          - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	v3_  _  	0
-        <nothing>          - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _v2_  	0
-        <nothing>          - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _  	0
+        <nothing>          - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	v3_  _  	0
+        <nothing>          - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _  _  	0
         <nothing>          - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _  _v1	0
         <nothing>          - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _v2_  	0
-        <nothing>          - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _  _  	0
+        <nothing>          - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _  	0
         <nothing>          - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _v1	0
-WITH          CHECK OPTION -         <nothing>          -         <nothing>         	UPDATE	v3_  _  	1369
+        <nothing>          - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _v2_  	0
+        <nothing>          - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	v3_  _  	0
 WITH          CHECK OPTION -         <nothing>          -         <nothing>         	INSERT	  _  _  	0
-WITH          CHECK OPTION -         <nothing>          -         <nothing>         	INSERT	  _v2_  	1369
 WITH          CHECK OPTION -         <nothing>          -         <nothing>         	INSERT	  _  _v1	1369
-WITH          CHECK OPTION -         <nothing>          -         <nothing>         	UPDATE	  _v2_  	1369
-WITH          CHECK OPTION -         <nothing>          -         <nothing>         	UPDATE	  _  _v1	1369
+WITH          CHECK OPTION -         <nothing>          -         <nothing>         	INSERT	  _v2_  	1369
 WITH          CHECK OPTION -         <nothing>          -         <nothing>         	UPDATE	  _  _  	0
-WITH          CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	UPDATE	  _v2_  	1369
-WITH          CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	UPDATE	v3_  _  	1369
-WITH          CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	INSERT	  _v2_  	1369
+WITH          CHECK OPTION -         <nothing>          -         <nothing>         	UPDATE	  _  _v1	1369
+WITH          CHECK OPTION -         <nothing>          -         <nothing>         	UPDATE	  _v2_  	1369
+WITH          CHECK OPTION -         <nothing>          -         <nothing>         	UPDATE	v3_  _  	1369
+WITH          CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	INSERT	  _  _  	0
 WITH          CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	INSERT	  _  _v1	1369
+WITH          CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	INSERT	  _v2_  	1369
 WITH          CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	UPDATE	  _  _  	0
 WITH          CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	UPDATE	  _  _v1	1369
-WITH          CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	INSERT	  _  _  	0
-WITH          CHECK OPTION -         <nothing>          - WITH CASCADED CHECK OPTION	UPDATE	v3_  _  	1369
+WITH          CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	UPDATE	  _v2_  	1369
+WITH          CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	UPDATE	v3_  _  	1369
 WITH          CHECK OPTION -         <nothing>          - WITH CASCADED CHECK OPTION	INSERT	  _  _  	0
-WITH          CHECK OPTION -         <nothing>          - WITH CASCADED CHECK OPTION	UPDATE	  _v2_  	1369
-WITH          CHECK OPTION -         <nothing>          - WITH CASCADED CHECK OPTION	INSERT	  _v2_  	1369
 WITH          CHECK OPTION -         <nothing>          - WITH CASCADED CHECK OPTION	INSERT	  _  _v1	1369
+WITH          CHECK OPTION -         <nothing>          - WITH CASCADED CHECK OPTION	INSERT	  _v2_  	1369
 WITH          CHECK OPTION -         <nothing>          - WITH CASCADED CHECK OPTION	UPDATE	  _  _  	0
 WITH          CHECK OPTION -         <nothing>          - WITH CASCADED CHECK OPTION	UPDATE	  _  _v1	1369
+WITH          CHECK OPTION -         <nothing>          - WITH CASCADED CHECK OPTION	UPDATE	  _v2_  	1369
+WITH          CHECK OPTION -         <nothing>          - WITH CASCADED CHECK OPTION	UPDATE	v3_  _  	1369
 WITH          CHECK OPTION -         <nothing>          - WITH LOCAL    CHECK OPTION	INSERT	  _  _  	0
-WITH          CHECK OPTION -         <nothing>          - WITH LOCAL    CHECK OPTION	UPDATE	  _v2_  	1369
-WITH          CHECK OPTION -         <nothing>          - WITH LOCAL    CHECK OPTION	UPDATE	  _  _v1	1369
-WITH          CHECK OPTION -         <nothing>          - WITH LOCAL    CHECK OPTION	UPDATE	  _  _  	0
 WITH          CHECK OPTION -         <nothing>          - WITH LOCAL    CHECK OPTION	INSERT	  _  _v1	1369
 WITH          CHECK OPTION -         <nothing>          - WITH LOCAL    CHECK OPTION	INSERT	  _v2_  	1369
+WITH          CHECK OPTION -         <nothing>          - WITH LOCAL    CHECK OPTION	UPDATE	  _  _  	0
+WITH          CHECK OPTION -         <nothing>          - WITH LOCAL    CHECK OPTION	UPDATE	  _  _v1	1369
+WITH          CHECK OPTION -         <nothing>          - WITH LOCAL    CHECK OPTION	UPDATE	  _v2_  	1369
 WITH          CHECK OPTION -         <nothing>          - WITH LOCAL    CHECK OPTION	UPDATE	v3_  _  	1369
-WITH          CHECK OPTION - WITH          CHECK OPTION -         <nothing>         	UPDATE	  _  _  	0
+WITH          CHECK OPTION - WITH          CHECK OPTION -         <nothing>         	INSERT	  _  _  	0
 WITH          CHECK OPTION - WITH          CHECK OPTION -         <nothing>         	INSERT	  _  _v1	1369
 WITH          CHECK OPTION - WITH          CHECK OPTION -         <nothing>         	INSERT	  _v2_  	1369
-WITH          CHECK OPTION - WITH          CHECK OPTION -         <nothing>         	INSERT	  _  _  	0
+WITH          CHECK OPTION - WITH          CHECK OPTION -         <nothing>         	UPDATE	  _  _  	0
 WITH          CHECK OPTION - WITH          CHECK OPTION -         <nothing>         	UPDATE	  _  _v1	1369
-WITH          CHECK OPTION - WITH          CHECK OPTION -         <nothing>         	UPDATE	v3_  _  	1369
 WITH          CHECK OPTION - WITH          CHECK OPTION -         <nothing>         	UPDATE	  _v2_  	1369
+WITH          CHECK OPTION - WITH          CHECK OPTION -         <nothing>         	UPDATE	v3_  _  	1369
+WITH          CHECK OPTION - WITH          CHECK OPTION - WITH          CHECK OPTION	INSERT	  _  _  	0
+WITH          CHECK OPTION - WITH          CHECK OPTION - WITH          CHECK OPTION	INSERT	  _  _v1	1369
 WITH          CHECK OPTION - WITH          CHECK OPTION - WITH          CHECK OPTION	INSERT	  _v2_  	1369
+WITH          CHECK OPTION - WITH          CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _  	0
+WITH          CHECK OPTION - WITH          CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _v1	1369
 WITH          CHECK OPTION - WITH          CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _v2_  	1369
 WITH          CHECK OPTION - WITH          CHECK OPTION - WITH          CHECK OPTION	UPDATE	v3_  _  	1369
-WITH          CHECK OPTION - WITH          CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _v1	1369
-WITH          CHECK OPTION - WITH          CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _  	0
-WITH          CHECK OPTION - WITH          CHECK OPTION - WITH          CHECK OPTION	INSERT	  _  _v1	1369
-WITH          CHECK OPTION - WITH          CHECK OPTION - WITH          CHECK OPTION	INSERT	  _  _  	0
+WITH          CHECK OPTION - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _  	0
 WITH          CHECK OPTION - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _v1	1369
+WITH          CHECK OPTION - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _v2_  	1369
+WITH          CHECK OPTION - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _  	0
+WITH          CHECK OPTION - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _v1	1369
 WITH          CHECK OPTION - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _v2_  	1369
 WITH          CHECK OPTION - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	v3_  _  	1369
-WITH          CHECK OPTION - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _  	0
-WITH          CHECK OPTION - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _v1	1369
-WITH          CHECK OPTION - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _  	0
-WITH          CHECK OPTION - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _v2_  	1369
-WITH          CHECK OPTION - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _v2_  	1369
+WITH          CHECK OPTION - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _  _  	0
 WITH          CHECK OPTION - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _  _v1	1369
-WITH          CHECK OPTION - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _v2_  	1369
+WITH          CHECK OPTION - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _v2_  	1369
 WITH          CHECK OPTION - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _  	0
 WITH          CHECK OPTION - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _v1	1369
-WITH          CHECK OPTION - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _  _  	0
+WITH          CHECK OPTION - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _v2_  	1369
 WITH          CHECK OPTION - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	v3_  _  	1369
-WITH          CHECK OPTION - WITH CASCADED CHECK OPTION -         <nothing>         	UPDATE	v3_  _  	1369
-WITH          CHECK OPTION - WITH CASCADED CHECK OPTION -         <nothing>         	UPDATE	  _v2_  	1369
-WITH          CHECK OPTION - WITH CASCADED CHECK OPTION -         <nothing>         	UPDATE	  _  _v1	1369
-WITH          CHECK OPTION - WITH CASCADED CHECK OPTION -         <nothing>         	UPDATE	  _  _  	0
+WITH          CHECK OPTION - WITH CASCADED CHECK OPTION -         <nothing>         	INSERT	  _  _  	0
 WITH          CHECK OPTION - WITH CASCADED CHECK OPTION -         <nothing>         	INSERT	  _  _v1	1369
 WITH          CHECK OPTION - WITH CASCADED CHECK OPTION -         <nothing>         	INSERT	  _v2_  	1369
-WITH          CHECK OPTION - WITH CASCADED CHECK OPTION -         <nothing>         	INSERT	  _  _  	0
-WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	UPDATE	v3_  _  	1369
-WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _v2_  	1369
-WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _v1	1369
-WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _  	0
+WITH          CHECK OPTION - WITH CASCADED CHECK OPTION -         <nothing>         	UPDATE	  _  _  	0
+WITH          CHECK OPTION - WITH CASCADED CHECK OPTION -         <nothing>         	UPDATE	  _  _v1	1369
+WITH          CHECK OPTION - WITH CASCADED CHECK OPTION -         <nothing>         	UPDATE	  _v2_  	1369
+WITH          CHECK OPTION - WITH CASCADED CHECK OPTION -         <nothing>         	UPDATE	v3_  _  	1369
+WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	INSERT	  _  _  	0
 WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	INSERT	  _  _v1	1369
 WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	INSERT	  _v2_  	1369
-WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	INSERT	  _  _  	0
-WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	v3_  _  	1369
-WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _v2_  	1369
+WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _  	0
+WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _v1	1369
+WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _v2_  	1369
+WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	UPDATE	v3_  _  	1369
+WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _  	0
 WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _v1	1369
+WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _v2_  	1369
 WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _  	0
 WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _v1	1369
 WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _v2_  	1369
-WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _  	0
+WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	v3_  _  	1369
+WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _  _  	0
+WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _  _v1	1369
 WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _v2_  	1369
-WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	v3_  _  	1369
-WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _v2_  	1369
-WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _v1	1369
 WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _  	0
-WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _  _v1	1369
-WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _  _  	0
+WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _v1	1369
+WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _v2_  	1369
+WITH          CHECK OPTION - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	v3_  _  	1369
+WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION -         <nothing>         	INSERT	  _  _  	0
 WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION -         <nothing>         	INSERT	  _  _v1	1369
+WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION -         <nothing>         	INSERT	  _v2_  	1369
 WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION -         <nothing>         	UPDATE	  _  _  	0
 WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION -         <nothing>         	UPDATE	  _  _v1	1369
-WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION -         <nothing>         	INSERT	  _  _  	0
-WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION -         <nothing>         	INSERT	  _v2_  	1369
 WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION -         <nothing>         	UPDATE	  _v2_  	1369
 WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION -         <nothing>         	UPDATE	v3_  _  	1369
 WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	INSERT	  _  _  	0
 WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	INSERT	  _  _v1	1369
-WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	UPDATE	v3_  _  	1369
+WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	INSERT	  _v2_  	1369
+WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _  	0
 WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _v1	1369
 WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _v2_  	1369
-WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _  	0
-WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	INSERT	  _v2_  	1369
-WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _v2_  	1369
+WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	UPDATE	v3_  _  	1369
+WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _  	0
 WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _v1	1369
+WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _v2_  	1369
 WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _  	0
 WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _v1	1369
-WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _  	0
-WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	v3_  _  	1369
 WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _v2_  	1369
-WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _  	0
+WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	v3_  _  	1369
+WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _  _  	0
 WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _  _v1	1369
-WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	v3_  _  	1369
-WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _v2_  	1369
 WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _v2_  	1369
-WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _  _  	0
+WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _  	0
 WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _v1	1369
-WITH CASCADED CHECK OPTION -         <nothing>          -         <nothing>         	INSERT	  _v2_  	1369
+WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _v2_  	1369
+WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	v3_  _  	1369
 WITH CASCADED CHECK OPTION -         <nothing>          -         <nothing>         	INSERT	  _  _  	0
+WITH CASCADED CHECK OPTION -         <nothing>          -         <nothing>         	INSERT	  _  _v1	1369
+WITH CASCADED CHECK OPTION -         <nothing>          -         <nothing>         	INSERT	  _v2_  	1369
 WITH CASCADED CHECK OPTION -         <nothing>          -         <nothing>         	UPDATE	  _  _  	0
 WITH CASCADED CHECK OPTION -         <nothing>          -         <nothing>         	UPDATE	  _  _v1	1369
 WITH CASCADED CHECK OPTION -         <nothing>          -         <nothing>         	UPDATE	  _v2_  	1369
 WITH CASCADED CHECK OPTION -         <nothing>          -         <nothing>         	UPDATE	v3_  _  	1369
-WITH CASCADED CHECK OPTION -         <nothing>          -         <nothing>         	INSERT	  _  _v1	1369
+WITH CASCADED CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	INSERT	  _  _  	0
+WITH CASCADED CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	INSERT	  _  _v1	1369
 WITH CASCADED CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	INSERT	  _v2_  	1369
-WITH CASCADED CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	UPDATE	v3_  _  	1369
-WITH CASCADED CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	UPDATE	  _v2_  	1369
-WITH CASCADED CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	UPDATE	  _  _v1	1369
 WITH CASCADED CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	UPDATE	  _  _  	0
-WITH CASCADED CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	INSERT	  _  _v1	1369
-WITH CASCADED CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	INSERT	  _  _  	0
-WITH CASCADED CHECK OPTION -         <nothing>          - WITH CASCADED CHECK OPTION	UPDATE	v3_  _  	1369
-WITH CASCADED CHECK OPTION -         <nothing>          - WITH CASCADED CHECK OPTION	UPDATE	  _v2_  	1369
-WITH CASCADED CHECK OPTION -         <nothing>          - WITH CASCADED CHECK OPTION	UPDATE	  _  _v1	1369
-WITH CASCADED CHECK OPTION -         <nothing>          - WITH CASCADED CHECK OPTION	UPDATE	  _  _  	0
-WITH CASCADED CHECK OPTION -         <nothing>          - WITH CASCADED CHECK OPTION	INSERT	  _v2_  	1369
+WITH CASCADED CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	UPDATE	  _  _v1	1369
+WITH CASCADED CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	UPDATE	  _v2_  	1369
+WITH CASCADED CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	UPDATE	v3_  _  	1369
 WITH CASCADED CHECK OPTION -         <nothing>          - WITH CASCADED CHECK OPTION	INSERT	  _  _  	0
 WITH CASCADED CHECK OPTION -         <nothing>          - WITH CASCADED CHECK OPTION	INSERT	  _  _v1	1369
-WITH CASCADED CHECK OPTION -         <nothing>          - WITH LOCAL    CHECK OPTION	UPDATE	  _v2_  	1369
+WITH CASCADED CHECK OPTION -         <nothing>          - WITH CASCADED CHECK OPTION	INSERT	  _v2_  	1369
+WITH CASCADED CHECK OPTION -         <nothing>          - WITH CASCADED CHECK OPTION	UPDATE	  _  _  	0
+WITH CASCADED CHECK OPTION -         <nothing>          - WITH CASCADED CHECK OPTION	UPDATE	  _  _v1	1369
+WITH CASCADED CHECK OPTION -         <nothing>          - WITH CASCADED CHECK OPTION	UPDATE	  _v2_  	1369
+WITH CASCADED CHECK OPTION -         <nothing>          - WITH CASCADED CHECK OPTION	UPDATE	v3_  _  	1369
 WITH CASCADED CHECK OPTION -         <nothing>          - WITH LOCAL    CHECK OPTION	INSERT	  _  _  	0
+WITH CASCADED CHECK OPTION -         <nothing>          - WITH LOCAL    CHECK OPTION	INSERT	  _  _v1	1369
 WITH CASCADED CHECK OPTION -         <nothing>          - WITH LOCAL    CHECK OPTION	INSERT	  _v2_  	1369
 WITH CASCADED CHECK OPTION -         <nothing>          - WITH LOCAL    CHECK OPTION	UPDATE	  _  _  	0
 WITH CASCADED CHECK OPTION -         <nothing>          - WITH LOCAL    CHECK OPTION	UPDATE	  _  _v1	1369
+WITH CASCADED CHECK OPTION -         <nothing>          - WITH LOCAL    CHECK OPTION	UPDATE	  _v2_  	1369
 WITH CASCADED CHECK OPTION -         <nothing>          - WITH LOCAL    CHECK OPTION	UPDATE	v3_  _  	1369
-WITH CASCADED CHECK OPTION -         <nothing>          - WITH LOCAL    CHECK OPTION	INSERT	  _  _v1	1369
-WITH CASCADED CHECK OPTION - WITH          CHECK OPTION -         <nothing>         	UPDATE	  _v2_  	1369
-WITH CASCADED CHECK OPTION - WITH          CHECK OPTION -         <nothing>         	UPDATE	v3_  _  	1369
-WITH CASCADED CHECK OPTION - WITH          CHECK OPTION -         <nothing>         	UPDATE	  _  _v1	1369
+WITH CASCADED CHECK OPTION - WITH          CHECK OPTION -         <nothing>         	INSERT	  _  _  	0
+WITH CASCADED CHECK OPTION - WITH          CHECK OPTION -         <nothing>         	INSERT	  _  _v1	1369
 WITH CASCADED CHECK OPTION - WITH          CHECK OPTION -         <nothing>         	INSERT	  _v2_  	1369
 WITH CASCADED CHECK OPTION - WITH          CHECK OPTION -         <nothing>         	UPDATE	  _  _  	0
-WITH CASCADED CHECK OPTION - WITH          CHECK OPTION -         <nothing>         	INSERT	  _  _v1	1369
-WITH CASCADED CHECK OPTION - WITH          CHECK OPTION -         <nothing>         	INSERT	  _  _  	0
-WITH CASCADED CHECK OPTION - WITH          CHECK OPTION - WITH          CHECK OPTION	UPDATE	v3_  _  	1369
+WITH CASCADED CHECK OPTION - WITH          CHECK OPTION -         <nothing>         	UPDATE	  _  _v1	1369
+WITH CASCADED CHECK OPTION - WITH          CHECK OPTION -         <nothing>         	UPDATE	  _v2_  	1369
+WITH CASCADED CHECK OPTION - WITH          CHECK OPTION -         <nothing>         	UPDATE	v3_  _  	1369
 WITH CASCADED CHECK OPTION - WITH          CHECK OPTION - WITH          CHECK OPTION	INSERT	  _  _  	0
-WITH CASCADED CHECK OPTION - WITH          CHECK OPTION - WITH          CHECK OPTION	INSERT	  _v2_  	1369
 WITH CASCADED CHECK OPTION - WITH          CHECK OPTION - WITH          CHECK OPTION	INSERT	  _  _v1	1369
+WITH CASCADED CHECK OPTION - WITH          CHECK OPTION - WITH          CHECK OPTION	INSERT	  _v2_  	1369
 WITH CASCADED CHECK OPTION - WITH          CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _  	0
 WITH CASCADED CHECK OPTION - WITH          CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _v1	1369
 WITH CASCADED CHECK OPTION - WITH          CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _v2_  	1369
+WITH CASCADED CHECK OPTION - WITH          CHECK OPTION - WITH          CHECK OPTION	UPDATE	v3_  _  	1369
 WITH CASCADED CHECK OPTION - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _  	0
-WITH CASCADED CHECK OPTION - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	v3_  _  	1369
+WITH CASCADED CHECK OPTION - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _v1	1369
 WITH CASCADED CHECK OPTION - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _v2_  	1369
-WITH CASCADED CHECK OPTION - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _v2_  	1369
-WITH CASCADED CHECK OPTION - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _v1	1369
 WITH CASCADED CHECK OPTION - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _  	0
-WITH CASCADED CHECK OPTION - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _v1	1369
+WITH CASCADED CHECK OPTION - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _v1	1369
+WITH CASCADED CHECK OPTION - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _v2_  	1369
+WITH CASCADED CHECK OPTION - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	v3_  _  	1369
+WITH CASCADED CHECK OPTION - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _  _  	0
 WITH CASCADED CHECK OPTION - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _  _v1	1369
-WITH CASCADED CHECK OPTION - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	v3_  _  	1369
 WITH CASCADED CHECK OPTION - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _v2_  	1369
-WITH CASCADED CHECK OPTION - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _  _  	0
-WITH CASCADED CHECK OPTION - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _v2_  	1369
-WITH CASCADED CHECK OPTION - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _v1	1369
 WITH CASCADED CHECK OPTION - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _  	0
-WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION -         <nothing>         	UPDATE	  _v2_  	1369
-WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION -         <nothing>         	UPDATE	v3_  _  	1369
-WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION -         <nothing>         	INSERT	  _v2_  	1369
+WITH CASCADED CHECK OPTION - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _v1	1369
+WITH CASCADED CHECK OPTION - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _v2_  	1369
+WITH CASCADED CHECK OPTION - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	v3_  _  	1369
+WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION -         <nothing>         	INSERT	  _  _  	0
 WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION -         <nothing>         	INSERT	  _  _v1	1369
+WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION -         <nothing>         	INSERT	  _v2_  	1369
 WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION -         <nothing>         	UPDATE	  _  _  	0
 WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION -         <nothing>         	UPDATE	  _  _v1	1369
-WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION -         <nothing>         	INSERT	  _  _  	0
-WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _  	0
+WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION -         <nothing>         	UPDATE	  _v2_  	1369
+WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION -         <nothing>         	UPDATE	v3_  _  	1369
 WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	INSERT	  _  _  	0
-WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _v1	1369
-WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	INSERT	  _v2_  	1369
 WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	INSERT	  _  _v1	1369
+WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	INSERT	  _v2_  	1369
+WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _  	0
+WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _v1	1369
 WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _v2_  	1369
 WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	UPDATE	v3_  _  	1369
+WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _  	0
+WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _v1	1369
 WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _v2_  	1369
-WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _v2_  	1369
-WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _v1	1369
 WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _  	0
-WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _v1	1369
-WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _  	0
+WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _v1	1369
+WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _v2_  	1369
 WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	v3_  _  	1369
-WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _v2_  	1369
 WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _  _  	0
-WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _v1	1369
-WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _  	0
 WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _  _v1	1369
 WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _v2_  	1369
+WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _  	0
+WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _v1	1369
+WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _v2_  	1369
 WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	v3_  _  	1369
-WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION -         <nothing>         	UPDATE	  _v2_  	1369
-WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION -         <nothing>         	UPDATE	v3_  _  	1369
-WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION -         <nothing>         	UPDATE	  _  _v1	1369
-WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION -         <nothing>         	UPDATE	  _  _  	0
+WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION -         <nothing>         	INSERT	  _  _  	0
 WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION -         <nothing>         	INSERT	  _  _v1	1369
 WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION -         <nothing>         	INSERT	  _v2_  	1369
-WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION -         <nothing>         	INSERT	  _  _  	0
+WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION -         <nothing>         	UPDATE	  _  _  	0
+WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION -         <nothing>         	UPDATE	  _  _v1	1369
+WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION -         <nothing>         	UPDATE	  _v2_  	1369
+WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION -         <nothing>         	UPDATE	v3_  _  	1369
 WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	INSERT	  _  _  	0
-WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	INSERT	  _v2_  	1369
-WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	UPDATE	v3_  _  	1369
-WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _v2_  	1369
-WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _v1	1369
 WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	INSERT	  _  _v1	1369
+WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	INSERT	  _v2_  	1369
 WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _  	0
+WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _v1	1369
+WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _v2_  	1369
+WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	UPDATE	v3_  _  	1369
 WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _  	0
+WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _v1	1369
 WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _v2_  	1369
 WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _  	0
 WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _v1	1369
 WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _v2_  	1369
-WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _v1	1369
 WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	v3_  _  	1369
-WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _v1	1369
 WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _  _  	0
-WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _v2_  	1369
-WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	v3_  _  	1369
-WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _v2_  	1369
 WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _  _v1	1369
+WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _v2_  	1369
 WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _  	0
+WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _v1	1369
+WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _v2_  	1369
+WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	v3_  _  	1369
 WITH LOCAL    CHECK OPTION -         <nothing>          -         <nothing>         	INSERT	  _  _  	0
-WITH LOCAL    CHECK OPTION -         <nothing>          -         <nothing>         	UPDATE	  _v2_  	0
-WITH LOCAL    CHECK OPTION -         <nothing>          -         <nothing>         	UPDATE	  _  _v1	0
-WITH LOCAL    CHECK OPTION -         <nothing>          -         <nothing>         	UPDATE	  _  _  	0
 WITH LOCAL    CHECK OPTION -         <nothing>          -         <nothing>         	INSERT	  _  _v1	0
 WITH LOCAL    CHECK OPTION -         <nothing>          -         <nothing>         	INSERT	  _v2_  	0
+WITH LOCAL    CHECK OPTION -         <nothing>          -         <nothing>         	UPDATE	  _  _  	0
+WITH LOCAL    CHECK OPTION -         <nothing>          -         <nothing>         	UPDATE	  _  _v1	0
+WITH LOCAL    CHECK OPTION -         <nothing>          -         <nothing>         	UPDATE	  _v2_  	0
 WITH LOCAL    CHECK OPTION -         <nothing>          -         <nothing>         	UPDATE	v3_  _  	1369
-WITH LOCAL    CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	UPDATE	  _  _  	0
-WITH LOCAL    CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	UPDATE	v3_  _  	1369
-WITH LOCAL    CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	UPDATE	  _v2_  	0
-WITH LOCAL    CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	UPDATE	  _  _v1	0
+WITH LOCAL    CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	INSERT	  _  _  	0
 WITH LOCAL    CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	INSERT	  _  _v1	0
 WITH LOCAL    CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	INSERT	  _v2_  	0
-WITH LOCAL    CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	INSERT	  _  _  	0
-WITH LOCAL    CHECK OPTION -         <nothing>          - WITH CASCADED CHECK OPTION	INSERT	  _v2_  	0
+WITH LOCAL    CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	UPDATE	  _  _  	0
+WITH LOCAL    CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	UPDATE	  _  _v1	0
+WITH LOCAL    CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	UPDATE	  _v2_  	0
+WITH LOCAL    CHECK OPTION -         <nothing>          - WITH          CHECK OPTION	UPDATE	v3_  _  	1369
 WITH LOCAL    CHECK OPTION -         <nothing>          - WITH CASCADED CHECK OPTION	INSERT	  _  _  	0
 WITH LOCAL    CHECK OPTION -         <nothing>          - WITH CASCADED CHECK OPTION	INSERT	  _  _v1	0
-WITH LOCAL    CHECK OPTION -         <nothing>          - WITH CASCADED CHECK OPTION	UPDATE	v3_  _  	1369
-WITH LOCAL    CHECK OPTION -         <nothing>          - WITH CASCADED CHECK OPTION	UPDATE	  _v2_  	0
-WITH LOCAL    CHECK OPTION -         <nothing>          - WITH CASCADED CHECK OPTION	UPDATE	  _  _v1	0
+WITH LOCAL    CHECK OPTION -         <nothing>          - WITH CASCADED CHECK OPTION	INSERT	  _v2_  	0
 WITH LOCAL    CHECK OPTION -         <nothing>          - WITH CASCADED CHECK OPTION	UPDATE	  _  _  	0
+WITH LOCAL    CHECK OPTION -         <nothing>          - WITH CASCADED CHECK OPTION	UPDATE	  _  _v1	0
+WITH LOCAL    CHECK OPTION -         <nothing>          - WITH CASCADED CHECK OPTION	UPDATE	  _v2_  	0
+WITH LOCAL    CHECK OPTION -         <nothing>          - WITH CASCADED CHECK OPTION	UPDATE	v3_  _  	1369
 WITH LOCAL    CHECK OPTION -         <nothing>          - WITH LOCAL    CHECK OPTION	INSERT	  _  _  	0
-WITH LOCAL    CHECK OPTION -         <nothing>          - WITH LOCAL    CHECK OPTION	INSERT	  _v2_  	0
 WITH LOCAL    CHECK OPTION -         <nothing>          - WITH LOCAL    CHECK OPTION	INSERT	  _  _v1	0
+WITH LOCAL    CHECK OPTION -         <nothing>          - WITH LOCAL    CHECK OPTION	INSERT	  _v2_  	0
 WITH LOCAL    CHECK OPTION -         <nothing>          - WITH LOCAL    CHECK OPTION	UPDATE	  _  _  	0
 WITH LOCAL    CHECK OPTION -         <nothing>          - WITH LOCAL    CHECK OPTION	UPDATE	  _  _v1	0
 WITH LOCAL    CHECK OPTION -         <nothing>          - WITH LOCAL    CHECK OPTION	UPDATE	  _v2_  	0
 WITH LOCAL    CHECK OPTION -         <nothing>          - WITH LOCAL    CHECK OPTION	UPDATE	v3_  _  	1369
-WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION -         <nothing>         	UPDATE	  _v2_  	0
-WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION -         <nothing>         	UPDATE	v3_  _  	1369
-WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION -         <nothing>         	UPDATE	  _  _  	0
 WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION -         <nothing>         	INSERT	  _  _  	0
-WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION -         <nothing>         	INSERT	  _v2_  	0
 WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION -         <nothing>         	INSERT	  _  _v1	0
+WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION -         <nothing>         	INSERT	  _v2_  	0
+WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION -         <nothing>         	UPDATE	  _  _  	0
 WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION -         <nothing>         	UPDATE	  _  _v1	0
-WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _v2_  	0
-WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION - WITH          CHECK OPTION	UPDATE	v3_  _  	1369
+WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION -         <nothing>         	UPDATE	  _v2_  	0
+WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION -         <nothing>         	UPDATE	v3_  _  	1369
 WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION - WITH          CHECK OPTION	INSERT	  _  _  	0
-WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION - WITH          CHECK OPTION	INSERT	  _v2_  	0
-WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _v1	0
 WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION - WITH          CHECK OPTION	INSERT	  _  _v1	0
+WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION - WITH          CHECK OPTION	INSERT	  _v2_  	0
 WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _  	0
-WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _v2_  	0
-WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _v1	0
-WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _  	0
+WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _v1	0
+WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _v2_  	0
+WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION - WITH          CHECK OPTION	UPDATE	v3_  _  	1369
+WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _  	0
 WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _v1	0
 WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _v2_  	0
-WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _  	0
+WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _  	0
+WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _v1	0
+WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _v2_  	0
 WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	v3_  _  	1369
 WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _  _  	0
-WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _v2_  	0
 WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _  _v1	0
+WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _v2_  	0
 WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _  	0
 WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _v1	0
-WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	v3_  _  	1369
 WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _v2_  	0
-WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION -         <nothing>         	INSERT	  _v2_  	0
+WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	v3_  _  	1369
+WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION -         <nothing>         	INSERT	  _  _  	0
 WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION -         <nothing>         	INSERT	  _  _v1	0
+WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION -         <nothing>         	INSERT	  _v2_  	0
 WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION -         <nothing>         	UPDATE	  _  _  	0
 WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION -         <nothing>         	UPDATE	  _  _v1	0
 WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION -         <nothing>         	UPDATE	  _v2_  	0
 WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION -         <nothing>         	UPDATE	v3_  _  	1369
-WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION -         <nothing>         	INSERT	  _  _  	0
 WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	INSERT	  _  _  	0
-WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	UPDATE	v3_  _  	1369
-WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _v1	0
-WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	INSERT	  _v2_  	0
-WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _v2_  	0
 WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	INSERT	  _  _v1	0
+WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	INSERT	  _v2_  	0
 WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _  	0
-WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _v2_  	0
-WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _v1	0
+WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _v1	0
+WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _v2_  	0
+WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION - WITH          CHECK OPTION	UPDATE	v3_  _  	1369
 WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _  	0
+WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _v1	0
+WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _v2_  	0
 WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _  	0
 WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _v1	0
 WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _v2_  	0
 WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	v3_  _  	1369
-WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	v3_  _  	1369
-WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _  	0
 WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _  _  	0
-WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _v2_  	0
-WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _v2_  	0
 WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _  _v1	0
+WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _v2_  	0
+WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _  	0
 WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _v1	0
-WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION -         <nothing>         	UPDATE	  _  _  	0
-WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION -         <nothing>         	INSERT	  _  _v1	0
+WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _v2_  	0
+WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	v3_  _  	1369
 WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION -         <nothing>         	INSERT	  _  _  	0
+WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION -         <nothing>         	INSERT	  _  _v1	0
+WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION -         <nothing>         	INSERT	  _v2_  	0
+WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION -         <nothing>         	UPDATE	  _  _  	0
 WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION -         <nothing>         	UPDATE	  _  _v1	0
 WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION -         <nothing>         	UPDATE	  _v2_  	0
 WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION -         <nothing>         	UPDATE	v3_  _  	1369
-WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION -         <nothing>         	INSERT	  _v2_  	0
-WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _  	0
 WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	INSERT	  _  _  	0
 WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	INSERT	  _  _v1	0
 WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	INSERT	  _v2_  	0
+WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _  	0
 WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _  _v1	0
 WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	UPDATE	  _v2_  	0
 WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH          CHECK OPTION	UPDATE	v3_  _  	1369
-WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _v1	0
 WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _  	0
-WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _v2_  	0
 WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _  _v1	0
+WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	INSERT	  _v2_  	0
 WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _  	0
-WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	v3_  _  	1369
+WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _  _v1	0
 WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	  _v2_  	0
-WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _v2_  	0
-WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _v1	0
-WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _  	0
-WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _  _v1	0
+WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH CASCADED CHECK OPTION	UPDATE	v3_  _  	1369
 WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _  _  	0
-WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	v3_  _  	1369
+WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _  _v1	0
 WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	INSERT	  _v2_  	0
+WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _  	0
+WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _  _v1	0
+WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	  _v2_  	0
+WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION - WITH LOCAL    CHECK OPTION	UPDATE	v3_  _  	1369
 
 Plausibility checks for INSERTs and UPDATEs ( 4. and 5. above).
 All following SELECTs must give ROW NOT FOUND 

=== modified file 'mysql-test/suite/funcs_1/views/views_master.inc'
--- a/mysql-test/suite/funcs_1/views/views_master.inc	2010-11-29 13:04:34 +0000
+++ b/mysql-test/suite/funcs_1/views/views_master.inc	2012-02-07 11:56:30 +0000
@@ -2262,7 +2262,7 @@ while ($num1)
   dec $num1;
 }
 
-SELECT * FROM t1_results ORDER BY v3_to_v1_options;
+SELECT * FROM t1_results ORDER BY v3_to_v1_options, statement, v3_to_v1_violation, errno;
 
 let $message=
 Plausibility checks for INSERTs and UPDATEs ( 4. and 5. above).

=== modified file 'mysql-test/suite/innodb/r/innodb.result'
--- a/mysql-test/suite/innodb/r/innodb.result	2012-02-01 14:09:34 +0000
+++ b/mysql-test/suite/innodb/r/innodb.result	2012-02-08 17:06:22 +0000
@@ -1974,15 +1974,15 @@ i	10
 select sql_big_result v,count(c) from t1 group by v limit 10;
 v	count(c)
 a	1
-a 	10
-b     	10
-c    	10
-d   	10
-e  	10
-f     	10
-g    	10
+a	10
+b	10
+c	10
+d	10
+e	10
+f	10
+g	10
 h	10
-i     	10
+i	10
 select c,count(*) from t1 group by c limit 10;
 c	count(*)
 a	1

=== added file 'mysql-test/suite/innodb/r/innodb_bug11754376.result'
--- a/mysql-test/suite/innodb/r/innodb_bug11754376.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb/r/innodb_bug11754376.result	2012-02-06 11:00:41 +0000
@@ -0,0 +1,4 @@
+CREATE TABLE bug11754376 (c INT) ENGINE=INNODB;
+SET SESSION DEBUG='+d,test_normalize_table_name_low';
+DROP TABLE bug11754376;
+SET SESSION DEBUG='-d,test_normalize_table_name_low';

=== added file 'mysql-test/suite/innodb/t/innodb_bug11754376.test'
--- a/mysql-test/suite/innodb/t/innodb_bug11754376.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb/t/innodb_bug11754376.test	2012-02-06 11:00:41 +0000
@@ -0,0 +1,16 @@
+#
+# Bug#11754376 45976: INNODB LOST FILES FOR TEMPORARY TABLES ON GRACEFUL SHUTDOWN
+#
+
+-- source include/have_debug.inc
+-- source include/have_innodb.inc
+
+CREATE TABLE bug11754376 (c INT) ENGINE=INNODB;
+
+# This will invoke test_normalize_table_name_low() in debug builds
+
+SET SESSION DEBUG='+d,test_normalize_table_name_low';
+
+DROP TABLE bug11754376;
+
+SET SESSION DEBUG='-d,test_normalize_table_name_low';

=== modified file 'mysql-test/suite/opt_trace/r/eq_range_statistics.result'
--- a/mysql-test/suite/opt_trace/r/eq_range_statistics.result	2012-01-26 13:09:59 +0000
+++ b/mysql-test/suite/opt_trace/r/eq_range_statistics.result	2012-02-02 16:56:36 +0000
@@ -36,10 +36,17 @@ SET eq_range_index_dive_limit=3;
 SELECT @@eq_range_index_dive_limit;
 @@eq_range_index_dive_limit
 3
+SET SESSION DEBUG="+d,crash_records_in_range";
 # Index statistics kicks in, giving incorrect estimate of 3x2=6 records
 EXPLAIN SELECT * FROM t1 WHERE a IN (1,2,3);
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t1	range	a	a	5	NULL	6	Using where; Using index
+SELECT * FROM t1 WHERE a IN (1,2,3);
+a	b
+1	1
+2	2
+3	3
+SET SESSION DEBUG="-d,crash_records_in_range";
 #####
 # Below: A number of tests to verify that the number of equality ranges
 # are counted correctly
@@ -422,6 +429,7 @@ EXPLAIN SELECT * FROM t1 WHERE a=5 OR a>
 }	0	0
 
 # 3 equality ranges: should use index statistics
+SET SESSION DEBUG="+d,crash_records_in_range";
 EXPLAIN SELECT * FROM t1 WHERE a=5 AND (b=2 OR b=3 OR b=4);
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t1	range	a	a	10	NULL	3	Using where; Using index
@@ -631,6 +639,7 @@ EXPLAIN SELECT * FROM t1 WHERE a=5 AND (
     }
   ] /* steps */
 }	0	0
+SET SESSION DEBUG="-d,crash_records_in_range";
 
 # 2 equality ranges: should not use index statistics
 EXPLAIN SELECT * FROM t1 WHERE a=5 AND (b=2 OR b=3 OR b>4);

=== modified file 'mysql-test/suite/opt_trace/t/eq_range_statistics.test'
--- a/mysql-test/suite/opt_trace/t/eq_range_statistics.test	2012-01-26 13:09:59 +0000
+++ b/mysql-test/suite/opt_trace/t/eq_range_statistics.test	2012-02-03 07:36:30 +0000
@@ -5,6 +5,7 @@
 #   predicate
 
 --source include/have_optimizer_trace.inc
+--source include/have_debug.inc
 
 SET optimizer_trace_max_mem_size=1048576; # 1MB
 SET optimizer_trace="enabled=on,end_marker=on,one_line=off";
@@ -38,8 +39,12 @@ EXPLAIN SELECT * FROM t1 WHERE a IN (1,2
 SET eq_range_index_dive_limit=3;
 SELECT @@eq_range_index_dive_limit;
 
+# Crash server if records_in_range() is called
+SET SESSION DEBUG="+d,crash_records_in_range";
 --echo # Index statistics kicks in, giving incorrect estimate of 3x2=6 records
 EXPLAIN SELECT * FROM t1 WHERE a IN (1,2,3);
+SELECT * FROM t1 WHERE a IN (1,2,3);
+SET SESSION DEBUG="-d,crash_records_in_range";
 
 --echo #####
 --echo # Below: A number of tests to verify that the number of equality ranges
@@ -53,15 +58,21 @@ EXPLAIN SELECT * FROM t1 WHERE a IN (1,2
 EXPLAIN SELECT * FROM t1 WHERE a=5 OR a>10 OR a IN (1);
 SELECT * FROM information_schema.OPTIMIZER_TRACE;
 
+# This query will use index statistics (as shown in trace) but
+# we cannot make it crash if records_in_range() is called
+# because the "a>10" range will correctly call records_in_range()
 --echo
 --echo # 3 equality ranges: should use index statistics
 EXPLAIN SELECT * FROM t1 WHERE a=5 OR a>10 OR a IN (1,2);
 SELECT * FROM information_schema.OPTIMIZER_TRACE;
 
+# Crash server if records_in_range() is called
 --echo
 --echo # 3 equality ranges: should use index statistics
+SET SESSION DEBUG="+d,crash_records_in_range";
 EXPLAIN SELECT * FROM t1 WHERE a=5 AND (b=2 OR b=3 OR b=4);
 SELECT * FROM information_schema.OPTIMIZER_TRACE;
+SET SESSION DEBUG="-d,crash_records_in_range";
 
 --echo
 --echo # 2 equality ranges: should not use index statistics

=== modified file 'mysql-test/suite/rpl/r/rpl_change_master.result'
--- a/mysql-test/suite/rpl/r/rpl_change_master.result	2011-11-19 08:08:03 +0000
+++ b/mysql-test/suite/rpl/r/rpl_change_master.result	2012-02-03 23:52:29 +0000
@@ -96,4 +96,27 @@ drop table t1;
 include/stop_slave.inc
 CHANGE MASTER TO master_host='SAVE_MASTER_HOST';
 include/start_slave.inc
+include/rpl_reset.inc
+include/stop_slave.inc
+CHANGE MASTER TO MASTER_USER='root', MASTER_HOST='', MASTER_PORT=MASTER_PORT;
+ERROR HY000: Incorrect arguments to MASTER_HOST
+CHANGE MASTER TO MASTER_USER='root', MASTER_HOST='127.0.0.1\n127.0.0.1', MASTER_PORT=MASTER_PORT;
+ERROR HY000: Incorrect argument contains not-allowed LF value: '127.0.0.1
+127.0.0.1'
+CHANGE MASTER TO MASTER_USER='root\n', MASTER_HOST='master2.mycompany.com', MASTER_PORT=MASTER_PORT, MASTER_USER='replication', MASTER_PASSWORD='bigs3cret', MASTER_LOG_FILE='master2-bin.001', MASTER_LOG_POS=4;
+ERROR HY000: Incorrect argument contains not-allowed LF value: 'root
+'
+CHANGE MASTER TO MASTER_USER='root', MASTER_HOST='master2.mycompany.com', MASTER_PORT=MASTER_PORT, MASTER_USER='repli\ncation', MASTER_PASSWORD='bigs3cret', MASTER_LOG_FILE='master2-bin.001', MASTER_LOG_POS=4;
+ERROR HY000: Incorrect argument contains not-allowed LF value: 'repli
+cation'
+CHANGE MASTER TO MASTER_USER='root', MASTER_HOST='master2.mycompany.com', MASTER_PORT=MASTER_PORT, MASTER_USER='replication', MASTER_PASSWORD='bigs3cret', MASTER_LOG_FILE='master2-bin.\n001', MASTER_LOG_POS=4;
+ERROR HY000: Incorrect argument contains not-allowed LF value: 'master2-bin.
+001'
+CHANGE MASTER TO MASTER_USER='root', MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT;
+Warnings:
+Note	1756	Sending passwords in plain text without SSL/TLS is extremely insecure.
+Note	1757	Storing MySQL user name or password information in the master.info repository is not secure and is therefore not recommended. Please see the MySQL Manual for more about this issue and possible alternatives.
+include/start_slave.inc
+Master_Host = '127.0.0.1'
+include/rpl_reset.inc
 include/rpl_end.inc

=== modified file 'mysql-test/suite/rpl/r/rpl_corruption.result'
--- a/mysql-test/suite/rpl/r/rpl_corruption.result	2011-11-19 08:08:03 +0000
+++ b/mysql-test/suite/rpl/r/rpl_corruption.result	2012-02-06 11:55:44 +0000
@@ -32,7 +32,7 @@ SET GLOBAL master_verify_checksum=1;
 # 5. Slave. Corruption in network
 SET GLOBAL debug="d,corrupt_queue_event";
 START SLAVE IO_THREAD;
-include/wait_for_slave_io_error.inc [errno=1595,1722]
+include/wait_for_slave_io_error.inc [errno=1595,1721]
 # 6. Slave. Corruption in relay log
 SET GLOBAL debug="d,corrupt_read_log_event_char";
 START SLAVE SQL_THREAD;

=== modified file 'mysql-test/suite/rpl/t/rpl_change_master.test'
--- a/mysql-test/suite/rpl/t/rpl_change_master.test	2010-12-19 17:25:42 +0000
+++ b/mysql-test/suite/rpl/t/rpl_change_master.test	2012-02-03 23:52:29 +0000
@@ -11,4 +11,51 @@
 
 --source include/master-slave.inc
 --source extra/rpl_tests/rpl_change_master.test
+
+
+# BUG#11758581 - 50801: CHANGE MASTER ACCEPTS BOGUS VARIABLES
+# We want to check if CHANGE MASTER values have newline characters.
+--source include/rpl_reset.inc
+connection slave;
+
+###
+### This should fail with error ER_WRONG_ARGUMENTS due to empty MASTER_HOST
+### value.
+###
+--source include/stop_slave.inc
+--replace_result $MASTER_MYPORT MASTER_PORT
+--error ER_WRONG_ARGUMENTS
+eval CHANGE MASTER TO MASTER_USER='root', MASTER_HOST='', MASTER_PORT=$MASTER_MYPORT;
+
+###
+### This should fail with error ER_SYNTAX_ERROR due to newline
+### in string values.
+###
+--replace_result $MASTER_MYPORT MASTER_PORT
+--error ER_WRONG_VALUE
+eval CHANGE MASTER TO MASTER_USER='root', MASTER_HOST='127.0.0.1\n127.0.0.1', MASTER_PORT=$MASTER_MYPORT;
+
+--replace_result $MASTER_MYPORT MASTER_PORT
+--error ER_WRONG_VALUE
+eval CHANGE MASTER TO MASTER_USER='root\n', MASTER_HOST='master2.mycompany.com', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='replication', MASTER_PASSWORD='bigs3cret', MASTER_LOG_FILE='master2-bin.001', MASTER_LOG_POS=4;
+
+--replace_result $MASTER_MYPORT MASTER_PORT
+--error ER_WRONG_VALUE
+eval CHANGE MASTER TO MASTER_USER='root', MASTER_HOST='master2.mycompany.com', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='repli\ncation', MASTER_PASSWORD='bigs3cret', MASTER_LOG_FILE='master2-bin.001', MASTER_LOG_POS=4;
+
+--replace_result $MASTER_MYPORT MASTER_PORT
+--error ER_WRONG_VALUE
+eval CHANGE MASTER TO MASTER_USER='root', MASTER_HOST='master2.mycompany.com', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='replication', MASTER_PASSWORD='bigs3cret', MASTER_LOG_FILE='master2-bin.\n001', MASTER_LOG_POS=4;
+
+###
+### This should be accepted.
+###
+--replace_result $MASTER_MYPORT MASTER_PORT
+eval CHANGE MASTER TO MASTER_USER='root', MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT;
+
+--source include/start_slave.inc
+--let $status_items= Master_Host
+--source include/show_slave_status.inc
+--source include/rpl_reset.inc
+
 --source include/rpl_end.inc

=== modified file 'mysql-test/suite/rpl/t/rpl_corruption.test'
--- a/mysql-test/suite/rpl/t/rpl_corruption.test	2011-08-19 13:04:28 +0000
+++ b/mysql-test/suite/rpl/t/rpl_corruption.test	2012-02-06 11:55:44 +0000
@@ -102,7 +102,7 @@ SET GLOBAL master_verify_checksum=1;
 --connection slave
 SET GLOBAL debug="d,corrupt_queue_event";
 START SLAVE IO_THREAD;
-let $slave_io_errno= 1595,1722;
+let $slave_io_errno= 1595,1721;
 --source include/wait_for_slave_io_error.inc
 
 # Emulate corruption in relay log

=== added file 'mysql-test/t/eq_range_idx_stat.test'
--- a/mysql-test/t/eq_range_idx_stat.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/eq_range_idx_stat.test	2012-02-02 16:56:36 +0000
@@ -0,0 +1,101 @@
+# Tests for eq_range_index_dive_limit variable: 
+#   test that index dives are not done when index 
+#   statistics is requested
+
+--source include/have_debug.inc
+
+SET eq_range_index_dive_limit=default;
+SELECT @@eq_range_index_dive_limit;
+
+CREATE TABLE t1
+(
+  /* Field names reflect value(rowid) distribution, st=STairs, swt= SaWTooth */
+  st_a int,
+  swt1a int,
+  swt2a int,
+
+  st_b int,
+  swt1b int,
+  swt2b int,
+
+  key sta_swt12a(st_a,swt1a,swt2a),
+  key sta_swt1a(st_a,swt1a),
+  key sta_swt2a(st_a,swt2a),
+  key sta_swt21a(st_a,swt2a,swt1a),
+
+  key st_a(st_a),
+  key stb_swt1a_2b(st_b,swt1b,swt2a),
+  key stb_swt1b(st_b,swt1b),
+  key st_b(st_b)
+) ;
+
+ALTER TABLE t1 DISABLE KEYS;
+
+--disable_query_log
+--echo #
+--echo # Printing of many insert into t1 disabled.
+--echo #
+let $1=3;
+while ($1)
+{
+  let $2=3;
+  while ($2)
+  {
+    let $3=3;
+    while ($3)
+    {
+      let $equal_records=30;
+      while ($equal_records)
+      {
+        eval insert into t1 select $1, $2, $3, $1 ,$2, $3;
+        dec $equal_records;
+      }
+      dec $3;
+    }
+    dec $2;
+  }
+ dec $1;
+}
+--enable_query_log
+ALTER TABLE t1 ENABLE KEYS;
+ANALYZE TABLE t1;
+
+--echo #
+--echo # Run index_merge queries two times: 1) with index dives
+--echo #                                    2) with index statistics
+--echo #
+let $iterations=2;
+while ($iterations)
+{
+  dec $iterations;
+
+  --echo
+  explain 
+  select * from t1 
+  where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1 and swt2b=1 limit 5;
+
+  select * from t1 
+  where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1 and swt2b=1 limit 5;
+
+  --echo
+  explain 
+  select * from t1
+  where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1 limit 5;
+
+  select * from t1
+  where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1 limit 5;
+
+  --echo
+  explain 
+  select * from t1
+  where st_a=1 and swt1a=1 and st_b=1 and swt1b=1 and swt1b=1 limit 5;
+
+  select * from t1
+  where st_a=1 and swt1a=1 and st_b=1 and swt1b=1 and swt1b=1 limit 5;
+
+  --echo
+  SET eq_range_index_dive_limit=1;
+  SET SESSION DEBUG="+d,crash_records_in_range";
+}
+
+DROP TABLE t1;

=== modified file 'mysql-test/t/innodb_mysql_sync.test'
--- a/mysql-test/t/innodb_mysql_sync.test	2012-02-01 11:43:43 +0000
+++ b/mysql-test/t/innodb_mysql_sync.test	2012-02-08 17:06:22 +0000
@@ -305,6 +305,62 @@ disconnect con1;
 
 
 --echo #
+--echo # Bug#13417754 ASSERT IN ROW_DROP_DATABASE_FOR_MYSQL DURING DROP SCHEMA
+--echo #
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+DROP DATABASE IF EXISTS db1;
+--enable_warnings
+
+CREATE TABLE t1(a int) engine=InnoDB;
+CREATE DATABASE db1;
+
+connect(con1, localhost, root);
+connect(con2, localhost, root);
+
+--echo # Connection con1
+connection con1;
+SET DEBUG_SYNC= 'after_innobase_rename_table SIGNAL locked WAIT_FOR continue';
+--echo # Sending:
+--send ALTER TABLE t1 RENAME db1.t1
+
+--echo # Connection con2
+connection con2;
+SET DEBUG_SYNC= 'now WAIT_FOR locked';
+--echo # DROP DATABASE db1 should now be blocked by ALTER TABLE
+--echo # Sending:
+--send DROP DATABASE db1
+
+--echo # Connection default
+connection default;
+--echo # Check that DROP DATABASE is blocked by IX lock on db1
+let $wait_condition=
+  SELECT COUNT(*) = 1 FROM information_schema.processlist
+  WHERE state = "Waiting for schema metadata lock" and
+        info = "DROP DATABASE db1";
+--source include/wait_condition.inc
+--echo # Resume ALTER TABLE
+SET DEBUG_SYNC= 'now SIGNAL continue';
+
+--echo # Connection con1
+connection con1;
+--echo # Reaping: ALTER TABLE t1 RENAME db1.t1;
+--reap
+
+--echo # Connection con2
+connection con2;
+--echo # Reaping: DROP DATABASE db1
+--reap
+
+--echo # Connection default;
+connection default;
+SET DEBUG_SYNC= 'RESET';
+disconnect con1;
+disconnect con2;
+
+
+--echo #
 --echo # WL#5534 Online ALTER, Phase 1
 --echo #
 

=== modified file 'mysql-test/t/join_outer.test'
--- a/mysql-test/t/join_outer.test	2012-01-03 11:04:14 +0000
+++ b/mysql-test/t/join_outer.test	2012-02-06 12:47:30 +0000
@@ -1489,3 +1489,19 @@ eval SELECT $rest_of_query;
 eval EXPLAIN SELECT $rest_of_query;
 
 drop table t1,t2,t3,t4,t5,t6;
+
+--echo #
+--echo # Bug#13464334 SAME QUERY PRODUCES DIFFERENT RESULTS WHEN USED WITH AND
+--echo # WITHOUT UNION ALL
+--echo #
+
+CREATE TABLE t1 (p1 INT PRIMARY KEY, a CHAR(1));
+CREATE TABLE t2 (p2 INT PRIMARY KEY, b CHAR(1));
+INSERT INTO t1 VALUES (1,'a'),(2,'b'),(3,'c');
+INSERT INTO t2 VALUES (1,'h'),(2,'i'),(3,'j'),(4,'k');
+CREATE VIEW v1 AS SELECT * FROM t1;
+CREATE VIEW v2 AS SELECT * FROM t2;
+(SELECT p1 FROM v2 LEFT JOIN v1 ON b = a WHERE p2 = 1 GROUP BY p1 ORDER BY p1)
+UNION (SELECT NULL LIMIT 0);
+DROP VIEW v1, v2;
+DROP TABLE t1, t2;

=== modified file 'mysql-test/valgrind.supp'
--- a/mysql-test/valgrind.supp	2012-01-29 00:57:40 +0000
+++ b/mysql-test/valgrind.supp	2012-02-07 11:56:30 +0000
@@ -985,7 +985,7 @@
    ...
    fun:my_b_flush_io_cache
    fun:_my_b_write
-   fun:_Z*10write_keysP10Sort_paramPPhjP11st_io_cacheS4_
+   fun:_Z*10write_keysP10Sort_paramP13Filesort_infojP11st_io_cacheS4_
    fun:_Z*13find_all_keysP10Sort_paramP10SQL_SELECTP13Filesort_infoP11st_io_cacheS6_P13Bounded_queueIhhEPy
    fun:_Z8filesortP3THDP5TABLEP13st_sort_fieldjP10SQL_SELECTybPyS7_
 }
@@ -1022,6 +1022,6 @@
    ...
    fun:my_b_flush_io_cache
    fun:_my_b_write
-   fun:_Z*10write_keysP10Sort_paramPPhjP11st_io_cacheS4_
+   fun:_Z*10write_keysP10Sort_paramP13Filesort_infojP11st_io_cacheS4_
    fun:_Z8filesortP3THDP5TABLEP13st_sort_fieldjP10SQL_SELECTybPyS7_
 }

=== modified file 'mysys/mf_radix.c'
--- a/mysys/mf_radix.c	2011-06-30 15:50:45 +0000
+++ b/mysys/mf_radix.c	2012-02-07 11:56:30 +0000
@@ -25,6 +25,11 @@
 
 	/* Radixsort */
 
+my_bool radixsort_is_appliccable(uint n_items, size_t size_of_element)
+{
+  return size_of_element <= 20 && n_items >= 1000 && n_items < 100000;
+}
+
 void radixsort_for_str_ptr(uchar **base, uint number_of_elements, size_t size_of_element, uchar **buffer)
 {
   uchar **end,**ptr,**buffer_ptr;

=== modified file 'mysys/mf_sort.c'
--- a/mysys/mf_sort.c	2011-06-30 15:46:53 +0000
+++ b/mysys/mf_sort.c	2012-02-07 11:56:30 +0000
@@ -23,7 +23,7 @@ void my_string_ptr_sort(uchar *base, uin
 #if INT_MAX > 65536L
   uchar **ptr=0;
 
-  if (size <= 20 && items >= 1000 && items < 100000 &&
+  if (radixsort_is_appliccable(items, size) &&
       (ptr= (uchar**) my_malloc(items*sizeof(char*),MYF(0))))
   {
     radixsort_for_str_ptr((uchar**) base,items,size,ptr);

=== modified file 'sql/filesort.cc'
--- a/sql/filesort.cc	2012-01-18 14:42:16 +0000
+++ b/sql/filesort.cc	2012-02-07 11:56:30 +0000
@@ -52,7 +52,7 @@ static ha_rows find_all_keys(Sort_param
                              IO_CACHE *tempfile,
                              Bounded_queue<uchar, uchar> *pq,
                              ha_rows *found_rows);
-static int write_keys(Sort_param *param,uchar * *sort_keys,
+static int write_keys(Sort_param *param, Filesort_info *fs_info,
                       uint count, IO_CACHE *buffer_file, IO_CACHE *tempfile);
 static void make_sortkey(Sort_param *param,uchar *to, uchar *ref_pos);
 static void register_used_fields(Sort_param *param);
@@ -60,7 +60,7 @@ static int merge_index(Sort_param *param
                        BUFFPEK *buffpek,
                        uint maxbuffer,IO_CACHE *tempfile,
                        IO_CACHE *outfile);
-static bool save_index(Sort_param *param,uchar **sort_keys, uint count, 
+static bool save_index(Sort_param *param, uint count,
                        Filesort_info *table_sort);
 static uint suffix_length(ulong string_length);
 static uint sortlength(THD *thd, SORT_FIELD *sortorder, uint s_length,
@@ -346,8 +346,7 @@ ha_rows filesort(THD *thd, TABLE *table,
 
   if (maxbuffer == 0)			// The whole set is in memory
   {
-    if (save_index(&param, table_sort.get_sort_keys(),
-                   (uint) num_rows, &table_sort))
+    if (save_index(&param, (uint) num_rows, &table_sort))
       goto err;
   }
   else
@@ -742,8 +741,7 @@ static ha_rows find_all_keys(Sort_param
       {
         if (idx == param->max_keys_per_buffer)
         {
-          if (write_keys(param, fs_info->get_sort_keys(),
-                         idx, buffpek_pointers, tempfile))
+          if (write_keys(param, fs_info, idx, buffpek_pointers, tempfile))
              DBUG_RETURN(HA_POS_ERROR);
           idx= 0;
           indexpos++;
@@ -777,8 +775,7 @@ static ha_rows find_all_keys(Sort_param
     DBUG_RETURN(HA_POS_ERROR);			/* purecov: inspected */
   }
   if (indexpos && idx &&
-      write_keys(param, fs_info->get_sort_keys(),
-                 idx, buffpek_pointers, tempfile))
+      write_keys(param, fs_info, idx, buffpek_pointers, tempfile))
     DBUG_RETURN(HA_POS_ERROR);			/* purecov: inspected */
   const ha_rows retval= 
     my_b_inited(tempfile) ?
@@ -811,21 +808,19 @@ static ha_rows find_all_keys(Sort_param
 */
 
 static int
-write_keys(Sort_param *param, register uchar **sort_keys, uint count,
+write_keys(Sort_param *param, Filesort_info *fs_info, uint count,
            IO_CACHE *buffpek_pointers, IO_CACHE *tempfile)
 {
-  size_t sort_length, rec_length;
+  size_t rec_length;
   uchar **end;
   BUFFPEK buffpek;
   DBUG_ENTER("write_keys");
 
-  sort_length= param->sort_length;
   rec_length= param->rec_length;
-#ifdef MC68000
-  quicksort(sort_keys,count,sort_length);
-#else
-  my_string_ptr_sort((uchar*) sort_keys, (uint) count, sort_length);
-#endif
+  uchar **sort_keys= fs_info->get_sort_keys();
+
+  fs_info->sort_buffer(param, count);
+
   if (!my_b_inited(tempfile) &&
       open_cached_file(tempfile, mysql_tmpdir, TEMP_PREFIX, DISK_BUFFER_SIZE,
                        MYF(MY_WME)))
@@ -1157,20 +1152,19 @@ static void register_used_fields(Sort_pa
   }
 }
 
-
-static bool save_index(Sort_param *param, uchar **sort_keys, uint count, 
-                       Filesort_info *table_sort)
+static bool save_index(Sort_param *param, uint count, Filesort_info *table_sort)
 {
   uint offset,res_length;
   uchar *to;
   DBUG_ENTER("save_index");
 
-  my_string_ptr_sort((uchar*) sort_keys, count, param->sort_length);
+  table_sort->sort_buffer(param, count);
   res_length= param->res_length;
   offset= param->rec_length-res_length;
   if (!(to= table_sort->record_pointers= 
         (uchar*) my_malloc(res_length*count, MYF(MY_WME))))
     DBUG_RETURN(1);                 /* purecov: inspected */
+  uchar **sort_keys= table_sort->get_sort_keys();
   for (uchar **end= sort_keys+count ; sort_keys != end ; sort_keys++)
   {
     memcpy(to, *sort_keys+offset, res_length);

=== modified file 'sql/filesort_utils.cc'
--- a/sql/filesort_utils.cc	2011-11-07 15:32:36 +0000
+++ b/sql/filesort_utils.cc	2012-02-07 11:56:30 +0000
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. 
+/* Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. 
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -18,6 +18,9 @@
 #include "sql_sort.h"
 #include "table.h"
 
+#include <algorithm>
+#include <functional>
+#include <vector>
 
 namespace {
 /**
@@ -116,3 +119,84 @@ void Filesort_buffer::free_sort_buffer()
   m_record_length= 0;
   m_start_of_data= NULL;
 }
+
+
+namespace {
+
+/*
+  An inline function which does memcmp().
+  This one turns out to be pretty fast on all platforms, except sparc.
+  See the accompanying unit tests, which measure various implementations.
+ */
+inline bool my_mem_compare(const uchar *s1, const uchar *s2, size_t len)
+{
+  DBUG_ASSERT(len > 0);
+  DBUG_ASSERT(s1 != NULL);
+  DBUG_ASSERT(s2 != NULL);
+  do {
+    if (*s1++ != *s2++)
+      return *--s1 < *--s2;
+  } while (--len != 0);
+  return false;
+}
+
+
+class Mem_compare :
+  public std::binary_function<const uchar*, const uchar*, bool>
+{
+public:
+  Mem_compare(size_t n) : m_size(n) {}
+  bool operator()(const uchar *s1, const uchar *s2) const
+  {
+#ifdef __sun
+    // Usually faster on SUN, see comment for native_compare()
+    return memcmp(s1, s2, m_size) < 0;
+#else
+    return my_mem_compare(s1, s2, m_size);
+#endif
+  }
+private:
+  size_t m_size;
+};
+
+template <typename type>
+size_t try_reserve(std::pair<type*, ptrdiff_t> *buf, ptrdiff_t size)
+{
+  *buf= std::get_temporary_buffer<type>(size);
+  if (buf->second != size)
+  {
+    std::return_temporary_buffer(buf->first);
+    return 0;
+  }
+  return buf->second;
+}
+
+} // namespace
+
+void Filesort_buffer::sort_buffer(const Sort_param *param, uint count)
+{
+  if (count <= 1)
+    return;
+  uchar **keys= get_sort_keys();
+  std::pair<uchar**, ptrdiff_t> buffer;
+  if (radixsort_is_appliccable(count, param->sort_length) &&
+      try_reserve(&buffer, count))
+  {
+    radixsort_for_str_ptr(keys, count, param->sort_length, buffer.first);
+    std::return_temporary_buffer(buffer.first);
+    return;
+  }
+  /*
+    std::stable_sort has some extra overhead in allocating the temp buffer,
+    which takes some time. The cutover point where it starts to get faster
+    than quicksort seems to be somewhere around 10 to 40 records.
+    So we're a bit conservative, and stay with quicksort up to 100 records.
+  */
+  if (count < 100)
+  {
+    size_t size= param->sort_length;
+    my_qsort2(keys, count, sizeof(uchar*), get_ptr_compare(size), &size);
+    return;
+  }
+  std::stable_sort(keys, keys + count, Mem_compare(param->sort_length));
+}

=== modified file 'sql/filesort_utils.h'
--- a/sql/filesort_utils.h	2012-01-18 14:42:16 +0000
+++ b/sql/filesort_utils.h	2012-02-07 11:56:30 +0000
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2010, 2012 Oracle and/or its affiliates. All rights reserved.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -22,6 +22,7 @@
 
 #include <utility>
 
+class Sort_param;
 /*
   Calculate cost of merge sort
 
@@ -65,6 +66,9 @@ public:
     m_idx_array(), m_record_length(0), m_start_of_data(NULL)
   {}
 
+  /** Sort me... */
+  void sort_buffer(const Sort_param *param, uint count);
+
   /// Initializes a record pointer.
   uchar *get_record_buffer(uint idx)
   {

=== modified file 'sql/handler.cc'
--- a/sql/handler.cc	2012-02-02 09:12:43 +0000
+++ b/sql/handler.cc	2012-02-08 17:06:22 +0000
@@ -5050,6 +5050,7 @@ handler::multi_range_read_info_const(uin
       rows= table->key_info[keyno].rec_per_key[keyparts_used-1];
     else
     {
+      DBUG_EXECUTE_IF("crash_records_in_range", DBUG_SUICIDE(););
       if (HA_POS_ERROR == (rows= this->records_in_range(keyno, min_endp, 
                                                         max_endp)))
       {

=== modified file 'sql/item.h'
--- a/sql/item.h	2012-01-31 15:16:16 +0000
+++ b/sql/item.h	2012-02-08 10:33:37 +0000
@@ -1045,6 +1045,8 @@ public:
   /* 
     Returns true if this is constant (during query execution, i.e. its value
     will not change until next fix_fields) and its value is known.
+    When the default implementation of used_tables() is effective, this
+    function will always return true (because used_tables() is empty).
   */
   virtual bool const_item() const { return used_tables() == 0; }
   /* 
@@ -1548,10 +1550,7 @@ public:
   bool is_null();
 
 public:
-  inline void make_field(Send_field *field);
-  
-  inline bool const_item() const;
-  
+  inline void make_field(Send_field *field);  
   inline int save_in_field(Field *field, bool no_conversions);
   inline bool send(Protocol *protocol, String *str);
 }; 
@@ -1571,11 +1570,6 @@ inline void Item_sp_variable::make_field
   it->make_field(field);
 }
 
-inline bool Item_sp_variable::const_item() const
-{
-  return TRUE;
-}
-
 inline int Item_sp_variable::save_in_field(Field *field, bool no_conversions)
 {
   return this_item()->save_in_field(field, no_conversions);
@@ -1767,11 +1761,6 @@ public:
     return value_item->result_type();
   }
 
-  bool const_item() const
-  {
-    return TRUE;
-  }
-
   int save_in_field(Field *field, bool no_conversions)
   {
     return  value_item->save_in_field(field, no_conversions);
@@ -2034,7 +2023,8 @@ public:
   bool is_outer_field() const
   {
     DBUG_ASSERT(fixed);
-    return field->table->pos_in_table_list->outer_join;
+    return field->table->pos_in_table_list->outer_join ||
+           field->table->pos_in_table_list->in_outer_join_nest();
   }
   Field::geometry_type get_geometry_type() const
   {
@@ -2922,7 +2912,16 @@ public:
       (*ref)->update_used_tables(); 
   }
   virtual table_map resolved_used_tables() const;
-  table_map not_null_tables() const { return (*ref)->not_null_tables(); }
+  table_map not_null_tables() const
+  {
+    /*
+      It can happen that our 'depended_from' member is set but the
+      'depended_from' member of the referenced item is not (example: if a
+      field in a subquery belongs to an outer merged view), so we first test
+      ours:
+    */
+    return depended_from ? OUTER_REF_TABLE_BIT : (*ref)->not_null_tables();
+  }
   void set_result_field(Field *field)	{ result_field= field; }
   bool is_result_field() { return 1; }
   void save_in_result_field(bool no_conversions)

=== modified file 'sql/item_cmpfunc.cc'
--- a/sql/item_cmpfunc.cc	2012-01-25 09:57:22 +0000
+++ b/sql/item_cmpfunc.cc	2012-02-08 10:33:37 +0000
@@ -4722,8 +4722,7 @@ longlong Item_func_bit_and::val_int()
 
 Item_cond::Item_cond(THD *thd, Item_cond *item)
   :Item_bool_func(thd, item),
-   abort_on_null(item->abort_on_null),
-   and_tables_cache(item->and_tables_cache)
+   abort_on_null(item->abort_on_null)
 {
   /*
     item->list will be copied by copy_andor_arguments() call
@@ -4748,16 +4747,16 @@ Item_cond::fix_fields(THD *thd, Item **r
   st_select_lex::Resolve_place save_resolve=
     thd->lex->current_select->resolve_place;
   uchar buff[sizeof(char*)];			// Max local vars in function
-  not_null_tables_cache= used_tables_cache= 0;
-  const_item_cache= 1;
+  used_tables_cache= 0;
+  const_item_cache= true;
 
   if (functype() != COND_AND_FUNC)
     thd->lex->current_select->resolve_place= st_select_lex::RESOLVE_NONE;
-  /*
-    and_table_cache is the value that Item_cond_or() returns for
-    not_null_tables()
-  */
-  and_tables_cache= ~(table_map) 0;
+
+  if (functype() == COND_AND_FUNC && abort_on_null)
+    not_null_tables_cache= 0;
+  else
+    not_null_tables_cache= ~(table_map) 0;
 
   if (check_stack_overrun(thd, STACK_MIN_SIZE, buff))
     return TRUE;				// Fatal error flag is set!
@@ -4778,7 +4777,6 @@ Item_cond::fix_fields(THD *thd, Item **r
   */
   while ((item=li++))
   {
-    table_map tmp_table_map;
     while (item->type() == Item::COND_ITEM &&
 	   ((Item_cond*) item)->functype() == functype() &&
            !((Item_cond*) item)->list.is_empty())
@@ -4795,26 +4793,26 @@ Item_cond::fix_fields(THD *thd, Item **r
 	 item->fix_fields(thd, li.ref())) ||
 	(item= *li.ref())->check_cols(1))
       return TRUE; /* purecov: inspected */
-    used_tables_cache|=     item->used_tables();
-    if (item->const_item())
-      and_tables_cache= (table_map) 0;
+    used_tables_cache|= item->used_tables();
+    const_item_cache&=  item->const_item();
+
+    // Old code assumed that not_null_tables() was 0 when const_item() was true
+    DBUG_ASSERT(!item->const_item() || !item->not_null_tables());
+
+    if (functype() == COND_AND_FUNC && abort_on_null)
+      not_null_tables_cache|= item->not_null_tables();
     else
-    {
-      tmp_table_map= item->not_null_tables();
-      not_null_tables_cache|= tmp_table_map;
-      and_tables_cache&= tmp_table_map;
-      const_item_cache= FALSE;
-    }  
-    with_sum_func=	    with_sum_func || item->with_sum_func;
-    with_subselect|=        item->has_subquery();
+      not_null_tables_cache&= item->not_null_tables();
+    with_sum_func|=  item->with_sum_func;
+    with_subselect|= item->has_subquery();
     if (item->maybe_null)
-      maybe_null=1;
+      maybe_null= true;
   }
   thd->lex->current_select->cond_count+= list.elements;
   thd->lex->current_select->resolve_place= save_resolve;
   fix_length_and_dec();
-  fixed= 1;
-  return FALSE;
+  fixed= true;
+  return false;
 }
 
 
@@ -4825,29 +4823,24 @@ void Item_cond::fix_after_pullout(st_sel
   List_iterator<Item> li(list);
   Item *item;
 
-  used_tables_cache=0;
-  const_item_cache=1;
+  used_tables_cache= 0;
+  const_item_cache= true;
 
-  and_tables_cache= ~(table_map) 0; // Here and below we do as fix_fields does
-  not_null_tables_cache= 0;
+  if (functype() == COND_AND_FUNC && abort_on_null)
+    not_null_tables_cache= 0;
+  else
+    not_null_tables_cache= ~(table_map) 0;
 
   while ((item=li++))
   {
-    table_map tmp_table_map;
     item->fix_after_pullout(parent_select, removed_select, li.ref());
     item= *li.ref();
     used_tables_cache|= item->used_tables();
     const_item_cache&= item->const_item();
-
-    if (item->const_item())
-      and_tables_cache= (table_map) 0;
+    if (functype() == COND_AND_FUNC && abort_on_null)
+      not_null_tables_cache|= item->not_null_tables();
     else
-    {
-      tmp_table_map= item->not_null_tables();
-      not_null_tables_cache|= tmp_table_map;
-      and_tables_cache&= tmp_table_map;
-      const_item_cache= FALSE;
-    }  
+      not_null_tables_cache&= item->not_null_tables();
   }
 }
 
@@ -5003,13 +4996,6 @@ void Item_cond::split_sum_func(THD *thd,
 }
 
 
-table_map
-Item_cond::used_tables() const
-{						// This caches used_tables
-  return used_tables_cache;
-}
-
-
 void Item_cond::update_used_tables()
 {
   List_iterator_fast<Item> li(list);

=== modified file 'sql/item_cmpfunc.h'
--- a/sql/item_cmpfunc.h	2012-01-30 06:39:02 +0000
+++ b/sql/item_cmpfunc.h	2012-02-08 10:33:37 +0000
@@ -1596,7 +1596,6 @@ class Item_cond :public Item_bool_func
 protected:
   List<Item> list;
   bool abort_on_null;
-  table_map and_tables_cache;
 
 public:
   /* Item_cond() is only used to create top level items */
@@ -1632,7 +1631,7 @@ public:
 
   enum Type type() const { return COND_ITEM; }
   List<Item>* argument_list() { return &list; }
-  table_map used_tables() const;
+  table_map used_tables() const { return used_tables_cache; }
   void update_used_tables();
   virtual void print(String *str, enum_query_type query_type);
   void split_sum_func(THD *thd, Ref_ptr_array ref_pointer_array,
@@ -1821,8 +1820,6 @@ public:
   enum Functype functype() const { return COND_AND_FUNC; }
   longlong val_int();
   const char *func_name() const { return "and"; }
-  table_map not_null_tables() const
-  { return abort_on_null ? not_null_tables_cache: and_tables_cache; }
   Item* copy_andor_structure(THD *thd)
   {
     Item_cond_and *item;
@@ -1852,7 +1849,6 @@ public:
   enum Functype functype() const { return COND_OR_FUNC; }
   longlong val_int();
   const char *func_name() const { return "or"; }
-  table_map not_null_tables() const { return and_tables_cache; }
   Item* copy_andor_structure(THD *thd)
   {
     Item_cond_or *item;

=== modified file 'sql/log_event.cc'
--- a/sql/log_event.cc	2012-01-31 15:16:16 +0000
+++ b/sql/log_event.cc	2012-02-07 23:33:54 +0000
@@ -4316,11 +4316,11 @@ int Query_log_event::do_apply_event(Rela
         nothing to do.
       */
       /*
-        We do not replicate IGNORE_DIR_IN_CREATE. That is, if the master is a
-        slave which runs with SQL_MODE=IGNORE_DIR_IN_CREATE, this should not
+        We do not replicate MODE_NO_DIR_IN_CREATE. That is, if the master is a
+        slave which runs with SQL_MODE=MODE_NO_DIR_IN_CREATE, this should not
         force us to ignore the dir too. Imagine you are a ring of machines, and
         one has a disk problem so that you temporarily need
-        IGNORE_DIR_IN_CREATE on this machine; you don't want it to propagate
+        MODE_NO_DIR_IN_CREATE on this machine; you don't want it to propagate
         elsewhere (you don't want all slaves to start ignoring the dirs).
       */
       if (sql_mode_inited)

=== modified file 'sql/opt_range.cc'
--- a/sql/opt_range.cc	2012-01-31 07:45:59 +0000
+++ b/sql/opt_range.cc	2012-02-07 20:32:47 +0000
@@ -4654,22 +4654,26 @@ void ror_intersect_cpy(ROR_INTERSECT_INF
 
 
 /*
-  Get selectivity of a ROR scan wrt ROR-intersection.
+  Get selectivity of adding a ROR scan to the ROR-intersection.
 
   SYNOPSIS
     ror_scan_selectivity()
-      info  ROR-interection 
-      scan  ROR scan
+      info  ROR-interection, an intersection of ROR index scans 
+      scan  ROR scan that may or may not improve the selectivity
+            of 'info'
       
   NOTES
-    Suppose we have a condition on several keys
-    cond=k_11=c_11 AND k_12=c_12 AND ...  // parts of first key
-         k_21=c_21 AND k_22=c_22 AND ...  // parts of second key
+    Suppose we have conditions on several keys
+    cond=k_11=c_11 AND k_12=c_12 AND ...  // key_parts of first key in 'info'
+         k_21=c_21 AND k_22=c_22 AND ...  // key_parts of second key in 'info'
           ...
-         k_n1=c_n1 AND k_n3=c_n3 AND ...  (1) //parts of the key used by *scan
+         k_n1=c_n1 AND k_n3=c_n3 AND ...  (1) //key_parts of 'scan'
 
     where k_ij may be the same as any k_pq (i.e. keys may have common parts).
 
+    Note that for ROR retrieval, only equality conditions are usable so there
+    are no open ranges (e.g., k_ij > c_ij) in 'scan' or 'info'
+
     A full row is retrieved if entire condition holds.
 
     The recursive procedure for finding P(cond) is as follows:
@@ -4736,19 +4740,30 @@ void ror_intersect_cpy(ROR_INTERSECT_INF
 
     where i1,i2, .. are key parts that were already marked as fixed.
 
-    In order to minimize number of expensive records_in_range calls we group
-    and reduce adjacent fractions.
+    In order to minimize number of expensive records_in_range calls we
+    group and reduce adjacent fractions. Note that on the optimizer's
+    request, index statistics may be used instead of records_in_range
+    @see RANGE_OPT_PARAM::use_index_statistics.
 
   RETURN
-    Selectivity of given ROR scan.
+    Selectivity of given ROR scan, a number between 0 and 1. 1 means that
+    adding 'scan' to the intersection does not improve the selectivity.
 */
 
 static double ror_scan_selectivity(const ROR_INTERSECT_INFO *info, 
                                    const ROR_SCAN_INFO *scan)
 {
   double selectivity_mult= 1.0;
-  KEY_PART_INFO *key_part= info->param->table->key_info[scan->keynr].key_part;
-  uchar key_val[MAX_KEY_LENGTH+MAX_FIELD_WIDTH]; /* key values tuple */
+  const TABLE * const table= info->param->table;
+  const KEY_PART_INFO * const key_part= table->key_info[scan->keynr].key_part;
+  /**
+    key values tuple, used to store both min_range.key and
+    max_range.key. This function is only called for equality ranges;
+    open ranges (e.g. "min_value < X < max_value") cannot be used for
+    rowid ordered retrieval, so in this function we know that
+    min_range.key == max_range.key
+  */
+  uchar key_val[MAX_KEY_LENGTH+MAX_FIELD_WIDTH];
   uchar *key_ptr= key_val;
   SEL_ARG *sel_arg, *tuple_arg= NULL;
   key_part_map keypart_map= 0;
@@ -4761,7 +4776,7 @@ static double ror_scan_selectivity(const
   min_range.flag= HA_READ_KEY_EXACT;
   max_range.key= key_val;
   max_range.flag= HA_READ_AFTER_KEY;
-  ha_rows prev_records= info->param->table->file->stats.records;
+  ha_rows prev_records= table->file->stats.records;
   DBUG_ENTER("ror_scan_selectivity");
 
   for (sel_arg= scan->sel_arg; sel_arg;
@@ -4773,12 +4788,14 @@ static double ror_scan_selectivity(const
     if (cur_covered != prev_covered)
     {
       /* create (part1val, ..., part{n-1}val) tuple. */
+      bool is_null_range= false;
       ha_rows records;
       if (!tuple_arg)
       {
         tuple_arg= scan->sel_arg;
         /* Here we use the length of the first key part */
-        tuple_arg->store_min(key_part->store_length, &key_ptr, 0);
+        tuple_arg->store_min(key_part[0].store_length, &key_ptr, 0);
+        is_null_range|= tuple_arg->is_null_interval();
         keypart_map= 1;
       }
       while (tuple_arg->next_key_part != sel_arg)
@@ -4786,12 +4803,33 @@ static double ror_scan_selectivity(const
         tuple_arg= tuple_arg->next_key_part;
         tuple_arg->store_min(key_part[tuple_arg->part].store_length,
                              &key_ptr, 0);
+        is_null_range|= tuple_arg->is_null_interval();
         keypart_map= (keypart_map << 1) | 1;
       }
       min_range.length= max_range.length= (size_t) (key_ptr - key_val);
       min_range.keypart_map= max_range.keypart_map= keypart_map;
-      records= (info->param->table->file->
-                records_in_range(scan->keynr, &min_range, &max_range));
+
+      /* 
+        Get the number of rows in this range. This is done by calling
+        records_in_range() unless all these are true:
+          1) The user has requested that index statistics should be used
+             for equality ranges to avoid the incurred overhead of 
+             index dives in records_in_range()
+          2) The range is not on the form "x IS NULL". The reason is
+             that the number of rows with this value are likely to be
+             very different than the values in the index statistics
+          3) Index statistics is available.
+        @see key_val
+      */
+      if (!info->param->use_index_statistics ||        // (1)
+          is_null_range ||                             // (2)
+          !(records= table->key_info[scan->keynr].
+                     rec_per_key[tuple_arg->part]))    // (3)
+      {
+        DBUG_EXECUTE_IF("crash_records_in_range", DBUG_SUICIDE(););
+        records= (table->file->
+                  records_in_range(scan->keynr, &min_range, &max_range));
+      }
       if (cur_covered)
       {
         /* uncovered -> covered */
@@ -4810,11 +4848,13 @@ static double ror_scan_selectivity(const
   }
   if (!prev_covered)
   {
-    double tmp= rows2double(info->param->table->quick_rows[scan->keynr]) /
+    double tmp= rows2double(table->quick_rows[scan->keynr]) /
                 rows2double(prev_records);
     DBUG_PRINT("info", ("Selectivity multiplier: %g", tmp));
     selectivity_mult *= tmp;
   }
+  // Todo: This assert fires in PB sysqa RQG tests.
+  // DBUG_ASSERT(selectivity_mult <= 1.0);
   DBUG_PRINT("info", ("Returning multiplier: %g", selectivity_mult));
   DBUG_RETURN(selectivity_mult);
 }

=== modified file 'sql/partition_info.cc'
--- a/sql/partition_info.cc	2011-12-19 12:53:11 +0000
+++ b/sql/partition_info.cc	2012-02-07 23:33:54 +0000
@@ -1233,9 +1233,7 @@ end:
 */
 static void warn_if_dir_in_part_elem(THD *thd, partition_element *part_elem)
 {
-#ifdef HAVE_READLINK
-  if (!my_use_symdir || (thd->variables.sql_mode & MODE_NO_DIR_IN_CREATE))
-#endif
+  if (thd->variables.sql_mode & MODE_NO_DIR_IN_CREATE)
   {
     if (part_elem->data_file_name)
       push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,

=== modified file 'sql/sql_executor.cc'
--- a/sql/sql_executor.cc	2012-01-31 11:19:25 +0000
+++ b/sql/sql_executor.cc	2012-02-07 14:50:31 +0000
@@ -2564,9 +2564,9 @@ test_if_quick_select(JOIN_TAB *tab)
    Reads content of constant table
    @param tab  table
    @param pos  position of table in query plan
-   @retval 0   ok
-   @retval >0  error
-   @retval <0  ??
+   @retval 0   ok, one row was found or one NULL-complemented row was created
+   @retval -1  ok, no row was found and no NULL-complemented row was created
+   @retval 1   error
 */
 
 int
@@ -2687,6 +2687,16 @@ join_read_const_table(JOIN_TAB *tab, POS
 }
 
 
+/**
+  Read a constant table when there is at most one matching row, using a table
+  scan.
+
+  @param tab			Table to read
+
+  @retval  0  Row was found
+  @retval  -1 Row was not found
+  @retval  1  Got an error (other than row not found) during read
+*/
 static int
 join_read_system(JOIN_TAB *tab)
 {
@@ -2713,16 +2723,14 @@ join_read_system(JOIN_TAB *tab)
 
 
 /**
-  Read a [constant] table when there is at most one matching row.
+  Read a constant table when there is at most one matching row, using an
+  index lookup.
 
   @param tab			Table to read
 
-  @retval
-    0	Row was found
-  @retval
-    -1   Row was not found
-  @retval
-    1   Got an error (other than row not found) during read
+  @retval 0  Row was found
+  @retval -1 Row was not found
+  @retval 1  Got an error (other than row not found) during read
 */
 
 static int

=== modified file 'sql/sql_lex.cc'
--- a/sql/sql_lex.cc	2012-02-02 09:12:43 +0000
+++ b/sql/sql_lex.cc	2012-02-08 17:06:22 +0000
@@ -2450,6 +2450,7 @@ void TABLE_LIST::print(THD *thd, String
         append_identifier(thd, str, table_name, table_name_length);
         cmp_name= table_name;
       }
+#ifdef WITH_PARTITION_STORAGE_ENGINE
       if (partition_names && partition_names->elements)
       {
         int i, num_parts= partition_names->elements;
@@ -2464,6 +2465,7 @@ void TABLE_LIST::print(THD *thd, String
         }
         str->append(')');
       }
+#endif /* WITH_PARTITION_STORAGE_ENGINE */
     }
     if (my_strcasecmp(table_alias_charset, cmp_name, alias))
     {

=== modified file 'sql/sql_optimizer.cc'
--- a/sql/sql_optimizer.cc	2012-01-27 14:22:35 +0000
+++ b/sql/sql_optimizer.cc	2012-02-07 20:32:47 +0000
@@ -55,7 +55,7 @@ static Item *optimize_cond(JOIN *join, I
                            List<TABLE_LIST> *join_list,
 			   bool build_equalities,
                            Item::cond_result *cond_value);
-static bool list_contains_unique_index(TABLE *table,
+static bool list_contains_unique_index(JOIN_TAB *tab,
                           bool (*find_func) (Field *, void *), void *data);
 static bool find_field_in_item_list (Field *field, void *data);
 static bool find_field_in_order_list (Field *field, void *data);
@@ -377,11 +377,9 @@ JOIN::optimize()
   }
 
   if (const_table_map != found_const_table_map &&
-      !(select_options & SELECT_DESCRIBE) &&
-      (!conds ||
-       !(conds->used_tables() & RAND_TABLE_BIT) ||
-       select_lex->master_unit() == &thd->lex->unit)) // upper level SELECT
+      !(select_options & SELECT_DESCRIBE))
   {
+    // There is at least one empty const table
     zero_result_cause= "no matching row in const table";
     DBUG_PRINT("error",("Error: %s", zero_result_cause));
     goto setup_subq_exit;
@@ -522,7 +520,7 @@ JOIN::optimize()
        QUICK_SELECT_I::QS_TYPE_GROUP_MIN_MAX))
   {
     if (group_list && rollup.state == ROLLUP::STATE_NONE &&
-       list_contains_unique_index(join_tab[const_tables].table,
+       list_contains_unique_index(&join_tab[const_tables],
                                  find_field_in_order_list,
                                  (void *) group_list))
     {
@@ -560,7 +558,7 @@ JOIN::optimize()
       group= 0;
     }
     if (select_distinct &&
-       list_contains_unique_index(join_tab[const_tables].table,
+       list_contains_unique_index(&join_tab[const_tables],
                                  find_field_in_item_list,
                                  (void *) &fields_list))
     {
@@ -8069,7 +8067,7 @@ internal_remove_eq_conds(THD *thd, Item
         if (!eq_cond)
           return cond;
 
-        if (field->table->pos_in_table_list->outer_join)
+        if (args[0]->is_outer_field())
         {
           // outer join: transform "col IS NULL" to "col IS NULL or col=0"
           Item *or_cond= new(thd->mem_root) Item_cond_or(eq_cond, cond);
@@ -8223,7 +8221,7 @@ remove_eq_conds(THD *thd, Item *cond, It
     can safely remove the GROUP BY/DISTINCT,
     as no result set can be more distinct than an unique key.
 
-  @param table                The table to operate on.
+  @param tab                  The join table to operate on.
   @param find_func            function to iterate over the list and search
                               for a field
 
@@ -8231,13 +8229,19 @@ remove_eq_conds(THD *thd, Item *cond, It
     1                    found
   @retval
     0                    not found.
+
+  @note
+    The function assumes that make_outerjoin_info() has been called in
+    order for the check for outer tables to work.
 */
 
 static bool
-list_contains_unique_index(TABLE *table,
+list_contains_unique_index(JOIN_TAB *tab,
                           bool (*find_func) (Field *, void *), void *data)
 {
-  if (table->pos_in_table_list->outer_join)
+  TABLE *table= tab->table;
+
+  if (tab->is_inner_table_of_outer_join())
     return 0;
   for (uint keynr= 0; keynr < table->s->keys; keynr++)
   {

=== modified file 'sql/sql_parse.cc'
--- a/sql/sql_parse.cc	2012-01-31 15:16:16 +0000
+++ b/sql/sql_parse.cc	2012-02-08 06:45:31 +0000
@@ -2603,14 +2603,13 @@ case SQLCOM_PREPARE:
     /* Might have been updated in create_table_precheck */
     create_info.alias= create_table->alias;
 
-#ifdef HAVE_READLINK
-    /* Fix names if symlinked tables */
+    /* Fix names if symlinked or relocated tables */
     if (append_file_to_dir(thd, &create_info.data_file_name,
 			   create_table->table_name) ||
 	append_file_to_dir(thd, &create_info.index_file_name,
 			   create_table->table_name))
       goto end_with_restore_list;
-#endif
+
     /*
       If no engine type was given, work out the default now
       rather than at parse-time.

=== modified file 'sql/sql_show.cc'
--- a/sql/sql_show.cc	2012-01-31 15:16:16 +0000
+++ b/sql/sql_show.cc	2012-02-08 12:49:33 +0000
@@ -1426,7 +1426,9 @@ int store_create_info(THD *thd, TABLE_LI
   handler *file= table->file;
   TABLE_SHARE *share= table->s;
   HA_CREATE_INFO create_info;
+#ifdef WITH_PARTITION_STORAGE_ENGINE
   bool show_table_options= FALSE;
+#endif /* WITH_PARTITION_STORAGE_ENGINE */
   bool foreign_db_mode=  (thd->variables.sql_mode & (MODE_POSTGRESQL |
                                                      MODE_ORACLE |
                                                      MODE_MSSQL |
@@ -1639,7 +1641,9 @@ int store_create_info(THD *thd, TABLE_LI
   packet->append(STRING_WITH_LEN("\n)"));
   if (!(thd->variables.sql_mode & MODE_NO_TABLE_OPTIONS) && !foreign_db_mode)
   {
+#ifdef WITH_PARTITION_STORAGE_ENGINE
     show_table_options= TRUE;
+#endif /* WITH_PARTITION_STORAGE_ENGINE */
 
     /* TABLESPACE and STORAGE */
     if (share->tablespace ||

=== modified file 'sql/sql_table.cc'
--- a/sql/sql_table.cc	2012-02-02 15:04:54 +0000
+++ b/sql/sql_table.cc	2012-02-08 17:06:22 +0000
@@ -4390,7 +4390,6 @@ bool create_table_impl(THD *thd,
 
   THD_STAGE_INFO(thd, stage_creating_table);
 
-#ifdef HAVE_READLINK
   {
     size_t dirlen;
     char   dirpath[FN_REFLEN];
@@ -4437,8 +4436,7 @@ bool create_table_impl(THD *thd,
   }
 #endif /* WITH_PARTITION_STORAGE_ENGINE */
 
-  if (!my_use_symdir || (thd->variables.sql_mode & MODE_NO_DIR_IN_CREATE))
-#endif /* HAVE_READLINK */
+  if (thd->variables.sql_mode & MODE_NO_DIR_IN_CREATE)
   {
     if (create_info->data_file_name)
       push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
@@ -6746,9 +6744,27 @@ bool mysql_alter_table(THD *thd,char *ne
     }
     else
     {
+      MDL_request_list mdl_requests;
+      MDL_request target_db_mdl_request;
+
       target_mdl_request.init(MDL_key::TABLE,
                               alter_ctx.new_db, alter_ctx.new_name,
                               MDL_EXCLUSIVE, MDL_TRANSACTION);
+      mdl_requests.push_front(&target_mdl_request);
+
+      /*
+        If we are moving the table to a different database, we also
+        need IX lock on the database name so that the target database
+        is protected by MDL while the table is moved.
+      */
+      if (alter_ctx.is_database_changed())
+      {
+        target_db_mdl_request.init(MDL_key::SCHEMA, alter_ctx.new_db, "",
+                                   MDL_INTENTION_EXCLUSIVE,
+                                   MDL_TRANSACTION);
+        mdl_requests.push_front(&target_db_mdl_request);
+      }
+
       /*
         Global intention exclusive lock must have been already acquired when
         table to be altered was open, so there is no need to do it here.
@@ -6757,14 +6773,10 @@ bool mysql_alter_table(THD *thd,char *ne
                                                  "", "",
                                                  MDL_INTENTION_EXCLUSIVE));
 
-      if (thd->mdl_context.try_acquire_lock(&target_mdl_request))
-        DBUG_RETURN(true);
-      if (target_mdl_request.ticket == NULL)
-      {
-        /* Table exists and is locked by some thread. */
-        my_error(ER_TABLE_EXISTS_ERROR, MYF(0), alter_ctx.new_alias);
+      if (thd->mdl_context.acquire_locks(&mdl_requests,
+                                         thd->variables.lock_wait_timeout))
         DBUG_RETURN(true);
-      }
+
       DEBUG_SYNC(thd, "locked_table_name");
       /*
         Table maybe does not exist, but we got an exclusive lock

=== modified file 'sql/sql_yacc.yy'
--- a/sql/sql_yacc.yy	2012-02-02 09:12:43 +0000
+++ b/sql/sql_yacc.yy	2012-02-08 17:06:22 +0000
@@ -1504,7 +1504,7 @@ bool my_yyoverflow(short **a, YYSTYPE **
         IDENT_sys TEXT_STRING_sys TEXT_STRING_literal
         NCHAR_STRING opt_component key_cache_name
         sp_opt_label BIN_NUM label_ident TEXT_STRING_filesystem ident_or_empty
-        opt_constraint constraint opt_ident
+        opt_constraint constraint opt_ident TEXT_STRING_sys_nonewline
 
 %type <lex_str_ptr>
         opt_table_alias
@@ -1983,19 +1983,19 @@ master_defs:
         ;
 
 master_def:
-          MASTER_HOST_SYM EQ TEXT_STRING_sys
+          MASTER_HOST_SYM EQ TEXT_STRING_sys_nonewline
           {
             Lex->mi.host = $3.str;
           }
-        | MASTER_BIND_SYM EQ TEXT_STRING_sys
+        | MASTER_BIND_SYM EQ TEXT_STRING_sys_nonewline
           {
             Lex->mi.bind_addr = $3.str;
           }
-        | MASTER_USER_SYM EQ TEXT_STRING_sys
+        | MASTER_USER_SYM EQ TEXT_STRING_sys_nonewline
           {
             Lex->mi.user = $3.str;
           }
-        | MASTER_PASSWORD_SYM EQ TEXT_STRING_sys
+        | MASTER_PASSWORD_SYM EQ TEXT_STRING_sys_nonewline
           {
             Lex->mi.password = $3.str;
           }
@@ -2027,23 +2027,23 @@ master_def:
             Lex->mi.ssl= $3 ? 
               LEX_MASTER_INFO::LEX_MI_ENABLE : LEX_MASTER_INFO::LEX_MI_DISABLE;
           }
-        | MASTER_SSL_CA_SYM EQ TEXT_STRING_sys
+        | MASTER_SSL_CA_SYM EQ TEXT_STRING_sys_nonewline
           {
             Lex->mi.ssl_ca= $3.str;
           }
-        | MASTER_SSL_CAPATH_SYM EQ TEXT_STRING_sys
+        | MASTER_SSL_CAPATH_SYM EQ TEXT_STRING_sys_nonewline
           {
             Lex->mi.ssl_capath= $3.str;
           }
-        | MASTER_SSL_CERT_SYM EQ TEXT_STRING_sys
+        | MASTER_SSL_CERT_SYM EQ TEXT_STRING_sys_nonewline
           {
             Lex->mi.ssl_cert= $3.str;
           }
-        | MASTER_SSL_CIPHER_SYM EQ TEXT_STRING_sys
+        | MASTER_SSL_CIPHER_SYM EQ TEXT_STRING_sys_nonewline
           {
             Lex->mi.ssl_cipher= $3.str;
           }
-        | MASTER_SSL_KEY_SYM EQ TEXT_STRING_sys
+        | MASTER_SSL_KEY_SYM EQ TEXT_STRING_sys_nonewline
           {
             Lex->mi.ssl_key= $3.str;
           }
@@ -2052,11 +2052,11 @@ master_def:
             Lex->mi.ssl_verify_server_cert= $3 ?
               LEX_MASTER_INFO::LEX_MI_ENABLE : LEX_MASTER_INFO::LEX_MI_DISABLE;
           }
-        | MASTER_SSL_CRL_SYM EQ TEXT_STRING_sys
+        | MASTER_SSL_CRL_SYM EQ TEXT_STRING_sys_nonewline
           {
             Lex->mi.ssl_crl= $3.str;
           }
-        | MASTER_SSL_CRLPATH_SYM EQ TEXT_STRING_sys
+        | MASTER_SSL_CRLPATH_SYM EQ TEXT_STRING_sys_nonewline
           {
             Lex->mi.ssl_crlpath= $3.str;
           }
@@ -2121,7 +2121,7 @@ ignore_server_id:
           }
 
 master_file_def:
-          MASTER_LOG_FILE_SYM EQ TEXT_STRING_sys
+          MASTER_LOG_FILE_SYM EQ TEXT_STRING_sys_nonewline
           {
             Lex->mi.log_file_name = $3.str;
           }
@@ -2141,7 +2141,7 @@ master_file_def:
             */
             Lex->mi.pos = max<ulonglong>(BIN_LOG_HEADER_SIZE, Lex->mi.pos);
           }
-        | RELAY_LOG_FILE_SYM EQ TEXT_STRING_sys
+        | RELAY_LOG_FILE_SYM EQ TEXT_STRING_sys_nonewline
           {
             Lex->mi.relay_log_name = $3.str;
           }
@@ -12864,6 +12864,19 @@ IDENT_sys:
             }
           }
         ;
+
+TEXT_STRING_sys_nonewline:
+          TEXT_STRING_sys
+          {
+            if (!strcont($1.str, "\n"))
+              $$= $1;
+            else
+            {
+              my_error(ER_WRONG_VALUE, MYF(0), "argument contains not-allowed LF", $1.str);
+              MYSQL_YYABORT;
+            }
+          }
+        ;
 
 TEXT_STRING_sys:
           TEXT_STRING

=== modified file 'sql/sys_vars.cc'
--- a/sql/sys_vars.cc	2012-01-31 10:40:02 +0000
+++ b/sql/sys_vars.cc	2012-02-02 16:56:36 +0000
@@ -2114,7 +2114,7 @@ static Sys_var_uint Sys_eq_range_index_d
        "eq_range_index_dive_limit",
        "The optimizer will use existing index statistics instead of "
        "doing index dives for equality ranges if the number of equality "
-       "ranges is larger than or equal to this number.",
+       "ranges for the index is larger than or equal to this number.",
        SESSION_VAR(eq_range_index_dive_limit), CMD_LINE(REQUIRED_ARG),
        VALID_RANGE(0, UINT_MAX32), DEFAULT(10), BLOCK_SIZE(1));
 

=== modified file 'sql/table.h'
--- a/sql/table.h	2012-01-31 15:16:16 +0000
+++ b/sql/table.h	2012-02-07 11:56:30 +0000
@@ -325,6 +325,10 @@ public:
   uchar     *record_pointers;    /* If sorted in memory */
   ha_rows   found_records;      /* How many records in sort */
 
+  /** Sort filesort_buffer */
+  void sort_buffer(Sort_param *param, uint count)
+  { filesort_buffer.sort_buffer(param, count); }
+
   /**
      Accessors for Filesort_buffer (which @c).
   */

=== modified file 'storage/archive/ha_archive.cc'
--- a/storage/archive/ha_archive.cc	2012-01-31 15:16:16 +0000
+++ b/storage/archive/ha_archive.cc	2012-02-07 23:33:54 +0000
@@ -294,6 +294,15 @@ err:
   DBUG_RETURN(1);
 }
 
+static void save_auto_increment(TABLE *table, ulonglong *value)
+{
+  Field *field= table->found_next_number_field;
+  ulonglong auto_value=
+    (ulonglong) field->val_int(table->record[0] +
+                               field->offset(table->record[0]));
+  if (*value <= auto_value)
+    *value= auto_value + 1;
+}
 
 /**
   @brief Read version 1 meta file (5.0 compatibility routine).
@@ -476,6 +485,7 @@ ARCHIVE_SHARE *ha_archive::get_share(con
     share->table_name= tmp_name;
     share->crashed= FALSE;
     share->archive_write_open= FALSE;
+    share->in_optimize= false;
     fn_format(share->data_file_name, table_name, "",
               ARZ, MY_REPLACE_EXT | MY_UNPACK_FILENAME);
     strmov(share->table_name, table_name);
@@ -727,12 +737,12 @@ void ha_archive::frm_load(const char *na
   {
     if (!mysql_file_fstat(frm_file, &file_stat, MYF(MY_WME)))
     {
-      frm_ptr= (uchar *) my_malloc(sizeof(uchar) * file_stat.st_size, MYF(0));
+      frm_ptr= (uchar *) my_malloc(sizeof(uchar) * (size_t) file_stat.st_size, MYF(0));
       if (frm_ptr)
       {
-        if (my_read(frm_file, frm_ptr, file_stat.st_size, MYF(0)) ==
+        if (my_read(frm_file, frm_ptr, (size_t) file_stat.st_size, MYF(0)) ==
             (size_t) file_stat.st_size)
-          azwrite_frm(dst, (char *) frm_ptr, file_stat.st_size);
+          azwrite_frm(dst, (char *) frm_ptr, (size_t) file_stat.st_size);
         my_free(frm_ptr);
       }
     }
@@ -821,7 +831,10 @@ int ha_archive::create(const char *name,
   /* 
     We reuse name_buff since it is available.
   */
-  if (create_info->data_file_name && create_info->data_file_name[0] != '#')
+#ifdef HAVE_READLINK
+  if (my_use_symdir &&
+      create_info->data_file_name &&
+      create_info->data_file_name[0] != '#')
   {
     DBUG_PRINT("ha_archive", ("archive will create stream file %s", 
                         create_info->data_file_name));
@@ -832,12 +845,29 @@ int ha_archive::create(const char *name,
               MY_REPLACE_EXT | MY_UNPACK_FILENAME);
   }
   else
+#endif /* HAVE_READLINK */
   {
+    if (create_info->data_file_name)
+    {
+      push_warning_printf(table_arg->in_use, Sql_condition::WARN_LEVEL_WARN,
+                          WARN_OPTION_IGNORED,
+                          ER_DEFAULT(WARN_OPTION_IGNORED),
+                          "DATA DIRECTORY");
+    }
     fn_format(name_buff, name, "", ARZ,
               MY_REPLACE_EXT | MY_UNPACK_FILENAME);
     linkname[0]= 0;
   }
 
+  /* Archive engine never uses INDEX DIRECTORY. */
+  if (create_info->index_file_name)
+  {
+    push_warning_printf(table_arg->in_use, Sql_condition::WARN_LEVEL_WARN,
+                        WARN_OPTION_IGNORED,
+                        ER_DEFAULT(WARN_OPTION_IGNORED),
+                        "INDEX DIRECTORY");
+  }
+
   /*
     There is a chance that the file was "discovered". In this case
     just use whatever file is there.
@@ -1506,34 +1536,45 @@ int ha_archive::optimize(THD* thd, HA_CH
 {
   int rc= 0;
   azio_stream writer;
+  ha_rows count;
+  my_bitmap_map *org_bitmap;
   char writer_filename[FN_REFLEN];
   DBUG_ENTER("ha_archive::optimize");
 
-  init_archive_reader();
-
-  // now we close both our writer and our reader for the rename
-  if (share->archive_write_open)
+  mysql_mutex_lock(&share->mutex);
+  if (share->in_optimize)
   {
-    if (share->archive_write.version == 1)
-      write_v1_metafile();
-    azclose(&(share->archive_write));
-    share->archive_write_open= FALSE;
+    mysql_mutex_unlock(&share->mutex);
+    DBUG_RETURN(HA_ADMIN_FAILED);
   }
+  share->in_optimize= true;
+  /* remember the number of rows */
+  count= share->rows_recorded;
+  if (share->archive_write_open)
+    azflush(&share->archive_write, Z_SYNC_FLUSH);
+  mysql_mutex_unlock(&share->mutex);
+
+  init_archive_reader();
 
   /* Lets create a file to contain the new data */
   fn_format(writer_filename, share->table_name, "", ARN, 
             MY_REPLACE_EXT | MY_UNPACK_FILENAME);
 
   if (!(azopen(&writer, writer_filename, O_CREAT|O_RDWR|O_BINARY)))
-    DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE); 
+  {
+    share->in_optimize= false;
+    DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE);
+  }
 
   /*
     Transfer the embedded FRM so that the file can be discoverable.
     Write file offset is set to the end of the file.
   */
   if ((rc= frm_copy(&archive, &writer)))
+  {
+    share->in_optimize= false;
     goto error;
-
+  }
   /* 
     An extended rebuild is a lot more effort. We open up each row and re-record it. 
     Any dead rows are removed (aka rows that may have been partially recorded). 
@@ -1541,75 +1582,85 @@ int ha_archive::optimize(THD* thd, HA_CH
     As of Archive format 3, this is the only type that is performed, before this
     version it was just done on T_EXTEND
   */
-  if (1)
-  {
-    DBUG_PRINT("ha_archive", ("archive extended rebuild"));
 
-    /*
-      Now we will rewind the archive file so that we are positioned at the 
-      start of the file.
-    */
-    rc= read_data_header(&archive);
+  DBUG_PRINT("ha_archive", ("archive extended rebuild"));
 
-    /* 
-      On success of writing out the new header, we now fetch each row and
-      insert it into the new archive file. 
-    */
-    if (!rc)
-    {
-      share->rows_recorded= 0;
-      stats.auto_increment_value= 1;
-      share->archive_write.auto_increment= 0;
-      my_bitmap_map *org_bitmap= tmp_use_all_columns(table, table->read_set);
+  /*
+    Now we will rewind the archive file so that we are positioned at the 
+    start of the file.
+  */
+  if ((rc= read_data_header(&archive)))
+  {
+    share->in_optimize= false;
+    goto error;
+  }
 
-      while (!(rc= get_row(&archive, table->record[0])))
-      {
-        real_write_row(table->record[0], &writer);
-        /*
-          Long term it should be possible to optimize this so that
-          it is not called on each row.
-        */
-        if (table->found_next_number_field)
-        {
-          Field *field= table->found_next_number_field;
-          ulonglong auto_value=
-            (ulonglong) field->val_int(table->record[0] +
-                                       field->offset(table->record[0]));
-          if (share->archive_write.auto_increment < auto_value)
-            stats.auto_increment_value=
-              (share->archive_write.auto_increment= auto_value) + 1;
-        }
-      }
+  stats.auto_increment_value= 1;
+  org_bitmap= tmp_use_all_columns(table, table->read_set);
+  /* read rows upto the remembered rows */ 
+  for (ha_rows cur_count= count; cur_count; cur_count--)
+  {
+    if ((rc= get_row(&archive, table->record[0])))
+      break;
+    real_write_row(table->record[0], &writer);
+    if (table->found_next_number_field)
+      save_auto_increment(table, &stats.auto_increment_value);
+  }
+
+  mysql_mutex_lock(&share->mutex);
 
-      tmp_restore_column_map(table->read_set, org_bitmap);
-      share->rows_recorded= (ha_rows)writer.rows;
+  if (share->archive_write_open)
+  {
+    if (share->archive_write.version == 1)
+      write_v1_metafile();
+    azclose(&share->archive_write);
+    share->archive_write_open= FALSE;
+  }
+  if (!rc)
+  {
+    /* read the remaining rows */
+    for (count= share->rows_recorded - count; count; count--)
+    {
+      if ((rc= get_row(&archive, table->record[0])))
+        break;
+      real_write_row(table->record[0], &writer);
+      if (table->found_next_number_field)
+        save_auto_increment(table, &stats.auto_increment_value);
     }
+  }
 
-    DBUG_PRINT("info", ("recovered %llu archive rows", 
-                        (unsigned long long)share->rows_recorded));
+  tmp_restore_column_map(table->read_set, org_bitmap);
+  share->rows_recorded= (ha_rows) writer.rows;
+  share->archive_write.auto_increment= stats.auto_increment_value - 1;
+  DBUG_PRINT("info", ("recovered %llu archive rows", 
+                      (unsigned long long)share->rows_recorded));
 
-    DBUG_PRINT("ha_archive", ("recovered %llu archive rows", 
-                        (unsigned long long)share->rows_recorded));
+  DBUG_PRINT("ha_archive", ("recovered %llu archive rows", 
+                      (unsigned long long)share->rows_recorded));
 
-    /*
-      If REPAIR ... EXTENDED is requested, try to recover as much data
-      from data file as possible. In this case if we failed to read a
-      record, we assume EOF. This allows massive data loss, but we can
-      hardly do more with broken zlib stream. And this is the only way
-      to restore at least what is still recoverable.
-    */
-    if (rc && rc != HA_ERR_END_OF_FILE && !(check_opt->flags & T_EXTEND))
-      goto error;
-  } 
+  /*
+    If REPAIR ... EXTENDED is requested, try to recover as much data
+    from data file as possible. In this case if we failed to read a
+    record, we assume EOF. This allows massive data loss, but we can
+    hardly do more with broken zlib stream. And this is the only way
+    to restore at least what is still recoverable.
+  */
+  if (rc && rc != HA_ERR_END_OF_FILE && !(check_opt->flags & T_EXTEND))
+  {
+    share->in_optimize= false;
+    mysql_mutex_unlock(&share->mutex);
+    goto error;
+  }
 
   azclose(&writer);
   share->dirty= FALSE;
-  
   azclose(&archive);
+  archive_reader_open= FALSE;
 
   // make the file we just wrote be our data file
   rc= my_rename(writer_filename, share->data_file_name, MYF(0));
-
+  share->in_optimize= false;
+  mysql_mutex_unlock(&share->mutex);
 
   DBUG_RETURN(rc);
 error:

=== modified file 'storage/archive/ha_archive.h'
--- a/storage/archive/ha_archive.h	2011-10-07 06:03:14 +0000
+++ b/storage/archive/ha_archive.h	2012-02-03 14:37:46 +0000
@@ -35,6 +35,7 @@ typedef struct st_archive_share {
   mysql_mutex_t mutex;
   THR_LOCK lock;
   azio_stream archive_write;     /* Archive file we are working with */
+  bool in_optimize;
   bool archive_write_open;
   bool dirty;               /* Flag for if a flush should occur */
   bool crashed;             /* Meta file is crashed */

=== modified file 'storage/innobase/handler/ha_innodb.cc'
--- a/storage/innobase/handler/ha_innodb.cc	2012-02-02 15:04:54 +0000
+++ b/storage/innobase/handler/ha_innodb.cc	2012-02-08 17:06:22 +0000
@@ -35,6 +35,7 @@ this program; if not, write to the Free
 			// EXPLAIN_FILENAME_MAX_EXTRA_LENGTH
 
 #include <sql_acl.h>	// PROCESS_ACL
+#include <debug_sync.h> // DEBUG_SYNC
 #include <mysys_err.h>
 #include <mysql/innodb_priv.h>
 
@@ -3789,37 +3790,114 @@ normalize_table_name_low(
 {
 	char*	name_ptr;
 	char*	db_ptr;
+	ulint	db_len;
 	char*	ptr;
 
 	/* Scan name from the end */
 
-	ptr = strend(name)-1;
+	ptr = strend(name) - 1;
 
+	/* seek to the last path separator */
 	while (ptr >= name && *ptr != '\\' && *ptr != '/') {
 		ptr--;
 	}
 
 	name_ptr = ptr + 1;
 
-	DBUG_ASSERT(ptr > name);
+	/* skip any number of path separators */
+	while (ptr >= name && (*ptr == '\\' || *ptr == '/')) {
+		ptr--;
+	}
 
-	ptr--;
+	DBUG_ASSERT(ptr >= name);
 
+	/* seek to the last but one path separator or one char before
+	the beginning of name */
+	db_len = 0;
 	while (ptr >= name && *ptr != '\\' && *ptr != '/') {
 		ptr--;
+		db_len++;
 	}
 
 	db_ptr = ptr + 1;
 
-	memcpy(norm_name, db_ptr, strlen(name) + 1 - (db_ptr - name));
+	memcpy(norm_name, db_ptr, db_len);
+
+	norm_name[db_len] = '/';
 
-	norm_name[name_ptr - db_ptr - 1] = '/';
+	memcpy(norm_name + db_len + 1, name_ptr, strlen(name_ptr) + 1);
 
 	if (set_lower_case) {
 		innobase_casedn_str(norm_name);
 	}
 }
 
+#if !defined(DBUG_OFF)
+/*********************************************************************
+Test normalize_table_name_low(). */
+static
+void
+test_normalize_table_name_low()
+/*===========================*/
+{
+	char		norm_name[128];
+	const char*	test_data[][2] = {
+		/* input, expected result */
+		{"./mysqltest/t1", "mysqltest/t1"},
+		{"./test/#sql-842b_2", "test/#sql-842b_2"},
+		{"./test/#sql-85a3_10", "test/#sql-85a3_10"},
+		{"./test/#sql2-842b-2", "test/#sql2-842b-2"},
+		{"./test/bug29807", "test/bug29807"},
+		{"./test/foo", "test/foo"},
+		{"./test/innodb_bug52663", "test/innodb_bug52663"},
+		{"./test/t", "test/t"},
+		{"./test/t1", "test/t1"},
+		{"./test/t10", "test/t10"},
+		{"/a/b/db/table", "db/table"},
+		{"/a/b/db///////table", "db/table"},
+		{"/a/b////db///////table", "db/table"},
+		{"/var/tmp/mysqld.1/#sql842b_2_10", "mysqld.1/#sql842b_2_10"},
+		{"db/table", "db/table"},
+		{"ddd/t", "ddd/t"},
+		{"d/ttt", "d/ttt"},
+		{"d/t", "d/t"},
+		{".\\mysqltest\\t1", "mysqltest/t1"},
+		{".\\test\\#sql-842b_2", "test/#sql-842b_2"},
+		{".\\test\\#sql-85a3_10", "test/#sql-85a3_10"},
+		{".\\test\\#sql2-842b-2", "test/#sql2-842b-2"},
+		{".\\test\\bug29807", "test/bug29807"},
+		{".\\test\\foo", "test/foo"},
+		{".\\test\\innodb_bug52663", "test/innodb_bug52663"},
+		{".\\test\\t", "test/t"},
+		{".\\test\\t1", "test/t1"},
+		{".\\test\\t10", "test/t10"},
+		{"C:\\a\\b\\db\\table", "db/table"},
+		{"C:\\a\\b\\db\\\\\\\\\\\\\\table", "db/table"},
+		{"C:\\a\\b\\\\\\\\db\\\\\\\\\\\\\\table", "db/table"},
+		{"C:\\var\\tmp\\mysqld.1\\#sql842b_2_10", "mysqld.1/#sql842b_2_10"},
+		{"db\\table", "db/table"},
+		{"ddd\\t", "ddd/t"},
+		{"d\\ttt", "d/ttt"},
+		{"d\\t", "d/t"},
+	};
+
+	for (size_t i = 0; i < UT_ARR_SIZE(test_data); i++) {
+		printf("test_normalize_table_name_low(): "
+		       "testing \"%s\", expected \"%s\"... ",
+		       test_data[i][0], test_data[i][1]);
+
+		normalize_table_name_low(norm_name, test_data[i][0], FALSE);
+
+		if (strcmp(norm_name, test_data[i][1]) == 0) {
+			printf("ok\n");
+		} else {
+			printf("got \"%s\"\n", norm_name);
+			ut_error;
+		}
+	}
+}
+#endif /* !DBUG_OFF */
+
 /********************************************************************//**
 Get the upper limit of the MySQL integral and floating-point type.
 @return maximum allowed value for the field */
@@ -9066,6 +9144,11 @@ ha_innobase::delete_table(
 
 	DBUG_ENTER("ha_innobase::delete_table");
 
+	DBUG_EXECUTE_IF(
+		"test_normalize_table_name_low",
+		test_normalize_table_name_low();
+	);
+
 	/* Strangely, MySQL passes the table name without the '.frm'
 	extension, in contrast to ::create */
 	normalize_table_name(norm_name, name);
@@ -9375,6 +9458,8 @@ ha_innobase::rename_table(
 
 	error = innobase_rename_table(trx, from, to, TRUE);
 
+	DEBUG_SYNC(thd, "after_innobase_rename_table");
+
 	/* Tell the InnoDB server that there might be work for
 	utility threads: */
 

=== modified file 'storage/myisam/ha_myisam.cc'
--- a/storage/myisam/ha_myisam.cc	2012-02-02 12:48:48 +0000
+++ b/storage/myisam/ha_myisam.cc	2012-02-07 23:33:54 +0000
@@ -1942,10 +1942,27 @@ int ha_myisam::create(const char *name,
                                (ulonglong) 0);
   create_info.data_file_length= ((ulonglong) share->max_rows *
                                  share->avg_row_length);
-  create_info.data_file_name= ha_create_info->data_file_name;
-  create_info.index_file_name= ha_create_info->index_file_name;
   create_info.language= share->table_charset->number;
 
+#ifdef HAVE_READLINK
+  if (my_use_symdir)
+  {
+    create_info.data_file_name= ha_create_info->data_file_name;
+    create_info.index_file_name= ha_create_info->index_file_name;
+  }
+  else
+#endif /* HAVE_READLINK */
+  {
+    if (ha_create_info->data_file_name)
+      push_warning_printf(table_arg->in_use, Sql_condition::WARN_LEVEL_WARN,
+                          WARN_OPTION_IGNORED, ER(WARN_OPTION_IGNORED),
+                          "DATA DIRECTORY");
+    if (ha_create_info->index_file_name)
+      push_warning_printf(table_arg->in_use, Sql_condition::WARN_LEVEL_WARN,
+                          WARN_OPTION_IGNORED, ER(WARN_OPTION_IGNORED),
+                          "INDEX DIRECTORY");
+  }
+
   if (ha_create_info->options & HA_LEX_CREATE_TMP_TABLE)
     create_flags|= HA_CREATE_TMP_TABLE;
   if (ha_create_info->options & HA_CREATE_KEEP_FILES)

=== modified file 'storage/myisam/mi_dbug.c'
--- a/storage/myisam/mi_dbug.c	2011-06-30 15:46:53 +0000
+++ b/storage/myisam/mi_dbug.c	2012-02-07 13:06:27 +0000
@@ -36,7 +36,6 @@ void _mi_print_key(FILE *stream, registe
   {
     if (flag++)
       (void) putc('-',stream);
-    end= key+ keyseg->length;
     if (keyseg->flag & HA_NULL_PART)
     {
       /* A NULL value is encoded by a 1-byte flag. Zero means NULL. */
@@ -46,6 +45,7 @@ void _mi_print_key(FILE *stream, registe
 	continue;
       }
     }
+    end= key + keyseg->length;
 
     switch (keyseg->type) {
     case HA_KEYTYPE_BINARY:

=== modified file 'unittest/gunit/CMakeLists.txt'
--- a/unittest/gunit/CMakeLists.txt	2012-01-31 15:16:16 +0000
+++ b/unittest/gunit/CMakeLists.txt	2012-02-07 11:56:30 +0000
@@ -233,6 +233,7 @@ SET(TESTS
   decimal
   dynarray
   filesort_buffer
+  filesort_compare
   mdl
   mdl_mytap
   my_bitmap

=== modified file 'unittest/gunit/dynarray-t.cc'
--- a/unittest/gunit/dynarray-t.cc	2011-12-20 09:51:05 +0000
+++ b/unittest/gunit/dynarray-t.cc	2012-02-07 11:56:30 +0000
@@ -148,7 +148,7 @@ void generate_test_data(Key_use *keys, T
 
 // Play around with these constants to see std::sort speedup vs. my_qsort.
 const int num_elements= 200;
-const int num_iterations= 10;
+const int num_iterations= 1000;
 
 /*
   This class is used for comparing performance of

=== added file 'unittest/gunit/filesort_compare-t.cc'
--- a/unittest/gunit/filesort_compare-t.cc	1970-01-01 00:00:00 +0000
+++ b/unittest/gunit/filesort_compare-t.cc	2012-02-07 11:56:30 +0000
@@ -0,0 +1,466 @@
+/* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; version 2 of the License.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02111-1307  USA */
+
+// First include (the generated) my_config.h, to get correct platform defines.
+#include "my_config.h"
+#include <gtest/gtest.h>
+
+#include "filesort_utils.h"
+
+#include <algorithm>
+#include <memory>
+#include <vector>
+
+namespace {
+
+/*
+  Below are some performance microbenchmarks in order to compare our sorting
+  options: 
+  my_qsort2        - requires no extra memory, uses insert sort on small ranges,
+                     uses quicksort on larger ranges
+  radixsort -        requires extra memory: array of n pointers,
+                     seems to be quite fast on intel *when it is appliccable*:
+                     if (size <= 20 && items >= 1000 && items < 100000)
+  std::sort -        requires no extra memory,
+                     typically implemented with introsort/insertion sort
+  std::stable_sort - requires extra memory: array of n pointers,
+                     typically implemented with mergesort
+
+  The record format for filesort is constructed in such a way that we can
+  compare records byte-by-byte, without knowing the data types.
+  Nullable fields (maybe_null()) are pre-pended with an extra byte.
+  If we are sorting in descending mode, all the bytes are simply flipped.
+
+  This means that any variant of memcmp() can be used for comparing record.
+  Below we test different variants, including memcmp() itself.
+*/
+
+// A simple helper function to determine array size.
+template <class T, int size>
+int array_size(const T (&)[size])
+{
+  return size;
+}
+
+inline int bytes_to_int(const uchar *s)
+{
+  int val;
+  longget(val, s);
+  return val ^ 0x80000000;
+}
+
+inline void int_to_bytes(uchar *s, int val)
+{
+  val= val ^ 0x80000000;
+  longstore(s, val);
+}
+
+
+TEST(AlignmentTest, IntsToBytesToInt)
+{
+  uchar buf[10];
+  memset(buf, 0, sizeof(buf));
+  for (int ix= 0; ix < 6; ++ix)
+  {
+    int test_data[]= { INT_MIN32, -42, -1, 0, 1, 42, INT_MAX32 };
+    for (int iy= 0; iy < array_size(test_data); ++iy)
+    {
+      int val= test_data[iy];
+      int_to_bytes(buf+ix, val);
+      EXPECT_EQ(val, bytes_to_int(buf+ix));
+    }
+  }
+}
+
+
+class FileSortCompareTest : public ::testing::Test
+{
+protected:
+  // Do each sort algorithm this many times. Increase value for benchmarking!
+  static const int num_iterations= 1;
+  // Number of records.
+  static const int num_records= 100 * 1000;
+  // Number of keys in each record.
+  static const int keys_per_record= 4;
+  // Size of each record.
+  static const int record_size= keys_per_record * sizeof(int);
+
+  // Static buffer containing data to be sorted.
+  // (actually: we only sort the sort_keys below, data is stable).
+  static std::vector<int> test_data;
+
+  static void SetUpTestCase()
+  {
+    test_data.reserve(num_records * keys_per_record);
+    union { int val; uchar buf[sizeof(int)]; } sort_str;
+
+    for (int ix= 0; ix < num_records * keys_per_record; ++ix)
+    {
+      int val= ix / (10 * keys_per_record);
+      if (ix % 10 == 0) val= -val;
+      int_to_bytes(sort_str.buf, val);
+      test_data.push_back(sort_str.val);
+    }
+    // Comment away shuffling for testing partially pre-sorted data.
+    std::random_shuffle(test_data.begin(), test_data.end());
+  }
+
+  static void TearDownTestCase()
+  {
+    // Delete the data now, rather than during exit().
+    std::vector<int>().swap(test_data);
+  }
+
+  virtual void SetUp()
+  {
+    sort_keys= new uchar* [num_records];
+    for (int ix= 0; ix < num_records; ++ix)
+      sort_keys[ix]=
+        static_cast<uchar*>(static_cast<void*>(&test_data[keys_per_record*ix]));
+  }
+
+  virtual void TearDown()
+  {
+    delete[] sort_keys;
+  }
+
+  uchar **sort_keys;
+};
+std::vector<int> FileSortCompareTest::test_data;
+
+/*
+  Some different mem_compare functions.
+  The first one seems to win on all platforms, except sparc,
+  where the builtin memcmp() wins.
+ */
+inline bool mem_compare_1(const uchar *s1, const uchar *s2, size_t len)
+{
+  do {
+    if (*s1++ != *s2++)
+      return *--s1 < *--s2;
+  } while (--len != 0);
+  return false;
+}
+
+inline bool mem_compare_2(const uchar *s1, const uchar *s2, size_t len)
+{
+  int v= 0;
+  while (len-- > 0 && v == 0)
+  {
+    v= *(s1++) - *(s2++);
+  }
+  return v < 0;
+}
+
+inline bool mem_compare_3(const uchar *s1, const uchar *s2, size_t len)
+{
+  while (--len && (s1[0] == s2[0]))
+  {
+    ++s1; ++s2;
+  }
+  return s1[0] < s2[0];
+}
+
+#if defined(__WIN__)
+#pragma intrinsic(memcmp)
+#endif
+// For gcc, __builtin_memcmp is actually *slower* than the library call:
+// http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43052
+
+
+class Mem_compare_memcmp :
+  public std::binary_function<const uchar*, const uchar*, bool>
+{
+public:
+  Mem_compare_memcmp(size_t n) : m_size(n) {}
+  bool operator()(const uchar *s1, const uchar *s2)
+  {
+    return memcmp(s1, s2, m_size) < 0;
+  }
+  size_t m_size;
+};
+
+
+class Mem_compare_1 :
+  public std::binary_function<const uchar*, const uchar*, bool>
+{
+public:
+  Mem_compare_1(size_t n) : m_size(n) {}
+  bool operator()(const uchar *s1, const uchar *s2)
+  {
+    return mem_compare_1(s1, s2, m_size);
+  }
+  size_t m_size;
+};
+
+
+class Mem_compare_2 :
+  public std::binary_function<const uchar*, const uchar*, bool>
+{
+public:
+  Mem_compare_2(size_t n) : m_size(n) {}
+  bool operator()(const uchar *s1, const uchar *s2)
+  {
+    return mem_compare_2(s1, s2, m_size);
+  }
+  size_t m_size;
+};
+
+
+class Mem_compare_3 :
+  public std::binary_function<const uchar*, const uchar*, bool>
+{
+public:
+  Mem_compare_3(size_t n) : m_size(n) {}
+  bool operator()(const uchar *s1, const uchar *s2)
+  {
+    return mem_compare_3(s1, s2, m_size);
+  }
+  size_t m_size;
+};
+
+
+#define COMPARE(N) if (s1[N] != s2[N]) return s1[N] < s2[N]
+
+class Mem_compare_0 : 
+  public std::binary_function<const uchar*, const uchar*, bool>
+{
+public:
+  Mem_compare_0(size_t n) : m_size(n) {}
+  bool operator()(const uchar *s1, const uchar *s2)
+  {
+    size_t len= m_size;
+    while(len)
+    {
+      COMPARE(0);
+      COMPARE(1);
+      COMPARE(2);
+      COMPARE(3);
+      len-= 4;
+      s1 += 4;
+      s2 += 4;
+    }
+    return s1[0] < s2[0];
+  }
+  size_t m_size;
+};
+
+
+// This one works for any number of keys.
+// We treat the first key as int, the rest byte-by-byte.
+class Mem_compare_int : 
+  public std::binary_function<const uchar*, const uchar*, bool>
+{
+public:
+  Mem_compare_int(size_t n) : m_size(n), rest(n - sizeof(int)) {}
+  bool operator()(const uchar *s1, const uchar *s2)
+  {
+    int int1= bytes_to_int(s1);
+    int int2= bytes_to_int(s2);
+    if (int1 == int2)
+      return mem_compare_1(s1 + rest, s2 + rest, rest);
+    return int1 < int2;
+  }
+private:
+  size_t m_size;
+  const size_t rest;
+};
+
+class Mem_compare_int_4 :
+  public std::binary_function<const uchar*, const uchar*, bool>
+{
+public:
+  Mem_compare_int_4(size_t) : keyno(1) {}
+  bool operator() (const uchar *s1, const uchar *s2)
+  {
+    int inta1= bytes_to_int(s1);
+    int intb1= bytes_to_int(s2);
+    if (keyno < 4 && inta1 == intb1)
+    {
+      ++keyno;
+      return operator()(s1 + sizeof(int), s2 + sizeof(int));
+    }
+    return inta1 < intb1;
+  }
+  int keyno;
+};
+
+/*
+  Several sorting tests below, each one runs num_iterations.
+  For each iteration we take a copy of the key pointers, and sort the copy.
+  Most of the tests below are run with std::sort and std::stable_sort.
+  Stable sort seems to be faster for all test cases, on all platforms.
+ */
+TEST_F(FileSortCompareTest, SetUpOnly)
+{
+  for (int ix= 0; ix < num_iterations; ++ix)
+  {
+    std::vector<uchar*> keys(sort_keys, sort_keys + num_records);
+  }
+}
+
+TEST_F(FileSortCompareTest, RadixSort)
+{
+  for (int ix= 0; ix < num_iterations; ++ix)
+  {
+    std::vector<uchar*> keys(sort_keys, sort_keys + num_records);
+    std::pair<uchar**, ptrdiff_t> buffer=
+      std::get_temporary_buffer<uchar*>(num_records);
+    radixsort_for_str_ptr(&keys[0], num_records, record_size, buffer.first);
+    std::return_temporary_buffer(buffer.first);
+  }
+}
+
+TEST_F(FileSortCompareTest, MyQsort)
+{
+  size_t size= record_size;
+  for (int ix= 0; ix < num_iterations; ++ix)
+  {
+    std::vector<uchar*> keys(sort_keys, sort_keys + num_records);
+    my_qsort2((uchar*) &keys[0], num_records, sizeof(uchar*),
+              get_ptr_compare(record_size), &size);
+  }
+}
+
+TEST_F(FileSortCompareTest, StdSortmemcmp)
+{
+  for (int ix= 0; ix < num_iterations; ++ix)
+  {
+    std::vector<uchar*> keys(sort_keys, sort_keys + num_records);
+    std::sort(keys.begin(), keys.end(), Mem_compare_memcmp(record_size));
+  }
+}
+
+TEST_F(FileSortCompareTest, StdStableSortmemcmp)
+{
+  for (int ix= 0; ix < num_iterations; ++ix)
+  {
+    std::vector<uchar*> keys(sort_keys, sort_keys + num_records);
+    std::stable_sort(keys.begin(), keys.end(),
+                     Mem_compare_memcmp(record_size));
+  }
+}
+
+TEST_F(FileSortCompareTest, StdSortCompare1)
+{
+  for (int ix= 0; ix < num_iterations; ++ix)
+  {
+    std::vector<uchar*> keys(sort_keys, sort_keys + num_records);
+    std::sort(keys.begin(), keys.end(), Mem_compare_1(record_size));
+  }
+}
+
+TEST_F(FileSortCompareTest, StdStableSortCompare1)
+{
+  for (int ix= 0; ix < num_iterations; ++ix)
+  {
+    std::vector<uchar*> keys(sort_keys, sort_keys + num_records);
+    std::stable_sort(keys.begin(), keys.end(), Mem_compare_1(record_size));
+  }
+}
+
+TEST_F(FileSortCompareTest, StdSortCompare2)
+{
+  for (int ix= 0; ix < num_iterations; ++ix)
+  {
+    std::vector<uchar*> keys(sort_keys, sort_keys + num_records);
+    std::sort(keys.begin(), keys.end(), Mem_compare_2(record_size));
+  }
+}
+
+TEST_F(FileSortCompareTest, StdStableSortCompare2)
+{
+  for (int ix= 0; ix < num_iterations; ++ix)
+  {
+    std::vector<uchar*> keys(sort_keys, sort_keys + num_records);
+    std::stable_sort(keys.begin(), keys.end(), Mem_compare_2(record_size));
+  }
+}
+
+TEST_F(FileSortCompareTest, StdSortCompare3)
+{
+  for (int ix= 0; ix < num_iterations; ++ix)
+  {
+    std::vector<uchar*> keys(sort_keys, sort_keys + num_records);
+    std::sort(keys.begin(), keys.end(), Mem_compare_3(record_size));
+  }
+}
+
+TEST_F(FileSortCompareTest, StdStableSortCompare3)
+{
+  for (int ix= 0; ix < num_iterations; ++ix)
+  {
+    std::vector<uchar*> keys(sort_keys, sort_keys + num_records);
+    std::stable_sort(keys.begin(), keys.end(), Mem_compare_3(record_size));
+  }
+}
+
+TEST_F(FileSortCompareTest, StdSortCompare4)
+{
+  for (int ix= 0; ix < num_iterations; ++ix)
+  {
+    std::vector<uchar*> keys(sort_keys, sort_keys + num_records);
+    std::sort(keys.begin(), keys.end(), Mem_compare_0(record_size));
+  }
+}
+
+TEST_F(FileSortCompareTest, StdStableSortCompare4)
+{
+  for (int ix= 0; ix < num_iterations; ++ix)
+  {
+    std::vector<uchar*> keys(sort_keys, sort_keys + num_records);
+    std::stable_sort(keys.begin(), keys.end(), Mem_compare_0(record_size));
+  }
+}
+
+TEST_F(FileSortCompareTest, StdSortIntCompare)
+{
+  for (int ix= 0; ix < num_iterations; ++ix)
+  {
+    std::vector<uchar*> keys(sort_keys, sort_keys + num_records);
+    std::sort(keys.begin(), keys.end(), Mem_compare_int(record_size));
+  }
+}
+
+TEST_F(FileSortCompareTest, StdStableSortIntCompare)
+{
+  for (int ix= 0; ix < num_iterations; ++ix)
+  {
+    std::vector<uchar*> keys(sort_keys, sort_keys + num_records);
+    std::stable_sort(keys.begin(), keys.end(), Mem_compare_int(record_size));
+  }
+}
+
+TEST_F(FileSortCompareTest, StdSortIntIntIntInt)
+{
+  for (int ix= 0; ix < num_iterations; ++ix)
+  {
+    std::vector<uchar*> keys(sort_keys, sort_keys + num_records);
+    std::sort(keys.begin(), keys.end(),
+              Mem_compare_int_4(record_size));
+  }
+}
+
+TEST_F(FileSortCompareTest, StdStableSortIntIntIntInt)
+{
+  for (int ix= 0; ix < num_iterations; ++ix)
+  {
+    std::vector<uchar*> keys(sort_keys, sort_keys + num_records);
+    std::stable_sort(keys.begin(), keys.end(),
+                     Mem_compare_int_4(record_size));
+  }
+}
+
+}  // namespace

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk-wl5534-stage branch (jon.hauglid:3826 to 3827) Jon Olav Hauglid9 Feb