Commit 0176dacd authored by unknown's avatar unknown

Fixed problem with t1 LEFT_JOIN t2 ... WHERE t2.date_column IS NULL when...

Fixed problem with t1 LEFT_JOIN t2 ... WHERE t2.date_column IS NULL when date_column is declared as NOT NULL.


BUILD/SETUP.sh:
  Use -O1 to avoid problem with INLINE functions
Docs/manual.texi:
  Changelog
mysql-test/r/join.result:
  Test for bugfix
mysql-test/t/join.test:
  Test for bugfix
sql/sql_select.cc:
  Fixed problem with t1 LEFT_JOIN t2 ... WHERE t2.date_column IS NULL when date_column was declared as NOT NULL.
BitKeeper/etc/ignore:
  Added bdb/include/db_ext.h bdb/include/mutex_ext.h to the ignore list
parent b2cec26d
...@@ -303,3 +303,5 @@ support-files/mysql.server ...@@ -303,3 +303,5 @@ support-files/mysql.server
support-files/mysql.spec support-files/mysql.spec
tags tags
tmp/* tmp/*
bdb/include/db_ext.h
bdb/include/mutex_ext.h
...@@ -48,7 +48,7 @@ fast_cflags="-O3 -fno-omit-frame-pointer" ...@@ -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 # this is one is for someone who thinks 1% speedup is worth not being
# able to backtrace # able to backtrace
reckless_cflags="-O3 -fomit-frame-pointer " 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" base_cxxflags="-felide-constructors -fno-exceptions -fno-rtti"
......
...@@ -46844,6 +46844,9 @@ not yet 100% confident in this code. ...@@ -46844,6 +46844,9 @@ not yet 100% confident in this code.
@appendixsubsec Changes in release 3.23.45 @appendixsubsec Changes in release 3.23.45
@itemize @bullet @itemize @bullet
@item @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. Fixed bug with BDB tables and keys on @code{BLOB}'s.
@item @item
Fixed bug in @code{MERGE} tables on OS with 32 bit file pointers. Fixed bug in @code{MERGE} tables on OS with 32 bit file pointers.
...@@ -22,3 +22,8 @@ a ...@@ -22,3 +22,8 @@ a
2 2
a a b a a b
2 2 3 2 2 3
d d
2001-08-01 NULL
0000-00-00 NULL
d
0000-00-00
...@@ -106,9 +106,17 @@ INSERT INTO t1 VALUES (1,1),(1,2),(1,3),(1,4),(1,5),(1,6),(1,7),(2,3); ...@@ -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 ( CREATE TABLE t2 (
a int(11) default NULL a int(11) default NULL
) TYPE=MyISAM; ) TYPE=MyISAM;
INSERT INTO t2 VALUES (2),(3); 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; 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; 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;
...@@ -3101,7 +3101,8 @@ remove_eq_conds(COND *cond,Item::cond_result *cond_value) ...@@ -3101,7 +3101,8 @@ remove_eq_conds(COND *cond,Item::cond_result *cond_value)
/* fix to replace 'NULL' dates with '0' (shreeve@uci.edu) */ /* fix to replace 'NULL' dates with '0' (shreeve@uci.edu) */
else if (((field->type() == FIELD_TYPE_DATE) || else if (((field->type() == FIELD_TYPE_DATE) ||
(field->type() == FIELD_TYPE_DATETIME)) && (field->type() == FIELD_TYPE_DATETIME)) &&
(field->flags & NOT_NULL_FLAG)) (field->flags & NOT_NULL_FLAG) &&
!field->table->maybe_null)
{ {
COND *new_cond; COND *new_cond;
if ((new_cond= new Item_func_eq(args[0],new Item_int("0", 0, 2)))) if ((new_cond= new Item_func_eq(args[0],new Item_int("0", 0, 2))))
......
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