Commit 7b109de6 authored by unknown's avatar unknown
Browse files

Merge bk-internal.mysql.com:/home/bk/mysql-5.0

into  mockturtle.local:/home/dlenev/src/mysql-5.0-merge


mysql-test/t/disabled.def:
  Auto merged
mysql-test/t/ps.test:
  Auto merged
parents 3f064efb 5f544ed0
Loading
Loading
Loading
Loading
+51 −0
Original line number Diff line number Diff line
# include/wait_show_pattern.inc
#
# SUMMARY
#
#   Waits until output produced by SHOW statement which particular type is
#   specified as parameter matches certain pattern or maximum time reached.
#
# NOTES
#
#   Only the first row produced by the parameter statement is checked.
#
# USAGE
#
#   let $show_type= <Tail of SHOW statement>;
#   let $show_pattern= 'Pattern to be used for LIKE matching';
#   --source wait_show_pattern.inc
#
# EXAMPLES
# 
#   alter_table-big.test, wait_slave_status.inc
#
# SEE ALSO
#
#   wait_slave_status.inc, wait_condition.inc (>=5.1)
#
###############################################################################

--disable_query_log

# We accept to wait maximum 30 seconds (0.2 sec/loop).
let $wait_counter= 150;
while ($wait_counter)
{
  let $result= `SHOW $show_type`;
  let $success= `SELECT '$result' LIKE $show_pattern`;
  if ($success)
  {
    let $wait_counter= 0;
  }
  if (!$success)
  {
    real_sleep 0.2;
    dec $wait_counter;
  }
}
if (!$success)
{
  echo Timeout in wait_show_pattern.inc \$show_type= $show_type \$show_pattern= $show_pattern (\$result= '$result');
}

--enable_query_log
+7 −36
Original line number Diff line number Diff line
@@ -104,50 +104,21 @@
eval SELECT "let \$result_pattern= $result_pattern ;" AS "";
SELECT '--source include/wait_slave_status.inc' AS "";

# We accept to wait maximum 30 seconds (0.2 sec/loop).
let $max_wait= 150;
while ($max_wait)
{
    let $my_val= `SHOW SLAVE STATUS`;
    # Now we have the first record of the SHOW result set as one fat string
    # within the variable  $my_val.

    eval SET @my_val = '$my_val';
    # DEBUG eval SELECT @my_val AS "response to SHOW SLAVE STATUS";
let $show_type= SLAVE STATUS;
let $show_pattern= $result_pattern;
--enable_query_log

    eval SELECT @my_val LIKE $result_pattern INTO @success;
    # @success is     '1' if we have a match
    #                 '0' if we have no match
    # DEBUG SELECT @success;
--source include/wait_show_pattern.inc

    let $success= `SELECT @success`;
    let $no_success= `SELECT @success = 0`;
    if ($success)
    {
       # We reached the expected result and want to jump out of the loop
       # without unneeded sleeps.
       # Attention: Do not set $max_wait to 0, because "while" with negative value
       #            does not work.
       let $max_wait= 1;
    }
    if ($no_success)
    {
       # We did not reach the expected result and will have to sleep again
       # or jump out of the loop, when max_wait is exhausted.
       real_sleep 0.2;
    }
    dec $max_wait;
}
--enable_query_log
if ($no_success)
if (!$success)
{
let $message= ! Attention: Timeout in wait_slave_status.inc.
              |       Possible reasons with decreasing probability:
              |       - The LIKE pattern ($result_pattern) is wrong, because the
              |       - The LIKE pattern is wrong, because the
              |         testcase was altered or the layout of the
              |         SHOW SLAVE STATUS result set changed.
              |       - There is a new bug within the replication.
              |       - We met an extreme testing environment and $max_wait is
              |       - We met an extreme testing environment and timeout is
              |         too small.;
--source include/show_msg80.inc
--echo DEBUG INFO START (wait_slave_status.inc):
+18 −0
Original line number Diff line number Diff line
drop table if exists t1, t2;
create table t1 (n1 int, n2 int, n3 int,
key (n1, n2, n3),
key (n2, n3, n1),
key (n3, n1, n2));
create table t2 (i int);
alter table t1 disable keys;
reset master;
alter table t1 enable keys;;
insert into t2 values (1);
insert into t1 values (1, 1, 1);
show binlog events in 'master-bin.000001' from 98;
Log_name	Pos	Event_type	Server_id	End_log_pos	Info
master-bin.000001	#	Query	1	#	use `test`; insert into t2 values (1)
master-bin.000001	#	Query	1	#	use `test`; alter table t1 enable keys
master-bin.000001	#	Query	1	#	use `test`; insert into t1 values (1, 1, 1)
drop tables t1, t2;
End of 5.0 tests
+113 −0
Original line number Diff line number Diff line
@@ -703,6 +703,119 @@ SHOW INDEX FROM bug24219_2;
Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment
bug24219_2	1	a	1	a	A	NULL	NULL	NULL	YES	BTREE	disabled
DROP TABLE bug24219_2;
drop table if exists table_24562;
create table table_24562(
section int,
subsection int,
title varchar(50));
insert into table_24562 values
(1, 0, "Introduction"),
(1, 1, "Authors"),
(1, 2, "Acknowledgements"),
(2, 0, "Basics"),
(2, 1, "Syntax"),
(2, 2, "Client"),
(2, 3, "Server"),
(3, 0, "Intermediate"),
(3, 1, "Complex queries"),
(3, 2, "Stored Procedures"),
(3, 3, "Stored Functions"),
(4, 0, "Advanced"),
(4, 1, "Replication"),
(4, 2, "Load balancing"),
(4, 3, "High availability"),
(5, 0, "Conclusion");
select * from table_24562;
section	subsection	title
1	0	Introduction
1	1	Authors
1	2	Acknowledgements
2	0	Basics
2	1	Syntax
2	2	Client
2	3	Server
3	0	Intermediate
3	1	Complex queries
3	2	Stored Procedures
3	3	Stored Functions
4	0	Advanced
4	1	Replication
4	2	Load balancing
4	3	High availability
5	0	Conclusion
alter table table_24562 add column reviewer varchar(20),
order by title;
select * from table_24562;
section	subsection	title	reviewer
1	2	Acknowledgements	NULL
4	0	Advanced	NULL
1	1	Authors	NULL
2	0	Basics	NULL
2	2	Client	NULL
3	1	Complex queries	NULL
5	0	Conclusion	NULL
4	3	High availability	NULL
3	0	Intermediate	NULL
1	0	Introduction	NULL
4	2	Load balancing	NULL
4	1	Replication	NULL
2	3	Server	NULL
3	3	Stored Functions	NULL
3	2	Stored Procedures	NULL
2	1	Syntax	NULL
update table_24562 set reviewer="Me" where section=2;
update table_24562 set reviewer="You" where section=3;
alter table table_24562
order by section ASC, subsection DESC;
select * from table_24562;
section	subsection	title	reviewer
1	2	Acknowledgements	NULL
1	1	Authors	NULL
1	0	Introduction	NULL
2	3	Server	Me
2	2	Client	Me
2	1	Syntax	Me
2	0	Basics	Me
3	3	Stored Functions	You
3	2	Stored Procedures	You
3	1	Complex queries	You
3	0	Intermediate	You
4	3	High availability	NULL
4	2	Load balancing	NULL
4	1	Replication	NULL
4	0	Advanced	NULL
5	0	Conclusion	NULL
alter table table_24562
order by table_24562.subsection ASC, table_24562.section DESC;
select * from table_24562;
section	subsection	title	reviewer
5	0	Conclusion	NULL
4	0	Advanced	NULL
3	0	Intermediate	You
2	0	Basics	Me
1	0	Introduction	NULL
4	1	Replication	NULL
3	1	Complex queries	You
2	1	Syntax	Me
1	1	Authors	NULL
4	2	Load balancing	NULL
3	2	Stored Procedures	You
2	2	Client	Me
1	2	Acknowledgements	NULL
4	3	High availability	NULL
3	3	Stored Functions	You
2	3	Server	Me
alter table table_24562 order by 12;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '12' at line 1
alter table table_24562 order by (section + 12);
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(section + 12)' at line 1
alter table table_24562 order by length(title);
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'length(title)' at line 1
alter table table_24562 order by (select 12 from dual);
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(select 12 from dual)' at line 1
alter table table_24562 order by no_such_col;
ERROR 42S22: Unknown column 'no_such_col' in 'order clause'
drop table table_24562;
create table t1 (mycol int(10) not null);
alter table t1 alter column mycol set default 0;
desc t1;
+16 −0
Original line number Diff line number Diff line
@@ -1645,4 +1645,20 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM AUTO_INCREMENT=100 DEFAULT CHARSET=latin1 COMMENT='comment for table t1'
deallocate prepare stmt;
drop table t1, t2;
drop tables if exists t1;
create table t1 (id int primary key auto_increment, value varchar(10));
insert into t1 (id, value) values (1, 'FIRST'), (2, 'SECOND'), (3, 'THIRD');
prepare stmt from "insert into t1 (id, value) select * from (select 4 as i, 'FOURTH' as v) as y on duplicate key update v = 'DUP'";
execute stmt;
ERROR 42S22: Unknown column 'v' in 'field list'
execute stmt;
ERROR 42S22: Unknown column 'v' in 'field list'
deallocate prepare stmt;
prepare stmt from "insert into t1 (id, value) select * from (select 4 as id, 'FOURTH' as value) as y on duplicate key update y.value = 'DUP'";
execute stmt;
ERROR 42S22: Unknown column 'y.value' in 'field list'
execute stmt;
ERROR 42S22: Unknown column 'y.value' in 'field list'
deallocate prepare stmt;
drop tables t1;
End of 5.0 tests.
Loading