List:Commits« Previous MessageNext Message »
From:He Zhenxing Date:January 19 2011 8:16am
Subject:Re: bzr commit into mysql-5.1-bugteam branch (zhenxing.he:3513)
Bug#51638
View as plain text  
Sven Sandberg wrote:
> Hi Zhenxing,
> 
> Thanks for this work. I think you came up with a good compromise to not 
> propagate deterministicness between tables in 5.1. This is also a good 
> start for the implementation. The test case is ambitious, it's very good.
> 

Thanks!

> I think some changes are still needed to organize the code better, and 
> there are also some cases when the algorithm gives wrong result:
> 
> ==== Code Organization ====
> 
> (S1) The code to check if the order is deterministic is pretty much 
> independent of everything else. Can we move it to a separate file?
> 

OK

> (S2) I think the "Result" class is not needed, it is not used in an 
> object-like manner: we only create one object instance and call one 
> method. So it works more like a function. I would therefore suggest to 
> simply use functions instead. I think we can use 
> bitmap_is_set/bitmap_union/bitmap_set instead of the wrapper functions.
> 

The class Result and the wrapper functions are there to make the code
neat, easier to understand and maintain. Without the class Result, we
will have to add some global variables (table, const_bitmap,
ordered_bitmap) or passing the parameters around the functions. Using
the wrapper function makes the purpose of the code more clear, and also
we can easily change there implementation (if we choose something better
than bitmap).

And if we will support multi-table, we will have multiple instances of
this class.

> ==== Algorithm ====
> 
> (S3) It's good that we don't do the full algorithm that uses the ON 
> clause to propagate deterministicness between tables in 5.1. But we can 
> still do a simple algorithm that works for many cases of joined tables, 
> like:
> 
>    for each table T:
>      if not is_order_deterministic(stmt, T):
>        return not_deterministic
>    return deterministic
> 

Agree, will do that

> (S4) Even when there is a WHERE pk_col = constant clause, it's possible 
> to have more than one matching rows in some cases. For example, every 
> number has many string representations:
>      CREATE TABLE t1 (a CHAR(10) PRIMARY KEY);
>      CREATE TABLE t2 LIKE t1;
>      INSERT INTO t2 VALUES (''),('0'),('0.'),('.0'),('0.0'),('00');
>      INSERT INTO t1 SELECT * FROM t2 WHERE a = 0 LIMIT 1;
> The last statement is actually unsafe, any of the six rows could match. 
> I don't know if it would be enough to check that the constant is of the 
> same type as the column. It's probably best to ask the runtime team 
> about that.
> 

Right, It looks it's not enough to check that they are the same type, I
found the following case in check_simple_equality().

    if (const_item &&
        field_item->result_type() == const_item->result_type())
    {
      if (field_item->result_type() == STRING_RESULT)
      {
        CHARSET_INFO *cs= ((Field_str*) field_item->field)->charset();
        ...
        if ((cs != ((Item_func *) item)->compare_collation()) ||
            !cs->coll->propagate(cs, 0, 0))
          return FALSE;
      }
    }

I think we should to do the same, for STRINGs, the collation of the
field should be used for comparison.

> (S5) As discussed in email "Calling fix_fields before any sub-statement 
> is executed", I think we should unconditionally mark stored functions 
> that contain a LIMIT clause unsafe.
> 

Agree

> (S6) The correct condition for MAX_SORT_LENGTH is that the length of the 
> prefix used by the key should be less than MAX_SORT_LENGTH (the code 
> below uses the length of the column). See comments inline.
> 

Yes, you're right.

> (S7) A table can be order-deterministic if there is a PK where some 
> components are ordered by ORDER BY and some are unique because of WHERE 
> col = constant clauses. For example, the following is 
> order-deterministic, but the current algorithm marks it as unsafe:
>      CREATE TABLE t1 (a INT, b INT, PRIMARY KEY(a, b));
>      CREATE TABLE t2 LIKE t1;
>      INSERT INTO t2 SELECT * FROM t1 WHERE a = 1 ORDER BY b;
> See comments inline.
> 

Yes, I ignore this for simplicity, I think this use case is not very
important, will handle this in the patch for trunk.

> ==== Other notes ====
> 
> (S8) I think you use the term "order deterministic" to denote that the 
> rows are in a deterministic order, in all places except 
> is_unique_key_const_ordered. Also, this doesn't check if a key is order 
> deterministic, it checks if a table is order deterministic. So I think 
> we can rename it to is_table_order_deterministic. See comments inline.
> 

OK, I think I can remove the function, and move the code to
Result::is_ordered();

> (S9) Please add comments describing each new function.
> 

OK

> (S10) Simplification: we can get rid of the call to is_cond_or. See 
> comments inline.
> 

OK

> (S11) Simplification: we can get rid of second_field and simplify that 
> part of the code a bit. See comments inline.
> 

OK

> (S12) Reminder: remember that in 5.5, we have to check unsafeness even 
> if statement is already marked unsafe. See comments inline.
> 

Right

> (S13) The stored proc in the test case can be simplified. See comments 
> inline.
> 

OK

> (S14) We can remove some commented lines from the test case. See 
> comments inline.
> 

Yes

> (S14) The tables t3, t4, t5 are not needed in the test case. We also 
> don't need to truncate t1 and t2 in every iteration. See comments inline.
> 

OK

> (S15) I think we can add some more cases to the test case, and maybe 
> also organize the tables in a slightly different way. See comments inline.
> 

OK

> On 12/11/2010 05:32 AM, He Zhenxing wrote:
> > #At file:///media/sdb2/hezx/work/mysql/bzr/b51638/5.1-bugteam/ based on
> revid:luis.soares@stripped
> >
> >   3513 He Zhenxing	2010-12-11
> >        BUG#51638 SBR logging warning messages for primary key updates with a
> LIMIT of 1
> >
> >        UPDATE/DELETE/INSERT..SELECT with LIMIT were marked unsafe
> >        unconditionally, but if there is a where condition or order by clause
> >        that can make the result row unique or ordered, then they are
> >        safe with LIMIT clause.
> >
> >        This patch fixed the the problem of UPDATE/DELETE and INSERT..SELECT
> >        from single table for the following simple cases:
> >         - LIMIT 0 will always be safe
> >         - there is a WHERE condition that can only result in one row,
> >           for example the condition requires the primary key or a non-
> >           null unique key to be some constant value.
> >         - ORDER BY primary key or non-null unique key, and all fields
> >           length of the key are not longer than MAX_SORT_LENGTH.
> >
> >        The problem of INSERT...SELECT from JOINed tables with LIMIT are
> >        not fixed in this patch, it will be fixed by patch for BUG#42415.
> >
> >      added:
> >        mysql-test/suite/binlog/r/binlog_unsafe_limit.result
> >        mysql-test/suite/binlog/t/binlog_unsafe_limit.test
> >      modified:
> >        mysql-test/suite/binlog/r/binlog_stm_unsafe_warning.result
> >        sql/sql_delete.cc
> >        sql/sql_insert.cc
> >        sql/sql_select.cc
> >        sql/sql_select.h
> >        sql/sql_update.cc
> > === modified file 'mysql-test/suite/binlog/r/binlog_stm_unsafe_warning.result'
> > --- a/mysql-test/suite/binlog/r/binlog_stm_unsafe_warning.result	2009-07-31
> 13:00:35 +0000
> > +++ b/mysql-test/suite/binlog/r/binlog_stm_unsafe_warning.result	2010-12-11
> 04:32:35 +0000
> > @@ -3,11 +3,7 @@ DROP TABLE IF EXISTS t1;
> >   CREATE TABLE t1 (a int, b int, primary key (a));
> >   INSERT INTO t1 VALUES (1,2), (2,3);
> >   UPDATE t1 SET b='4' WHERE a=1 LIMIT 1;
> > -Warnings:
> > -Note	1592	Statement may not be safe to log in statement format.
> >   UPDATE t1 SET b='5' WHERE a=2 ORDER BY a LIMIT 1;
> > -Warnings:
> > -Note	1592	Statement may not be safe to log in statement format.
> >   DROP TABLE t1;
> >   ### NOT filtered database =>  assertion: binlog disabled and warnings ARE
> NOT shown
> >   SET SQL_LOG_BIN= 0;
> >
> > === added file 'mysql-test/suite/binlog/r/binlog_unsafe_limit.result'
> > --- a/mysql-test/suite/binlog/r/binlog_unsafe_limit.result	1970-01-01 00:00:00
> +0000
> > +++ b/mysql-test/suite/binlog/r/binlog_unsafe_limit.result	2010-12-11 04:32:35
> +0000
> > @@ -0,0 +1,2414 @@
> > +CREATE TABLE t (nokey INT, pk INT PRIMARY KEY, nnuk INT NOT NULL UNIQUE KEY,
> nuk INT UNIQUE KEY,
> > +nnuk1 INT NOT NULL, nnuk2 INT NOT NULL, UNIQUE KEY(nnuk1, nnuk2),
> > +nnuk_str_long VARCHAR(512) NOT NULL UNIQUE KEY,
> > +nnuk_str_short VARCHAR(50) NOT NULL UNIQUE KEY);
> > +CREATE TABLE t1 LIKE t;
> > +CREATE TABLE t2 LIKE t;
> > +CREATE TABLE t3 LIKE t;
> > +CREATE TABLE t4 LIKE t;
> > +CREATE TABLE queries (query VARCHAR(1024) NOT NULL, unsafeness1 INT,
> unsafeness2 INT);
> > +CREATE TABLE result_queries (id INT AUTO_INCREMENT PRIMARY KEY,
> > +query VARCHAR(1024) NOT NULL, unsafe1 BOOL, unsafe2 BOOL DEFAULT FALSE);
> > +CREATE TABLE limits (`limit` VARCHAR(256) NOT NULL, safeness INT DEFAULT 0);
> > +INSERT INTO queries VALUES
> > +('UPDATE t SET nokey = nokey + 10 [LIMIT_1]', 1, 0),
> > +('UPDATE t SET nokey = nokey + 10 WHERE nokey=1 [LIMIT_1]', 1, 0),
> > +('UPDATE t SET nokey = nokey + 10 WHERE nuk=1   [LIMIT_1]', 1, 0),
> > +('UPDATE t SET nokey = nokey + 10 WHERE nnuk=1  [LIMIT_1]', 0, 0),
> > +('UPDATE t SET nokey = nokey + 10 WHERE pk=1    [LIMIT_1]', 0, 0),
> > +('DELETE FROM t [LIMIT_1]', 1, 0),
> > +('DELETE FROM t WHERE nokey=1 [LIMIT_1]', 1, 0),
> > +('DELETE FROM t WHERE nuk=1   [LIMIT_1]', 1, 0),
> > +('DELETE FROM t WHERE nnuk=1  [LIMIT_1]', 0, 0),
> > +('DELETE FROM t WHERE pk=1    [LIMIT_1]', 0, 0),
> > +('REPLACE INTO t SELECT * FROM t1 [LIMIT_1]', 1, 0),
> > +('REPLACE INTO t SELECT * FROM t1 WHERE nokey=1 [LIMIT_1]', 1, 0),
> > +('REPLACE INTO t SELECT * FROM t1 WHERE nuk=1   [LIMIT_1]', 1, 0),
> > +('REPLACE INTO t SELECT * FROM t1 WHERE nnuk=1  [LIMIT_1]', 0, 0),
> > +('REPLACE INTO t SELECT * FROM t1 WHERE pk=1    [LIMIT_1]', 0, 0),
> > +('INSERT INTO t SELECT * FROM t1 [LIMIT_1]', 1, 0),
> > +('INSERT INTO t SELECT * FROM t1 WHERE nokey=1 [LIMIT_1]', 1, 0),
> > +('INSERT INTO t SELECT * FROM t1 WHERE nuk=1   [LIMIT_1]', 1, 0),
> > +('INSERT INTO t SELECT * FROM t1 WHERE nnuk=1  [LIMIT_1]', 0, 0),
> > +('INSERT INTO t SELECT * FROM t1 WHERE pk=1    [LIMIT_1]', 0, 0),
> > +('INSERT INTO t (SELECT * FROM t1) UNION (SELECT * FROM t2) [LIMIT_1]', 2, 0),
> > +('INSERT INTO t (SELECT * FROM t1 [LIMIT_1]) UNION (SELECT * FROM t2)', 1, 0),
> > +('INSERT INTO t (SELECT * FROM t1) UNION (SELECT * FROM t2 [LIMIT_1])', 1, 0),
> > +('INSERT INTO t (SELECT * FROM t1 [LIMIT_1]) UNION (SELECT * FROM t2
> [LIMIT_2])', 1, 1),
> > +('INSERT INTO t (SELECT * FROM t1 [LIMIT_1]) UNION (SELECT * FROM t2)
> [LIMIT_2]', 1, 2),
> > +('INSERT INTO t SELECT * FROM (SELECT * FROM t1 [LIMIT_1]) AS subselect
> [LIMIT_2]', 1, 2);
> > +INSERT INTO limits (`limit`, safeness) VALUES
> > +('LIMIT 0', 2),
> > +('LIMIT 1', 0),
> > +('ORDER BY nokey LIMIT 1', 0),
> > +('ORDER BY nuk LIMIT 1', 0),
> > +('ORDER BY nnuk1 LIMIT 1', 0),
> > +('ORDER BY nnuk LIMIT 1', 1),
> > +('ORDER BY nnuk_str_short LIMIT 1', 1),
> > +('ORDER BY nnuk_str_long LIMIT 1', 0),
> > +('ORDER BY pk LIMIT 1', 1),
> > +('ORDER BY nnuk1, nnuk2 LIMIT 1', 1),
> > +('ORDER BY nnuk1, nnuk2, nokey LIMIT 1', 1),
> > +('ORDER BY nnuk1, nokey, nnuk2 LIMIT 1', 1);
> > +CREATE PROCEDURE gen_queries()
> > +BEGIN
> > +DECLARE done INT DEFAULT 0;
> > +DECLARE q VARCHAR(1024);
> > +DECLARE unsafeness1, unsafeness2 INT;
> > +DECLARE limit1, limit2 VARCHAR(256);
> > +DECLARE limit1_safeness, limit2_safeness INT;
> > +DECLARE qcur CURSOR FOR SELECT * FROM queries;
> > +DECLARE lcur1 CURSOR FOR SELECT * FROM limits;
> > +DECLARE lcur2 CURSOR FOR SELECT * FROM limits;
> > +DECLARE CONTINUE HANDLER FOR NOT FOUND SET done=1;
> > +OPEN qcur;
> > +FETCH qcur INTO q, unsafeness1, unsafeness2;
> > +WHILE done<>  1 DO
> > +OPEN lcur1;
> > +FETCH lcur1 INTO limit1, limit1_safeness;
> > +WHILE done<>  1 DO
> > +IF LOCATE('[LIMIT_2]', q)>  0 THEN
> > +OPEN lcur2;
> > +FETCH lcur2 INTO limit2, limit2_safeness;
> > +WHILE done<>  1 DO
> > +SELECT REPLACE(REPLACE(q, '[LIMIT_1]', limit1), '[LIMIT_2]', limit2) INTO
> @query;
> > +INSERT INTO result_queries (query, unsafe1, unsafe2) VALUES
> > +(@query, limit1_safeness<  unsafeness1, limit2_safeness<  unsafeness2);
> > +FETCH lcur2 INTO limit2, limit2_safeness;
> > +END WHILE;
> > +CLOSE lcur2;
> > +SET done = 0;
> > +ELSE
> > +SELECT REPLACE(q, '[LIMIT_1]', limit1) INTO @query;
> > +INSERT INTO result_queries (query, unsafe1) VALUES (@query, limit1_safeness<
>  unsafeness1);
> > +END IF;
> > +FETCH lcur1 INTO limit1, limit1_safeness;
> > +END WHILE;
> > +CLOSE lcur1;
> > +SET done = 0;
> > +FETCH qcur INTO q, unsafeness1, unsafeness2;
> > +END WHILE;
> > +CLOSE qcur;
> > +END|
> > +call gen_queries();
> > +SET MAX_SORT_LENGTH=50;
> > +UPDATE t SET nokey = nokey + 10 LIMIT 0;
> > +ROWS in table t: 2
> > +UPDATE t SET nokey = nokey + 10 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 2
> > +UPDATE t SET nokey = nokey + 10 ORDER BY nokey LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 2
> > +UPDATE t SET nokey = nokey + 10 ORDER BY nuk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 2
> > +UPDATE t SET nokey = nokey + 10 ORDER BY nnuk1 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 2
> > +UPDATE t SET nokey = nokey + 10 ORDER BY nnuk LIMIT 1;
> > +ROWS in table t: 2
> > +UPDATE t SET nokey = nokey + 10 ORDER BY nnuk_str_short LIMIT 1;
> > +ROWS in table t: 2
> > +UPDATE t SET nokey = nokey + 10 ORDER BY nnuk_str_long LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 2
> > +UPDATE t SET nokey = nokey + 10 ORDER BY pk LIMIT 1;
> > +ROWS in table t: 2
> > +UPDATE t SET nokey = nokey + 10 ORDER BY nnuk1, nnuk2 LIMIT 1;
> > +ROWS in table t: 2
> > +UPDATE t SET nokey = nokey + 10 ORDER BY nnuk1, nnuk2, nokey LIMIT 1;
> > +ROWS in table t: 2
> > +UPDATE t SET nokey = nokey + 10 ORDER BY nnuk1, nokey, nnuk2 LIMIT 1;
> > +ROWS in table t: 2
> > +UPDATE t SET nokey = nokey + 10 WHERE nokey=1 LIMIT 0;
> > +ROWS in table t: 2
> > +UPDATE t SET nokey = nokey + 10 WHERE nokey=1 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 2
> > +UPDATE t SET nokey = nokey + 10 WHERE nokey=1 ORDER BY nokey LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 2
> > +UPDATE t SET nokey = nokey + 10 WHERE nokey=1 ORDER BY nuk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 2
> > +UPDATE t SET nokey = nokey + 10 WHERE nokey=1 ORDER BY nnuk1 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 2
> > +UPDATE t SET nokey = nokey + 10 WHERE nokey=1 ORDER BY nnuk LIMIT 1;
> > +ROWS in table t: 2
> > +UPDATE t SET nokey = nokey + 10 WHERE nokey=1 ORDER BY nnuk_str_short LIMIT 1;
> > +ROWS in table t: 2
> > +UPDATE t SET nokey = nokey + 10 WHERE nokey=1 ORDER BY nnuk_str_long LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 2
> > +UPDATE t SET nokey = nokey + 10 WHERE nokey=1 ORDER BY pk LIMIT 1;
> > +ROWS in table t: 2
> > +UPDATE t SET nokey = nokey + 10 WHERE nokey=1 ORDER BY nnuk1, nnuk2 LIMIT 1;
> > +ROWS in table t: 2
> > +UPDATE t SET nokey = nokey + 10 WHERE nokey=1 ORDER BY nnuk1, nnuk2, nokey
> LIMIT 1;
> > +ROWS in table t: 2
> > +UPDATE t SET nokey = nokey + 10 WHERE nokey=1 ORDER BY nnuk1, nokey, nnuk2
> LIMIT 1;
> > +ROWS in table t: 2
> > +UPDATE t SET nokey = nokey + 10 WHERE nuk=1   LIMIT 0;
> > +ROWS in table t: 2
> > +UPDATE t SET nokey = nokey + 10 WHERE nuk=1   LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 2
> > +UPDATE t SET nokey = nokey + 10 WHERE nuk=1   ORDER BY nokey LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 2
> > +UPDATE t SET nokey = nokey + 10 WHERE nuk=1   ORDER BY nuk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 2
> > +UPDATE t SET nokey = nokey + 10 WHERE nuk=1   ORDER BY nnuk1 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 2
> > +UPDATE t SET nokey = nokey + 10 WHERE nuk=1   ORDER BY nnuk LIMIT 1;
> > +ROWS in table t: 2
> > +UPDATE t SET nokey = nokey + 10 WHERE nuk=1   ORDER BY nnuk_str_short LIMIT 1;
> > +ROWS in table t: 2
> > +UPDATE t SET nokey = nokey + 10 WHERE nuk=1   ORDER BY nnuk_str_long LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 2
> > +UPDATE t SET nokey = nokey + 10 WHERE nuk=1   ORDER BY pk LIMIT 1;
> > +ROWS in table t: 2
> > +UPDATE t SET nokey = nokey + 10 WHERE nuk=1   ORDER BY nnuk1, nnuk2 LIMIT 1;
> > +ROWS in table t: 2
> > +UPDATE t SET nokey = nokey + 10 WHERE nuk=1   ORDER BY nnuk1, nnuk2, nokey
> LIMIT 1;
> > +ROWS in table t: 2
> > +UPDATE t SET nokey = nokey + 10 WHERE nuk=1   ORDER BY nnuk1, nokey, nnuk2
> LIMIT 1;
> > +ROWS in table t: 2
> > +UPDATE t SET nokey = nokey + 10 WHERE nnuk=1  LIMIT 0;
> > +ROWS in table t: 2
> > +UPDATE t SET nokey = nokey + 10 WHERE nnuk=1  LIMIT 1;
> > +ROWS in table t: 2
> > +UPDATE t SET nokey = nokey + 10 WHERE nnuk=1  ORDER BY nokey LIMIT 1;
> > +ROWS in table t: 2
> > +UPDATE t SET nokey = nokey + 10 WHERE nnuk=1  ORDER BY nuk LIMIT 1;
> > +ROWS in table t: 2
> > +UPDATE t SET nokey = nokey + 10 WHERE nnuk=1  ORDER BY nnuk1 LIMIT 1;
> > +ROWS in table t: 2
> > +UPDATE t SET nokey = nokey + 10 WHERE nnuk=1  ORDER BY nnuk LIMIT 1;
> > +ROWS in table t: 2
> > +UPDATE t SET nokey = nokey + 10 WHERE nnuk=1  ORDER BY nnuk_str_short LIMIT 1;
> > +ROWS in table t: 2
> > +UPDATE t SET nokey = nokey + 10 WHERE nnuk=1  ORDER BY nnuk_str_long LIMIT 1;
> > +ROWS in table t: 2
> > +UPDATE t SET nokey = nokey + 10 WHERE nnuk=1  ORDER BY pk LIMIT 1;
> > +ROWS in table t: 2
> > +UPDATE t SET nokey = nokey + 10 WHERE nnuk=1  ORDER BY nnuk1, nnuk2 LIMIT 1;
> > +ROWS in table t: 2
> > +UPDATE t SET nokey = nokey + 10 WHERE nnuk=1  ORDER BY nnuk1, nnuk2, nokey
> LIMIT 1;
> > +ROWS in table t: 2
> > +UPDATE t SET nokey = nokey + 10 WHERE nnuk=1  ORDER BY nnuk1, nokey, nnuk2
> LIMIT 1;
> > +ROWS in table t: 2
> > +UPDATE t SET nokey = nokey + 10 WHERE pk=1    LIMIT 0;
> > +ROWS in table t: 2
> > +UPDATE t SET nokey = nokey + 10 WHERE pk=1    LIMIT 1;
> > +ROWS in table t: 2
> > +UPDATE t SET nokey = nokey + 10 WHERE pk=1    ORDER BY nokey LIMIT 1;
> > +ROWS in table t: 2
> > +UPDATE t SET nokey = nokey + 10 WHERE pk=1    ORDER BY nuk LIMIT 1;
> > +ROWS in table t: 2
> > +UPDATE t SET nokey = nokey + 10 WHERE pk=1    ORDER BY nnuk1 LIMIT 1;
> > +ROWS in table t: 2
> > +UPDATE t SET nokey = nokey + 10 WHERE pk=1    ORDER BY nnuk LIMIT 1;
> > +ROWS in table t: 2
> > +UPDATE t SET nokey = nokey + 10 WHERE pk=1    ORDER BY nnuk_str_short LIMIT 1;
> > +ROWS in table t: 2
> > +UPDATE t SET nokey = nokey + 10 WHERE pk=1    ORDER BY nnuk_str_long LIMIT 1;
> > +ROWS in table t: 2
> > +UPDATE t SET nokey = nokey + 10 WHERE pk=1    ORDER BY pk LIMIT 1;
> > +ROWS in table t: 2
> > +UPDATE t SET nokey = nokey + 10 WHERE pk=1    ORDER BY nnuk1, nnuk2 LIMIT 1;
> > +ROWS in table t: 2
> > +UPDATE t SET nokey = nokey + 10 WHERE pk=1    ORDER BY nnuk1, nnuk2, nokey
> LIMIT 1;
> > +ROWS in table t: 2
> > +UPDATE t SET nokey = nokey + 10 WHERE pk=1    ORDER BY nnuk1, nokey, nnuk2
> LIMIT 1;
> > +ROWS in table t: 2
> > +DELETE FROM t LIMIT 0;
> > +ROWS in table t: 2
> > +DELETE FROM t LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 1
> > +DELETE FROM t ORDER BY nokey LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 1
> > +DELETE FROM t ORDER BY nuk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 1
> > +DELETE FROM t ORDER BY nnuk1 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 1
> > +DELETE FROM t ORDER BY nnuk LIMIT 1;
> > +ROWS in table t: 1
> > +DELETE FROM t ORDER BY nnuk_str_short LIMIT 1;
> > +ROWS in table t: 1
> > +DELETE FROM t ORDER BY nnuk_str_long LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 1
> > +DELETE FROM t ORDER BY pk LIMIT 1;
> > +ROWS in table t: 1
> > +DELETE FROM t ORDER BY nnuk1, nnuk2 LIMIT 1;
> > +ROWS in table t: 1
> > +DELETE FROM t ORDER BY nnuk1, nnuk2, nokey LIMIT 1;
> > +ROWS in table t: 1
> > +DELETE FROM t ORDER BY nnuk1, nokey, nnuk2 LIMIT 1;
> > +ROWS in table t: 1
> > +DELETE FROM t WHERE nokey=1 LIMIT 0;
> > +ROWS in table t: 2
> > +DELETE FROM t WHERE nokey=1 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 1
> > +DELETE FROM t WHERE nokey=1 ORDER BY nokey LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 1
> > +DELETE FROM t WHERE nokey=1 ORDER BY nuk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 1
> > +DELETE FROM t WHERE nokey=1 ORDER BY nnuk1 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 1
> > +DELETE FROM t WHERE nokey=1 ORDER BY nnuk LIMIT 1;
> > +ROWS in table t: 1
> > +DELETE FROM t WHERE nokey=1 ORDER BY nnuk_str_short LIMIT 1;
> > +ROWS in table t: 1
> > +DELETE FROM t WHERE nokey=1 ORDER BY nnuk_str_long LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 1
> > +DELETE FROM t WHERE nokey=1 ORDER BY pk LIMIT 1;
> > +ROWS in table t: 1
> > +DELETE FROM t WHERE nokey=1 ORDER BY nnuk1, nnuk2 LIMIT 1;
> > +ROWS in table t: 1
> > +DELETE FROM t WHERE nokey=1 ORDER BY nnuk1, nnuk2, nokey LIMIT 1;
> > +ROWS in table t: 1
> > +DELETE FROM t WHERE nokey=1 ORDER BY nnuk1, nokey, nnuk2 LIMIT 1;
> > +ROWS in table t: 1
> > +DELETE FROM t WHERE nuk=1   LIMIT 0;
> > +ROWS in table t: 2
> > +DELETE FROM t WHERE nuk=1   LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 1
> > +DELETE FROM t WHERE nuk=1   ORDER BY nokey LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 1
> > +DELETE FROM t WHERE nuk=1   ORDER BY nuk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 1
> > +DELETE FROM t WHERE nuk=1   ORDER BY nnuk1 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 1
> > +DELETE FROM t WHERE nuk=1   ORDER BY nnuk LIMIT 1;
> > +ROWS in table t: 1
> > +DELETE FROM t WHERE nuk=1   ORDER BY nnuk_str_short LIMIT 1;
> > +ROWS in table t: 1
> > +DELETE FROM t WHERE nuk=1   ORDER BY nnuk_str_long LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 1
> > +DELETE FROM t WHERE nuk=1   ORDER BY pk LIMIT 1;
> > +ROWS in table t: 1
> > +DELETE FROM t WHERE nuk=1   ORDER BY nnuk1, nnuk2 LIMIT 1;
> > +ROWS in table t: 1
> > +DELETE FROM t WHERE nuk=1   ORDER BY nnuk1, nnuk2, nokey LIMIT 1;
> > +ROWS in table t: 1
> > +DELETE FROM t WHERE nuk=1   ORDER BY nnuk1, nokey, nnuk2 LIMIT 1;
> > +ROWS in table t: 1
> > +DELETE FROM t WHERE nnuk=1  LIMIT 0;
> > +ROWS in table t: 2
> > +DELETE FROM t WHERE nnuk=1  LIMIT 1;
> > +ROWS in table t: 1
> > +DELETE FROM t WHERE nnuk=1  ORDER BY nokey LIMIT 1;
> > +ROWS in table t: 1
> > +DELETE FROM t WHERE nnuk=1  ORDER BY nuk LIMIT 1;
> > +ROWS in table t: 1
> > +DELETE FROM t WHERE nnuk=1  ORDER BY nnuk1 LIMIT 1;
> > +ROWS in table t: 1
> > +DELETE FROM t WHERE nnuk=1  ORDER BY nnuk LIMIT 1;
> > +ROWS in table t: 1
> > +DELETE FROM t WHERE nnuk=1  ORDER BY nnuk_str_short LIMIT 1;
> > +ROWS in table t: 1
> > +DELETE FROM t WHERE nnuk=1  ORDER BY nnuk_str_long LIMIT 1;
> > +ROWS in table t: 1
> > +DELETE FROM t WHERE nnuk=1  ORDER BY pk LIMIT 1;
> > +ROWS in table t: 1
> > +DELETE FROM t WHERE nnuk=1  ORDER BY nnuk1, nnuk2 LIMIT 1;
> > +ROWS in table t: 1
> > +DELETE FROM t WHERE nnuk=1  ORDER BY nnuk1, nnuk2, nokey LIMIT 1;
> > +ROWS in table t: 1
> > +DELETE FROM t WHERE nnuk=1  ORDER BY nnuk1, nokey, nnuk2 LIMIT 1;
> > +ROWS in table t: 1
> > +DELETE FROM t WHERE pk=1    LIMIT 0;
> > +ROWS in table t: 2
> > +DELETE FROM t WHERE pk=1    LIMIT 1;
> > +ROWS in table t: 1
> > +DELETE FROM t WHERE pk=1    ORDER BY nokey LIMIT 1;
> > +ROWS in table t: 1
> > +DELETE FROM t WHERE pk=1    ORDER BY nuk LIMIT 1;
> > +ROWS in table t: 1
> > +DELETE FROM t WHERE pk=1    ORDER BY nnuk1 LIMIT 1;
> > +ROWS in table t: 1
> > +DELETE FROM t WHERE pk=1    ORDER BY nnuk LIMIT 1;
> > +ROWS in table t: 1
> > +DELETE FROM t WHERE pk=1    ORDER BY nnuk_str_short LIMIT 1;
> > +ROWS in table t: 1
> > +DELETE FROM t WHERE pk=1    ORDER BY nnuk_str_long LIMIT 1;
> > +ROWS in table t: 1
> > +DELETE FROM t WHERE pk=1    ORDER BY pk LIMIT 1;
> > +ROWS in table t: 1
> > +DELETE FROM t WHERE pk=1    ORDER BY nnuk1, nnuk2 LIMIT 1;
> > +ROWS in table t: 1
> > +DELETE FROM t WHERE pk=1    ORDER BY nnuk1, nnuk2, nokey LIMIT 1;
> > +ROWS in table t: 1
> > +DELETE FROM t WHERE pk=1    ORDER BY nnuk1, nokey, nnuk2 LIMIT 1;
> > +ROWS in table t: 1
> > +REPLACE INTO t SELECT * FROM t1 LIMIT 0;
> > +ROWS in table t: 2
> > +REPLACE INTO t SELECT * FROM t1 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +REPLACE INTO t SELECT * FROM t1 ORDER BY nokey LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +REPLACE INTO t SELECT * FROM t1 ORDER BY nuk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +REPLACE INTO t SELECT * FROM t1 ORDER BY nnuk1 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +REPLACE INTO t SELECT * FROM t1 ORDER BY nnuk LIMIT 1;
> > +ROWS in table t: 3
> > +REPLACE INTO t SELECT * FROM t1 ORDER BY nnuk_str_short LIMIT 1;
> > +ROWS in table t: 3
> > +REPLACE INTO t SELECT * FROM t1 ORDER BY nnuk_str_long LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +REPLACE INTO t SELECT * FROM t1 ORDER BY pk LIMIT 1;
> > +ROWS in table t: 3
> > +REPLACE INTO t SELECT * FROM t1 ORDER BY nnuk1, nnuk2 LIMIT 1;
> > +ROWS in table t: 3
> > +REPLACE INTO t SELECT * FROM t1 ORDER BY nnuk1, nnuk2, nokey LIMIT 1;
> > +ROWS in table t: 3
> > +REPLACE INTO t SELECT * FROM t1 ORDER BY nnuk1, nokey, nnuk2 LIMIT 1;
> > +ROWS in table t: 3
> > +REPLACE INTO t SELECT * FROM t1 WHERE nokey=1 LIMIT 0;
> > +ROWS in table t: 2
> > +REPLACE INTO t SELECT * FROM t1 WHERE nokey=1 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 2
> > +REPLACE INTO t SELECT * FROM t1 WHERE nokey=1 ORDER BY nokey LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 2
> > +REPLACE INTO t SELECT * FROM t1 WHERE nokey=1 ORDER BY nuk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 2
> > +REPLACE INTO t SELECT * FROM t1 WHERE nokey=1 ORDER BY nnuk1 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 2
> > +REPLACE INTO t SELECT * FROM t1 WHERE nokey=1 ORDER BY nnuk LIMIT 1;
> > +ROWS in table t: 2
> > +REPLACE INTO t SELECT * FROM t1 WHERE nokey=1 ORDER BY nnuk_str_short LIMIT 1;
> > +ROWS in table t: 2
> > +REPLACE INTO t SELECT * FROM t1 WHERE nokey=1 ORDER BY nnuk_str_long LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 2
> > +REPLACE INTO t SELECT * FROM t1 WHERE nokey=1 ORDER BY pk LIMIT 1;
> > +ROWS in table t: 2
> > +REPLACE INTO t SELECT * FROM t1 WHERE nokey=1 ORDER BY nnuk1, nnuk2 LIMIT 1;
> > +ROWS in table t: 2
> > +REPLACE INTO t SELECT * FROM t1 WHERE nokey=1 ORDER BY nnuk1, nnuk2, nokey
> LIMIT 1;
> > +ROWS in table t: 2
> > +REPLACE INTO t SELECT * FROM t1 WHERE nokey=1 ORDER BY nnuk1, nokey, nnuk2
> LIMIT 1;
> > +ROWS in table t: 2
> > +REPLACE INTO t SELECT * FROM t1 WHERE nuk=1   LIMIT 0;
> > +ROWS in table t: 2
> > +REPLACE INTO t SELECT * FROM t1 WHERE nuk=1   LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 2
> > +REPLACE INTO t SELECT * FROM t1 WHERE nuk=1   ORDER BY nokey LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 2
> > +REPLACE INTO t SELECT * FROM t1 WHERE nuk=1   ORDER BY nuk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 2
> > +REPLACE INTO t SELECT * FROM t1 WHERE nuk=1   ORDER BY nnuk1 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 2
> > +REPLACE INTO t SELECT * FROM t1 WHERE nuk=1   ORDER BY nnuk LIMIT 1;
> > +ROWS in table t: 2
> > +REPLACE INTO t SELECT * FROM t1 WHERE nuk=1   ORDER BY nnuk_str_short LIMIT 1;
> > +ROWS in table t: 2
> > +REPLACE INTO t SELECT * FROM t1 WHERE nuk=1   ORDER BY nnuk_str_long LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 2
> > +REPLACE INTO t SELECT * FROM t1 WHERE nuk=1   ORDER BY pk LIMIT 1;
> > +ROWS in table t: 2
> > +REPLACE INTO t SELECT * FROM t1 WHERE nuk=1   ORDER BY nnuk1, nnuk2 LIMIT 1;
> > +ROWS in table t: 2
> > +REPLACE INTO t SELECT * FROM t1 WHERE nuk=1   ORDER BY nnuk1, nnuk2, nokey
> LIMIT 1;
> > +ROWS in table t: 2
> > +REPLACE INTO t SELECT * FROM t1 WHERE nuk=1   ORDER BY nnuk1, nokey, nnuk2
> LIMIT 1;
> > +ROWS in table t: 2
> > +REPLACE INTO t SELECT * FROM t1 WHERE nnuk=1  LIMIT 0;
> > +ROWS in table t: 2
> > +REPLACE INTO t SELECT * FROM t1 WHERE nnuk=1  LIMIT 1;
> > +ROWS in table t: 2
> > +REPLACE INTO t SELECT * FROM t1 WHERE nnuk=1  ORDER BY nokey LIMIT 1;
> > +ROWS in table t: 2
> > +REPLACE INTO t SELECT * FROM t1 WHERE nnuk=1  ORDER BY nuk LIMIT 1;
> > +ROWS in table t: 2
> > +REPLACE INTO t SELECT * FROM t1 WHERE nnuk=1  ORDER BY nnuk1 LIMIT 1;
> > +ROWS in table t: 2
> > +REPLACE INTO t SELECT * FROM t1 WHERE nnuk=1  ORDER BY nnuk LIMIT 1;
> > +ROWS in table t: 2
> > +REPLACE INTO t SELECT * FROM t1 WHERE nnuk=1  ORDER BY nnuk_str_short LIMIT 1;
> > +ROWS in table t: 2
> > +REPLACE INTO t SELECT * FROM t1 WHERE nnuk=1  ORDER BY nnuk_str_long LIMIT 1;
> > +ROWS in table t: 2
> > +REPLACE INTO t SELECT * FROM t1 WHERE nnuk=1  ORDER BY pk LIMIT 1;
> > +ROWS in table t: 2
> > +REPLACE INTO t SELECT * FROM t1 WHERE nnuk=1  ORDER BY nnuk1, nnuk2 LIMIT 1;
> > +ROWS in table t: 2
> > +REPLACE INTO t SELECT * FROM t1 WHERE nnuk=1  ORDER BY nnuk1, nnuk2, nokey
> LIMIT 1;
> > +ROWS in table t: 2
> > +REPLACE INTO t SELECT * FROM t1 WHERE nnuk=1  ORDER BY nnuk1, nokey, nnuk2
> LIMIT 1;
> > +ROWS in table t: 2
> > +REPLACE INTO t SELECT * FROM t1 WHERE pk=1    LIMIT 0;
> > +ROWS in table t: 2
> > +REPLACE INTO t SELECT * FROM t1 WHERE pk=1    LIMIT 1;
> > +ROWS in table t: 2
> > +REPLACE INTO t SELECT * FROM t1 WHERE pk=1    ORDER BY nokey LIMIT 1;
> > +ROWS in table t: 2
> > +REPLACE INTO t SELECT * FROM t1 WHERE pk=1    ORDER BY nuk LIMIT 1;
> > +ROWS in table t: 2
> > +REPLACE INTO t SELECT * FROM t1 WHERE pk=1    ORDER BY nnuk1 LIMIT 1;
> > +ROWS in table t: 2
> > +REPLACE INTO t SELECT * FROM t1 WHERE pk=1    ORDER BY nnuk LIMIT 1;
> > +ROWS in table t: 2
> > +REPLACE INTO t SELECT * FROM t1 WHERE pk=1    ORDER BY nnuk_str_short LIMIT 1;
> > +ROWS in table t: 2
> > +REPLACE INTO t SELECT * FROM t1 WHERE pk=1    ORDER BY nnuk_str_long LIMIT 1;
> > +ROWS in table t: 2
> > +REPLACE INTO t SELECT * FROM t1 WHERE pk=1    ORDER BY pk LIMIT 1;
> > +ROWS in table t: 2
> > +REPLACE INTO t SELECT * FROM t1 WHERE pk=1    ORDER BY nnuk1, nnuk2 LIMIT 1;
> > +ROWS in table t: 2
> > +REPLACE INTO t SELECT * FROM t1 WHERE pk=1    ORDER BY nnuk1, nnuk2, nokey
> LIMIT 1;
> > +ROWS in table t: 2
> > +REPLACE INTO t SELECT * FROM t1 WHERE pk=1    ORDER BY nnuk1, nokey, nnuk2
> LIMIT 1;
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM t1 LIMIT 0;
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM t1 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM t1 ORDER BY nokey LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM t1 ORDER BY nuk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM t1 ORDER BY nnuk1 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM t1 ORDER BY nnuk LIMIT 1;
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM t1 ORDER BY nnuk_str_short LIMIT 1;
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM t1 ORDER BY nnuk_str_long LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM t1 ORDER BY pk LIMIT 1;
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM t1 ORDER BY nnuk1, nnuk2 LIMIT 1;
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM t1 ORDER BY nnuk1, nnuk2, nokey LIMIT 1;
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM t1 ORDER BY nnuk1, nokey, nnuk2 LIMIT 1;
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM t1 WHERE nokey=1 LIMIT 0;
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM t1 WHERE nokey=1 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM t1 WHERE nokey=1 ORDER BY nokey LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM t1 WHERE nokey=1 ORDER BY nuk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM t1 WHERE nokey=1 ORDER BY nnuk1 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM t1 WHERE nokey=1 ORDER BY nnuk LIMIT 1;
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM t1 WHERE nokey=1 ORDER BY nnuk_str_short LIMIT 1;
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM t1 WHERE nokey=1 ORDER BY nnuk_str_long LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM t1 WHERE nokey=1 ORDER BY pk LIMIT 1;
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM t1 WHERE nokey=1 ORDER BY nnuk1, nnuk2 LIMIT 1;
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM t1 WHERE nokey=1 ORDER BY nnuk1, nnuk2, nokey LIMIT
> 1;
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM t1 WHERE nokey=1 ORDER BY nnuk1, nokey, nnuk2 LIMIT
> 1;
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM t1 WHERE nuk=1   LIMIT 0;
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM t1 WHERE nuk=1   LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM t1 WHERE nuk=1   ORDER BY nokey LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM t1 WHERE nuk=1   ORDER BY nuk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM t1 WHERE nuk=1   ORDER BY nnuk1 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM t1 WHERE nuk=1   ORDER BY nnuk LIMIT 1;
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM t1 WHERE nuk=1   ORDER BY nnuk_str_short LIMIT 1;
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM t1 WHERE nuk=1   ORDER BY nnuk_str_long LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM t1 WHERE nuk=1   ORDER BY pk LIMIT 1;
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM t1 WHERE nuk=1   ORDER BY nnuk1, nnuk2 LIMIT 1;
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM t1 WHERE nuk=1   ORDER BY nnuk1, nnuk2, nokey LIMIT
> 1;
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM t1 WHERE nuk=1   ORDER BY nnuk1, nokey, nnuk2 LIMIT
> 1;
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM t1 WHERE nnuk=1  LIMIT 0;
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM t1 WHERE nnuk=1  LIMIT 1;
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM t1 WHERE nnuk=1  ORDER BY nokey LIMIT 1;
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM t1 WHERE nnuk=1  ORDER BY nuk LIMIT 1;
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM t1 WHERE nnuk=1  ORDER BY nnuk1 LIMIT 1;
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM t1 WHERE nnuk=1  ORDER BY nnuk LIMIT 1;
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM t1 WHERE nnuk=1  ORDER BY nnuk_str_short LIMIT 1;
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM t1 WHERE nnuk=1  ORDER BY nnuk_str_long LIMIT 1;
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM t1 WHERE nnuk=1  ORDER BY pk LIMIT 1;
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM t1 WHERE nnuk=1  ORDER BY nnuk1, nnuk2 LIMIT 1;
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM t1 WHERE nnuk=1  ORDER BY nnuk1, nnuk2, nokey LIMIT
> 1;
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM t1 WHERE nnuk=1  ORDER BY nnuk1, nokey, nnuk2 LIMIT
> 1;
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM t1 WHERE pk=1    LIMIT 0;
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM t1 WHERE pk=1    LIMIT 1;
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM t1 WHERE pk=1    ORDER BY nokey LIMIT 1;
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM t1 WHERE pk=1    ORDER BY nuk LIMIT 1;
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM t1 WHERE pk=1    ORDER BY nnuk1 LIMIT 1;
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM t1 WHERE pk=1    ORDER BY nnuk LIMIT 1;
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM t1 WHERE pk=1    ORDER BY nnuk_str_short LIMIT 1;
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM t1 WHERE pk=1    ORDER BY nnuk_str_long LIMIT 1;
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM t1 WHERE pk=1    ORDER BY pk LIMIT 1;
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM t1 WHERE pk=1    ORDER BY nnuk1, nnuk2 LIMIT 1;
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM t1 WHERE pk=1    ORDER BY nnuk1, nnuk2, nokey LIMIT
> 1;
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM t1 WHERE pk=1    ORDER BY nnuk1, nokey, nnuk2 LIMIT
> 1;
> > +ROWS in table t: 2
> > +INSERT INTO t (SELECT * FROM t1) UNION (SELECT * FROM t2) LIMIT 0;
> > +ROWS in table t: 2
> > +INSERT INTO t (SELECT * FROM t1) UNION (SELECT * FROM t2) LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1) UNION (SELECT * FROM t2) ORDER BY nokey LIMIT
> 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1) UNION (SELECT * FROM t2) ORDER BY nuk LIMIT
> 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1) UNION (SELECT * FROM t2) ORDER BY nnuk1 LIMIT
> 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1) UNION (SELECT * FROM t2) ORDER BY nnuk LIMIT
> 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1) UNION (SELECT * FROM t2) ORDER BY
> nnuk_str_short LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1) UNION (SELECT * FROM t2) ORDER BY
> nnuk_str_long LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1) UNION (SELECT * FROM t2) ORDER BY pk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1) UNION (SELECT * FROM t2) ORDER BY nnuk1, nnuk2
> LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1) UNION (SELECT * FROM t2) ORDER BY nnuk1,
> nnuk2, nokey LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1) UNION (SELECT * FROM t2) ORDER BY nnuk1,
> nokey, nnuk2 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 LIMIT 0) UNION (SELECT * FROM t2);
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 LIMIT 1) UNION (SELECT * FROM t2);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 5
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nokey LIMIT 1) UNION (SELECT * FROM
> t2);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 5
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nuk LIMIT 1) UNION (SELECT * FROM
> t2);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 5
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1 LIMIT 1) UNION (SELECT * FROM
> t2);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 5
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk LIMIT 1) UNION (SELECT * FROM
> t2);
> > +ROWS in table t: 5
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk_str_short LIMIT 1) UNION (SELECT
> * FROM t2);
> > +ROWS in table t: 5
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk_str_long LIMIT 1) UNION (SELECT *
> FROM t2);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 5
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY pk LIMIT 1) UNION (SELECT * FROM t2);
> > +ROWS in table t: 5
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nnuk2 LIMIT 1) UNION (SELECT *
> FROM t2);
> > +ROWS in table t: 5
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nnuk2, nokey LIMIT 1) UNION
> (SELECT * FROM t2);
> > +ROWS in table t: 5
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nokey, nnuk2 LIMIT 1) UNION
> (SELECT * FROM t2);
> > +ROWS in table t: 5
> > +INSERT INTO t (SELECT * FROM t1) UNION (SELECT * FROM t2 LIMIT 0);
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1) UNION (SELECT * FROM t2 LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 5
> > +INSERT INTO t (SELECT * FROM t1) UNION (SELECT * FROM t2 ORDER BY nokey LIMIT
> 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 5
> > +INSERT INTO t (SELECT * FROM t1) UNION (SELECT * FROM t2 ORDER BY nuk LIMIT
> 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 5
> > +INSERT INTO t (SELECT * FROM t1) UNION (SELECT * FROM t2 ORDER BY nnuk1 LIMIT
> 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 5
> > +INSERT INTO t (SELECT * FROM t1) UNION (SELECT * FROM t2 ORDER BY nnuk LIMIT
> 1);
> > +ROWS in table t: 5
> > +INSERT INTO t (SELECT * FROM t1) UNION (SELECT * FROM t2 ORDER BY
> nnuk_str_short LIMIT 1);
> > +ROWS in table t: 5
> > +INSERT INTO t (SELECT * FROM t1) UNION (SELECT * FROM t2 ORDER BY nnuk_str_long
> LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 5
> > +INSERT INTO t (SELECT * FROM t1) UNION (SELECT * FROM t2 ORDER BY pk LIMIT 1);
> > +ROWS in table t: 5
> > +INSERT INTO t (SELECT * FROM t1) UNION (SELECT * FROM t2 ORDER BY nnuk1, nnuk2
> LIMIT 1);
> > +ROWS in table t: 5
> > +INSERT INTO t (SELECT * FROM t1) UNION (SELECT * FROM t2 ORDER BY nnuk1, nnuk2,
> nokey LIMIT 1);
> > +ROWS in table t: 5
> > +INSERT INTO t (SELECT * FROM t1) UNION (SELECT * FROM t2 ORDER BY nnuk1, nokey,
> nnuk2 LIMIT 1);
> > +ROWS in table t: 5
> > +INSERT INTO t (SELECT * FROM t1 LIMIT 0) UNION (SELECT * FROM t2 LIMIT 0);
> > +ROWS in table t: 2
> > +INSERT INTO t (SELECT * FROM t1 LIMIT 0) UNION (SELECT * FROM t2 LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 LIMIT 0) UNION (SELECT * FROM t2 ORDER BY nokey
> LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 LIMIT 0) UNION (SELECT * FROM t2 ORDER BY nuk
> LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 LIMIT 0) UNION (SELECT * FROM t2 ORDER BY nnuk1
> LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 LIMIT 0) UNION (SELECT * FROM t2 ORDER BY nnuk
> LIMIT 1);
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 LIMIT 0) UNION (SELECT * FROM t2 ORDER BY
> nnuk_str_short LIMIT 1);
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 LIMIT 0) UNION (SELECT * FROM t2 ORDER BY
> nnuk_str_long LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 LIMIT 0) UNION (SELECT * FROM t2 ORDER BY pk
> LIMIT 1);
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 LIMIT 0) UNION (SELECT * FROM t2 ORDER BY
> nnuk1, nnuk2 LIMIT 1);
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 LIMIT 0) UNION (SELECT * FROM t2 ORDER BY
> nnuk1, nnuk2, nokey LIMIT 1);
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 LIMIT 0) UNION (SELECT * FROM t2 ORDER BY
> nnuk1, nokey, nnuk2 LIMIT 1);
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 LIMIT 1) UNION (SELECT * FROM t2 LIMIT 0);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 LIMIT 1) UNION (SELECT * FROM t2 LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 LIMIT 1) UNION (SELECT * FROM t2 ORDER BY nokey
> LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 LIMIT 1) UNION (SELECT * FROM t2 ORDER BY nuk
> LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 LIMIT 1) UNION (SELECT * FROM t2 ORDER BY nnuk1
> LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 LIMIT 1) UNION (SELECT * FROM t2 ORDER BY nnuk
> LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 LIMIT 1) UNION (SELECT * FROM t2 ORDER BY
> nnuk_str_short LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 LIMIT 1) UNION (SELECT * FROM t2 ORDER BY
> nnuk_str_long LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 LIMIT 1) UNION (SELECT * FROM t2 ORDER BY pk
> LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 LIMIT 1) UNION (SELECT * FROM t2 ORDER BY
> nnuk1, nnuk2 LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 LIMIT 1) UNION (SELECT * FROM t2 ORDER BY
> nnuk1, nnuk2, nokey LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 LIMIT 1) UNION (SELECT * FROM t2 ORDER BY
> nnuk1, nokey, nnuk2 LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nokey LIMIT 1) UNION (SELECT * FROM t2
> LIMIT 0);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nokey LIMIT 1) UNION (SELECT * FROM t2
> LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nokey LIMIT 1) UNION (SELECT * FROM t2
> ORDER BY nokey LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nokey LIMIT 1) UNION (SELECT * FROM t2
> ORDER BY nuk LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nokey LIMIT 1) UNION (SELECT * FROM t2
> ORDER BY nnuk1 LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nokey LIMIT 1) UNION (SELECT * FROM t2
> ORDER BY nnuk LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nokey LIMIT 1) UNION (SELECT * FROM t2
> ORDER BY nnuk_str_short LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nokey LIMIT 1) UNION (SELECT * FROM t2
> ORDER BY nnuk_str_long LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nokey LIMIT 1) UNION (SELECT * FROM t2
> ORDER BY pk LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nokey LIMIT 1) UNION (SELECT * FROM t2
> ORDER BY nnuk1, nnuk2 LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nokey LIMIT 1) UNION (SELECT * FROM t2
> ORDER BY nnuk1, nnuk2, nokey LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nokey LIMIT 1) UNION (SELECT * FROM t2
> ORDER BY nnuk1, nokey, nnuk2 LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nuk LIMIT 1) UNION (SELECT * FROM t2
> LIMIT 0);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nuk LIMIT 1) UNION (SELECT * FROM t2
> LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nuk LIMIT 1) UNION (SELECT * FROM t2
> ORDER BY nokey LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nuk LIMIT 1) UNION (SELECT * FROM t2
> ORDER BY nuk LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nuk LIMIT 1) UNION (SELECT * FROM t2
> ORDER BY nnuk1 LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nuk LIMIT 1) UNION (SELECT * FROM t2
> ORDER BY nnuk LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nuk LIMIT 1) UNION (SELECT * FROM t2
> ORDER BY nnuk_str_short LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nuk LIMIT 1) UNION (SELECT * FROM t2
> ORDER BY nnuk_str_long LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nuk LIMIT 1) UNION (SELECT * FROM t2
> ORDER BY pk LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nuk LIMIT 1) UNION (SELECT * FROM t2
> ORDER BY nnuk1, nnuk2 LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nuk LIMIT 1) UNION (SELECT * FROM t2
> ORDER BY nnuk1, nnuk2, nokey LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nuk LIMIT 1) UNION (SELECT * FROM t2
> ORDER BY nnuk1, nokey, nnuk2 LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1 LIMIT 1) UNION (SELECT * FROM t2
> LIMIT 0);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1 LIMIT 1) UNION (SELECT * FROM t2
> LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1 LIMIT 1) UNION (SELECT * FROM t2
> ORDER BY nokey LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1 LIMIT 1) UNION (SELECT * FROM t2
> ORDER BY nuk LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1 LIMIT 1) UNION (SELECT * FROM t2
> ORDER BY nnuk1 LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1 LIMIT 1) UNION (SELECT * FROM t2
> ORDER BY nnuk LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1 LIMIT 1) UNION (SELECT * FROM t2
> ORDER BY nnuk_str_short LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1 LIMIT 1) UNION (SELECT * FROM t2
> ORDER BY nnuk_str_long LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1 LIMIT 1) UNION (SELECT * FROM t2
> ORDER BY pk LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1 LIMIT 1) UNION (SELECT * FROM t2
> ORDER BY nnuk1, nnuk2 LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1 LIMIT 1) UNION (SELECT * FROM t2
> ORDER BY nnuk1, nnuk2, nokey LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1 LIMIT 1) UNION (SELECT * FROM t2
> ORDER BY nnuk1, nokey, nnuk2 LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk LIMIT 1) UNION (SELECT * FROM t2
> LIMIT 0);
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk LIMIT 1) UNION (SELECT * FROM t2
> LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk LIMIT 1) UNION (SELECT * FROM t2
> ORDER BY nokey LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk LIMIT 1) UNION (SELECT * FROM t2
> ORDER BY nuk LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk LIMIT 1) UNION (SELECT * FROM t2
> ORDER BY nnuk1 LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk LIMIT 1) UNION (SELECT * FROM t2
> ORDER BY nnuk LIMIT 1);
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk LIMIT 1) UNION (SELECT * FROM t2
> ORDER BY nnuk_str_short LIMIT 1);
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk LIMIT 1) UNION (SELECT * FROM t2
> ORDER BY nnuk_str_long LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk LIMIT 1) UNION (SELECT * FROM t2
> ORDER BY pk LIMIT 1);
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk LIMIT 1) UNION (SELECT * FROM t2
> ORDER BY nnuk1, nnuk2 LIMIT 1);
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk LIMIT 1) UNION (SELECT * FROM t2
> ORDER BY nnuk1, nnuk2, nokey LIMIT 1);
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk LIMIT 1) UNION (SELECT * FROM t2
> ORDER BY nnuk1, nokey, nnuk2 LIMIT 1);
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk_str_short LIMIT 1) UNION (SELECT
> * FROM t2 LIMIT 0);
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk_str_short LIMIT 1) UNION (SELECT
> * FROM t2 LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk_str_short LIMIT 1) UNION (SELECT
> * FROM t2 ORDER BY nokey LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk_str_short LIMIT 1) UNION (SELECT
> * FROM t2 ORDER BY nuk LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk_str_short LIMIT 1) UNION (SELECT
> * FROM t2 ORDER BY nnuk1 LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk_str_short LIMIT 1) UNION (SELECT
> * FROM t2 ORDER BY nnuk LIMIT 1);
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk_str_short LIMIT 1) UNION (SELECT
> * FROM t2 ORDER BY nnuk_str_short LIMIT 1);
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk_str_short LIMIT 1) UNION (SELECT
> * FROM t2 ORDER BY nnuk_str_long LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk_str_short LIMIT 1) UNION (SELECT
> * FROM t2 ORDER BY pk LIMIT 1);
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk_str_short LIMIT 1) UNION (SELECT
> * FROM t2 ORDER BY nnuk1, nnuk2 LIMIT 1);
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk_str_short LIMIT 1) UNION (SELECT
> * FROM t2 ORDER BY nnuk1, nnuk2, nokey LIMIT 1);
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk_str_short LIMIT 1) UNION (SELECT
> * FROM t2 ORDER BY nnuk1, nokey, nnuk2 LIMIT 1);
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk_str_long LIMIT 1) UNION (SELECT *
> FROM t2 LIMIT 0);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk_str_long LIMIT 1) UNION (SELECT *
> FROM t2 LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk_str_long LIMIT 1) UNION (SELECT *
> FROM t2 ORDER BY nokey LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk_str_long LIMIT 1) UNION (SELECT *
> FROM t2 ORDER BY nuk LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk_str_long LIMIT 1) UNION (SELECT *
> FROM t2 ORDER BY nnuk1 LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk_str_long LIMIT 1) UNION (SELECT *
> FROM t2 ORDER BY nnuk LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk_str_long LIMIT 1) UNION (SELECT *
> FROM t2 ORDER BY nnuk_str_short LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk_str_long LIMIT 1) UNION (SELECT *
> FROM t2 ORDER BY nnuk_str_long LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk_str_long LIMIT 1) UNION (SELECT *
> FROM t2 ORDER BY pk LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk_str_long LIMIT 1) UNION (SELECT *
> FROM t2 ORDER BY nnuk1, nnuk2 LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk_str_long LIMIT 1) UNION (SELECT *
> FROM t2 ORDER BY nnuk1, nnuk2, nokey LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk_str_long LIMIT 1) UNION (SELECT *
> FROM t2 ORDER BY nnuk1, nokey, nnuk2 LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY pk LIMIT 1) UNION (SELECT * FROM t2
> LIMIT 0);
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY pk LIMIT 1) UNION (SELECT * FROM t2
> LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY pk LIMIT 1) UNION (SELECT * FROM t2
> ORDER BY nokey LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY pk LIMIT 1) UNION (SELECT * FROM t2
> ORDER BY nuk LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY pk LIMIT 1) UNION (SELECT * FROM t2
> ORDER BY nnuk1 LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY pk LIMIT 1) UNION (SELECT * FROM t2
> ORDER BY nnuk LIMIT 1);
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY pk LIMIT 1) UNION (SELECT * FROM t2
> ORDER BY nnuk_str_short LIMIT 1);
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY pk LIMIT 1) UNION (SELECT * FROM t2
> ORDER BY nnuk_str_long LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY pk LIMIT 1) UNION (SELECT * FROM t2
> ORDER BY pk LIMIT 1);
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY pk LIMIT 1) UNION (SELECT * FROM t2
> ORDER BY nnuk1, nnuk2 LIMIT 1);
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY pk LIMIT 1) UNION (SELECT * FROM t2
> ORDER BY nnuk1, nnuk2, nokey LIMIT 1);
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY pk LIMIT 1) UNION (SELECT * FROM t2
> ORDER BY nnuk1, nokey, nnuk2 LIMIT 1);
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nnuk2 LIMIT 1) UNION (SELECT *
> FROM t2 LIMIT 0);
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nnuk2 LIMIT 1) UNION (SELECT *
> FROM t2 LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nnuk2 LIMIT 1) UNION (SELECT *
> FROM t2 ORDER BY nokey LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nnuk2 LIMIT 1) UNION (SELECT *
> FROM t2 ORDER BY nuk LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nnuk2 LIMIT 1) UNION (SELECT *
> FROM t2 ORDER BY nnuk1 LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nnuk2 LIMIT 1) UNION (SELECT *
> FROM t2 ORDER BY nnuk LIMIT 1);
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nnuk2 LIMIT 1) UNION (SELECT *
> FROM t2 ORDER BY nnuk_str_short LIMIT 1);
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nnuk2 LIMIT 1) UNION (SELECT *
> FROM t2 ORDER BY nnuk_str_long LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nnuk2 LIMIT 1) UNION (SELECT *
> FROM t2 ORDER BY pk LIMIT 1);
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nnuk2 LIMIT 1) UNION (SELECT *
> FROM t2 ORDER BY nnuk1, nnuk2 LIMIT 1);
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nnuk2 LIMIT 1) UNION (SELECT *
> FROM t2 ORDER BY nnuk1, nnuk2, nokey LIMIT 1);
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nnuk2 LIMIT 1) UNION (SELECT *
> FROM t2 ORDER BY nnuk1, nokey, nnuk2 LIMIT 1);
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nnuk2, nokey LIMIT 1) UNION
> (SELECT * FROM t2 LIMIT 0);
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nnuk2, nokey LIMIT 1) UNION
> (SELECT * FROM t2 LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nnuk2, nokey LIMIT 1) UNION
> (SELECT * FROM t2 ORDER BY nokey LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nnuk2, nokey LIMIT 1) UNION
> (SELECT * FROM t2 ORDER BY nuk LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nnuk2, nokey LIMIT 1) UNION
> (SELECT * FROM t2 ORDER BY nnuk1 LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nnuk2, nokey LIMIT 1) UNION
> (SELECT * FROM t2 ORDER BY nnuk LIMIT 1);
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nnuk2, nokey LIMIT 1) UNION
> (SELECT * FROM t2 ORDER BY nnuk_str_short LIMIT 1);
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nnuk2, nokey LIMIT 1) UNION
> (SELECT * FROM t2 ORDER BY nnuk_str_long LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nnuk2, nokey LIMIT 1) UNION
> (SELECT * FROM t2 ORDER BY pk LIMIT 1);
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nnuk2, nokey LIMIT 1) UNION
> (SELECT * FROM t2 ORDER BY nnuk1, nnuk2 LIMIT 1);
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nnuk2, nokey LIMIT 1) UNION
> (SELECT * FROM t2 ORDER BY nnuk1, nnuk2, nokey LIMIT 1);
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nnuk2, nokey LIMIT 1) UNION
> (SELECT * FROM t2 ORDER BY nnuk1, nokey, nnuk2 LIMIT 1);
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nokey, nnuk2 LIMIT 1) UNION
> (SELECT * FROM t2 LIMIT 0);
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nokey, nnuk2 LIMIT 1) UNION
> (SELECT * FROM t2 LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nokey, nnuk2 LIMIT 1) UNION
> (SELECT * FROM t2 ORDER BY nokey LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nokey, nnuk2 LIMIT 1) UNION
> (SELECT * FROM t2 ORDER BY nuk LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nokey, nnuk2 LIMIT 1) UNION
> (SELECT * FROM t2 ORDER BY nnuk1 LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nokey, nnuk2 LIMIT 1) UNION
> (SELECT * FROM t2 ORDER BY nnuk LIMIT 1);
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nokey, nnuk2 LIMIT 1) UNION
> (SELECT * FROM t2 ORDER BY nnuk_str_short LIMIT 1);
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nokey, nnuk2 LIMIT 1) UNION
> (SELECT * FROM t2 ORDER BY nnuk_str_long LIMIT 1);
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nokey, nnuk2 LIMIT 1) UNION
> (SELECT * FROM t2 ORDER BY pk LIMIT 1);
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nokey, nnuk2 LIMIT 1) UNION
> (SELECT * FROM t2 ORDER BY nnuk1, nnuk2 LIMIT 1);
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nokey, nnuk2 LIMIT 1) UNION
> (SELECT * FROM t2 ORDER BY nnuk1, nnuk2, nokey LIMIT 1);
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nokey, nnuk2 LIMIT 1) UNION
> (SELECT * FROM t2 ORDER BY nnuk1, nokey, nnuk2 LIMIT 1);
> > +ROWS in table t: 4
> > +INSERT INTO t (SELECT * FROM t1 LIMIT 0) UNION (SELECT * FROM t2) LIMIT 0;
> > +ROWS in table t: 2
> > +INSERT INTO t (SELECT * FROM t1 LIMIT 0) UNION (SELECT * FROM t2) LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 LIMIT 0) UNION (SELECT * FROM t2) ORDER BY
> nokey LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 LIMIT 0) UNION (SELECT * FROM t2) ORDER BY nuk
> LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 LIMIT 0) UNION (SELECT * FROM t2) ORDER BY
> nnuk1 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 LIMIT 0) UNION (SELECT * FROM t2) ORDER BY nnuk
> LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 LIMIT 0) UNION (SELECT * FROM t2) ORDER BY
> nnuk_str_short LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 LIMIT 0) UNION (SELECT * FROM t2) ORDER BY
> nnuk_str_long LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 LIMIT 0) UNION (SELECT * FROM t2) ORDER BY pk
> LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 LIMIT 0) UNION (SELECT * FROM t2) ORDER BY
> nnuk1, nnuk2 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 LIMIT 0) UNION (SELECT * FROM t2) ORDER BY
> nnuk1, nnuk2, nokey LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 LIMIT 0) UNION (SELECT * FROM t2) ORDER BY
> nnuk1, nokey, nnuk2 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 LIMIT 1) UNION (SELECT * FROM t2) LIMIT 0;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 2
> > +INSERT INTO t (SELECT * FROM t1 LIMIT 1) UNION (SELECT * FROM t2) LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 LIMIT 1) UNION (SELECT * FROM t2) ORDER BY
> nokey LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 LIMIT 1) UNION (SELECT * FROM t2) ORDER BY nuk
> LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 LIMIT 1) UNION (SELECT * FROM t2) ORDER BY
> nnuk1 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 LIMIT 1) UNION (SELECT * FROM t2) ORDER BY nnuk
> LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 LIMIT 1) UNION (SELECT * FROM t2) ORDER BY
> nnuk_str_short LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 LIMIT 1) UNION (SELECT * FROM t2) ORDER BY
> nnuk_str_long LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 LIMIT 1) UNION (SELECT * FROM t2) ORDER BY pk
> LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 LIMIT 1) UNION (SELECT * FROM t2) ORDER BY
> nnuk1, nnuk2 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 LIMIT 1) UNION (SELECT * FROM t2) ORDER BY
> nnuk1, nnuk2, nokey LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 LIMIT 1) UNION (SELECT * FROM t2) ORDER BY
> nnuk1, nokey, nnuk2 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nokey LIMIT 1) UNION (SELECT * FROM
> t2) LIMIT 0;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 2
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nokey LIMIT 1) UNION (SELECT * FROM
> t2) LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nokey LIMIT 1) UNION (SELECT * FROM
> t2) ORDER BY nokey LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nokey LIMIT 1) UNION (SELECT * FROM
> t2) ORDER BY nuk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nokey LIMIT 1) UNION (SELECT * FROM
> t2) ORDER BY nnuk1 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nokey LIMIT 1) UNION (SELECT * FROM
> t2) ORDER BY nnuk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nokey LIMIT 1) UNION (SELECT * FROM
> t2) ORDER BY nnuk_str_short LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nokey LIMIT 1) UNION (SELECT * FROM
> t2) ORDER BY nnuk_str_long LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nokey LIMIT 1) UNION (SELECT * FROM
> t2) ORDER BY pk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nokey LIMIT 1) UNION (SELECT * FROM
> t2) ORDER BY nnuk1, nnuk2 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nokey LIMIT 1) UNION (SELECT * FROM
> t2) ORDER BY nnuk1, nnuk2, nokey LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nokey LIMIT 1) UNION (SELECT * FROM
> t2) ORDER BY nnuk1, nokey, nnuk2 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nuk LIMIT 1) UNION (SELECT * FROM t2)
> LIMIT 0;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 2
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nuk LIMIT 1) UNION (SELECT * FROM t2)
> LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nuk LIMIT 1) UNION (SELECT * FROM t2)
> ORDER BY nokey LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nuk LIMIT 1) UNION (SELECT * FROM t2)
> ORDER BY nuk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nuk LIMIT 1) UNION (SELECT * FROM t2)
> ORDER BY nnuk1 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nuk LIMIT 1) UNION (SELECT * FROM t2)
> ORDER BY nnuk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nuk LIMIT 1) UNION (SELECT * FROM t2)
> ORDER BY nnuk_str_short LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nuk LIMIT 1) UNION (SELECT * FROM t2)
> ORDER BY nnuk_str_long LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nuk LIMIT 1) UNION (SELECT * FROM t2)
> ORDER BY pk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nuk LIMIT 1) UNION (SELECT * FROM t2)
> ORDER BY nnuk1, nnuk2 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nuk LIMIT 1) UNION (SELECT * FROM t2)
> ORDER BY nnuk1, nnuk2, nokey LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nuk LIMIT 1) UNION (SELECT * FROM t2)
> ORDER BY nnuk1, nokey, nnuk2 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1 LIMIT 1) UNION (SELECT * FROM
> t2) LIMIT 0;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 2
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1 LIMIT 1) UNION (SELECT * FROM
> t2) LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1 LIMIT 1) UNION (SELECT * FROM
> t2) ORDER BY nokey LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1 LIMIT 1) UNION (SELECT * FROM
> t2) ORDER BY nuk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1 LIMIT 1) UNION (SELECT * FROM
> t2) ORDER BY nnuk1 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1 LIMIT 1) UNION (SELECT * FROM
> t2) ORDER BY nnuk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1 LIMIT 1) UNION (SELECT * FROM
> t2) ORDER BY nnuk_str_short LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1 LIMIT 1) UNION (SELECT * FROM
> t2) ORDER BY nnuk_str_long LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1 LIMIT 1) UNION (SELECT * FROM
> t2) ORDER BY pk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1 LIMIT 1) UNION (SELECT * FROM
> t2) ORDER BY nnuk1, nnuk2 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1 LIMIT 1) UNION (SELECT * FROM
> t2) ORDER BY nnuk1, nnuk2, nokey LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1 LIMIT 1) UNION (SELECT * FROM
> t2) ORDER BY nnuk1, nokey, nnuk2 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk LIMIT 1) UNION (SELECT * FROM t2)
> LIMIT 0;
> > +ROWS in table t: 2
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk LIMIT 1) UNION (SELECT * FROM t2)
> LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk LIMIT 1) UNION (SELECT * FROM t2)
> ORDER BY nokey LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk LIMIT 1) UNION (SELECT * FROM t2)
> ORDER BY nuk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk LIMIT 1) UNION (SELECT * FROM t2)
> ORDER BY nnuk1 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk LIMIT 1) UNION (SELECT * FROM t2)
> ORDER BY nnuk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk LIMIT 1) UNION (SELECT * FROM t2)
> ORDER BY nnuk_str_short LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk LIMIT 1) UNION (SELECT * FROM t2)
> ORDER BY nnuk_str_long LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk LIMIT 1) UNION (SELECT * FROM t2)
> ORDER BY pk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk LIMIT 1) UNION (SELECT * FROM t2)
> ORDER BY nnuk1, nnuk2 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk LIMIT 1) UNION (SELECT * FROM t2)
> ORDER BY nnuk1, nnuk2, nokey LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk LIMIT 1) UNION (SELECT * FROM t2)
> ORDER BY nnuk1, nokey, nnuk2 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk_str_short LIMIT 1) UNION (SELECT
> * FROM t2) LIMIT 0;
> > +ROWS in table t: 2
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk_str_short LIMIT 1) UNION (SELECT
> * FROM t2) LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk_str_short LIMIT 1) UNION (SELECT
> * FROM t2) ORDER BY nokey LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk_str_short LIMIT 1) UNION (SELECT
> * FROM t2) ORDER BY nuk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk_str_short LIMIT 1) UNION (SELECT
> * FROM t2) ORDER BY nnuk1 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk_str_short LIMIT 1) UNION (SELECT
> * FROM t2) ORDER BY nnuk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk_str_short LIMIT 1) UNION (SELECT
> * FROM t2) ORDER BY nnuk_str_short LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk_str_short LIMIT 1) UNION (SELECT
> * FROM t2) ORDER BY nnuk_str_long LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk_str_short LIMIT 1) UNION (SELECT
> * FROM t2) ORDER BY pk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk_str_short LIMIT 1) UNION (SELECT
> * FROM t2) ORDER BY nnuk1, nnuk2 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk_str_short LIMIT 1) UNION (SELECT
> * FROM t2) ORDER BY nnuk1, nnuk2, nokey LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk_str_short LIMIT 1) UNION (SELECT
> * FROM t2) ORDER BY nnuk1, nokey, nnuk2 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk_str_long LIMIT 1) UNION (SELECT *
> FROM t2) LIMIT 0;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 2
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk_str_long LIMIT 1) UNION (SELECT *
> FROM t2) LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk_str_long LIMIT 1) UNION (SELECT *
> FROM t2) ORDER BY nokey LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk_str_long LIMIT 1) UNION (SELECT *
> FROM t2) ORDER BY nuk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk_str_long LIMIT 1) UNION (SELECT *
> FROM t2) ORDER BY nnuk1 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk_str_long LIMIT 1) UNION (SELECT *
> FROM t2) ORDER BY nnuk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk_str_long LIMIT 1) UNION (SELECT *
> FROM t2) ORDER BY nnuk_str_short LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk_str_long LIMIT 1) UNION (SELECT *
> FROM t2) ORDER BY nnuk_str_long LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk_str_long LIMIT 1) UNION (SELECT *
> FROM t2) ORDER BY pk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk_str_long LIMIT 1) UNION (SELECT *
> FROM t2) ORDER BY nnuk1, nnuk2 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk_str_long LIMIT 1) UNION (SELECT *
> FROM t2) ORDER BY nnuk1, nnuk2, nokey LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk_str_long LIMIT 1) UNION (SELECT *
> FROM t2) ORDER BY nnuk1, nokey, nnuk2 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY pk LIMIT 1) UNION (SELECT * FROM t2)
> LIMIT 0;
> > +ROWS in table t: 2
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY pk LIMIT 1) UNION (SELECT * FROM t2)
> LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY pk LIMIT 1) UNION (SELECT * FROM t2)
> ORDER BY nokey LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY pk LIMIT 1) UNION (SELECT * FROM t2)
> ORDER BY nuk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY pk LIMIT 1) UNION (SELECT * FROM t2)
> ORDER BY nnuk1 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY pk LIMIT 1) UNION (SELECT * FROM t2)
> ORDER BY nnuk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY pk LIMIT 1) UNION (SELECT * FROM t2)
> ORDER BY nnuk_str_short LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY pk LIMIT 1) UNION (SELECT * FROM t2)
> ORDER BY nnuk_str_long LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY pk LIMIT 1) UNION (SELECT * FROM t2)
> ORDER BY pk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY pk LIMIT 1) UNION (SELECT * FROM t2)
> ORDER BY nnuk1, nnuk2 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY pk LIMIT 1) UNION (SELECT * FROM t2)
> ORDER BY nnuk1, nnuk2, nokey LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY pk LIMIT 1) UNION (SELECT * FROM t2)
> ORDER BY nnuk1, nokey, nnuk2 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nnuk2 LIMIT 1) UNION (SELECT *
> FROM t2) LIMIT 0;
> > +ROWS in table t: 2
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nnuk2 LIMIT 1) UNION (SELECT *
> FROM t2) LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nnuk2 LIMIT 1) UNION (SELECT *
> FROM t2) ORDER BY nokey LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nnuk2 LIMIT 1) UNION (SELECT *
> FROM t2) ORDER BY nuk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nnuk2 LIMIT 1) UNION (SELECT *
> FROM t2) ORDER BY nnuk1 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nnuk2 LIMIT 1) UNION (SELECT *
> FROM t2) ORDER BY nnuk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nnuk2 LIMIT 1) UNION (SELECT *
> FROM t2) ORDER BY nnuk_str_short LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nnuk2 LIMIT 1) UNION (SELECT *
> FROM t2) ORDER BY nnuk_str_long LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nnuk2 LIMIT 1) UNION (SELECT *
> FROM t2) ORDER BY pk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nnuk2 LIMIT 1) UNION (SELECT *
> FROM t2) ORDER BY nnuk1, nnuk2 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nnuk2 LIMIT 1) UNION (SELECT *
> FROM t2) ORDER BY nnuk1, nnuk2, nokey LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nnuk2 LIMIT 1) UNION (SELECT *
> FROM t2) ORDER BY nnuk1, nokey, nnuk2 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nnuk2, nokey LIMIT 1) UNION
> (SELECT * FROM t2) LIMIT 0;
> > +ROWS in table t: 2
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nnuk2, nokey LIMIT 1) UNION
> (SELECT * FROM t2) LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nnuk2, nokey LIMIT 1) UNION
> (SELECT * FROM t2) ORDER BY nokey LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nnuk2, nokey LIMIT 1) UNION
> (SELECT * FROM t2) ORDER BY nuk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nnuk2, nokey LIMIT 1) UNION
> (SELECT * FROM t2) ORDER BY nnuk1 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nnuk2, nokey LIMIT 1) UNION
> (SELECT * FROM t2) ORDER BY nnuk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nnuk2, nokey LIMIT 1) UNION
> (SELECT * FROM t2) ORDER BY nnuk_str_short LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nnuk2, nokey LIMIT 1) UNION
> (SELECT * FROM t2) ORDER BY nnuk_str_long LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nnuk2, nokey LIMIT 1) UNION
> (SELECT * FROM t2) ORDER BY pk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nnuk2, nokey LIMIT 1) UNION
> (SELECT * FROM t2) ORDER BY nnuk1, nnuk2 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nnuk2, nokey LIMIT 1) UNION
> (SELECT * FROM t2) ORDER BY nnuk1, nnuk2, nokey LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nnuk2, nokey LIMIT 1) UNION
> (SELECT * FROM t2) ORDER BY nnuk1, nokey, nnuk2 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nokey, nnuk2 LIMIT 1) UNION
> (SELECT * FROM t2) LIMIT 0;
> > +ROWS in table t: 2
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nokey, nnuk2 LIMIT 1) UNION
> (SELECT * FROM t2) LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nokey, nnuk2 LIMIT 1) UNION
> (SELECT * FROM t2) ORDER BY nokey LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nokey, nnuk2 LIMIT 1) UNION
> (SELECT * FROM t2) ORDER BY nuk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nokey, nnuk2 LIMIT 1) UNION
> (SELECT * FROM t2) ORDER BY nnuk1 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nokey, nnuk2 LIMIT 1) UNION
> (SELECT * FROM t2) ORDER BY nnuk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nokey, nnuk2 LIMIT 1) UNION
> (SELECT * FROM t2) ORDER BY nnuk_str_short LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nokey, nnuk2 LIMIT 1) UNION
> (SELECT * FROM t2) ORDER BY nnuk_str_long LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nokey, nnuk2 LIMIT 1) UNION
> (SELECT * FROM t2) ORDER BY pk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nokey, nnuk2 LIMIT 1) UNION
> (SELECT * FROM t2) ORDER BY nnuk1, nnuk2 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nokey, nnuk2 LIMIT 1) UNION
> (SELECT * FROM t2) ORDER BY nnuk1, nnuk2, nokey LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t (SELECT * FROM t1 ORDER BY nnuk1, nokey, nnuk2 LIMIT 1) UNION
> (SELECT * FROM t2) ORDER BY nnuk1, nokey, nnuk2 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 LIMIT 0) AS subselect LIMIT 0;
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 LIMIT 0) AS subselect LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 LIMIT 0) AS subselect ORDER BY
> nokey LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 LIMIT 0) AS subselect ORDER BY
> nuk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 LIMIT 0) AS subselect ORDER BY
> nnuk1 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 LIMIT 0) AS subselect ORDER BY
> nnuk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 LIMIT 0) AS subselect ORDER BY
> nnuk_str_short LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 LIMIT 0) AS subselect ORDER BY
> nnuk_str_long LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 LIMIT 0) AS subselect ORDER BY pk
> LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 LIMIT 0) AS subselect ORDER BY
> nnuk1, nnuk2 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 LIMIT 0) AS subselect ORDER BY
> nnuk1, nnuk2, nokey LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 LIMIT 0) AS subselect ORDER BY
> nnuk1, nokey, nnuk2 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 LIMIT 1) AS subselect LIMIT 0;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 LIMIT 1) AS subselect LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 LIMIT 1) AS subselect ORDER BY
> nokey LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 LIMIT 1) AS subselect ORDER BY
> nuk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 LIMIT 1) AS subselect ORDER BY
> nnuk1 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 LIMIT 1) AS subselect ORDER BY
> nnuk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 LIMIT 1) AS subselect ORDER BY
> nnuk_str_short LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 LIMIT 1) AS subselect ORDER BY
> nnuk_str_long LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 LIMIT 1) AS subselect ORDER BY pk
> LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 LIMIT 1) AS subselect ORDER BY
> nnuk1, nnuk2 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 LIMIT 1) AS subselect ORDER BY
> nnuk1, nnuk2, nokey LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 LIMIT 1) AS subselect ORDER BY
> nnuk1, nokey, nnuk2 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nokey LIMIT 1) AS
> subselect LIMIT 0;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nokey LIMIT 1) AS
> subselect LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nokey LIMIT 1) AS
> subselect ORDER BY nokey LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nokey LIMIT 1) AS
> subselect ORDER BY nuk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nokey LIMIT 1) AS
> subselect ORDER BY nnuk1 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nokey LIMIT 1) AS
> subselect ORDER BY nnuk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nokey LIMIT 1) AS
> subselect ORDER BY nnuk_str_short LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nokey LIMIT 1) AS
> subselect ORDER BY nnuk_str_long LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nokey LIMIT 1) AS
> subselect ORDER BY pk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nokey LIMIT 1) AS
> subselect ORDER BY nnuk1, nnuk2 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nokey LIMIT 1) AS
> subselect ORDER BY nnuk1, nnuk2, nokey LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nokey LIMIT 1) AS
> subselect ORDER BY nnuk1, nokey, nnuk2 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nuk LIMIT 1) AS
> subselect LIMIT 0;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nuk LIMIT 1) AS
> subselect LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nuk LIMIT 1) AS
> subselect ORDER BY nokey LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nuk LIMIT 1) AS
> subselect ORDER BY nuk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nuk LIMIT 1) AS
> subselect ORDER BY nnuk1 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nuk LIMIT 1) AS
> subselect ORDER BY nnuk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nuk LIMIT 1) AS
> subselect ORDER BY nnuk_str_short LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nuk LIMIT 1) AS
> subselect ORDER BY nnuk_str_long LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nuk LIMIT 1) AS
> subselect ORDER BY pk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nuk LIMIT 1) AS
> subselect ORDER BY nnuk1, nnuk2 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nuk LIMIT 1) AS
> subselect ORDER BY nnuk1, nnuk2, nokey LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nuk LIMIT 1) AS
> subselect ORDER BY nnuk1, nokey, nnuk2 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk1 LIMIT 1) AS
> subselect LIMIT 0;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk1 LIMIT 1) AS
> subselect LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk1 LIMIT 1) AS
> subselect ORDER BY nokey LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk1 LIMIT 1) AS
> subselect ORDER BY nuk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk1 LIMIT 1) AS
> subselect ORDER BY nnuk1 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk1 LIMIT 1) AS
> subselect ORDER BY nnuk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk1 LIMIT 1) AS
> subselect ORDER BY nnuk_str_short LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk1 LIMIT 1) AS
> subselect ORDER BY nnuk_str_long LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk1 LIMIT 1) AS
> subselect ORDER BY pk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk1 LIMIT 1) AS
> subselect ORDER BY nnuk1, nnuk2 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk1 LIMIT 1) AS
> subselect ORDER BY nnuk1, nnuk2, nokey LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk1 LIMIT 1) AS
> subselect ORDER BY nnuk1, nokey, nnuk2 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk LIMIT 1) AS
> subselect LIMIT 0;
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk LIMIT 1) AS
> subselect LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk LIMIT 1) AS
> subselect ORDER BY nokey LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk LIMIT 1) AS
> subselect ORDER BY nuk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk LIMIT 1) AS
> subselect ORDER BY nnuk1 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk LIMIT 1) AS
> subselect ORDER BY nnuk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk LIMIT 1) AS
> subselect ORDER BY nnuk_str_short LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk LIMIT 1) AS
> subselect ORDER BY nnuk_str_long LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk LIMIT 1) AS
> subselect ORDER BY pk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk LIMIT 1) AS
> subselect ORDER BY nnuk1, nnuk2 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk LIMIT 1) AS
> subselect ORDER BY nnuk1, nnuk2, nokey LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk LIMIT 1) AS
> subselect ORDER BY nnuk1, nokey, nnuk2 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk_str_short LIMIT 1)
> AS subselect LIMIT 0;
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk_str_short LIMIT 1)
> AS subselect LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk_str_short LIMIT 1)
> AS subselect ORDER BY nokey LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk_str_short LIMIT 1)
> AS subselect ORDER BY nuk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk_str_short LIMIT 1)
> AS subselect ORDER BY nnuk1 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk_str_short LIMIT 1)
> AS subselect ORDER BY nnuk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk_str_short LIMIT 1)
> AS subselect ORDER BY nnuk_str_short LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk_str_short LIMIT 1)
> AS subselect ORDER BY nnuk_str_long LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk_str_short LIMIT 1)
> AS subselect ORDER BY pk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk_str_short LIMIT 1)
> AS subselect ORDER BY nnuk1, nnuk2 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk_str_short LIMIT 1)
> AS subselect ORDER BY nnuk1, nnuk2, nokey LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk_str_short LIMIT 1)
> AS subselect ORDER BY nnuk1, nokey, nnuk2 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk_str_long LIMIT 1)
> AS subselect LIMIT 0;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk_str_long LIMIT 1)
> AS subselect LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk_str_long LIMIT 1)
> AS subselect ORDER BY nokey LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk_str_long LIMIT 1)
> AS subselect ORDER BY nuk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk_str_long LIMIT 1)
> AS subselect ORDER BY nnuk1 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk_str_long LIMIT 1)
> AS subselect ORDER BY nnuk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk_str_long LIMIT 1)
> AS subselect ORDER BY nnuk_str_short LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk_str_long LIMIT 1)
> AS subselect ORDER BY nnuk_str_long LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk_str_long LIMIT 1)
> AS subselect ORDER BY pk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk_str_long LIMIT 1)
> AS subselect ORDER BY nnuk1, nnuk2 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk_str_long LIMIT 1)
> AS subselect ORDER BY nnuk1, nnuk2, nokey LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk_str_long LIMIT 1)
> AS subselect ORDER BY nnuk1, nokey, nnuk2 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY pk LIMIT 1) AS subselect
> LIMIT 0;
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY pk LIMIT 1) AS subselect
> LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY pk LIMIT 1) AS subselect
> ORDER BY nokey LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY pk LIMIT 1) AS subselect
> ORDER BY nuk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY pk LIMIT 1) AS subselect
> ORDER BY nnuk1 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY pk LIMIT 1) AS subselect
> ORDER BY nnuk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY pk LIMIT 1) AS subselect
> ORDER BY nnuk_str_short LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY pk LIMIT 1) AS subselect
> ORDER BY nnuk_str_long LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY pk LIMIT 1) AS subselect
> ORDER BY pk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY pk LIMIT 1) AS subselect
> ORDER BY nnuk1, nnuk2 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY pk LIMIT 1) AS subselect
> ORDER BY nnuk1, nnuk2, nokey LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY pk LIMIT 1) AS subselect
> ORDER BY nnuk1, nokey, nnuk2 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk1, nnuk2 LIMIT 1) AS
> subselect LIMIT 0;
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk1, nnuk2 LIMIT 1) AS
> subselect LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk1, nnuk2 LIMIT 1) AS
> subselect ORDER BY nokey LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk1, nnuk2 LIMIT 1) AS
> subselect ORDER BY nuk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk1, nnuk2 LIMIT 1) AS
> subselect ORDER BY nnuk1 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk1, nnuk2 LIMIT 1) AS
> subselect ORDER BY nnuk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk1, nnuk2 LIMIT 1) AS
> subselect ORDER BY nnuk_str_short LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk1, nnuk2 LIMIT 1) AS
> subselect ORDER BY nnuk_str_long LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk1, nnuk2 LIMIT 1) AS
> subselect ORDER BY pk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk1, nnuk2 LIMIT 1) AS
> subselect ORDER BY nnuk1, nnuk2 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk1, nnuk2 LIMIT 1) AS
> subselect ORDER BY nnuk1, nnuk2, nokey LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk1, nnuk2 LIMIT 1) AS
> subselect ORDER BY nnuk1, nokey, nnuk2 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk1, nnuk2, nokey
> LIMIT 1) AS subselect LIMIT 0;
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk1, nnuk2, nokey
> LIMIT 1) AS subselect LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk1, nnuk2, nokey
> LIMIT 1) AS subselect ORDER BY nokey LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk1, nnuk2, nokey
> LIMIT 1) AS subselect ORDER BY nuk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk1, nnuk2, nokey
> LIMIT 1) AS subselect ORDER BY nnuk1 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk1, nnuk2, nokey
> LIMIT 1) AS subselect ORDER BY nnuk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk1, nnuk2, nokey
> LIMIT 1) AS subselect ORDER BY nnuk_str_short LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk1, nnuk2, nokey
> LIMIT 1) AS subselect ORDER BY nnuk_str_long LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk1, nnuk2, nokey
> LIMIT 1) AS subselect ORDER BY pk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk1, nnuk2, nokey
> LIMIT 1) AS subselect ORDER BY nnuk1, nnuk2 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk1, nnuk2, nokey
> LIMIT 1) AS subselect ORDER BY nnuk1, nnuk2, nokey LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk1, nnuk2, nokey
> LIMIT 1) AS subselect ORDER BY nnuk1, nokey, nnuk2 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk1, nokey, nnuk2
> LIMIT 1) AS subselect LIMIT 0;
> > +ROWS in table t: 2
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk1, nokey, nnuk2
> LIMIT 1) AS subselect LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk1, nokey, nnuk2
> LIMIT 1) AS subselect ORDER BY nokey LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk1, nokey, nnuk2
> LIMIT 1) AS subselect ORDER BY nuk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk1, nokey, nnuk2
> LIMIT 1) AS subselect ORDER BY nnuk1 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk1, nokey, nnuk2
> LIMIT 1) AS subselect ORDER BY nnuk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk1, nokey, nnuk2
> LIMIT 1) AS subselect ORDER BY nnuk_str_short LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk1, nokey, nnuk2
> LIMIT 1) AS subselect ORDER BY nnuk_str_long LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk1, nokey, nnuk2
> LIMIT 1) AS subselect ORDER BY pk LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk1, nokey, nnuk2
> LIMIT 1) AS subselect ORDER BY nnuk1, nnuk2 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk1, nokey, nnuk2
> LIMIT 1) AS subselect ORDER BY nnuk1, nnuk2, nokey LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +INSERT INTO t SELECT * FROM (SELECT * FROM t1 ORDER BY nnuk1, nokey, nnuk2
> LIMIT 1) AS subselect ORDER BY nnuk1, nokey, nnuk2 LIMIT 1;
> > +Warnings:
> > +Note	1592	Statement may not be safe to log in statement format.
> > +ROWS in table t: 3
> > +SET MAX_SORT_LENGTH=DEFAULT;
> > +DROP TABLE t, t1, t2, t3, t4;
> > +DROP TABLE queries, result_queries, limits;
> > +DROP PROCEDURE gen_queries;
> >
> > === added file 'mysql-test/suite/binlog/t/binlog_unsafe_limit.test'
> > --- a/mysql-test/suite/binlog/t/binlog_unsafe_limit.test	1970-01-01 00:00:00
> +0000
> > +++ b/mysql-test/suite/binlog/t/binlog_unsafe_limit.test	2010-12-11 04:32:35
> +0000
> > @@ -0,0 +1,241 @@
> > +# ==== Purpose ====
> > +#
> > +# Test under what circumstances there is a warning for unsafe
> > +# statements on the following form:
> > +#
> > +# [INSERT...SELECT | REPLACE...SELECT | DELETE | UPDATE] ... ORDER BY ...
> LIMIT
> > +#
> > +# INSERT...SELECT...LIMIT should give a warning because the order of
> > +# rows may differ between master and slave, so the LIMIT may select a
> > +# different set of rows on master and slave.  However, if there is an
> > +# 'ORDER BY primary_key', then the order is known and there should not
> > +# be any warning.  The same is true for REPLACE...SELECT, DELETE, and
> > +# UPDATE.  In REPLACE...SELECT and INSERT...SELECT, the select may be
> > +# compound using UNION or JOIN or subqueries in the FROM clause.  So
> > +# we test LIMIT in various places in the subqueries.
> > +#
> > +# We also test various forms of ORDER BY ... LIMIT. If there is one
> > +# ORDER BY column and it is a PRIMARY KEY or NOT NULL UNIQUE KEY, then
> > +# the order is deterministic.  If there is one ORDER BY column and it
> > +# is neither a PRIMARY KEY nor a NOT NULL UNIQUE KEY, then the order
> > +# is not deterministic.  If the ORDER BY consists of several columns,
> > +# and a prefix of the ORDER BY columns is a PRIMARY KEY or NOT NULL
> > +# UNIQUE KEY, then the order is deterministic.  If the ORDER BY
> > +# consists of several columns, and no prefix of the ORDER BY COLUMNS
> > +# is a PRIMARY KEY or NOT NULL UNIQUE KEY, then the order is not
> > +# deterministic.
> > +
> > +source include/have_log_bin.inc;
> > +source include/have_binlog_format_statement.inc;
> > +
> > +#
> > +# Create the tables for test
> > +# Where:
> > +#    - nokey is a column not part of key
> > +#    - pk is column of the primary key
> > +#    - nuk is a column of UNIQUE KEY, which can be NULL.
> > +#    - nnuk is a column of NOT NULL UNIQUE KEY
> > +#    - nnuk1 and nnuk2 are NOT NULL columns, and togather forms a UNIQUE KEY.
> > +#    - nnuk_str_long is a VARCHAR UNIQUE KEY column that is longer than
> MAX_LENGTH_SORT in this test.
> > +#    - nnuk_str_short is a VARCHAR UNIQUE KEY column that is shorter than
> MAX_LENGTH_SORT in this test.
> > +#
> > +CREATE TABLE t (nokey INT, pk INT PRIMARY KEY, nnuk INT NOT NULL UNIQUE KEY,
> nuk INT UNIQUE KEY,
> > +                nnuk1 INT NOT NULL, nnuk2 INT NOT NULL, UNIQUE KEY(nnuk1,
> nnuk2),
> > +		nnuk_str_long VARCHAR(512) NOT NULL UNIQUE KEY,
> > +		nnuk_str_short VARCHAR(50) NOT NULL UNIQUE KEY);
> > +CREATE TABLE t1 LIKE t;
> > +CREATE TABLE t2 LIKE t;
> > +CREATE TABLE t3 LIKE t;
> > +CREATE TABLE t4 LIKE t;
> > +
> > +
> > +# unsafeness
> > +#   0: always safe
> > +#   1: safe when ORDER BY primary key or non-null unique key
> > +#   2: safe when limit 0
> > +#
> > +# unsafeness1/2 is the unsafeness value for the the first and the
> > +# second (if not exists, the value is 0) SELECT/UPDATE/DELETE/UNION
> > +# that have LIMIT clause, the safeness of the limit clause must be
> > +# higher than the unsafeness of the SELECT/UPDATE/DELETE/UNION part.
> > +
> > +CREATE TABLE queries (query VARCHAR(1024) NOT NULL, unsafeness1 INT,
> unsafeness2 INT);
> > +CREATE TABLE result_queries (id INT AUTO_INCREMENT PRIMARY KEY,
> > +       	     		     query VARCHAR(1024) NOT NULL, unsafe1 BOOL, unsafe2 BOOL
> DEFAULT FALSE);
> > +# safeness
> > +#   0: ORDER BY normal columns
> > +#   1: ORDER BY primary key or non-null unique key
> > +#   2: limit 0
> > +CREATE TABLE limits (`limit` VARCHAR(256) NOT NULL, safeness INT DEFAULT 0);
> > +
> > +#
> > +# Iterate through the following queries
> > +#
> > +# [LIMIT_1] and [LIMIT_2] will iterate over the strings in table `limits`
> > +#
> > +INSERT INTO queries VALUES
> > +	('UPDATE t SET nokey = nokey + 10 [LIMIT_1]', 1, 0),
> > +	('UPDATE t SET nokey = nokey + 10 WHERE nokey=1 [LIMIT_1]', 1, 0),
> > +	('UPDATE t SET nokey = nokey + 10 WHERE nuk=1   [LIMIT_1]', 1, 0),
> > +	('UPDATE t SET nokey = nokey + 10 WHERE nnuk=1  [LIMIT_1]', 0, 0),
> > +	('UPDATE t SET nokey = nokey + 10 WHERE pk=1    [LIMIT_1]', 0, 0),
> > +
> > +	('DELETE FROM t [LIMIT_1]', 1, 0),
> > +	('DELETE FROM t WHERE nokey=1 [LIMIT_1]', 1, 0),
> > +	('DELETE FROM t WHERE nuk=1   [LIMIT_1]', 1, 0),
> > +	('DELETE FROM t WHERE nnuk=1  [LIMIT_1]', 0, 0),
> > +	('DELETE FROM t WHERE pk=1    [LIMIT_1]', 0, 0),
> > +
> > +	('REPLACE INTO t SELECT * FROM t1 [LIMIT_1]', 1, 0),
> > +	('REPLACE INTO t SELECT * FROM t1 WHERE nokey=1 [LIMIT_1]', 1, 0),
> > +	('REPLACE INTO t SELECT * FROM t1 WHERE nuk=1   [LIMIT_1]', 1, 0),
> > +	('REPLACE INTO t SELECT * FROM t1 WHERE nnuk=1  [LIMIT_1]', 0, 0),
> > +	('REPLACE INTO t SELECT * FROM t1 WHERE pk=1    [LIMIT_1]', 0, 0),
> > +					
> > +	('INSERT INTO t SELECT * FROM t1 [LIMIT_1]', 1, 0),
> > +	('INSERT INTO t SELECT * FROM t1 WHERE nokey=1 [LIMIT_1]', 1, 0),
> > +	('INSERT INTO t SELECT * FROM t1 WHERE nuk=1   [LIMIT_1]', 1, 0),
> > +	('INSERT INTO t SELECT * FROM t1 WHERE nnuk=1  [LIMIT_1]', 0, 0),
> > +	('INSERT INTO t SELECT * FROM t1 WHERE pk=1    [LIMIT_1]', 0, 0),
> > +
> > +	('INSERT INTO t (SELECT * FROM t1) UNION (SELECT * FROM t2) [LIMIT_1]', 2,
> 0),
> > +	('INSERT INTO t (SELECT * FROM t1 [LIMIT_1]) UNION (SELECT * FROM t2)', 1,
> 0),
> > +	('INSERT INTO t (SELECT * FROM t1) UNION (SELECT * FROM t2 [LIMIT_1])', 1,
> 0),
> > +	('INSERT INTO t (SELECT * FROM t1 [LIMIT_1]) UNION (SELECT * FROM t2
> [LIMIT_2])', 1, 1),
> > +	('INSERT INTO t (SELECT * FROM t1 [LIMIT_1]) UNION (SELECT * FROM t2)
> [LIMIT_2]', 1, 2),
> > +
> > +	('INSERT INTO t SELECT * FROM (SELECT * FROM t1 [LIMIT_1]) AS subselect
> [LIMIT_2]', 1, 2);
> > +
> 
> (S15) I think maybe we can add some cases here, just to try everything, 
> in particular we should try 'WHERE nnuk1=1 ORDER BY nnuk2'. Also, I 
> think maybe we can organize the tables in a slightly different way:
> 
> Table queries:
> 'UPDATE t SET nokey = nokey + 10 [WHERE_1] [ORDER_1] [LIMIT_1]'
> 'DELETE FROM t [WHERE_1] [ORDER_1] [LIMIT_1]'
> 'REPLACE INTO t SELECT * FROM t1 [WHERE_1] [ORDER_1] [LIMIT_1]'
> 'INSERT INTO t SELECT * FROM t1 [WHERE_1] [ORDER_1] [LIMIT_1]'
> 'INSERT INTO t (SELECT * FROM t1) UNION (SELECT * FROM t2) [LIMIT_1]
> 'INSERT INTO t (SELECT * FROM t1) UNION (SELECT * FROM t2) [WHERE_1] 
> [ORDER_1] [LIMIT_1]'
> 'INSERT INTO t (SELECT * FROM t1 [WHERE_1] [ORDER_1] [LIMIT_1]) UNION 
> (SELECT * FROM t2)'
> 'INSERT INTO t (SELECT * FROM t1) UNION (SELECT * FROM t2 [WHERE_1] 
> [ORDER_1] [LIMIT_1])'
> 'INSERT INTO t (SELECT * FROM t1 [WHERE_1] [ORDER_1] [LIMIT_1]) UNION 
> (SELECT * FROM t2 [WHERE_2] [ORDER_2] [LIMIT_2])'
> 'INSERT INTO t (SELECT * FROM t1 [WHERE_1] [ORDER_1] [LIMIT_1]) UNION 
> (SELECT * FROM t2) [WHERE_2] [ORDER_2] [LIMIT_2]'
> 
> Table where_clauses:
> '', 0x000
> 'WHERE nokey=1', 0x000
> 'WHERE pk=1 AND nokey=1 AND RAND()=1', 0x100
> 'WHERE nuk=1', 0x000
> 'WHERE nnuk=1', 0x100
> 'WHERE nnuk1=1', 0x010
> 'WHERE nnuk2=1', 0x001
> 'WHERE nnuk2=1 AND nnuk1=1', 0x011
> 
> Table order_clauses:
> '', 0x000
> 'ORDER BY nokey', 0x000
> 'ORDER BY pk', 0x100
> 'ORDER BY nuk', 0x000
> 'ORDER BY nnuk', 0x100
> 'ORDER BY nnuk1', 0x010
> 'ORDER BY nnuk2', 0x001
> 'ORDER BY nnuk2, nnuk1', 0x011
> 'ORDER BY nnuk1, nokey, nnuk2', 0x011
> 'ORDER BY nnuk_str_short', 0x100
> 'ORDER BY nnuk_str_long', 0x000
> 
> Table limit_clauses:
> '', 0
> 'LIMIT 0', 0
> 'LIMIT 1', 1
> 
> The second column in the limit_clauses table is 0 if the statement is 
> always deterministic and 1 otherwise. The second column in the 
> where_clauses and order_clauses has three bits. The first bit is set if 
> one of the one-column indexes is deterministic. The second bit is set if 
> nnuk1 is deterministic and the third bit is set if nnuk2 is 
> deterministic. So the statement is deterministic if either the value in 
> the limit_clauses is 0, or the boolean "or" of the values from 
> where_clauses and order_clauses is either 1 in the first bit or 11 in 
> the second and third bit.
> 
> > +
> > +#
> > +# Let the LIMIT cluase ([LIMIT_1] and [LIMIT_2]) iterate through the following
> strings:
> > +#
> > +INSERT INTO limits (`limit`, safeness) VALUES
> > +	('LIMIT 0', 2),
> > +	('LIMIT 1', 0),
> > +	('ORDER BY nokey LIMIT 1', 0),
> > +	('ORDER BY nuk LIMIT 1', 0),
> > +	('ORDER BY nnuk1 LIMIT 1', 0),
> > +	('ORDER BY nnuk LIMIT 1', 1),
> > +	('ORDER BY nnuk_str_short LIMIT 1', 1),
> > +	('ORDER BY nnuk_str_long LIMIT 1', 0),
> > +	('ORDER BY pk LIMIT 1', 1),
> > +	('ORDER BY nnuk1, nnuk2 LIMIT 1', 1),
> > +	('ORDER BY nnuk1, nnuk2, nokey LIMIT 1', 1),
> > +	('ORDER BY nnuk1, nokey, nnuk2 LIMIT 1', 1);
> > +	
> > +
> > +DELIMITER |;
> > +
> > +#
> > +# This function is used to generate the queries by replace [LIMIT_1]
> > +# and [LIMIT_2] with values in table `limits` for values in table
> > +# `queries`. And the result will be save in table `result_queries`.
> > +#
> > +
> > +CREATE PROCEDURE gen_queries()
> > +BEGIN
> > +  DECLARE done INT DEFAULT 0;
> > +  DECLARE q VARCHAR(1024);
> > +  DECLARE unsafeness1, unsafeness2 INT;
> > +  DECLARE limit1, limit2 VARCHAR(256);
> > +  DECLARE limit1_safeness, limit2_safeness INT;
> > +  DECLARE qcur CURSOR FOR SELECT * FROM queries;
> > +  DECLARE lcur1 CURSOR FOR SELECT * FROM limits;
> > +  DECLARE lcur2 CURSOR FOR SELECT * FROM limits;
> > +  DECLARE CONTINUE HANDLER FOR NOT FOUND SET done=1;
> > +
> > +  OPEN qcur;
> > +
> > +  FETCH qcur INTO q, unsafeness1, unsafeness2;
> > +  WHILE done<>  1 DO
> > +    OPEN lcur1;
> > +    FETCH lcur1 INTO limit1, limit1_safeness;
> > +    WHILE done<>  1 DO
> > +      IF LOCATE('[LIMIT_2]', q)>  0 THEN
> > +        OPEN lcur2;
> > +        FETCH lcur2 INTO limit2, limit2_safeness;
> > +        WHILE done<>  1 DO
> > +	     SELECT REPLACE(REPLACE(q, '[LIMIT_1]', limit1), '[LIMIT_2]', limit2) INTO
> @query;
> > +          INSERT INTO result_queries (query, unsafe1, unsafe2) VALUES
> > +	  	      		     (@query, limit1_safeness<  unsafeness1, limit2_safeness<
>  unsafeness2);
> > +          FETCH lcur2 INTO limit2, limit2_safeness;
> > +	   END WHILE;
> > + 	   CLOSE lcur2;
> > +	   SET done = 0;
> > +      ELSE
> > +        SELECT REPLACE(q, '[LIMIT_1]', limit1) INTO @query;
> > +        INSERT INTO result_queries (query, unsafe1) VALUES (@query,
> limit1_safeness<  unsafeness1);
> > +      END IF;
> > +      FETCH lcur1 INTO limit1, limit1_safeness;
> > +    END WHILE;
> > +    CLOSE lcur1;
> > +    SET done = 0;
> > +    FETCH qcur INTO q, unsafeness1, unsafeness2;
> > +  END WHILE;
> > +  CLOSE qcur;
> > +END|
> 
> (S13) I think we can simplify the above, something like:
> 
> INSERT INTO result_queries(query, unsafe)
>    SELECT REPLACE(queries.query, '[LIMIT_1]', limits.limit),
>           limits.safeness < queries.safeness
>      FROM queries, limits
>      WHERE queries.query NOT LIKE '%[LIMIT_2]%'
>    UNION
>    SELECT REPLACE(REPLACE(queries.query, '[LIMIT_1]', limits1.limit),
>                   '[limit2]', limits2.limit),
>           limits1.safeness < queries.safeness1 OR
>           limits2.safeness < queries.safeness2
>      FROM queries, limits AS limits1, limits AS limits2
>      WHERE queries.query LIKE '%[LIMIT_2]%'
> 
> > +
> > +DELIMITER ;|
> > +
> > +call gen_queries();
> > +
> > +#
> > +# Execute the generated queries
> > +#
> > +let $count= `SELECT COUNT(*) FROM result_queries`;
> > +let $id=1;
> > +SET MAX_SORT_LENGTH=50;
> > +while (`SELECT $id<= $count`)
> > +{
> > +  disable_query_log;
> > +  TRUNCATE t;
> > +  TRUNCATE t1;
> > +  TRUNCATE t2;
> > +  TRUNCATE t3;
> > +  TRUNCATE t4;
> 
> (S14) Tables t3, t4, t5 are not needed in the test case. Also, I think 
> we don't need to truncate t1, t2 in each iteration. We can just 
> initialize them once, before the loop.
> 
> > +
> > +  # INSERT INTO t VALUES  (1, 1, 1, 1, 1, 1), (2, 2, 2, 2, 2, 2);
> > +  # INSERT INTO t1 VALUES (3, 3, 3, 3, 3, 3), (4, 4, 4, 4, 4, 4);
> > +  # INSERT INTO t2 VALUES (5, 5, 5, 5, 5, 5), (6, 6, 6, 6, 6, 6);
> > +  # INSERT INTO t3 VALUES (7, 7, 7, 7, 7, 7), (8, 8, 8, 8, 8, 8);
> > +  # INSERT INTO t4 VALUES (9, 9, 9, 9, 9, 9), (10, 10, 10, 10, 10, 10);
> 
> (S14) I think the above lines can be removed.
> 
> > +
> > +  INSERT INTO t VALUES  (1, 1, 1, 1, 1, 1, "a", "a"), (2, 2, 2, 2, 2, 2, "b",
> "b");
> > +  INSERT INTO t1 VALUES (3, 3, 3, 3, 3, 3, "c", "c"), (4, 4, 4, 4, 4, 4, "d",
> "d");
> > +  INSERT INTO t2 VALUES (5, 5, 5, 5, 5, 5, "e", "e"), (6, 6, 6, 6, 6, 6, "f",
> "f");
> > +  INSERT INTO t3 VALUES (7, 7, 7, 7, 7, 7, "g", "g"), (8, 8, 8, 8, 8, 8, "h",
> "h");
> > +  INSERT INTO t4 VALUES (9, 9, 9, 9, 9, 9, "i", "i"), (10, 10, 10, 10, 10, 10,
> "j", "j");
> > +
> > +  let $query= `SELECT query FROM result_queries WHERE id=$id`;
> > +  let $query_unsafe= `SELECT unsafe1 OR unsafe2 FROM result_queries WHERE
> id=$id`;
> > +  enable_query_log;
> > +
> > +  eval $query;
> > +  let $warning_count= `SELECT @@warning_count`;
> > +  if ($query_unsafe)
> > +  {
> > +    if (!$warning_count)
> > +    {
> > +      die Expect unsafe warnings;
> > +    }
> > +  }
> > +  if (!$query_unsafe)
> > +  {
> > +    if ($warning_count)
> > +    {
> > +      die Unexpected unsafe warnings;
> > +    }
> > +  }
> > +  let $rows= `SELECT COUNT(*) FROM t`;
> > +  echo ROWS in table t: $rows;
> > +  inc $id;
> > +}
> > +SET MAX_SORT_LENGTH=DEFAULT;
> > +
> > +#
> > +# Cleanup
> > +#
> > +DROP TABLE t, t1, t2, t3, t4;
> > +DROP TABLE queries, result_queries, limits;
> > +DROP PROCEDURE gen_queries;
> >
> > === modified file 'sql/sql_delete.cc'
> > --- a/sql/sql_delete.cc	2010-07-19 09:03:52 +0000
> > +++ b/sql/sql_delete.cc	2010-12-11 04:32:35 +0000
> > @@ -93,6 +93,19 @@ bool mysql_delete(THD *thd, TABLE_LIST *
> >       }
> >     }
> >
> > +  /*
> > +    Statement-based replication of DELETE ... LIMIT is not safe as
> > +    order of rows is not defined unless ORDER BY primary_key, so in
> > +    mixed mode we go to row-based.
> > +  */
> > +  if (thd->lex->current_select->select_limit&&
> > +      select_lex->select_limit->val_int()&&
> > +      !is_order_deterministic(table_list, conds, (ORDER*)order->first))
> > +  {
> > +    thd->lex->set_stmt_unsafe();
> > +    thd->set_current_stmt_binlog_row_based_if_mixed();
> > +  }
> > +
> >     const_cond= (!conds || conds->const_item());
> >     safe_update=test(thd->options&  OPTION_SAFE_UPDATES);
> >     if (safe_update&&  const_cond)
> > @@ -476,19 +489,6 @@ int mysql_prepare_delete(THD *thd, TABLE
> >     DBUG_ENTER("mysql_prepare_delete");
> >     List<Item>  all_fields;
> >
> > -  /*
> > -    Statement-based replication of DELETE ... LIMIT is not safe as order of
> > -    rows is not defined, so in mixed mode we go to row-based.
> > -
> > -    Note that we may consider a statement as safe if ORDER BY primary_key
> > -    is present. However it may confuse users to see very similiar statements
> > -    replicated differently.
> > -  */
> > -  if (thd->lex->current_select->select_limit)
> > -  {
> > -    thd->lex->set_stmt_unsafe();
> > -    thd->set_current_stmt_binlog_row_based_if_mixed();
> > -  }
> >     thd->lex->allow_sum_func= 0;
> >     if
> (setup_tables_and_check_access(thd,&thd->lex->select_lex.context,
> >                                      
> &thd->lex->select_lex.top_join_list,
> >
> > === modified file 'sql/sql_insert.cc'
> > --- a/sql/sql_insert.cc	2010-10-07 08:13:11 +0000
> > +++ b/sql/sql_insert.cc	2010-12-11 04:32:35 +0000
> > @@ -2879,19 +2879,6 @@ bool mysql_insert_select_prepare(THD *th
> >     DBUG_ENTER("mysql_insert_select_prepare");
> >
> >     /*
> > -    Statement-based replication of INSERT ... SELECT ... LIMIT is not safe
> > -    as order of rows is not defined, so in mixed mode we go to row-based.
> > -
> > -    Note that we may consider a statement as safe if ORDER BY primary_key
> > -    is present or we SELECT a constant. However it may confuse users to
> > -    see very similiar statements replicated differently.
> > -  */
> > -  if (lex->current_select->select_limit)
> > -  {
> > -    lex->set_stmt_unsafe();
> > -    thd->set_current_stmt_binlog_row_based_if_mixed();
> > -  }
> > -  /*
> >       SELECT_LEX do not belong to INSERT statement, so we can't add WHERE
> >       clause if table is VIEW
> >     */
> >
> > === modified file 'sql/sql_select.cc'
> > --- a/sql/sql_select.cc	2010-11-26 12:51:48 +0000
> > +++ b/sql/sql_select.cc	2010-12-11 04:32:35 +0000
> > @@ -918,6 +918,22 @@ JOIN::optimize()
> >       }
> >     }
> >
> > +  if (thd->lex->sql_command == SQLCOM_INSERT_SELECT ||
> > +      thd->lex->sql_command == SQLCOM_REPLACE_SELECT)
> > +  {
> > +    /*
> > +      Statement-based replication of INSERT ... SELECT ... LIMIT is
> > +      not safe if the order of the result is not deterministic.
> > +    */
> > +    if (!thd->lex->is_stmt_unsafe()&& 
> select_lex->select_limit&&
> 
> (S12) Just a reminder, in 5.1 it's OK that we omit the check if the 
> statement is already unsafe. But in 5.5 and up, if using 
> binlog_format=statement, we give warnings that explain why the statement 
> is unsafe, and we give one warning for each type of unsafeness. So when 
> merging to 5.5, you have to do the check even if 
> thd->lex->is_stmt_unsafe() is true.
> 
> > +        select_lex->select_limit->val_int()&&
> > +        !is_order_deterministic(join_list, conds, order))
> > +    {
> > +      thd->lex->set_stmt_unsafe();
> > +      thd->set_current_stmt_binlog_row_based_if_mixed();
> > +    }
> > +  }
> > +
> >   #ifdef WITH_PARTITION_STORAGE_ENGINE
> >     {
> >       TABLE_LIST *tbl;
> > @@ -17269,6 +17285,236 @@ bool JOIN::change_result(select_result *
> >     DBUG_RETURN(FALSE);
> >   }
> >
> > +bool is_cond_equal(COND *cond)
> > +{
> > +  if (cond->type() == Item::FUNC_ITEM&&
> > +      (((Item_func*)cond)->functype() == Item_func::EQ_FUNC ||
> > +       ((Item_func*)cond)->functype() == Item_func::EQUAL_FUNC))
> > +    return TRUE;
> > +  return FALSE;
> > +}
> > +
> > +bool is_cond_mult_equal(COND *cond)
> > +{
> > +  if (cond->type() == Item::FUNC_ITEM&&
> > +      (((Item_func*)cond)->functype() == Item_func::MULT_EQUAL_FUNC))
> > +    return TRUE;
> > +  return FALSE;
> > +}
> > +
> > +class Result {
> > +public:
> > +  Result(TABLE_LIST* table, COND* cond, ORDER* order);
> > +  bool is_ordered();
> > +private:
> > +  bool is_column_const(Field* field);
> > +  bool is_column_ordered(Field* field);
> > +  void add_ordered_columns(ORDER* order);
> > +  void add_const_equi_columns(COND* cond);
> > +  void add_const_column(Field* field);
> > +  void add_ordered_column(Field* field);
> > +  void add_const_columns(MY_BITMAP* bitmap);
> > +  void add_ordered_columns(MY_BITMAP* bitmap);
> > +  bool is_unique_key_const_ordered();
> > +private:
> > +  TABLE* table;
> > +  ulong max_sort_length;
> > +  MY_BITMAP const_bitmap;
> > +  MY_BITMAP ordered_bitmap;
> > +};
> > +
> > +inline Result::Result(TABLE_LIST* table_list, COND* cond, ORDER* order)
> > +{
> > +  table= table_list->table;
> > +  bitmap_init(&const_bitmap, NULL, table->s->fields, FALSE);
> > +  bitmap_init(&ordered_bitmap, NULL, table->s->fields, FALSE);
> > +  max_sort_length= current_thd->variables.max_sort_length;
> > +  add_ordered_columns(order);
> > +  add_const_equi_columns(cond);
> > +}
> > +
> > +inline bool Result::is_column_const(Field* field)
> > +{
> > +  return bitmap_is_set(&const_bitmap, field->field_index);
> > +}
> > +
> > +inline bool Result::is_column_ordered(Field* field)
> > +{
> > +  return bitmap_is_set(&ordered_bitmap, field->field_index);
> > +}
> > +
> > +inline void Result::add_const_column(Field* field)
> > +{
> > +  bitmap_set_bit(&const_bitmap, field->field_index);
> > +}
> > +
> > +inline void Result::add_const_columns(MY_BITMAP* bitmap)
> > +{
> > +  bitmap_union(&const_bitmap, bitmap);
> > +}
> > +
> > +inline void Result::add_ordered_column(Field* field)
> > +{
> > +  bitmap_set_bit(&ordered_bitmap, field->field_index);
> > +}
> > +
> > +inline void Result::add_ordered_columns(MY_BITMAP* bitmap)
> > +{
> > +  bitmap_union(&ordered_bitmap, bitmap);
> > +}
> > +
> > +void Result::add_const_equi_columns(COND* cond)
> > +{
> > +  if (!cond)
> > +    return;
> > +  if (is_cond_or(cond))
> > +    return;
> 
> (S10) We don't need to check if it's an OR, easier to just fall through.
> 
> > +  if (is_cond_and(cond))
> > +  {
> > +    List<Item>  *args= ((Item_cond*) cond)->argument_list();
> > +    List_iterator<COND>  it(*args);
> > +    COND *c;
> > +    while ((c= it++))
> > +      add_const_equi_columns(c);
> > +    return;
> > +  }
> > +  if (is_cond_equal(cond))
> > +  {
> > +    uint i;
> > +    Field *first_field= NULL;
> > +    Field *second_field= NULL;
> > +    Item **args= ((Item_func*)cond)->arguments();
> > +    uint arg_count= ((Item_func*)cond)->argument_count();
> > +    bool const_value= FALSE;
> > +
> > +    DBUG_ASSERT(arg_count == 2);
> > +
> > +    for (i=0; i<arg_count; i++)
> > +    {
> > +      if (args[i]->real_item()->type() == Item::FIELD_ITEM)
> > +      {
> > +        if (!first_field)
> > +          first_field= ((Item_field*)args[i]->real_item())->field;
> > +        else
> > +          second_field= ((Item_field*)args[i]->real_item())->field;
> > +      }
> > +      else if (args[i]->real_item()->basic_const_item())
> > +      {
> > +        const_value = TRUE;
> > +      }
> 
> (S11) We don't need second_field, that can just be removed. Also, we can 
> simplify by storing args[i]->real_item() in a variable:
> 
>      for (i=0; i<arg_count; i++)
>      {
>        Item *item= args[i]->real_item();
>        if (item->type() == Item::FIELD_ITEM)
>          field= item;
>        else if (item->basic_const_item())
>          have_const_value= TRUE;
>      }
> 
> > +    }
> > +    if (first_field&&  const_value)
> > +      add_const_column(first_field);
> > +    return;
> > +  }
> > +  if (is_cond_mult_equal(cond))
> > +  {
> > +    bool has_const= ((Item_equal*)cond)->get_const();
> > +    Item_equal_iterator it(*((Item_equal*)cond));
> > +    Item_field *item;
> > +    if (has_const)
> > +    {
> > +      while ((item= it++))
> > +        add_const_column(item->field);
> > +    }
> > +  }
> > +  return;
> > +}
> > +
> > +void Result::add_ordered_columns(ORDER* order_arg)
> > +{
> > +  ORDER* order= order_arg;
> > +  for (; order; order=order->next)
> > +  {
> > +    if ((*order->item)->real_item()->type() == Item::FIELD_ITEM)
> > +    {
> > +      Field *field=((Item_field*)
> (*order->item)->real_item())->field;
> > +      /*
> > +        If the field length is larger than the max_sort_length, then
> > +        ORDER BY the field will not be guaranteed to be deterministic.
> > +       */
> > +      if (field->field_length>  max_sort_length)
> 
> (S6) This compares the length of the field in the table's column 
> definition with max_sort_length. That's not completely correct, it will 
> give spurious unsafe warnings if the column is longer than 
> max_sort_length, even if the PK is defined on a prefix of the field that 
> is shorter than max_sort_length. The correct condition is that the 
> length of the prefix of key that is part of the key should be smaller 
> than or equal to max_sort_length.
> 
> So here we should mark the column unconditionally. Then, in 
> is_unique_const_key_ordered, we add a condition that checks that the key 
> is not defined on a prefix that is longer than max_sort_length. See below.
> 
> > +        continue;
> > +      add_ordered_column(field);
> > +    }
> > +  }
> > +}
> > +
> > +inline bool Result::is_unique_key_const_ordered()
> 
> (S8) I'd suggest to name this is_table_order_deterministic
> 
> > +{
> > +  uint key;
> > +  MY_BITMAP key_set;
> > +  bitmap_init(&key_set, NULL, table->s->fields, FALSE);
> > +  for (key=0; key<  table->s->keys; key++)
> > +  {
> > +    if ((table->s->key_info[key].flags&  (HA_NOSAME |
> HA_NULL_PART_KEY)) == HA_NOSAME)
> > +    {
> > +      table->mark_columns_used_by_index_no_reset(key,&key_set);
> > +      if (bitmap_is_subset(&key_set,&const_bitmap) ||
> > +          bitmap_is_subset(&key_set,&ordered_bitmap))
> 
> (S6)+(S7) Here, we have to rewrite a bit. I'd suggest to add a new 
> function and use that:
> 
>    if (is_key_order_deterministic(key, &const_bitmap, &ordered_bitmap))
> 
> 
> is_key_order_deterministic should do something like this:
> 
>    for part in key.key_part:
>      if not bitmap_is_set(const_bitmap, part.fieldnr-1) and
>         (not bitmap_is_set(ordered_bitmap, part.fieldnr-1) or
>          part.length > max_sort_length):
>        return True
>    return False
> 
> 
> > +      {
> > +        bitmap_free(&key_set);
> > +        return TRUE;
> > +      }
> > +      bitmap_clear_all(&key_set);
> > +    }
> > +  }
> > +  bitmap_free(&key_set);
> > +  return FALSE;
> > +}
> > +
> > +bool Result::is_ordered()
> > +{
> > +  if (table->s->primary_key == MAX_KEY&& 
> !table->s->uniques)
> > +    return FALSE;
> > +  return is_unique_key_const_ordered();
> > +}
> > +
> > +/*
> > +  Test if the result order is deterministic for a JOIN table list.
> > +
> > +  NOTE: this function only handles single table case, does not handler
> > +  JOIN tables, which will be fixed in BUG#42415.
> > +
> > +  @retval FALSE not deterministic
> > +  @retval TRUE deterministic
> > + */
> > +bool is_order_deterministic(List<TABLE_LIST>* join_list,
> > +                            COND* cond, ORDER* order)
> > +{
> > +  /*
> > +    join_list->is_empty() means this is a UNION with a global LIMIT,
> > +    always mark such statements as non-deterministic, although it
> > +    might be deterministic for some cases (for example, UNION DISTINCT
> > +    with ORDER BY a unique key of both side of the UNION).
> > +  */
> > +  if (join_list->is_empty())
> > +    return FALSE;
> > +
> > +  /* JOINs will be handled in the patch for BUG#42415 */
> > +  if (join_list->elements>  1)
> > +    return FALSE;
> > +
> > +  Result result(join_list->head(), cond, order);
> > +  return result.is_ordered();
> > +}
> > +
> > +/*
> > +  Test if the result order is deterministic for a single table.
> > +
> > +  @retval FALSE not deterministic
> > +  @retval TRUE deterministic
> > + */
> > +bool is_order_deterministic(TABLE_LIST *table,
> > +                            COND *cond, ORDER *order)
> > +{
> > +  if (order == NULL&&  cond == NULL)
> > +    return FALSE;
> > +
> > +  Result result(table, cond, order);
> > +  return result.is_ordered();
> > +}
> > +
> >   /**
> >     @} (end of group Query_Optimizer)
> >   */
> >
> > === modified file 'sql/sql_select.h'
> > --- a/sql/sql_select.h	2010-08-24 10:44:15 +0000
> > +++ b/sql/sql_select.h	2010-12-11 04:32:35 +0000
> > @@ -795,3 +795,5 @@ inline bool optimizer_flag(THD *thd, uin
> >     return (thd->variables.optimizer_switch&  flag);
> >   }
> >
> > +bool is_order_deterministic(TABLE_LIST *table_list, COND *cond, ORDER *order);
> > +bool is_order_deterministic(List<TABLE_LIST>  *join_list, COND *cond,
> ORDER *order);
> >
> > === modified file 'sql/sql_update.cc'
> > --- a/sql/sql_update.cc	2010-10-07 08:13:11 +0000
> > +++ b/sql/sql_update.cc	2010-12-11 04:32:35 +0000
> > @@ -304,6 +304,19 @@ int mysql_update(THD *thd,
> >     if (mysql_prepare_update(thd, table_list,&conds, order_num, order))
> >       DBUG_RETURN(1);
> >
> > +  /*
> > +    Statement-based replication of UPDATE ... LIMIT is not safe as
> > +    order of rows is not defined unless ORDER BY primary_key, so in
> > +    mixed mode we go to row-based.
> > +  */
> > +  if (thd->lex->current_select->select_limit&&
> > +      select_lex->select_limit->val_int()&&
> > +      !is_order_deterministic(table_list, conds, order))
> > +  {
> > +    thd->lex->set_stmt_unsafe();
> > +    thd->set_current_stmt_binlog_row_based_if_mixed();
> > +  }
> > +
> >     old_covering_keys= table->covering_keys;		// Keys used in WHERE
> >     /* Check the fields we are going to modify */
> >   #ifndef NO_EMBEDDED_ACCESS_CHECKS
> > @@ -930,19 +943,6 @@ bool mysql_prepare_update(THD *thd, TABL
> >     SELECT_LEX *select_lex=&thd->lex->select_lex;
> >     DBUG_ENTER("mysql_prepare_update");
> >
> > -  /*
> > -    Statement-based replication of UPDATE ... LIMIT is not safe as order of
> > -    rows is not defined, so in mixed mode we go to row-based.
> > -
> > -    Note that we may consider a statement as safe if ORDER BY primary_key
> > -    is present. However it may confuse users to see very similiar statements
> > -    replicated differently.
> > -  */
> > -  if (thd->lex->current_select->select_limit)
> > -  {
> > -    thd->lex->set_stmt_unsafe();
> > -    thd->set_current_stmt_binlog_row_based_if_mixed();
> > -  }
> >   #ifndef NO_EMBEDDED_ACCESS_CHECKS
> >     table_list->grant.want_privilege= table->grant.want_privilege=
> >       (SELECT_ACL&  ~table->grant.privilege);
> >
> >
> >
> >
> >
> 
> 


Thread
bzr commit into mysql-5.1-bugteam branch (zhenxing.he:3513) Bug#51638He Zhenxing11 Dec
  • Re: bzr commit into mysql-5.1-bugteam branch (zhenxing.he:3513) Bug#51638Sven Sandberg18 Jan
    • Re: bzr commit into mysql-5.1-bugteam branch (zhenxing.he:3513)Bug#51638He Zhenxing19 Jan
      • Re: bzr commit into mysql-5.1-bugteam branch (zhenxing.he:3513) Bug#51638Sven Sandberg20 Jan
        • Re: bzr commit into mysql-5.1-bugteam branch (zhenxing.he:3513)Bug#51638He Zhenxing20 Jan