Commit fea67e68 authored by igor@olga.mysql.com's avatar igor@olga.mysql.com
Browse files

Merge olga.mysql.com:/home/igor/dev-opt/mysql-4.1-opt-bug28272

into  olga.mysql.com:/home/igor/dev-opt/mysql-5.0-opt-bug28272
parents 22dfb9f0 268be068
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -144,6 +144,27 @@ SELECT * FROM t1;
c1	cnt
1a	2
DROP TABLE t1;
CREATE TABLE t1 (
a1 decimal(10,0) DEFAULT NULL,
a2 blob,
a3 time DEFAULT NULL,
a4 blob,
a5 char(175) DEFAULT NULL,
a6 timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
a7 tinyblob,
INDEX idx (a6,a7(239),a5)
) ENGINE=InnoDB;
EXPLAIN SELECT a4 FROM t1 WHERE
a6=NULL AND
a4='UNcT5pIde4I6c2SheTo4gt92OV1jgJCVkXmzyf325R1DwLURkbYHwhydANIZMbKTgdcR5xS';
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE noticed after reading const tables
EXPLAIN SELECT t1.a4 FROM t1, t1 t WHERE
t.a6=t.a6 AND t1.a6=NULL AND
t1.a4='UNcT5pIde4I6c2SheTo4gt92OV1jgJCVkXmzyf325R1DwLURkbYHwhydANIZMbKTgdcR5xS';
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE noticed after reading const tables
DROP TABLE t1;
End of 4.1 tests
create table t1m (a int) engine=myisam;
create table t1i (a int) engine=innodb;
+25 −0
Original line number Diff line number Diff line
@@ -169,6 +169,31 @@ INSERT INTO t1 (c1) VALUES ('1b') ON DUPLICATE KEY UPDATE cnt=cnt+1;
SELECT * FROM t1;
DROP TABLE t1;

#
# Bug #28272: EXPLAIN for SELECT from an empty InnoDB table
#

CREATE TABLE t1 (
  a1 decimal(10,0) DEFAULT NULL,
  a2 blob,
  a3 time DEFAULT NULL,
  a4 blob,
  a5 char(175) DEFAULT NULL,
  a6 timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  a7 tinyblob,
  INDEX idx (a6,a7(239),a5)
) ENGINE=InnoDB;

EXPLAIN SELECT a4 FROM t1 WHERE
a6=NULL AND
a4='UNcT5pIde4I6c2SheTo4gt92OV1jgJCVkXmzyf325R1DwLURkbYHwhydANIZMbKTgdcR5xS';

EXPLAIN SELECT t1.a4 FROM t1, t1 t WHERE
t.a6=t.a6 AND t1.a6=NULL AND
t1.a4='UNcT5pIde4I6c2SheTo4gt92OV1jgJCVkXmzyf325R1DwLURkbYHwhydANIZMbKTgdcR5xS';

DROP TABLE t1;

--echo End of 4.1 tests
#
# Bug #12882  	min/max inconsistent on empty table
+6 −0
Original line number Diff line number Diff line
@@ -976,6 +976,12 @@ JOIN::optimize()
    }
  }

  if (conds &&!outer_join && const_table_map != found_const_table_map && 
      (select_options & SELECT_DESCRIBE) &&
      select_lex->master_unit() == &thd->lex->unit) // upper level SELECT
  {
    conds=new Item_int((longlong) 0,1);	// Always false
  }
  if (make_join_select(this, select, conds))
  {
    zero_result_cause=