Commit 7f6f31ae authored by unknown's avatar unknown

Merge mysql.com:/home/kostja/mysql/mysql-4.1-root

into  mysql.com:/home/kostja/mysql/mysql-5.0-merge


client/mysqltest.c:
  Auto merged
mysql-test/r/rpl_log.result:
  Auto merged
mysql-test/r/rpl_rotate_logs.result:
  Auto merged
mysql-test/r/select.result:
  Auto merged
mysql-test/r/timezone_grant.result:
  Auto merged
mysql-test/t/ctype_utf8.test:
  Auto merged
mysql-test/t/timezone_grant.test:
  Auto merged
sql/sql_prepare.cc:
  Auto merged
sql/sql_repl.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
tests/mysql_client_test.c:
  Auto merged
configure.in:
  Manual merge
mysql-test/r/olap.result:
  Manual merge
mysql-test/t/olap.test:
  Manual merge
mysql-test/t/select.test:
  Manual merge
sql/mysqld.cc:
  Manual merge
sql/sql_parse.cc:
  Manual merge
parents 21332fe0 ddc35864
...@@ -3393,10 +3393,10 @@ static void run_query_display_metadata(MYSQL_FIELD *field, uint num_fields, ...@@ -3393,10 +3393,10 @@ static void run_query_display_metadata(MYSQL_FIELD *field, uint num_fields,
int10_to_str((int) field->type, buff, 10); int10_to_str((int) field->type, buff, 10);
dynstr_append(ds, buff); dynstr_append(ds, buff);
dynstr_append_mem(ds, "\t", 1); dynstr_append_mem(ds, "\t", 1);
int10_to_str((int) field->length, buff, 10); longlong10_to_str((unsigned int) field->length, buff, 10);
dynstr_append(ds, buff); dynstr_append(ds, buff);
dynstr_append_mem(ds, "\t", 1); dynstr_append_mem(ds, "\t", 1);
int10_to_str((int) field->max_length, buff, 10); longlong10_to_str((unsigned int) field->max_length, buff, 10);
dynstr_append(ds, buff); dynstr_append(ds, buff);
dynstr_append_mem(ds, "\t", 1); dynstr_append_mem(ds, "\t", 1);
dynstr_append_mem(ds, (char*) (IS_NOT_NULL(field->flags) ? dynstr_append_mem(ds, (char*) (IS_NOT_NULL(field->flags) ?
......
...@@ -478,7 +478,7 @@ el_gets(EditLine *el, int *nread) ...@@ -478,7 +478,7 @@ el_gets(EditLine *el, int *nread)
#endif /* DEBUG_READ */ #endif /* DEBUG_READ */
break; break;
} }
if ((uint)cmdnum >= el->el_map.nfunc) { /* BUG CHECK command */ if ((unsigned int)cmdnum >= el->el_map.nfunc) { /* BUG CHECK command */
#ifdef DEBUG_EDIT #ifdef DEBUG_EDIT
(void) fprintf(el->el_errfile, (void) fprintf(el->el_errfile,
"ERROR: illegal command from key 0%o\r\n", ch); "ERROR: illegal command from key 0%o\r\n", ch);
......
dnl -*- ksh -*- dnl -*- ksh -*-
dnl Process this file with autoconf to produce a configure script. dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.58)dnl Minimum Autoconf version required. AC_PREREQ(2.57)dnl Minimum Autoconf version required.
AC_INIT(sql/mysqld.cc) AC_INIT(sql/mysqld.cc)
AC_CANONICAL_SYSTEM AC_CANONICAL_SYSTEM
......
...@@ -576,4 +576,15 @@ EXPLAIN SELECT type FROM v1 GROUP BY type WITH ROLLUP; ...@@ -576,4 +576,15 @@ EXPLAIN SELECT type FROM v1 GROUP BY type WITH ROLLUP;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 10 Using filesort 1 PRIMARY t1 ALL NULL NULL NULL NULL 10 Using filesort
DROP VIEW v1; DROP VIEW v1;
CREATE TABLE t1 (a INT(10) NOT NULL, b INT(10) NOT NULL);
INSERT INTO t1 VALUES (1, 1);
INSERT INTO t1 VALUES (1, 2);
SELECT a, b, a AS c, COUNT(*) AS count FROM t1 GROUP BY a, b, c WITH ROLLUP;
a b c count
1 1 1 1
1 1 NULL 1
1 2 1 1
1 2 NULL 1
1 NULL NULL 2
NULL NULL NULL 2
DROP TABLE t1; DROP TABLE t1;
...@@ -69,12 +69,12 @@ master-bin.000002 346 Query 1 434 use `test`; insert into t1 values (1) ...@@ -69,12 +69,12 @@ master-bin.000002 346 Query 1 434 use `test`; insert into t1 values (1)
master-bin.000002 434 Query 1 510 use `test`; drop table t1 master-bin.000002 434 Query 1 510 use `test`; drop table t1
show binary logs; show binary logs;
Log_name File_size Log_name File_size
master-bin.000001 0 master-bin.000001 1171
master-bin.000002 510 master-bin.000002 510
start slave; start slave;
show binary logs; show binary logs;
Log_name File_size Log_name File_size
slave-bin.000001 0 slave-bin.000001 1285
slave-bin.000002 348 slave-bin.000002 348
show binlog events in 'slave-bin.000001' from 4; show binlog events in 'slave-bin.000001' from 4;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
......
...@@ -27,8 +27,8 @@ insert into t2 values (34),(67),(123); ...@@ -27,8 +27,8 @@ insert into t2 values (34),(67),(123);
flush logs; flush logs;
show binary logs; show binary logs;
Log_name File_size Log_name File_size
master-bin.000001 0 master-bin.000001 461
master-bin.000002 0 master-bin.000002 213
master-bin.000003 98 master-bin.000003 98
create table t3 select * from temp_table; create table t3 select * from temp_table;
select * from t3; select * from t3;
...@@ -43,12 +43,12 @@ start slave; ...@@ -43,12 +43,12 @@ start slave;
purge master logs to 'master-bin.000002'; purge master logs to 'master-bin.000002';
show master logs; show master logs;
Log_name File_size Log_name File_size
master-bin.000002 0 master-bin.000002 213
master-bin.000003 407 master-bin.000003 407
purge binary logs to 'master-bin.000002'; purge binary logs to 'master-bin.000002';
show binary logs; show binary logs;
Log_name File_size Log_name File_size
master-bin.000002 0 master-bin.000002 213
master-bin.000003 407 master-bin.000003 407
purge master logs before now(); purge master logs before now();
show binary logs; show binary logs;
...@@ -74,7 +74,7 @@ count(*) ...@@ -74,7 +74,7 @@ count(*)
create table t4 select * from temp_table; create table t4 select * from temp_table;
show binary logs; show binary logs;
Log_name File_size Log_name File_size
master-bin.000003 0 master-bin.000003 4167
master-bin.000004 0 master-bin.000004 0
master-bin.000005 2032 master-bin.000005 2032
show master status; show master status;
......
...@@ -2757,3 +2757,31 @@ f2 ...@@ -2757,3 +2757,31 @@ f2
1 1
NULL NULL
drop table t1,t2; drop table t1,t2;
create table t2 (a tinyint unsigned);
create index t2i on t2(a);
insert into t2 values (0), (254), (255);
explain select * from t2 where a > -1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 index t2i t2i 2 NULL 3 Using where; Using index
select * from t2 where a > -1;
a
0
254
255
drop table t2;
CREATE TABLE t1 (a int, b int, c int);
INSERT INTO t1
SELECT 50, 3, 3 FROM DUAL
WHERE NOT EXISTS
(SELECT * FROM t1 WHERE a = 50 AND b = 3);
SELECT * FROM t1;
a b c
50 3 3
INSERT INTO t1
SELECT 50, 3, 3 FROM DUAL
WHERE NOT EXISTS
(SELECT * FROM t1 WHERE a = 50 AND b = 3);
SELECT * FROM t1;
a b c
50 3 3
DROP TABLE t1;
...@@ -47,6 +47,13 @@ select * from mysql.time_zone_name; ...@@ -47,6 +47,13 @@ select * from mysql.time_zone_name;
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'time_zone_name' ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'time_zone_name'
select Name, convert_tz('2004-11-30 12:00:00', Name, 'UTC') from mysql.time_zone_name; select Name, convert_tz('2004-11-30 12:00:00', Name, 'UTC') from mysql.time_zone_name;
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'time_zone_name' ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'time_zone_name'
drop table t1, t2;
create table t1 (a int, b datetime);
create table t2 (a int, b varchar(40));
update t1 set b = '2005-01-01 10:00';
update t1 set b = convert_tz(b, 'UTC', 'UTC');
update t1 join t2 on (t1.a = t2.a) set t1.b = '2005-01-01 10:00' where t2.b = 'foo';
update t1 join t2 on (t1.a = t2.a) set t1.b = convert_tz('2005-01-01 10:00','UTC','UTC') where t2.b = 'foo';
delete from mysql.user where user like 'mysqltest\_%'; delete from mysql.user where user like 'mysqltest\_%';
delete from mysql.db where user like 'mysqltest\_%'; delete from mysql.db where user like 'mysqltest\_%';
delete from mysql.tables_priv where user like 'mysqltest\_%'; delete from mysql.tables_priv where user like 'mysqltest\_%';
......
...@@ -265,4 +265,13 @@ SELECT type FROM v1 GROUP BY type WITH ROLLUP; ...@@ -265,4 +265,13 @@ SELECT type FROM v1 GROUP BY type WITH ROLLUP;
EXPLAIN SELECT type FROM v1 GROUP BY type WITH ROLLUP; EXPLAIN SELECT type FROM v1 GROUP BY type WITH ROLLUP;
DROP VIEW v1; DROP VIEW v1;
# Test for bug #11543: ROLLUP query with a repeated column in GROUP BY
#
CREATE TABLE t1 (a INT(10) NOT NULL, b INT(10) NOT NULL);
INSERT INTO t1 VALUES (1, 1);
INSERT INTO t1 VALUES (1, 2);
SELECT a, b, a AS c, COUNT(*) AS count FROM t1 GROUP BY a, b, c WITH ROLLUP;
DROP TABLE t1; DROP TABLE t1;
...@@ -2341,3 +2341,31 @@ insert into t2 values (1,2,3),(2,4,6); ...@@ -2341,3 +2341,31 @@ insert into t2 values (1,2,3),(2,4,6);
select A.f2 from t1 left join t2 A on A.f2 = f1 where A.f3=(select min(f3) select A.f2 from t1 left join t2 A on A.f2 = f1 where A.f3=(select min(f3)
from t2 C where A.f4 = C.f4) or A.f3 IS NULL; from t2 C where A.f4 = C.f4) or A.f3 IS NULL;
drop table t1,t2; drop table t1,t2;
#
# Bug #11521 Negative integer keys incorrectly substituted for 0 during
# range analysis.
create table t2 (a tinyint unsigned);
create index t2i on t2(a);
insert into t2 values (0), (254), (255);
explain select * from t2 where a > -1;
select * from t2 where a > -1;
drop table t2;
#
# Bug #11745: SELECT ... FROM DUAL with WHERE condition
#
CREATE TABLE t1 (a int, b int, c int);
INSERT INTO t1
SELECT 50, 3, 3 FROM DUAL
WHERE NOT EXISTS
(SELECT * FROM t1 WHERE a = 50 AND b = 3);
SELECT * FROM t1;
INSERT INTO t1
SELECT 50, 3, 3 FROM DUAL
WHERE NOT EXISTS
(SELECT * FROM t1 WHERE a = 50 AND b = 3);
SELECT * FROM t1;
DROP TABLE t1;
...@@ -61,6 +61,18 @@ select * from mysql.time_zone_name; ...@@ -61,6 +61,18 @@ select * from mysql.time_zone_name;
--error 1142 --error 1142
select Name, convert_tz('2004-11-30 12:00:00', Name, 'UTC') from mysql.time_zone_name; select Name, convert_tz('2004-11-30 12:00:00', Name, 'UTC') from mysql.time_zone_name;
#
# Bug #9979: Use of CONVERT_TZ in multiple-table UPDATE causes bogus
# privilege error
#
drop table t1, t2;
create table t1 (a int, b datetime);
create table t2 (a int, b varchar(40));
update t1 set b = '2005-01-01 10:00';
update t1 set b = convert_tz(b, 'UTC', 'UTC');
update t1 join t2 on (t1.a = t2.a) set t1.b = '2005-01-01 10:00' where t2.b = 'foo';
update t1 join t2 on (t1.a = t2.a) set t1.b = convert_tz('2005-01-01 10:00','UTC','UTC') where t2.b = 'foo';
# Clean-up # Clean-up
connection default; connection default;
delete from mysql.user where user like 'mysqltest\_%'; delete from mysql.user where user like 'mysqltest\_%';
......
...@@ -685,7 +685,13 @@ static void close_connections(void) ...@@ -685,7 +685,13 @@ static void close_connections(void)
{ {
DBUG_PRINT("quit",("Informing thread %ld that it's time to die", DBUG_PRINT("quit",("Informing thread %ld that it's time to die",
tmp->thread_id)); tmp->thread_id));
tmp->killed= THD::KILL_CONNECTION; /*
Re: bug 7403 - close_connection will be called mulitple times
a wholesale clean up of our network code is a very large project.
This will wake up the socket on Windows and prevent the printing of
the error message that we are force closing a connection.
*/
close_connection(tmp, 0, 0);
if (tmp->mysys_var) if (tmp->mysys_var)
{ {
tmp->mysys_var->abort=1; tmp->mysys_var->abort=1;
......
...@@ -2304,7 +2304,8 @@ mysql_execute_command(THD *thd) ...@@ -2304,7 +2304,8 @@ mysql_execute_command(THD *thd)
Don't reset warnings when executing a stored routine. Don't reset warnings when executing a stored routine.
*/ */
if ((all_tables || &lex->select_lex != lex->all_selects_list || if ((all_tables || &lex->select_lex != lex->all_selects_list ||
lex->sroutines.records) && !thd->spcont) lex->sroutines.records) && !thd->spcont ||
lex->time_zone_tables_used)
mysql_reset_errors(thd, 0); mysql_reset_errors(thd, 0);
#ifdef HAVE_REPLICATION #ifdef HAVE_REPLICATION
...@@ -6843,7 +6844,7 @@ bool multi_update_precheck(THD *thd, TABLE_LIST *tables) ...@@ -6843,7 +6844,7 @@ bool multi_update_precheck(THD *thd, TABLE_LIST *tables)
/* /*
Is there tables of subqueries? Is there tables of subqueries?
*/ */
if (&lex->select_lex != lex->all_selects_list) if (&lex->select_lex != lex->all_selects_list || lex->time_zone_tables_used)
{ {
DBUG_PRINT("info",("Checking sub query list")); DBUG_PRINT("info",("Checking sub query list"));
for (table= tables; table; table= table->next_global) for (table= tables; table; table= table->next_global)
......
...@@ -1526,7 +1526,7 @@ bool show_binlogs(THD* thd) ...@@ -1526,7 +1526,7 @@ bool show_binlogs(THD* thd)
else else
{ {
/* this is an old log, open it and find the size */ /* this is an old log, open it and find the size */
if ((file= my_open(fname+dir_len, O_RDONLY | O_SHARE | O_BINARY, if ((file= my_open(fname, O_RDONLY | O_SHARE | O_BINARY,
MYF(0))) >= 0) MYF(0))) >= 0)
{ {
file_length= (ulonglong) my_seek(file, 0L, MY_SEEK_END, MYF(0)); file_length= (ulonglong) my_seek(file, 0L, MY_SEEK_END, MYF(0));
......
...@@ -1198,7 +1198,7 @@ JOIN::exec() ...@@ -1198,7 +1198,7 @@ JOIN::exec()
{ {
result->send_fields(fields_list, result->send_fields(fields_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF); Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF);
if (!having || having->val_int()) if (cond_value != Item::COND_FALSE && (!having || having->val_int()))
{ {
if (do_send_rows && (procedure ? (procedure->send_row(fields_list) || if (do_send_rows && (procedure ? (procedure->send_row(fields_list) ||
procedure->end_of_records()) procedure->end_of_records())
...@@ -13065,7 +13065,7 @@ bool JOIN::rollup_init() ...@@ -13065,7 +13065,7 @@ bool JOIN::rollup_init()
ORDER *group_tmp; ORDER *group_tmp;
for (group_tmp= group_list; group_tmp; group_tmp= group_tmp->next) for (group_tmp= group_list; group_tmp; group_tmp= group_tmp->next)
{ {
if (item->eq(*group_tmp->item,0)) if (*group_tmp->item == item)
item->maybe_null= 1; item->maybe_null= 1;
} }
if (item->type() == Item::FUNC_ITEM) if (item->type() == Item::FUNC_ITEM)
...@@ -13185,7 +13185,7 @@ bool JOIN::rollup_make_fields(List<Item> &fields_arg, List<Item> &sel_fields, ...@@ -13185,7 +13185,7 @@ bool JOIN::rollup_make_fields(List<Item> &fields_arg, List<Item> &sel_fields,
for (group_tmp= start_group, i= pos ; for (group_tmp= start_group, i= pos ;
group_tmp ; group_tmp= group_tmp->next, i++) group_tmp ; group_tmp= group_tmp->next, i++)
{ {
if (item->eq(*group_tmp->item,0)) if (*group_tmp->item == item)
{ {
/* /*
This is an element that is used by the GROUP BY and should be This is an element that is used by the GROUP BY and should be
......
...@@ -4026,7 +4026,7 @@ select_into: ...@@ -4026,7 +4026,7 @@ select_into:
select_from: select_from:
FROM join_table_list where_clause group_clause having_clause FROM join_table_list where_clause group_clause having_clause
opt_order_clause opt_limit_clause procedure_clause opt_order_clause opt_limit_clause procedure_clause
| FROM DUAL_SYM opt_limit_clause | FROM DUAL_SYM where_clause opt_limit_clause
/* oracle compatibility: oracle always requires FROM clause, /* oracle compatibility: oracle always requires FROM clause,
and DUAL is system table without fields. and DUAL is system table without fields.
Is "SELECT 1 FROM DUAL" any better than "SELECT 1" ? Is "SELECT 1 FROM DUAL" any better than "SELECT 1" ?
......
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