Commit 253b9ecb authored by unknown's avatar unknown

Don't use signal() on windows.

Added missing InnoDB variables to SHOW VARIABLES.
Fixed bug when doing WHERE 'column_name=NULL' on an indexed column that had NULL values.
Fixed bug when doing 'LEFT JOIN ...  ON (column_name = constant) WHERE column_name = constant'


Docs/manual.texi:
  Changelog
libmysql/libmysql.c:
  Don't use signal() on windows.
mysql-test/r/join_outer.result:
  Test for bugfix
mysql-test/r/null.result:
  Test for bugfix
mysql-test/t/join_outer.test:
  Test for bugfix
mysql-test/t/null.test:
  Test for bugfix
sql/mysqld.cc:
  Add missing InnoDB variables to SHOW VARIABLES.
sql/sql_select.cc:
  Fixed bug when doing WHERE 'column_name=NULL' on an indexed column that had NULL values.
  Fixed bug when doing 'LEFT JOIN ...  ON (column_name = constant) WHERE column_name = constant'
parent 6f2d5616
...@@ -46845,6 +46845,14 @@ not yet 100% confident in this code. ...@@ -46845,6 +46845,14 @@ not yet 100% confident in this code.
@appendixsubsec Changes in release 3.23.44 @appendixsubsec Changes in release 3.23.44
@itemize @bullet @itemize @bullet
@item @item
Don't use @code{signal()} on windows because this appears to not be
100 % reliable.
@item
Fixed bug when doing @code{WHERE column_name=NULL} on an indexed column
that had @code{NULL} values.
@item
Fixed bug when doing @code{LEFT JOIN ... ON (column_name = constant) WHERE column_name = constant}.
@item
When using replications, aborted queries that contained @code{%} could cause When using replications, aborted queries that contained @code{%} could cause
a core dum. a core dum.
@item @item
...@@ -1002,7 +1002,7 @@ mysql_init(MYSQL *mysql) ...@@ -1002,7 +1002,7 @@ mysql_init(MYSQL *mysql)
else else
bzero((char*) (mysql),sizeof(*(mysql))); bzero((char*) (mysql),sizeof(*(mysql)));
mysql->options.connect_timeout=CONNECT_TIMEOUT; mysql->options.connect_timeout=CONNECT_TIMEOUT;
#if defined(SIGPIPE) && defined(THREAD) #if defined(SIGPIPE) && defined(THREAD) && !defined(__WIN__)
if (!((mysql)->client_flag & CLIENT_IGNORE_SIGPIPE)) if (!((mysql)->client_flag & CLIENT_IGNORE_SIGPIPE))
(void) signal(SIGPIPE,pipe_sig_handler); (void) signal(SIGPIPE,pipe_sig_handler);
#endif #endif
...@@ -1043,7 +1043,7 @@ static void mysql_once_init() ...@@ -1043,7 +1043,7 @@ static void mysql_once_init()
mysql_unix_port = env; mysql_unix_port = env;
} }
mysql_debug(NullS); mysql_debug(NullS);
#if defined(SIGPIPE) && !defined(THREAD) #if defined(SIGPIPE) && !defined(THREAD) && !defined(__WIN__)
(void) signal(SIGPIPE,SIG_IGN); (void) signal(SIGPIPE,SIG_IGN);
#endif #endif
} }
......
...@@ -318,3 +318,5 @@ t1 ALL NULL NULL NULL NULL 2 ...@@ -318,3 +318,5 @@ t1 ALL NULL NULL NULL NULL 2
t2 index id id 8 NULL 1 where used; Using index; Not exists t2 index id id 8 NULL 1 where used; Using index; Not exists
id name id idx id name id idx
2 no NULL NULL 2 no NULL NULL
bug_id reporter bug_id who
1 1 1 2
...@@ -23,3 +23,10 @@ NULL 0 ...@@ -23,3 +23,10 @@ NULL 0
inet_ntoa(null) inet_aton(null) inet_aton("122.256") inet_aton("122.226.") inet_aton("") inet_ntoa(null) inet_aton(null) inet_aton("122.256") inet_aton("122.226.") inet_aton("")
NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
x x
indexed_field
indexed_field
NULL
NULL
indexed_field
NULL
NULL
...@@ -394,3 +394,13 @@ INSERT INTO t2 VALUES (1,1); ...@@ -394,3 +394,13 @@ INSERT INTO t2 VALUES (1,1);
explain SELECT * from t1 left join t2 on t1.id=t2.id where t2.id IS NULL; explain SELECT * from t1 left join t2 on t1.id=t2.id where t2.id IS NULL;
SELECT * from t1 left join t2 on t1.id=t2.id where t2.id IS NULL; SELECT * from t1 left join t2 on t1.id=t2.id where t2.id IS NULL;
drop table t1,t2; drop table t1,t2;
#
# Test problem with using key_column= constant in ON and WHERE
#
create table t1 (bug_id mediumint, reporter mediumint);
create table t2 (bug_id mediumint, who mediumint, index(who));
insert into t2 values (1,1),(1,2);
insert into t1 values (1,1),(2,1);
SELECT * FROM t1 LEFT JOIN t2 ON (t1.bug_id = t2.bug_id AND t2.who = 2) WHERE (t1.reporter = 2 OR t2.who = 2);
drop table t1,t2;
...@@ -20,3 +20,18 @@ create table t1 (x int); ...@@ -20,3 +20,18 @@ create table t1 (x int);
insert into t1 values (null); insert into t1 values (null);
select * from t1 where x != 0; select * from t1 where x != 0;
drop table t1; drop table t1;
#
# Test problem med index on NULL columns and testing with =NULL;
#
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
indexed_field int default NULL,
KEY indexed_field (indexed_field)
);
INSERT INTO t1 VALUES (NULL),(NULL);
SELECT * FROM t1 WHERE indexed_field=NULL;
SELECT * FROM t1 WHERE indexed_field IS NULL;
SELECT * FROM t1 WHERE indexed_field<=>NULL;
DROP TABLE t1;
...@@ -2901,13 +2901,21 @@ struct show_var_st init_vars[]= { ...@@ -2901,13 +2901,21 @@ struct show_var_st init_vars[]= {
{"have_openssl", (char*) &have_ssl, SHOW_HAVE}, {"have_openssl", (char*) &have_ssl, SHOW_HAVE},
{"init_file", (char*) &opt_init_file, SHOW_CHAR_PTR}, {"init_file", (char*) &opt_init_file, SHOW_CHAR_PTR},
#ifdef HAVE_INNOBASE_DB #ifdef HAVE_INNOBASE_DB
{"innodb_additional_mem_pool_size", (char*) &innobase_additional_mem_pool_size, SHOW_LONG },
{"innodb_buffer_pool_size", (char*) &innobase_buffer_pool_size, SHOW_LONG },
{"innodb_data_file_path", (char*) &innobase_data_file_path, SHOW_CHAR_PTR}, {"innodb_data_file_path", (char*) &innobase_data_file_path, SHOW_CHAR_PTR},
{"innodb_data_home_dir", (char*) &innobase_data_home_dir, SHOW_CHAR_PTR}, {"innodb_data_home_dir", (char*) &innobase_data_home_dir, SHOW_CHAR_PTR},
{"innodb_file_io_threads", (char*) &innobase_file_io_threads, SHOW_LONG },
{"innodb_flush_log_at_trx_commit", (char*) &innobase_flush_log_at_trx_commit, SHOW_MY_BOOL}, {"innodb_flush_log_at_trx_commit", (char*) &innobase_flush_log_at_trx_commit, SHOW_MY_BOOL},
{"innodb_flush_method", (char*) &innobase_unix_file_flush_method, SHOW_CHAR_PTR},
{"innodb_lock_wait_timeout", (char*) &innobase_lock_wait_timeout, SHOW_LONG },
{"innodb_log_arch_dir", (char*) &innobase_log_arch_dir, SHOW_CHAR_PTR}, {"innodb_log_arch_dir", (char*) &innobase_log_arch_dir, SHOW_CHAR_PTR},
{"innodb_log_archive", (char*) &innobase_log_archive, SHOW_MY_BOOL}, {"innodb_log_archive", (char*) &innobase_log_archive, SHOW_MY_BOOL},
{"innodb_log_buffer_size", (char*) &innobase_log_buffer_size, SHOW_LONG },
{"innodb_log_file_size", (char*) &innobase_log_file_size, SHOW_LONG},
{"innodb_log_files_in_group", (char*) &innobase_log_files_in_group, SHOW_LONG},
{"innodb_log_group_home_dir", (char*) &innobase_log_group_home_dir, SHOW_CHAR_PTR}, {"innodb_log_group_home_dir", (char*) &innobase_log_group_home_dir, SHOW_CHAR_PTR},
{"innodb_flush_method", (char*) &innobase_unix_file_flush_method, SHOW_CHAR_PTR}, {"innodb_mirrored_log_groups", (char*) &innobase_mirrored_log_groups, SHOW_LONG},
#endif #endif
{"interactive_timeout", (char*) &net_interactive_timeout, SHOW_LONG}, {"interactive_timeout", (char*) &net_interactive_timeout, SHOW_LONG},
{"join_buffer_size", (char*) &join_buff_size, SHOW_LONG}, {"join_buffer_size", (char*) &join_buff_size, SHOW_LONG},
......
...@@ -4963,15 +4963,16 @@ end_write_group(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)), ...@@ -4963,15 +4963,16 @@ end_write_group(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
static bool test_if_ref(Item_field *left_item,Item *right_item) static bool test_if_ref(Item_field *left_item,Item *right_item)
{ {
Field *field=left_item->field; Field *field=left_item->field;
if (!field->table->const_table) // No need to change const test // No need to change const test. We also have to keep tests on LEFT JOIN
if (!field->table->const_table && !field->table->maybe_null)
{ {
Item *ref_item=part_of_refkey(field->table,field); Item *ref_item=part_of_refkey(field->table,field);
if (ref_item && ref_item->eq(right_item)) if (ref_item && ref_item->eq(right_item))
{ {
if (right_item->type() == Item::FIELD_ITEM) if (right_item->type() == Item::FIELD_ITEM)
return (field->eq_def(((Item_field *) right_item)->field) && return (field->eq_def(((Item_field *) right_item)->field));
!field->table->maybe_null); if (right_item->const_item() &&
if (right_item->const_item()) (right_item->val_int() || !right_item->null_value))
{ {
// We can remove binary fields and numerical fields except float, // We can remove binary fields and numerical fields except float,
// as float comparison isn't 100 % secure // as float comparison isn't 100 % secure
......
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