Commit 4f90ab4d authored by Joerg Bruehe's avatar Joerg Bruehe

Merge main 5.0 -> 5.0-build

parents 64dc750b 94ac4f70
......@@ -1359,4 +1359,34 @@ tt
41
SET sql_mode=@save_sql_mode;
DROP TABLE t1, t2;
#
# BUG#38072: Wrong result: HAVING not observed in a query with aggregate
#
CREATE TABLE t1 (
pk int(11) NOT NULL AUTO_INCREMENT,
int_nokey int(11) NOT NULL,
int_key int(11) NOT NULL,
varchar_key varchar(1) NOT NULL,
varchar_nokey varchar(1) NOT NULL,
PRIMARY KEY (pk),
KEY int_key (int_key),
KEY varchar_key (varchar_key)
);
INSERT INTO t1 VALUES
(1,5,5, 'h','h'),
(2,1,1, '{','{'),
(3,1,1, 'z','z'),
(4,8,8, 'x','x'),
(5,7,7, 'o','o'),
(6,3,3, 'p','p'),
(7,9,9, 'c','c'),
(8,0,0, 'k','k'),
(9,6,6, 't','t'),
(10,0,0,'c','c');
explain SELECT COUNT(varchar_key) AS X FROM t1 WHERE pk = 8 having 'foo'='bar';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible HAVING
SELECT COUNT(varchar_key) AS X FROM t1 WHERE pk = 8 having 'foo'='bar';
X
drop table t1;
End of 5.0 tests
......@@ -20,5 +20,36 @@ master_password='',master_port=SLAVE_PORT;
start slave;
flush logs;
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
# 127.0.0.1 root SLAVE_PORT 60 slave-bin.000001 208 # # slave-bin.000001 Yes Yes 0 0 208 # None 0 No #
Slave_IO_State #
Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos 98
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
Slave_IO_Running Yes
Slave_SQL_Running Yes
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
Exec_Master_Log_Pos 98
Relay_Log_Space #
Until_Condition None
Until_Log_File
Until_Log_Pos 0
Master_SSL_Allowed No
Master_SSL_CA_File
Master_SSL_CA_Path
Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
......@@ -6646,6 +6646,24 @@ ttt
2
drop function func30787;
drop table t1;
CREATE TABLE t1 (id INT);
INSERT INTO t1 VALUES (1),(2),(3),(4);
CREATE PROCEDURE test_sp()
SELECT t1.* FROM t1 RIGHT JOIN t1 t2 ON t1.id=t2.id;
CALL test_sp();
id
1
2
3
4
CALL test_sp();
id
1
2
3
4
DROP PROCEDURE test_sp;
DROP TABLE t1;
create table t1(c1 INT);
create function f1(p1 int) returns varchar(32)
return 'aaa';
......
......@@ -53,11 +53,11 @@ Assert Questions == 16
SHOW STATUS LIKE 'Questions';
Variable_name Value
Questions 16
Global status updated; Assert diff == 5
Global status updated; Assert diff == 4
FLUSH STATUS;
SELECT 5;
5
5
SELECT 4;
4
4
DROP TABLE t1,t2;
DROP PROCEDURE p1;
DROP FUNCTION f1;
......
......@@ -3677,6 +3677,8 @@ DROP VIEW v1;
# -- End of test case for Bug#35193.
CREATE VIEW v1 AS SELECT 1;
DROP VIEW v1;
# -----------------------------------------------------------------
# -- End of 5.0 tests.
# -----------------------------------------------------------------
......@@ -1010,4 +1010,33 @@ select (select sum(outr.a + t1.a) from t1 limit 1) as tt from t1 as outr order b
SET sql_mode=@save_sql_mode;
DROP TABLE t1, t2;
--echo #
--echo # BUG#38072: Wrong result: HAVING not observed in a query with aggregate
--echo #
CREATE TABLE t1 (
pk int(11) NOT NULL AUTO_INCREMENT,
int_nokey int(11) NOT NULL,
int_key int(11) NOT NULL,
varchar_key varchar(1) NOT NULL,
varchar_nokey varchar(1) NOT NULL,
PRIMARY KEY (pk),
KEY int_key (int_key),
KEY varchar_key (varchar_key)
);
INSERT INTO t1 VALUES
(1,5,5, 'h','h'),
(2,1,1, '{','{'),
(3,1,1, 'z','z'),
(4,8,8, 'x','x'),
(5,7,7, 'o','o'),
(6,3,3, 'p','p'),
(7,9,9, 'c','c'),
(8,0,0, 'k','k'),
(9,6,6, 't','t'),
(10,0,0,'c','c');
explain SELECT COUNT(varchar_key) AS X FROM t1 WHERE pk = 8 having 'foo'='bar';
SELECT COUNT(varchar_key) AS X FROM t1 WHERE pk = 8 having 'foo'='bar';
drop table t1;
--echo End of 5.0 tests
......@@ -12,16 +12,27 @@ stop slave;
eval change master to master_host='127.0.0.1',master_user='root',
master_password='',master_port=$MASTER_MYPORT;
start slave;
connection master;
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval change master to master_host='127.0.0.1',master_user='root',
master_password='',master_port=$SLAVE_MYPORT;
start slave;
sleep 5;
--source include/wait_for_slave_to_start.inc
# Calculate file name of relay log after flush logs
let $relay_file= query_get_value(show slave status, Relay_Log_File,1);
let $relay_name= `select substring_index('$relay_file','.',1);`;
let $relay_index= `select substring_index('$relay_file','.',-1);`;
let $relay_index_len= `select length(substring_index('$relay_file','.',-1));`;
let $relay_index_next=`select $relay_index+1`;
let $relay_file=`select concat('$relay_name','.',repeat('0',($relay_index_len-length($relay_index_next))),$relay_index_next);`;
flush logs;
sleep 5;
--replace_result $SLAVE_MYPORT SLAVE_PORT
--replace_column 1 # 8 # 9 # 23 # 33 #
show slave status;
let $slave_param= Relay_Log_File;
let $slave_param_value= $relay_file;
source include/wait_for_slave_param.inc;
--replace_result $SLAVE_MYPORT SLAVE_PORT $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 8 # 9 # 16 # 23 # 33 # 34 # 35 #
--query_vertical show slave status
# End of 4.1 tests
......@@ -7793,6 +7793,21 @@ select (select func30787(f1)) as ttt from t1;
drop function func30787;
drop table t1;
#
# Bug #33811: Call to stored procedure with SELECT * / RIGHT JOIN fails
# after the first time
#
CREATE TABLE t1 (id INT);
INSERT INTO t1 VALUES (1),(2),(3),(4);
CREATE PROCEDURE test_sp()
SELECT t1.* FROM t1 RIGHT JOIN t1 t2 ON t1.id=t2.id;
CALL test_sp();
CALL test_sp();
DROP PROCEDURE test_sp;
DROP TABLE t1;
#
# Bug#38291 memory corruption and server crash with view/sp/function
......
......@@ -47,16 +47,16 @@ FLUSH STATUS;
let $org_questions= `SHOW GLOBAL STATUS LIKE 'questions'`;
SELECT 1;
connection default;
disconnect con1;
--echo Assert Questions == 16
SHOW STATUS LIKE 'Questions';
--echo Global status updated; Assert diff == 5
--echo Global status updated; Assert diff == 4
FLUSH STATUS;
let $new_questions= `SHOW GLOBAL STATUS LIKE 'questions'`;
--disable_log
let $diff= `SELECT SUBSTRING('$new_questions',10)-SUBSTRING('$org_questions',10)`;
--enable_log
eval SELECT $diff;
disconnect con1;
DROP TABLE t1,t2;
DROP PROCEDURE p1;
DROP FUNCTION f1;
......
......@@ -3560,6 +3560,15 @@ DROP VIEW v1;
###########################################################################
#
# Bug#39040: valgrind errors/crash when creating views with binlog logging
# enabled
#
# Bug is visible only when running in valgrind with binary logging.
CREATE VIEW v1 AS SELECT 1;
DROP VIEW v1;
--echo # -----------------------------------------------------------------
--echo # -- End of 5.0 tests.
--echo # -----------------------------------------------------------------
......@@ -5508,6 +5508,10 @@ insert_fields(THD *thd, Name_resolution_context *context, const char *db_name,
if (!(item= field_iterator.create_item(thd)))
DBUG_RETURN(TRUE);
DBUG_ASSERT(item->fixed);
/* cache the table for the Item_fields inserted by expanding stars */
if (item->type() == Item::FIELD_ITEM && tables->cacheable_table)
((Item_field *)item)->cached_table= tables;
if (!found)
{
......
......@@ -8269,6 +8269,8 @@ simplify_joins(JOIN *join, List<TABLE_LIST> *join_list, COND *conds, bool top)
}
/* Flatten nested joins that can be flattened. */
TABLE_LIST *right_neighbor= NULL;
bool fix_name_res= FALSE;
li.rewind();
while ((table= li++))
{
......@@ -8281,9 +8283,17 @@ simplify_joins(JOIN *join, List<TABLE_LIST> *join_list, COND *conds, bool top)
{
tbl->embedding= table->embedding;
tbl->join_list= table->join_list;
}
}
li.replace(nested_join->join_list);
}
/* Need to update the name resolution table chain when flattening joins */
fix_name_res= TRUE;
table= *li.ref();
}
if (fix_name_res)
table->next_name_resolution_table= right_neighbor ?
right_neighbor->first_leaf_for_name_resolution() :
NULL;
right_neighbor= table;
}
DBUG_RETURN(conds);
}
......
......@@ -464,7 +464,7 @@ class JOIN :public Sql_alloc
bool send_row_on_empty_set()
{
return (do_send_rows && tmp_table_param.sum_func_count != 0 &&
!group_list);
!group_list && having_value != Item::COND_FALSE);
}
bool change_result(select_result *result);
bool is_top_level_join() const
......
......@@ -774,8 +774,13 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view,
DBUG_PRINT("info", ("View: %s", str.ptr()));
/* fill structure */
view->query.str= str.c_ptr_safe();
view->query.length= str.length();
if (!make_lex_string(thd, &view->query, str.ptr(), str.length(), false))
{
my_error(ER_OUT_OF_RESOURCES, MYF(0));
error= -1;
goto err;
}
view->source.str= thd->query + thd->lex->create_view_select_start;
view->source.length= (char *)skip_rear_comments(thd->charset(),
(char *)view->source.str,
......@@ -784,7 +789,12 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view,
view->source.str;
view->file_version= 1;
view->calc_md5(md5);
view->md5.str= md5;
if (!(view->md5.str= thd->memdup(md5, 32)))
{
my_error(ER_OUT_OF_RESOURCES, MYF(0));
error= -1;
goto err;
}
view->md5.length= 32;
can_be_merged= lex->can_be_merged();
if (lex->create_view_algorithm == VIEW_ALGORITHM_MERGE &&
......
......@@ -240,10 +240,8 @@ BuildMySQL() {
sh -c "PATH=\"${MYSQL_BUILD_PATH:-$PATH}\" \
CC=\"${CC:-$MYSQL_BUILD_CC}\" \
CXX=\"${CXX:-$MYSQL_BUILD_CXX}\" \
CFLAGS=\"${MYSQL_BUILD_CFLAGS:-$RPM_OPT_FLAGS}\" \
CXXFLAGS=\"${MYSQL_BUILD_CXXFLAGS:-$RPM_OPT_FLAGS \
-felide-constructors -fno-exceptions -fno-rtti \
}\" \
CFLAGS=\"$CFLAGS\" \
CXXFLAGS=\"$CXXFLAGS\" \
LDFLAGS=\"$MYSQL_BUILD_LDFLAGS\" \
./configure \
$* \
......@@ -307,6 +305,10 @@ then
export CXX="gcc"
fi
# Prepare compiler flags
CFLAGS=${MYSQL_BUILD_CFLAGS:-$RPM_OPT_FLAGS}
CXXFLAGS=${MYSQL_BUILD_CXXFLAGS:-$RPM_OPT_FLAGS -felide-constructors -fno-exceptions -fno-rtti }
#
# Only link statically on our i386 build host (which has a specially
# patched static glibc installed) - ia64 and x86_64 run glibc-2.3 (unpatched)
......@@ -314,6 +316,14 @@ fi
#
for servertype in '--with-debug=full' ' '
do
(
# We are in a subshell, so we can modify variables just for one run.
if test "$servertype" != ' '
then
CFLAGS=`echo $CFLAGS | sed -e 's/-O[0-9]* //' -e 's/-unroll2 //' -e 's/-ip //'`
CXXFLAGS=`echo $CXXFLAGS | sed -e 's/-O[0-9]* //' -e 's/-unroll2 //' -e 's/-ip //'`
fi
BuildMySQL "\
%if %{STATIC_BUILD}
--disable-shared \
......@@ -335,6 +345,7 @@ do
--with-blackhole-storage-engine \
--with-federated-storage-engine \
--with-big-tables $servertype"
if test "$servertype" != ' '
then
# if this is not the regular build, we save the server binary
......@@ -344,6 +355,7 @@ do
make test-bt-debug
make clean
fi
)
done
./libtool --mode=execute nm --numeric-sort sql/mysqld > sql/mysqld.sym
......@@ -795,6 +807,11 @@ fi
# itself - note that they must be ordered by date (important when
# merging BK trees)
%changelog
* Thu Nov 06 2008 Joerg Bruehe <joerg@mysql.com>
- Modify CFLAGS and CXXFLAGS such that a debug build is not optimized.
This should cover both gcc and icc flags. Fixes bug#40546.
* Mon Aug 18 2008 Joerg Bruehe <joerg@mysql.com>
- Get rid of the "warning: Installed (but unpackaged) file(s) found:"
......
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