Commit 2fecf795 authored by kostja@bodhi.local's avatar kostja@bodhi.local

Merge bodhi.local:/opt/local/work/mysql-5.0-runtime

into  bodhi.local:/opt/local/work/mysql-5.1-runtime-merge
parents 4cb57ac0 643606ca
...@@ -119,4 +119,13 @@ END| ...@@ -119,4 +119,13 @@ END|
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
CREATE FUNCTION sp_vars_div_zero() RETURNS INTEGER
BEGIN
DECLARE div_zero INTEGER;
SELECT 1/0 INTO div_zero;
RETURN div_zero;
END|
---------------------------------------------------------------------------
delimiter ;| delimiter ;|
...@@ -1425,6 +1425,7 @@ sub environment_setup () { ...@@ -1425,6 +1425,7 @@ sub environment_setup () {
# $ENV{'MYSQL_TCP_PORT'}= '@MYSQL_TCP_PORT@'; # FIXME # $ENV{'MYSQL_TCP_PORT'}= '@MYSQL_TCP_PORT@'; # FIXME
$ENV{'MYSQL_TCP_PORT'}= 3306; $ENV{'MYSQL_TCP_PORT'}= 3306;
$ENV{'EXE_MYSQL'}= $exe_mysql;
$ENV{MTR_BUILD_THREAD}= 0 unless $ENV{MTR_BUILD_THREAD}; # Set if not set $ENV{MTR_BUILD_THREAD}= 0 unless $ENV{MTR_BUILD_THREAD}; # Set if not set
# ---------------------------------------------------- # ----------------------------------------------------
...@@ -1456,6 +1457,9 @@ sub environment_setup () { ...@@ -1456,6 +1457,9 @@ sub environment_setup () {
$ENV{'IM_PORT'}= $instance_manager->{port}; $ENV{'IM_PORT'}= $instance_manager->{port};
$ENV{'IM_DEFAULTS_PATH'}= $instance_manager->{defaults_file}; $ENV{'IM_DEFAULTS_PATH'}= $instance_manager->{defaults_file};
$ENV{'IM_PASSWORD_PATH'}= $instance_manager->{password_file}; $ENV{'IM_PASSWORD_PATH'}= $instance_manager->{password_file};
$ENV{'IM_PATH_SOCK'}= $instance_manager->{path_sock};
$ENV{'IM_USERNAME'}= $instance_manager->{admin_login};
$ENV{'IM_PASSWORD'}= $instance_manager->{admin_password};
$ENV{'IM_MYSQLD1_SOCK'}= $instance_manager->{instances}->[0]->{path_sock}; $ENV{'IM_MYSQLD1_SOCK'}= $instance_manager->{instances}->[0]->{path_sock};
$ENV{'IM_MYSQLD1_PORT'}= $instance_manager->{instances}->[0]->{port}; $ENV{'IM_MYSQLD1_PORT'}= $instance_manager->{instances}->[0]->{port};
...@@ -1464,9 +1468,9 @@ sub environment_setup () { ...@@ -1464,9 +1468,9 @@ sub environment_setup () {
$ENV{'IM_MYSQLD2_PORT'}= $instance_manager->{instances}->[1]->{port}; $ENV{'IM_MYSQLD2_PORT'}= $instance_manager->{instances}->[1]->{port};
$ENV{'IM_MYSQLD2_PATH_PID'}=$instance_manager->{instances}->[1]->{path_pid}; $ENV{'IM_MYSQLD2_PATH_PID'}=$instance_manager->{instances}->[1]->{path_pid};
# ---------------------------------------------------- # ----------------------------------------------------
# Setup env so childs can execute mysqlcheck # Setup env so childs can execute mysqlcheck
# ---------------------------------------------------- # ----------------------------------------------------
my $cmdline_mysqlcheck= my $cmdline_mysqlcheck=
"$exe_mysqlcheck --no-defaults -uroot " . "$exe_mysqlcheck --no-defaults -uroot " .
"--port=$master->[0]->{'port'} " . "--port=$master->[0]->{'port'} " .
...@@ -1630,9 +1634,9 @@ sub environment_setup () { ...@@ -1630,9 +1634,9 @@ sub environment_setup () {
($ENV{'LD_LIBRARY_PATH'} ? ":$ENV{'LD_LIBRARY_PATH'}" : ""); ($ENV{'LD_LIBRARY_PATH'} ? ":$ENV{'LD_LIBRARY_PATH'}" : "");
# ---------------------------------------------------- # ----------------------------------------------------
# We are nice and report a bit about our settings # We are nice and report a bit about our settings
# ---------------------------------------------------- # ----------------------------------------------------
if (!$opt_extern) if (!$opt_extern)
{ {
print "Using MTR_BUILD_THREAD = $ENV{MTR_BUILD_THREAD}\n"; print "Using MTR_BUILD_THREAD = $ENV{MTR_BUILD_THREAD}\n";
......
...@@ -8,6 +8,7 @@ mysqld2 offline ...@@ -8,6 +8,7 @@ mysqld2 offline
Killing the process... Killing the process...
Sleeping... Sleeping...
Success: the process was restarted. Success: the process was restarted.
Success: server is ready to accept connection on socket.
-------------------------------------------------------------------- --------------------------------------------------------------------
-- Test for BUG#12751 -- Test for BUG#12751
......
...@@ -4,6 +4,7 @@ DROP FUNCTION IF EXISTS sp_vars_check_ret1; ...@@ -4,6 +4,7 @@ DROP FUNCTION IF EXISTS sp_vars_check_ret1;
DROP FUNCTION IF EXISTS sp_vars_check_ret2; DROP FUNCTION IF EXISTS sp_vars_check_ret2;
DROP FUNCTION IF EXISTS sp_vars_check_ret3; DROP FUNCTION IF EXISTS sp_vars_check_ret3;
DROP FUNCTION IF EXISTS sp_vars_check_ret4; DROP FUNCTION IF EXISTS sp_vars_check_ret4;
DROP FUNCTION IF EXISTS sp_vars_div_zero;
SET @@sql_mode = 'ansi'; SET @@sql_mode = 'ansi';
CREATE PROCEDURE sp_vars_check_dflt() CREATE PROCEDURE sp_vars_check_dflt()
BEGIN BEGIN
...@@ -88,6 +89,12 @@ CREATE FUNCTION sp_vars_check_ret4() RETURNS DECIMAL(64, 2) ...@@ -88,6 +89,12 @@ CREATE FUNCTION sp_vars_check_ret4() RETURNS DECIMAL(64, 2)
BEGIN BEGIN
RETURN 12 * 10 + 34 + 0.1234; RETURN 12 * 10 + 34 + 0.1234;
END| END|
CREATE FUNCTION sp_vars_div_zero() RETURNS INTEGER
BEGIN
DECLARE div_zero INTEGER;
SELECT 1/0 INTO div_zero;
RETURN div_zero;
END|
--------------------------------------------------------------- ---------------------------------------------------------------
Calling the routines, created in ANSI mode. Calling the routines, created in ANSI mode.
...@@ -172,6 +179,9 @@ sp_vars_check_ret4() ...@@ -172,6 +179,9 @@ sp_vars_check_ret4()
154.12 154.12
Warnings: Warnings:
Note 1265 Data truncated for column 'sp_vars_check_ret4()' at row 1 Note 1265 Data truncated for column 'sp_vars_check_ret4()' at row 1
SELECT sp_vars_div_zero();
sp_vars_div_zero()
NULL
SET @@sql_mode = 'traditional'; SET @@sql_mode = 'traditional';
--------------------------------------------------------------- ---------------------------------------------------------------
...@@ -257,12 +267,16 @@ sp_vars_check_ret4() ...@@ -257,12 +267,16 @@ sp_vars_check_ret4()
154.12 154.12
Warnings: Warnings:
Note 1265 Data truncated for column 'sp_vars_check_ret4()' at row 1 Note 1265 Data truncated for column 'sp_vars_check_ret4()' at row 1
SELECT sp_vars_div_zero();
sp_vars_div_zero()
NULL
DROP PROCEDURE sp_vars_check_dflt; DROP PROCEDURE sp_vars_check_dflt;
DROP PROCEDURE sp_vars_check_assignment; DROP PROCEDURE sp_vars_check_assignment;
DROP FUNCTION sp_vars_check_ret1; DROP FUNCTION sp_vars_check_ret1;
DROP FUNCTION sp_vars_check_ret2; DROP FUNCTION sp_vars_check_ret2;
DROP FUNCTION sp_vars_check_ret3; DROP FUNCTION sp_vars_check_ret3;
DROP FUNCTION sp_vars_check_ret4; DROP FUNCTION sp_vars_check_ret4;
DROP FUNCTION sp_vars_div_zero;
CREATE PROCEDURE sp_vars_check_dflt() CREATE PROCEDURE sp_vars_check_dflt()
BEGIN BEGIN
DECLARE v1 TINYINT DEFAULT 1e200; DECLARE v1 TINYINT DEFAULT 1e200;
...@@ -346,6 +360,12 @@ CREATE FUNCTION sp_vars_check_ret4() RETURNS DECIMAL(64, 2) ...@@ -346,6 +360,12 @@ CREATE FUNCTION sp_vars_check_ret4() RETURNS DECIMAL(64, 2)
BEGIN BEGIN
RETURN 12 * 10 + 34 + 0.1234; RETURN 12 * 10 + 34 + 0.1234;
END| END|
CREATE FUNCTION sp_vars_div_zero() RETURNS INTEGER
BEGIN
DECLARE div_zero INTEGER;
SELECT 1/0 INTO div_zero;
RETURN div_zero;
END|
--------------------------------------------------------------- ---------------------------------------------------------------
Calling the routines, created in TRADITIONAL mode. Calling the routines, created in TRADITIONAL mode.
...@@ -366,6 +386,8 @@ sp_vars_check_ret4() ...@@ -366,6 +386,8 @@ sp_vars_check_ret4()
154.12 154.12
Warnings: Warnings:
Note 1265 Data truncated for column 'sp_vars_check_ret4()' at row 1 Note 1265 Data truncated for column 'sp_vars_check_ret4()' at row 1
SELECT sp_vars_div_zero();
ERROR 22012: Division by 0
SET @@sql_mode = 'ansi'; SET @@sql_mode = 'ansi';
DROP PROCEDURE sp_vars_check_dflt; DROP PROCEDURE sp_vars_check_dflt;
DROP PROCEDURE sp_vars_check_assignment; DROP PROCEDURE sp_vars_check_assignment;
...@@ -373,6 +395,7 @@ DROP FUNCTION sp_vars_check_ret1; ...@@ -373,6 +395,7 @@ DROP FUNCTION sp_vars_check_ret1;
DROP FUNCTION sp_vars_check_ret2; DROP FUNCTION sp_vars_check_ret2;
DROP FUNCTION sp_vars_check_ret3; DROP FUNCTION sp_vars_check_ret3;
DROP FUNCTION sp_vars_check_ret4; DROP FUNCTION sp_vars_check_ret4;
DROP FUNCTION sp_vars_div_zero;
--------------------------------------------------------------- ---------------------------------------------------------------
BIT data type tests BIT data type tests
......
...@@ -1073,10 +1073,11 @@ SELECT @x; ...@@ -1073,10 +1073,11 @@ SELECT @x;
NULL NULL
SET @x=2; SET @x=2;
UPDATE t1 SET i1 = @x; UPDATE t1 SET i1 = @x;
ERROR 22012: Division by 0 Warnings:
Error 1365 Division by 0
SELECT @x; SELECT @x;
@x @x
2 NULL
SET SQL_MODE=''; SET SQL_MODE='';
SET @x=3; SET @x=3;
INSERT INTO t1 VALUES (@x); INSERT INTO t1 VALUES (@x);
...@@ -1085,10 +1086,12 @@ SELECT @x; ...@@ -1085,10 +1086,12 @@ SELECT @x;
NULL NULL
SET @x=4; SET @x=4;
UPDATE t1 SET i1 = @x; UPDATE t1 SET i1 = @x;
ERROR 22012: Division by 0 Warnings:
Error 1365 Division by 0
Error 1365 Division by 0
SELECT @x; SELECT @x;
@x @x
4 NULL
SET @@sql_mode=@save_sql_mode; SET @@sql_mode=@save_sql_mode;
DROP TRIGGER t1_ai; DROP TRIGGER t1_ai;
DROP TRIGGER t1_au; DROP TRIGGER t1_au;
...@@ -1174,6 +1177,59 @@ ERROR HY000: String '1234567890abcdefghij1234567890abcdefghij1234567890abcdefghi ...@@ -1174,6 +1177,59 @@ ERROR HY000: String '1234567890abcdefghij1234567890abcdefghij1234567890abcdefghi
DROP TABLE t1; DROP TABLE t1;
DROP TABLE t2; DROP TABLE t2;
drop table if exists t1; drop table if exists t1;
drop table if exists t2;
drop table if exists t3;
drop table if exists t4;
SET @save_sql_mode=@@sql_mode;
SET sql_mode='TRADITIONAL'|
create table t1 (id int(10) not null primary key, v int(10) )|
create table t2 (id int(10) not null primary key, v int(10) )|
create table t3 (id int(10) not null primary key, v int(10) )|
create table t4 (c int)|
create trigger t4_bi before insert on t4 for each row set @t4_bi_called:=1|
create trigger t4_bu before update on t4 for each row set @t4_bu_called:=1|
insert into t1 values(10, 10)|
set @a:=1/0|
Warnings:
Error 1365 Division by 0
select 1/0 from t1|
1/0
NULL
Warnings:
Error 1365 Division by 0
create trigger t1_bi before insert on t1 for each row set @a:=1/0|
insert into t1 values(20, 20)|
Warnings:
Error 1365 Division by 0
drop trigger t1_bi|
create trigger t1_bi before insert on t1 for each row
begin
insert into t2 values (new.id, new.v);
update t2 set v=v+1 where id= new.id;
replace t3 values (new.id, 0);
update t2, t3 set t2.v=new.v, t3.v=new.v where t2.id=t3.id;
create temporary table t5 select * from t1;
delete from t5;
insert into t5 select * from t1;
insert into t4 values (0);
set @check= (select count(*) from t5);
update t4 set c= @check;
drop temporary table t5;
set @a:=1/0;
end|
set @check=0, @t4_bi_called=0, @t4_bu_called=0|
insert into t1 values(30, 30)|
Warnings:
Error 1365 Division by 0
select @check, @t4_bi_called, @t4_bu_called|
@check @t4_bi_called @t4_bu_called
2 1 1
SET @@sql_mode=@save_sql_mode;
drop table t1;
drop table t2;
drop table t3;
drop table t4;
drop table if exists t1;
create table t1 (i int, j int key); create table t1 (i int, j int key);
insert into t1 values (1,1), (2,2), (3,3); insert into t1 values (1,1), (2,2), (3,3);
create trigger t1_bu before update on t1 for each row create trigger t1_bu before update on t1 for each row
......
...@@ -17,6 +17,12 @@ ...@@ -17,6 +17,12 @@
########################################################################### ###########################################################################
# Wait for IM to start accepting connections.
--exec $MYSQL_TEST_DIR/t/wait_for_socket.sh $EXE_MYSQL $IM_PATH_SOCK $IM_USERNAME $IM_PASSWORD '' 30
###########################################################################
# #
# BUG#12751: Instance Manager: client hangs # BUG#12751: Instance Manager: client hangs
# #
......
...@@ -988,6 +988,7 @@ execute stmt; ...@@ -988,6 +988,7 @@ execute stmt;
drop temporary table t1; drop temporary table t1;
deallocate prepare stmt; deallocate prepare stmt;
# #
# BUG#22085: Crash on the execution of a prepared statement that # BUG#22085: Crash on the execution of a prepared statement that
# uses an IN subquery with aggregate functions in HAVING # uses an IN subquery with aggregate functions in HAVING
...@@ -1114,6 +1115,7 @@ DROP TABLE t1; ...@@ -1114,6 +1115,7 @@ DROP TABLE t1;
--echo End of 4.1 tests. --echo End of 4.1 tests.
############################# 5.0 tests start ################################ ############################# 5.0 tests start ################################
# #
# #
......
...@@ -1748,6 +1748,8 @@ drop function if exists bug16896; ...@@ -1748,6 +1748,8 @@ drop function if exists bug16896;
--error ER_SP_NO_AGGREGATE --error ER_SP_NO_AGGREGATE
create aggregate function bug16896() returns int return 1; create aggregate function bug16896() returns int return 1;
#
#
# BUG#14702: misleading error message when syntax error in CREATE # BUG#14702: misleading error message when syntax error in CREATE
# PROCEDURE # PROCEDURE
# #
......
...@@ -15,6 +15,7 @@ DROP FUNCTION IF EXISTS sp_vars_check_ret1; ...@@ -15,6 +15,7 @@ DROP FUNCTION IF EXISTS sp_vars_check_ret1;
DROP FUNCTION IF EXISTS sp_vars_check_ret2; DROP FUNCTION IF EXISTS sp_vars_check_ret2;
DROP FUNCTION IF EXISTS sp_vars_check_ret3; DROP FUNCTION IF EXISTS sp_vars_check_ret3;
DROP FUNCTION IF EXISTS sp_vars_check_ret4; DROP FUNCTION IF EXISTS sp_vars_check_ret4;
DROP FUNCTION IF EXISTS sp_vars_div_zero;
--enable_warnings --enable_warnings
...@@ -49,6 +50,8 @@ SELECT sp_vars_check_ret3(); ...@@ -49,6 +50,8 @@ SELECT sp_vars_check_ret3();
SELECT sp_vars_check_ret4(); SELECT sp_vars_check_ret4();
SELECT sp_vars_div_zero();
# Check that changing sql_mode after creating a store procedure does not # Check that changing sql_mode after creating a store procedure does not
# matter. # matter.
...@@ -72,6 +75,8 @@ SELECT sp_vars_check_ret3(); ...@@ -72,6 +75,8 @@ SELECT sp_vars_check_ret3();
SELECT sp_vars_check_ret4(); SELECT sp_vars_check_ret4();
SELECT sp_vars_div_zero();
# Create the procedure in TRADITIONAL mode. Check that error will be thrown on # Create the procedure in TRADITIONAL mode. Check that error will be thrown on
# execution. # execution.
...@@ -81,6 +86,7 @@ DROP FUNCTION sp_vars_check_ret1; ...@@ -81,6 +86,7 @@ DROP FUNCTION sp_vars_check_ret1;
DROP FUNCTION sp_vars_check_ret2; DROP FUNCTION sp_vars_check_ret2;
DROP FUNCTION sp_vars_check_ret3; DROP FUNCTION sp_vars_check_ret3;
DROP FUNCTION sp_vars_check_ret4; DROP FUNCTION sp_vars_check_ret4;
DROP FUNCTION sp_vars_div_zero;
--source include/sp-vars.inc --source include/sp-vars.inc
...@@ -110,6 +116,9 @@ SELECT sp_vars_check_ret3(); ...@@ -110,6 +116,9 @@ SELECT sp_vars_check_ret3();
SELECT sp_vars_check_ret4(); SELECT sp_vars_check_ret4();
--error ER_DIVISION_BY_ZERO
SELECT sp_vars_div_zero();
SET @@sql_mode = 'ansi'; SET @@sql_mode = 'ansi';
# #
...@@ -122,6 +131,7 @@ DROP FUNCTION sp_vars_check_ret1; ...@@ -122,6 +131,7 @@ DROP FUNCTION sp_vars_check_ret1;
DROP FUNCTION sp_vars_check_ret2; DROP FUNCTION sp_vars_check_ret2;
DROP FUNCTION sp_vars_check_ret3; DROP FUNCTION sp_vars_check_ret3;
DROP FUNCTION sp_vars_check_ret4; DROP FUNCTION sp_vars_check_ret4;
DROP FUNCTION sp_vars_div_zero;
########################################################################### ###########################################################################
# #
......
...@@ -6419,6 +6419,170 @@ SELECT bug21493(Member_ID) FROM t3| ...@@ -6419,6 +6419,170 @@ SELECT bug21493(Member_ID) FROM t3|
DROP FUNCTION bug21493| DROP FUNCTION bug21493|
DROP TABLE t3,t4| DROP TABLE t3,t4|
#
# Bug#20028 Function with select return no data
#
--disable_warnings
drop function if exists func_20028_a|
drop function if exists func_20028_b|
drop function if exists func_20028_c|
drop procedure if exists proc_20028_a|
drop procedure if exists proc_20028_b|
drop procedure if exists proc_20028_c|
drop table if exists table_20028|
--enable_warnings
create table table_20028 (i int)|
SET @save_sql_mode=@@sql_mode|
SET sql_mode=''|
create function func_20028_a() returns integer
begin
declare temp integer;
select i into temp from table_20028 limit 1;
return ifnull(temp, 0);
end|
create function func_20028_b() returns integer
begin
return func_20028_a();
end|
create function func_20028_c() returns integer
begin
declare div_zero integer;
set SQL_MODE='TRADITIONAL';
select 1/0 into div_zero;
return div_zero;
end|
create procedure proc_20028_a()
begin
declare temp integer;
select i into temp from table_20028 limit 1;
end|
create procedure proc_20028_b()
begin
call proc_20028_a();
end|
create procedure proc_20028_c()
begin
declare div_zero integer;
set SQL_MODE='TRADITIONAL';
select 1/0 into div_zero;
end|
select func_20028_a()|
select func_20028_b()|
--error ER_DIVISION_BY_ZERO
select func_20028_c()|
call proc_20028_a()|
call proc_20028_b()|
--error ER_DIVISION_BY_ZERO
call proc_20028_c()|
SET sql_mode='TRADITIONAL'|
drop function func_20028_a|
drop function func_20028_b|
drop function func_20028_c|
drop procedure proc_20028_a|
drop procedure proc_20028_b|
drop procedure proc_20028_c|
create function func_20028_a() returns integer
begin
declare temp integer;
select i into temp from table_20028 limit 1;
return ifnull(temp, 0);
end|
create function func_20028_b() returns integer
begin
return func_20028_a();
end|
create function func_20028_c() returns integer
begin
declare div_zero integer;
set SQL_MODE='';
select 1/0 into div_zero;
return div_zero;
end|
create procedure proc_20028_a()
begin
declare temp integer;
select i into temp from table_20028 limit 1;
end|
create procedure proc_20028_b()
begin
call proc_20028_a();
end|
create procedure proc_20028_c()
begin
declare div_zero integer;
set SQL_MODE='';
select 1/0 into div_zero;
end|
select func_20028_a()|
select func_20028_b()|
select func_20028_c()|
call proc_20028_a()|
call proc_20028_b()|
call proc_20028_c()|
SET @@sql_mode=@save_sql_mode|
drop function func_20028_a|
drop function func_20028_b|
drop function func_20028_c|
drop procedure proc_20028_a|
drop procedure proc_20028_b|
drop procedure proc_20028_c|
drop table table_20028|
#
# Bug#21462 Stored procedures with no arguments require parenthesis
#
--disable_warnings
drop procedure if exists proc_21462_a|
drop procedure if exists proc_21462_b|
--enable_warnings
create procedure proc_21462_a()
begin
select "Called A";
end|
create procedure proc_21462_b(x int)
begin
select "Called B";
end|
call proc_21462_a|
call proc_21462_a()|
-- error ER_SP_WRONG_NO_OF_ARGS
call proc_21462_a(1)|
-- error ER_SP_WRONG_NO_OF_ARGS
call proc_21462_b|
-- error ER_SP_WRONG_NO_OF_ARGS
call proc_21462_b()|
call proc_21462_b(1)|
drop procedure proc_21462_a|
drop procedure proc_21462_b|
--echo End of 5.0 tests --echo End of 5.0 tests
......
...@@ -1274,7 +1274,6 @@ INSERT INTO t1 VALUES (@x); ...@@ -1274,7 +1274,6 @@ INSERT INTO t1 VALUES (@x);
SELECT @x; SELECT @x;
SET @x=2; SET @x=2;
--error ER_DIVISION_BY_ZERO
UPDATE t1 SET i1 = @x; UPDATE t1 SET i1 = @x;
SELECT @x; SELECT @x;
...@@ -1285,7 +1284,6 @@ INSERT INTO t1 VALUES (@x); ...@@ -1285,7 +1284,6 @@ INSERT INTO t1 VALUES (@x);
SELECT @x; SELECT @x;
SET @x=4; SET @x=4;
--error ER_DIVISION_BY_ZERO
UPDATE t1 SET i1 = @x; UPDATE t1 SET i1 = @x;
SELECT @x; SELECT @x;
...@@ -1420,6 +1418,67 @@ CREATE DEFINER=some_user_name@1234567890abcdefghij1234567890abcdefghij1234567890 ...@@ -1420,6 +1418,67 @@ CREATE DEFINER=some_user_name@1234567890abcdefghij1234567890abcdefghij1234567890
DROP TABLE t1; DROP TABLE t1;
DROP TABLE t2; DROP TABLE t2;
#
# Bug#20028 Function with select return no data
#
--disable_warnings
drop table if exists t1;
drop table if exists t2;
drop table if exists t3;
drop table if exists t4;
--enable_warnings
SET @save_sql_mode=@@sql_mode;
delimiter |;
SET sql_mode='TRADITIONAL'|
create table t1 (id int(10) not null primary key, v int(10) )|
create table t2 (id int(10) not null primary key, v int(10) )|
create table t3 (id int(10) not null primary key, v int(10) )|
create table t4 (c int)|
create trigger t4_bi before insert on t4 for each row set @t4_bi_called:=1|
create trigger t4_bu before update on t4 for each row set @t4_bu_called:=1|
insert into t1 values(10, 10)|
set @a:=1/0|
select 1/0 from t1|
create trigger t1_bi before insert on t1 for each row set @a:=1/0|
insert into t1 values(20, 20)|
drop trigger t1_bi|
create trigger t1_bi before insert on t1 for each row
begin
insert into t2 values (new.id, new.v);
update t2 set v=v+1 where id= new.id;
replace t3 values (new.id, 0);
update t2, t3 set t2.v=new.v, t3.v=new.v where t2.id=t3.id;
create temporary table t5 select * from t1;
delete from t5;
insert into t5 select * from t1;
insert into t4 values (0);
set @check= (select count(*) from t5);
update t4 set c= @check;
drop temporary table t5;
set @a:=1/0;
end|
set @check=0, @t4_bi_called=0, @t4_bu_called=0|
insert into t1 values(30, 30)|
select @check, @t4_bi_called, @t4_bu_called|
delimiter ;|
SET @@sql_mode=@save_sql_mode;
drop table t1;
drop table t2;
drop table t3;
drop table t4;
# #
# Bug#20670 "UPDATE using key and invoking trigger that modifies # Bug#20670 "UPDATE using key and invoking trigger that modifies
......
#!/bin/sh
###########################################################################
if [ $# -ne 6 ]; then
echo "Usage: wait_for_socket.sh <executable path> <socket path> <username> <password> <db> <timeout>"
exit 0
fi
client_exe="$1"
socket_path="$2"
username="$3"
password="$4"
db="$5"
total_timeout="$6"
###########################################################################
if [ -z "$client_exe" ]; then
echo "Error: invalid path to client executable ($client_exe)."
exit 0;
fi
if [ ! -x "$client_exe" ]; then
echo "Error: client by path '$client_exe' is not available."
exit 0;
fi
if [ -z "$socket_path" ]; then
echo "Error: invalid socket patch."
exit 0
fi
###########################################################################
client_args="--silent --socket=$socket_path "
[ -n "$username" ] && client_args="$client_args --user=$username "
[ -n "$password" ] && client_args="$client_args --password=$password "
[ -n "$db" ] && client_args="$client_args $db"
###########################################################################
cur_attempt=1
while true; do
if ( echo 'quit' | "$client_exe" $client_args >/dev/null 2>&1 ); then
echo "Success: server is ready to accept connection on socket."
exit 0
fi
[ $cur_attempt -ge $total_timeout ] && break
sleep 1
cur_attempt=`expr $cur_attempt + 1`
done
echo "Error: server does not accept connections after $total_timeout seconds."
exit 0
...@@ -95,11 +95,11 @@ Guardian_thread::~Guardian_thread() ...@@ -95,11 +95,11 @@ Guardian_thread::~Guardian_thread()
} }
void Guardian_thread::request_shutdown(bool stop_instances_arg) void Guardian_thread::request_shutdown()
{ {
pthread_mutex_lock(&LOCK_guardian); pthread_mutex_lock(&LOCK_guardian);
/* stop instances or just clean up Guardian repository */ /* stop instances or just clean up Guardian repository */
stop_instances(stop_instances_arg); stop_instances();
shutdown_requested= TRUE; shutdown_requested= TRUE;
pthread_mutex_unlock(&LOCK_guardian); pthread_mutex_unlock(&LOCK_guardian);
} }
...@@ -154,11 +154,11 @@ void Guardian_thread::process_instance(Instance *instance, ...@@ -154,11 +154,11 @@ void Guardian_thread::process_instance(Instance *instance,
{ {
/* Pid file not created yet, don't go to STARTED state yet */ /* Pid file not created yet, don't go to STARTED state yet */
} }
else else if (current_node->state != STARTED)
{ {
/* clear status fields */ /* clear status fields */
log_info("guardian: instance %s is running, set state to STARTED", log_info("guardian: instance '%s' is running, set state to STARTED.",
instance->options.instance_name); (const char *) instance->options.instance_name);
current_node->restart_counter= 0; current_node->restart_counter= 0;
current_node->crash_moment= 0; current_node->crash_moment= 0;
current_node->state= STARTED; current_node->state= STARTED;
...@@ -168,8 +168,8 @@ void Guardian_thread::process_instance(Instance *instance, ...@@ -168,8 +168,8 @@ void Guardian_thread::process_instance(Instance *instance,
{ {
switch (current_node->state) { switch (current_node->state) {
case NOT_STARTED: case NOT_STARTED:
log_info("guardian: starting instance %s", log_info("guardian: starting instance '%s'...",
instance->options.instance_name); (const char *) instance->options.instance_name);
/* NOTE, set state to STARTING _before_ start() is called */ /* NOTE, set state to STARTING _before_ start() is called */
current_node->state= STARTING; current_node->state= STARTING;
...@@ -193,8 +193,8 @@ void Guardian_thread::process_instance(Instance *instance, ...@@ -193,8 +193,8 @@ void Guardian_thread::process_instance(Instance *instance,
if (instance->is_crashed()) if (instance->is_crashed())
{ {
instance->start(); instance->start();
log_info("guardian: starting instance %s", log_info("guardian: starting instance '%s'...",
instance->options.instance_name); (const char *) instance->options.instance_name);
} }
} }
else else
...@@ -211,8 +211,8 @@ void Guardian_thread::process_instance(Instance *instance, ...@@ -211,8 +211,8 @@ void Guardian_thread::process_instance(Instance *instance,
instance->start(); instance->start();
current_node->last_checked= current_time; current_node->last_checked= current_time;
current_node->restart_counter++; current_node->restart_counter++;
log_info("guardian: restarting instance %s", log_info("guardian: restarting instance '%s'...",
instance->options.instance_name); (const char *) instance->options.instance_name);
} }
} }
else else
...@@ -414,12 +414,11 @@ int Guardian_thread::stop_guard(Instance *instance) ...@@ -414,12 +414,11 @@ int Guardian_thread::stop_guard(Instance *instance)
SYNOPSYS SYNOPSYS
stop_instances() stop_instances()
stop_instances_arg whether we should stop instances at shutdown
DESCRIPTION DESCRIPTION
Loops through the guarded_instances list and prepares them for shutdown. Loops through the guarded_instances list and prepares them for shutdown.
If stop_instances was requested, we need to issue a stop command and change For each instance we issue a stop command and change the state
the state accordingly. Otherwise we simply delete an entry. accordingly.
NOTE NOTE
Guardian object should be locked by the calling function. Guardian object should be locked by the calling function.
...@@ -429,23 +428,11 @@ int Guardian_thread::stop_guard(Instance *instance) ...@@ -429,23 +428,11 @@ int Guardian_thread::stop_guard(Instance *instance)
1 - error occured 1 - error occured
*/ */
int Guardian_thread::stop_instances(bool stop_instances_arg) int Guardian_thread::stop_instances()
{ {
LIST *node; LIST *node;
node= guarded_instances; node= guarded_instances;
while (node != NULL) while (node != NULL)
{
if (!stop_instances_arg)
{
/* just forget about an instance */
guarded_instances= list_delete(guarded_instances, node);
/*
This should still work fine, as we have only removed the
node from the list. The pointer to the next one is still valid
*/
node= node->next;
}
else
{ {
GUARD_NODE *current_node= (GUARD_NODE *) node->data; GUARD_NODE *current_node= (GUARD_NODE *) node->data;
/* /*
...@@ -465,7 +452,6 @@ int Guardian_thread::stop_instances(bool stop_instances_arg) ...@@ -465,7 +452,6 @@ int Guardian_thread::stop_instances(bool stop_instances_arg)
current_node->instance->kill_instance(SIGTERM); current_node->instance->kill_instance(SIGTERM);
node= node->next; node= node->next;
} }
}
return 0; return 0;
} }
......
...@@ -91,7 +91,7 @@ class Guardian_thread: public Guardian_thread_args ...@@ -91,7 +91,7 @@ class Guardian_thread: public Guardian_thread_args
/* Initialize or refresh the list of guarded instances */ /* Initialize or refresh the list of guarded instances */
int init(); int init();
/* Request guardian shutdown. Stop instances if needed */ /* Request guardian shutdown. Stop instances if needed */
void request_shutdown(bool stop_instances); void request_shutdown();
/* Start instance protection */ /* Start instance protection */
int guard(Instance *instance, bool nolock= FALSE); int guard(Instance *instance, bool nolock= FALSE);
/* Stop instance protection */ /* Stop instance protection */
...@@ -123,7 +123,7 @@ class Guardian_thread: public Guardian_thread_args ...@@ -123,7 +123,7 @@ class Guardian_thread: public Guardian_thread_args
private: private:
/* Prepares Guardian shutdown. Stops instances is needed */ /* Prepares Guardian shutdown. Stops instances is needed */
int stop_instances(bool stop_instances_arg); int stop_instances();
/* check instance state and act accordingly */ /* check instance state and act accordingly */
void process_instance(Instance *instance, GUARD_NODE *current_node, void process_instance(Instance *instance, GUARD_NODE *current_node,
LIST **guarded_instances, LIST *elem); LIST **guarded_instances, LIST *elem);
......
...@@ -165,8 +165,8 @@ static int start_process(Instance_options *instance_options, ...@@ -165,8 +165,8 @@ static int start_process(Instance_options *instance_options,
/* exec never returns */ /* exec never returns */
exit(1); exit(1);
case -1: case -1:
log_info("cannot create a new process to start instance %s", log_info("cannot create a new process to start instance '%s'.",
instance_options->instance_name); (const char *) instance_options->instance_name);
return 1; return 1;
} }
return 0; return 0;
...@@ -256,7 +256,8 @@ static void start_and_monitor_instance(Instance_options *old_instance_options, ...@@ -256,7 +256,8 @@ static void start_and_monitor_instance(Instance_options *old_instance_options,
are using is destroyed. (E.g. by "FLUSH INSTANCES") are using is destroyed. (E.g. by "FLUSH INSTANCES")
*/ */
log_info("starting instance %s", (const char *) instance_name.get_c_str()); log_info("starting instance %s...",
(const char *) instance_name.get_c_str());
if (start_process(old_instance_options, &process_info)) if (start_process(old_instance_options, &process_info))
{ {
...@@ -311,9 +312,9 @@ void Instance::remove_pid() ...@@ -311,9 +312,9 @@ void Instance::remove_pid()
int pid; int pid;
if ((pid= options.get_pid()) != 0) /* check the pidfile */ if ((pid= options.get_pid()) != 0) /* check the pidfile */
if (options.unlink_pidfile()) /* remove stalled pidfile */ if (options.unlink_pidfile()) /* remove stalled pidfile */
log_error("cannot remove pidfile for instance %i, this might be \ log_error("cannot remove pidfile for instance '%s', this might be \
since IM lacks permmissions or hasn't found the pidifle", since IM lacks permmissions or hasn't found the pidifle",
options.instance_name); (const char *) options.instance_name);
} }
...@@ -467,9 +468,9 @@ bool Instance::is_running() ...@@ -467,9 +468,9 @@ bool Instance::is_running()
We have successfully connected to the server using fake We have successfully connected to the server using fake
username/password. Write a warning to the logfile. username/password. Write a warning to the logfile.
*/ */
log_info("The Instance Manager was able to log into you server \ log_info("The Instance Manager was able to log into you server "
with faked compiled-in password while checking server status. \ "with faked compiled-in password while checking server status. "
Looks like something is wrong."); "Looks like something is wrong.");
pthread_mutex_unlock(&LOCK_instance); pthread_mutex_unlock(&LOCK_instance);
return_val= TRUE; /* server is alive */ return_val= TRUE; /* server is alive */
} }
...@@ -616,10 +617,10 @@ void Instance::kill_instance(int signum) ...@@ -616,10 +617,10 @@ void Instance::kill_instance(int signum)
/* Kill suceeded */ /* Kill suceeded */
if (signum == SIGKILL) /* really killed instance with SIGKILL */ if (signum == SIGKILL) /* really killed instance with SIGKILL */
{ {
log_error("The instance %s is being stopped forcibly. Normally" \ log_error("The instance '%s' is being stopped forcibly. Normally"
"it should not happen. Probably the instance has been" \ "it should not happen. Probably the instance has been"
"hanging. You should also check your IM setup", "hanging. You should also check your IM setup",
options.instance_name); (const char *) options.instance_name);
/* After sucessful hard kill the pidfile need to be removed */ /* After sucessful hard kill the pidfile need to be removed */
options.unlink_pidfile(); options.unlink_pidfile();
} }
......
...@@ -293,6 +293,8 @@ int Instance_map::flush_instances() ...@@ -293,6 +293,8 @@ int Instance_map::flush_instances()
get_instance_key, delete_instance, 0); get_instance_key, delete_instance, 0);
rc= load(); rc= load();
/* don't init guardian if we failed to load instances */
if (!rc)
guardian->init(); // TODO: check error status. guardian->init(); // TODO: check error status.
return rc; return rc;
} }
......
...@@ -283,7 +283,7 @@ int Listener_thread::create_tcp_socket() ...@@ -283,7 +283,7 @@ int Listener_thread::create_tcp_socket()
FD_SET(ip_socket, &read_fds); FD_SET(ip_socket, &read_fds);
sockets[num_sockets++]= ip_socket; sockets[num_sockets++]= ip_socket;
log_info("accepting connections on ip socket"); log_info("accepting connections on ip socket (port: %d)", (int) im_port);
return 0; return 0;
} }
...@@ -337,7 +337,7 @@ create_unix_socket(struct sockaddr_un &unix_socket_address) ...@@ -337,7 +337,7 @@ create_unix_socket(struct sockaddr_un &unix_socket_address)
/* make sure that instances won't be listening our sockets */ /* make sure that instances won't be listening our sockets */
set_no_inherit(unix_socket); set_no_inherit(unix_socket);
log_info("accepting connections on unix socket %s", log_info("accepting connections on unix socket '%s'",
unix_socket_address.sun_path); unix_socket_address.sun_path);
sockets[num_sockets++]= unix_socket; sockets[num_sockets++]= unix_socket;
FD_SET(unix_socket, &read_fds); FD_SET(unix_socket, &read_fds);
......
...@@ -120,6 +120,19 @@ int my_sigwait(const sigset_t *set, int *sig) ...@@ -120,6 +120,19 @@ int my_sigwait(const sigset_t *set, int *sig)
#endif #endif
void stop_all(Guardian_thread *guardian, Thread_registry *registry)
{
/*
Let guardian thread know that it should break it's processing cycle,
once it wakes up.
*/
guardian->request_shutdown();
/* wake guardian */
pthread_cond_signal(&guardian->COND_guardian);
/* stop all threads */
registry->deliver_shutdown();
}
/* /*
manager - entry point to the main instance manager process: start manager - entry point to the main instance manager process: start
listener thread, write pid file and enter into signal handling. listener thread, write pid file and enter into signal handling.
...@@ -251,7 +264,6 @@ void manager() ...@@ -251,7 +264,6 @@ void manager()
/* Load instances. */ /* Load instances. */
{ {
instance_map.guardian->lock(); instance_map.guardian->lock();
instance_map.lock(); instance_map.lock();
...@@ -266,7 +278,8 @@ void manager() ...@@ -266,7 +278,8 @@ void manager()
log_error("Cannot init instances repository. This might be caused by " log_error("Cannot init instances repository. This might be caused by "
"the wrong config file options. For instance, missing mysqld " "the wrong config file options. For instance, missing mysqld "
"binary. Aborting."); "binary. Aborting.");
return; stop_all(&guardian_thread, &thread_registry);
goto err;
} }
} }
...@@ -284,6 +297,7 @@ void manager() ...@@ -284,6 +297,7 @@ void manager()
if (rc) if (rc)
{ {
log_error("manager(): set_stacksize_n_create_thread(listener) failed"); log_error("manager(): set_stacksize_n_create_thread(listener) failed");
stop_all(&guardian_thread, &thread_registry);
goto err; goto err;
} }
} }
...@@ -302,6 +316,7 @@ void manager() ...@@ -302,6 +316,7 @@ void manager()
if ((status= my_sigwait(&mask, &signo)) != 0) if ((status= my_sigwait(&mask, &signo)) != 0)
{ {
log_error("sigwait() failed"); log_error("sigwait() failed");
stop_all(&guardian_thread, &thread_registry);
goto err; goto err;
} }
...@@ -323,8 +338,7 @@ void manager() ...@@ -323,8 +338,7 @@ void manager()
{ {
if (!guardian_thread.is_stopped()) if (!guardian_thread.is_stopped())
{ {
bool stop_instances= TRUE; guardian_thread.request_shutdown();
guardian_thread.request_shutdown(stop_instances);
pthread_cond_signal(&guardian_thread.COND_guardian); pthread_cond_signal(&guardian_thread.COND_guardian);
} }
else else
......
...@@ -41,7 +41,6 @@ ...@@ -41,7 +41,6 @@
static char win_dflt_config_file_name[FN_REFLEN]; static char win_dflt_config_file_name[FN_REFLEN];
static char win_dflt_password_file_name[FN_REFLEN]; static char win_dflt_password_file_name[FN_REFLEN];
static char win_dflt_pid_file_name[FN_REFLEN]; static char win_dflt_pid_file_name[FN_REFLEN];
static char win_dflt_socket_file_name[FN_REFLEN];
static char win_dflt_mysqld_path[FN_REFLEN]; static char win_dflt_mysqld_path[FN_REFLEN];
...@@ -54,7 +53,6 @@ my_bool Options::Service::stand_alone; ...@@ -54,7 +53,6 @@ my_bool Options::Service::stand_alone;
const char *Options::Main::config_file= win_dflt_config_file_name; const char *Options::Main::config_file= win_dflt_config_file_name;
const char *Options::Main::password_file_name= win_dflt_password_file_name; const char *Options::Main::password_file_name= win_dflt_password_file_name;
const char *Options::Main::pid_file_name= win_dflt_pid_file_name; const char *Options::Main::pid_file_name= win_dflt_pid_file_name;
const char *Options::Main::socket_file_name= win_dflt_socket_file_name;
const char *Options::Main::default_mysqld_path= win_dflt_mysqld_path; const char *Options::Main::default_mysqld_path= win_dflt_mysqld_path;
...@@ -262,10 +260,12 @@ static struct my_option my_long_options[] = ...@@ -262,10 +260,12 @@ static struct my_option my_long_options[] =
0, 0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 0, 0 }, 0, 0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 0, 0 },
#endif #endif
#ifndef __WIN__
{ "socket", OPT_SOCKET, "Socket file to use for connection.", { "socket", OPT_SOCKET, "Socket file to use for connection.",
(gptr *) &Options::Main::socket_file_name, (gptr *) &Options::Main::socket_file_name,
(gptr *) &Options::Main::socket_file_name, (gptr *) &Options::Main::socket_file_name,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
#endif
#ifdef __WIN__ #ifdef __WIN__
{ "standalone", OPT_STAND_ALONE, "Run the application in stand alone mode.", { "standalone", OPT_STAND_ALONE, "Run the application in stand alone mode.",
...@@ -550,8 +550,6 @@ static int setup_windows_defaults() ...@@ -550,8 +550,6 @@ static int setup_windows_defaults()
strxmov(win_dflt_password_file_name, dir_name, im_name, DFLT_PASSWD_FILE_EXT, strxmov(win_dflt_password_file_name, dir_name, im_name, DFLT_PASSWD_FILE_EXT,
NullS); NullS);
strxmov(win_dflt_pid_file_name, dir_name, im_name, DFLT_PID_FILE_EXT, NullS); strxmov(win_dflt_pid_file_name, dir_name, im_name, DFLT_PID_FILE_EXT, NullS);
strxmov(win_dflt_socket_file_name, dir_name, im_name, DFLT_SOCKET_FILE_EXT,
NullS);
return 0; return 0;
} }
......
...@@ -50,7 +50,9 @@ struct Options ...@@ -50,7 +50,9 @@ struct Options
static bool is_forced_default_file; static bool is_forced_default_file;
static const char *pid_file_name; static const char *pid_file_name;
#ifndef __WIN__
static const char *socket_file_name; static const char *socket_file_name;
#endif
static const char *password_file_name; static const char *password_file_name;
static const char *default_mysqld_path; static const char *default_mysqld_path;
static uint monitoring_interval; static uint monitoring_interval;
......
...@@ -1065,7 +1065,7 @@ longlong Item_sum_count::val_int() ...@@ -1065,7 +1065,7 @@ longlong Item_sum_count::val_int()
void Item_sum_count::cleanup() void Item_sum_count::cleanup()
{ {
DBUG_ENTER("Item_sum_count::cleanup"); DBUG_ENTER("Item_sum_count::cleanup");
clear(); count= 0;
Item_sum_int::cleanup(); Item_sum_int::cleanup();
used_table_cache= ~(table_map) 0; used_table_cache= ~(table_map) 0;
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
......
...@@ -643,8 +643,8 @@ class Item_sum_avg :public Item_sum_sum ...@@ -643,8 +643,8 @@ class Item_sum_avg :public Item_sum_sum
Field *create_tmp_field(bool group, TABLE *table, uint convert_blob_length); Field *create_tmp_field(bool group, TABLE *table, uint convert_blob_length);
void cleanup() void cleanup()
{ {
clear(); count= 0;
Item_sum_num::cleanup(); Item_sum_sum::cleanup();
} }
}; };
...@@ -727,7 +727,8 @@ class Item_sum_variance : public Item_sum_num ...@@ -727,7 +727,8 @@ class Item_sum_variance : public Item_sum_num
enum Item_result result_type () const { return REAL_RESULT; } enum Item_result result_type () const { return REAL_RESULT; }
void cleanup() void cleanup()
{ {
clear(); cur_dec= 0;
count= 0;
Item_sum_num::cleanup(); Item_sum_num::cleanup();
} }
}; };
...@@ -862,7 +863,7 @@ class Item_sum_bit :public Item_sum_int ...@@ -862,7 +863,7 @@ class Item_sum_bit :public Item_sum_int
{ decimals= 0; max_length=21; unsigned_flag= 1; maybe_null= null_value= 0; } { decimals= 0; max_length=21; unsigned_flag= 1; maybe_null= null_value= 0; }
void cleanup() void cleanup()
{ {
clear(); bits= reset_bits;
Item_sum_int::cleanup(); Item_sum_int::cleanup();
} }
}; };
......
...@@ -1029,8 +1029,7 @@ sp_head::execute(THD *thd) ...@@ -1029,8 +1029,7 @@ sp_head::execute(THD *thd)
save_sql_mode= thd->variables.sql_mode; save_sql_mode= thd->variables.sql_mode;
thd->variables.sql_mode= m_sql_mode; thd->variables.sql_mode= m_sql_mode;
save_abort_on_warning= thd->abort_on_warning; save_abort_on_warning= thd->abort_on_warning;
thd->abort_on_warning= thd->abort_on_warning= 0;
(m_sql_mode & (MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES));
/* /*
It is also more efficient to save/restore current thd->lex once when It is also more efficient to save/restore current thd->lex once when
......
...@@ -1724,11 +1724,16 @@ call: ...@@ -1724,11 +1724,16 @@ call:
lex->value_list.empty(); lex->value_list.empty();
sp_add_used_routine(lex, YYTHD, $2, TYPE_ENUM_PROCEDURE); sp_add_used_routine(lex, YYTHD, $2, TYPE_ENUM_PROCEDURE);
} }
'(' sp_cparam_list ')' {} opt_sp_cparam_list {}
; ;
/* CALL parameters */ /* CALL parameters */
sp_cparam_list: opt_sp_cparam_list:
/* Empty */
| '(' opt_sp_cparams ')'
;
opt_sp_cparams:
/* Empty */ /* Empty */
| sp_cparams | sp_cparams
; ;
...@@ -6822,7 +6827,7 @@ when_list2: ...@@ -6822,7 +6827,7 @@ when_list2:
/* Warning - may return NULL in case of incomplete SELECT */ /* Warning - may return NULL in case of incomplete SELECT */
table_ref: table_ref:
table_factor { $$=$1; } table_factor { $$=$1; }
| join_table { $$=$1; } | join_table
{ {
LEX *lex= Lex; LEX *lex= Lex;
if (!($$= lex->current_select->nest_last_join(lex->thd))) if (!($$= lex->current_select->nest_last_join(lex->thd)))
...@@ -6864,7 +6869,7 @@ join_table: ...@@ -6864,7 +6869,7 @@ join_table:
| table_ref normal_join table_ref | table_ref normal_join table_ref
ON ON
{ {
YYERROR_UNLESS($1 && ($$=$3)); YYERROR_UNLESS($1 && $3);
/* Change the current name resolution context to a local context. */ /* Change the current name resolution context to a local context. */
if (push_new_name_resolution_context(YYTHD, $1, $3)) if (push_new_name_resolution_context(YYTHD, $1, $3))
YYABORT; YYABORT;
...@@ -6879,7 +6884,7 @@ join_table: ...@@ -6879,7 +6884,7 @@ join_table:
| table_ref STRAIGHT_JOIN table_factor | table_ref STRAIGHT_JOIN table_factor
ON ON
{ {
YYERROR_UNLESS($1 && ($$=$3)); YYERROR_UNLESS($1 && $3);
/* Change the current name resolution context to a local context. */ /* Change the current name resolution context to a local context. */
if (push_new_name_resolution_context(YYTHD, $1, $3)) if (push_new_name_resolution_context(YYTHD, $1, $3))
YYABORT; YYABORT;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment