summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xBuild-tools/Do-compile6
-rw-r--r--bdb/dist/aclocal/mutex.m42
-rw-r--r--mysql-test/r/null_key.result17
-rw-r--r--mysql-test/t/func_time.test1
-rw-r--r--mysql-test/t/null_key.test21
-rw-r--r--sql/mysqld.cc3
-rw-r--r--sql/opt_range.cc18
7 files changed, 60 insertions, 8 deletions
diff --git a/Build-tools/Do-compile b/Build-tools/Do-compile
index 8d647ef0d82..52c1951f48f 100755
--- a/Build-tools/Do-compile
+++ b/Build-tools/Do-compile
@@ -72,6 +72,12 @@ if (@config_env > 0)
$opt_config_env= join(" ", @config_env);
}
+if (@config_env > 0)
+{
+ chomp(@config_env);
+ $opt_config_env= join(" ", @config_env);
+}
+
chomp($host=`hostname`);
$full_host_name=$host;
$connect_option= ($opt_tcpip ? "--host=$host" : "");
diff --git a/bdb/dist/aclocal/mutex.m4 b/bdb/dist/aclocal/mutex.m4
index a6b1fa1a053..5c9218da163 100644
--- a/bdb/dist/aclocal/mutex.m4
+++ b/bdb/dist/aclocal/mutex.m4
@@ -403,5 +403,7 @@ UTS/cc-assembly) ADDITIONAL_OBJS="$ADDITIONAL_OBJS uts4.cc${o}"
AC_DEFINE(HAVE_MUTEX_UTS_CC_ASSEMBLY);;
x86/gcc-assembly) ADDITIONAL_OBJS="mut_tas${o} $ADDITIONAL_OBJS"
AC_DEFINE(HAVE_MUTEX_X86_GCC_ASSEMBLY);;
+x86_64/gcc-assembly) ADDITIONAL_OBJS="mut_tas${o} $ADDITIONAL_OBJS"
+ AC_DEFINE(HAVE_MUTEX_X86_64_GCC_ASSEMBLY);;
esac
])dnl
diff --git a/mysql-test/r/null_key.result b/mysql-test/r/null_key.result
index ce397e11c1a..b737f9254b0 100644
--- a/mysql-test/r/null_key.result
+++ b/mysql-test/r/null_key.result
@@ -228,3 +228,20 @@ alter table t1 add key id (id);
select * from t1, t2 where t1.id = t2.id;
id id
drop table t1,t2;
+id id2
+NULL 0
+1 1
+id id2
+NULL 0
+id id2
+NULL 0
+1 1
+id id2
+NULL 0
+1 1
+id id2
+1 1
+id id2
+1 1
+id id2
+1 1
diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test
index fdbc0f71dba..dd589ff2e66 100644
--- a/mysql-test/t/func_time.test
+++ b/mysql-test/t/func_time.test
@@ -166,6 +166,7 @@ select to_days("0000-00-00"),to_days(d),to_days(dt),to_days(t),to_days(c) from t
select extract(MONTH FROM "0000-00-00"),extract(MONTH FROM d),extract(MONTH FROM dt),extract(MONTH FROM t),extract(MONTH FROM c) from t1;
drop table t1;
+
#
# Test problem with TIMESTAMP and BETWEEN
#
diff --git a/mysql-test/t/null_key.test b/mysql-test/t/null_key.test
index 3ab8b993f43..b1cbd5cdfb0 100644
--- a/mysql-test/t/null_key.test
+++ b/mysql-test/t/null_key.test
@@ -135,3 +135,24 @@ select * from t1, t2 where t1.id = t2.id;
alter table t1 add key id (id);
select * from t1, t2 where t1.id = t2.id;
drop table t1,t2;
+
+#
+# Check bug when doing <=> NULL on an indexed null field
+#
+
+create table t1 (
+ id integer,
+ id2 integer not null,
+ index (id),
+ index (id2)
+);
+insert into t1 values(null,null),(1,1);
+select * from t1;
+select * from t1 where id <=> null;
+select * from t1 where id <=> null or id > 0;
+select * from t1 where id is null or id > 0;
+select * from t1 where id2 <=> null or id2 > 0;
+select * from t1 where id2 is null or id2 > 0;
+delete from t1 where id <=> NULL;
+select * from t1;
+drop table t1;
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index ffe3d1be47c..a60fee84d0b 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -4228,7 +4228,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
else
{
struct hostent *ent;
- if (!argument || !argument[0])
+ if (argument || argument[0])
ent=gethostbyname(argument);
else
{
@@ -4417,7 +4417,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
}
return 0;
}
-
/* Initiates DEBUG - but no debugging here ! */
static void get_options(int argc,char **argv)
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index f33a2d312b4..d1f99604959 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -936,8 +936,11 @@ get_mm_leaf(PARAM *param, Field *field, KEY_PART *key_part,
if (!(res= value->val_str(&tmp)))
DBUG_RETURN(&null_element);
- // Check if this was a function. This should have be optimized away
- // in the sql_select.cc
+ /*
+ TODO:
+ Check if this was a function. This should have be optimized away
+ in the sql_select.cc
+ */
if (res != &tmp)
{
tmp.copy(*res); // Get own copy
@@ -1017,8 +1020,10 @@ get_mm_leaf(PARAM *param, Field *field, KEY_PART *key_part,
type != Item_func::EQUAL_FUNC)
DBUG_RETURN(0); // Can't optimize this
- /* We can't always use indexes when comparing a string index to a number */
- /* cmp_type() is checked to allow compare of dates to numbers */
+ /*
+ We can't always use indexes when comparing a string index to a number
+ cmp_type() is checked to allow compare of dates to numbers
+ */
if (field->result_type() == STRING_RESULT &&
value->result_type() != STRING_RESULT &&
field->cmp_type() != value->result_type())
@@ -1026,6 +1031,7 @@ get_mm_leaf(PARAM *param, Field *field, KEY_PART *key_part,
if (value->save_in_field(field))
{
+ /* This happens when we try to insert a NULL field in a not null column */
// TODO; Check if we can we remove the following block.
if (type == Item_func::EQUAL_FUNC)
{
@@ -1037,7 +1043,7 @@ get_mm_leaf(PARAM *param, Field *field, KEY_PART *key_part,
*str = 1;
DBUG_RETURN(new SEL_ARG(field,str,str));
}
- DBUG_RETURN(&null_element); // NULL is never true
+ DBUG_RETURN(&null_element); // cmp with NULL is never true
}
// Get local copy of key
char *str= (char*) alloc_root(param->mem_root,
@@ -1045,7 +1051,7 @@ get_mm_leaf(PARAM *param, Field *field, KEY_PART *key_part,
if (!str)
DBUG_RETURN(0);
if (maybe_null)
- *str=0; // Not NULL
+ *str= (char) field->is_real_null(); // Set to 1 if null
field->get_key_image(str+maybe_null,key_part->part_length);
if (!(tree=new SEL_ARG(field,str,str)))
DBUG_RETURN(0);