summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.bzrignore2
-rw-r--r--BUILD/SETUP.sh2
-rw-r--r--Docs/manual.texi3
-rw-r--r--mysql-test/r/join.result5
-rw-r--r--mysql-test/t/join.test14
-rw-r--r--sql/sql_select.cc3
6 files changed, 24 insertions, 5 deletions
diff --git a/.bzrignore b/.bzrignore
index 5eb355adf90..1699cf52943 100644
--- a/.bzrignore
+++ b/.bzrignore
@@ -303,3 +303,5 @@ support-files/mysql.server
support-files/mysql.spec
tags
tmp/*
+bdb/include/db_ext.h
+bdb/include/mutex_ext.h
diff --git a/BUILD/SETUP.sh b/BUILD/SETUP.sh
index 2a99915a18d..0f2334dd573 100644
--- a/BUILD/SETUP.sh
+++ b/BUILD/SETUP.sh
@@ -48,7 +48,7 @@ fast_cflags="-O3 -fno-omit-frame-pointer"
# this is one is for someone who thinks 1% speedup is worth not being
# able to backtrace
reckless_cflags="-O3 -fomit-frame-pointer "
-debug_cflags="-DEXTRA_DEBUG -DFORCE_INIT_OF_VARS -DSAFEMALLOC -DSAFE_MUTEX -O0"
+debug_cflags="-DEXTRA_DEBUG -DFORCE_INIT_OF_VARS -DSAFEMALLOC -DSAFE_MUTEX -O1"
base_cxxflags="-felide-constructors -fno-exceptions -fno-rtti"
diff --git a/Docs/manual.texi b/Docs/manual.texi
index 84048a74aad..46a62f66eef 100644
--- a/Docs/manual.texi
+++ b/Docs/manual.texi
@@ -46844,6 +46844,9 @@ not yet 100% confident in this code.
@appendixsubsec Changes in release 3.23.45
@itemize @bullet
@item
+Fixed problem with @code{t1 LEFT_JOIN t2 ... WHERE t2.date_column IS NULL} when
+date_column was declared as @code{NOT NULL}.
+@item
Fixed bug with BDB tables and keys on @code{BLOB}'s.
@item
Fixed bug in @code{MERGE} tables on OS with 32 bit file pointers.
diff --git a/mysql-test/r/join.result b/mysql-test/r/join.result
index 7db456a1af5..e48c209fed6 100644
--- a/mysql-test/r/join.result
+++ b/mysql-test/r/join.result
@@ -22,3 +22,8 @@ a
2
a a b
2 2 3
+d d
+2001-08-01 NULL
+0000-00-00 NULL
+d
+0000-00-00
diff --git a/mysql-test/t/join.test b/mysql-test/t/join.test
index 224db1dd8f0..530dcd5fca7 100644
--- a/mysql-test/t/join.test
+++ b/mysql-test/t/join.test
@@ -106,9 +106,17 @@ INSERT INTO t1 VALUES (1,1),(1,2),(1,3),(1,4),(1,5),(1,6),(1,7),(2,3);
CREATE TABLE t2 (
a int(11) default NULL
) TYPE=MyISAM;
-
INSERT INTO t2 VALUES (2),(3);
-
SELECT t1.a,t2.a,b FROM t1,t2 WHERE t1.a=t2.a AND (t1.a=1 OR t1.a=2) AND b>=1 AND b<=3;
-
DROP TABLE t1, t2;
+
+#
+# TEST LEFT JOIN with DATE columns
+#
+
+CREATE TABLE t1 (d DATE NOT NULL);
+CREATE TABLE t2 (d DATE NOT NULL);
+INSERT INTO t1 (d) VALUES ('2001-08-01'),('0000-00-00');
+SELECT * FROM t1 LEFT JOIN t2 USING (d) WHERE t2.d IS NULL;
+SELECT * from t1 WHERE t1.d IS NULL;
+DROP TABLE t1,t2;
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 431674a58e2..d1df2b2aa71 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -3101,7 +3101,8 @@ remove_eq_conds(COND *cond,Item::cond_result *cond_value)
/* fix to replace 'NULL' dates with '0' (shreeve@uci.edu) */
else if (((field->type() == FIELD_TYPE_DATE) ||
(field->type() == FIELD_TYPE_DATETIME)) &&
- (field->flags & NOT_NULL_FLAG))
+ (field->flags & NOT_NULL_FLAG) &&
+ !field->table->maybe_null)
{
COND *new_cond;
if ((new_cond= new Item_func_eq(args[0],new Item_int("0", 0, 2))))