Commit 48101c7f authored by mysqldev's avatar mysqldev

Auto merge fix for showstopper bug 39353 from mysql-5.0-5.1.29-rc branch

parents bed8cec4 bf09a809
...@@ -1836,7 +1836,13 @@ static uint get_table_structure(char *table, char *db, char *table_type, ...@@ -1836,7 +1836,13 @@ static uint get_table_structure(char *table, char *db, char *table_type,
fprintf(sql_file, ",\n %s %s", fprintf(sql_file, ",\n %s %s",
quote_name(row[0], name_buff, 0), row[1]); quote_name(row[0], name_buff, 0), row[1]);
} }
fprintf(sql_file, "\n) */;\n"); /*
Stand-in tables are always MyISAM tables as the default
engine might have a column-limit that's lower than the
number of columns in the view, and MyISAM support is
guaranteed to be in the server anyway.
*/
fprintf(sql_file, "\n) ENGINE=MyISAM */;\n");
check_io(sql_file); check_io(sql_file);
} }
} }
......
...@@ -90,4 +90,9 @@ Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1 ...@@ -90,4 +90,9 @@ Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1
Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1
Note 1003 select `test`.`t2`.`a` AS `a`,(select count(0) AS `COUNT(*)` from `test`.`t1` where ((`test`.`t1`.`b` = `test`.`t2`.`a`) and (concat(`test`.`t1`.`b`,`test`.`t1`.`c`) = concat(_latin1'0',`test`.`t2`.`a`,_latin1'01')))) AS `x` from `test`.`t2` order by `test`.`t2`.`a` Note 1003 select `test`.`t2`.`a` AS `a`,(select count(0) AS `COUNT(*)` from `test`.`t1` where ((`test`.`t1`.`b` = `test`.`t2`.`a`) and (concat(`test`.`t1`.`b`,`test`.`t1`.`c`) = concat(_latin1'0',`test`.`t2`.`a`,_latin1'01')))) AS `x` from `test`.`t2` order by `test`.`t2`.`a`
DROP TABLE t1,t2; DROP TABLE t1,t2;
CREATE TABLE t1 (a TIMESTAMP);
INSERT INTO t1 VALUES (NOW()),(NOW()),(NOW());
SELECT * FROM t1 WHERE a > '2008-01-01' AND a = '0000-00-00';
a
DROP TABLE t1;
End of 5.0 tests End of 5.0 tests
...@@ -1996,7 +1996,7 @@ DROP TABLE IF EXISTS `v2`; ...@@ -1996,7 +1996,7 @@ DROP TABLE IF EXISTS `v2`;
/*!50001 DROP VIEW IF EXISTS `v2`*/; /*!50001 DROP VIEW IF EXISTS `v2`*/;
/*!50001 CREATE TABLE `v2` ( /*!50001 CREATE TABLE `v2` (
`a` varchar(30) `a` varchar(30)
) */; ) ENGINE=MyISAM */;
/*!50001 DROP TABLE `v2`*/; /*!50001 DROP TABLE `v2`*/;
/*!50001 DROP VIEW IF EXISTS `v2`*/; /*!50001 DROP VIEW IF EXISTS `v2`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50001 CREATE ALGORITHM=UNDEFINED */
...@@ -2078,7 +2078,7 @@ DROP TABLE IF EXISTS `v1`; ...@@ -2078,7 +2078,7 @@ DROP TABLE IF EXISTS `v1`;
/*!50001 DROP VIEW IF EXISTS `v1`*/; /*!50001 DROP VIEW IF EXISTS `v1`*/;
/*!50001 CREATE TABLE `v1` ( /*!50001 CREATE TABLE `v1` (
`a` int(11) `a` int(11)
) */; ) ENGINE=MyISAM */;
/*!50001 DROP TABLE `v1`*/; /*!50001 DROP TABLE `v1`*/;
/*!50001 DROP VIEW IF EXISTS `v1`*/; /*!50001 DROP VIEW IF EXISTS `v1`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50001 CREATE ALGORITHM=UNDEFINED */
...@@ -2140,7 +2140,7 @@ DROP TABLE IF EXISTS `v2`; ...@@ -2140,7 +2140,7 @@ DROP TABLE IF EXISTS `v2`;
/*!50001 DROP VIEW IF EXISTS `v2`*/; /*!50001 DROP VIEW IF EXISTS `v2`*/;
/*!50001 CREATE TABLE `v2` ( /*!50001 CREATE TABLE `v2` (
`a` varchar(30) `a` varchar(30)
) */; ) ENGINE=MyISAM */;
/*!50001 DROP TABLE `v2`*/; /*!50001 DROP TABLE `v2`*/;
/*!50001 DROP VIEW IF EXISTS `v2`*/; /*!50001 DROP VIEW IF EXISTS `v2`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50001 CREATE ALGORITHM=UNDEFINED */
...@@ -2244,19 +2244,19 @@ DROP TABLE IF EXISTS `v1`; ...@@ -2244,19 +2244,19 @@ DROP TABLE IF EXISTS `v1`;
`a` int(11), `a` int(11),
`b` int(11), `b` int(11),
`c` varchar(30) `c` varchar(30)
) */; ) ENGINE=MyISAM */;
DROP TABLE IF EXISTS `v2`; DROP TABLE IF EXISTS `v2`;
/*!50001 DROP VIEW IF EXISTS `v2`*/; /*!50001 DROP VIEW IF EXISTS `v2`*/;
/*!50001 CREATE TABLE `v2` ( /*!50001 CREATE TABLE `v2` (
`a` int(11) `a` int(11)
) */; ) ENGINE=MyISAM */;
DROP TABLE IF EXISTS `v3`; DROP TABLE IF EXISTS `v3`;
/*!50001 DROP VIEW IF EXISTS `v3`*/; /*!50001 DROP VIEW IF EXISTS `v3`*/;
/*!50001 CREATE TABLE `v3` ( /*!50001 CREATE TABLE `v3` (
`a` int(11), `a` int(11),
`b` int(11), `b` int(11),
`c` varchar(30) `c` varchar(30)
) */; ) ENGINE=MyISAM */;
/*!50001 DROP TABLE `v1`*/; /*!50001 DROP TABLE `v1`*/;
/*!50001 DROP VIEW IF EXISTS `v1`*/; /*!50001 DROP VIEW IF EXISTS `v1`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50001 CREATE ALGORITHM=UNDEFINED */
...@@ -2860,21 +2860,21 @@ DROP TABLE IF EXISTS `v0`; ...@@ -2860,21 +2860,21 @@ DROP TABLE IF EXISTS `v0`;
`a` int(11), `a` int(11),
`b` varchar(32), `b` varchar(32),
`c` varchar(32) `c` varchar(32)
) */; ) ENGINE=MyISAM */;
DROP TABLE IF EXISTS `v1`; DROP TABLE IF EXISTS `v1`;
/*!50001 DROP VIEW IF EXISTS `v1`*/; /*!50001 DROP VIEW IF EXISTS `v1`*/;
/*!50001 CREATE TABLE `v1` ( /*!50001 CREATE TABLE `v1` (
`a` int(11), `a` int(11),
`b` varchar(32), `b` varchar(32),
`c` varchar(32) `c` varchar(32)
) */; ) ENGINE=MyISAM */;
DROP TABLE IF EXISTS `v2`; DROP TABLE IF EXISTS `v2`;
/*!50001 DROP VIEW IF EXISTS `v2`*/; /*!50001 DROP VIEW IF EXISTS `v2`*/;
/*!50001 CREATE TABLE `v2` ( /*!50001 CREATE TABLE `v2` (
`a` int(11), `a` int(11),
`b` varchar(32), `b` varchar(32),
`c` varchar(32) `c` varchar(32)
) */; ) ENGINE=MyISAM */;
USE `test`; USE `test`;
/*!50001 DROP TABLE `v0`*/; /*!50001 DROP TABLE `v0`*/;
...@@ -3198,7 +3198,7 @@ DROP TABLE IF EXISTS `v1`; ...@@ -3198,7 +3198,7 @@ DROP TABLE IF EXISTS `v1`;
/*!50001 DROP VIEW IF EXISTS `v1`*/; /*!50001 DROP VIEW IF EXISTS `v1`*/;
/*!50001 CREATE TABLE `v1` ( /*!50001 CREATE TABLE `v1` (
`id` int(11) `id` int(11)
) */; ) ENGINE=MyISAM */;
USE `mysqldump_test_db`; USE `mysqldump_test_db`;
/*!50001 DROP TABLE `v1`*/; /*!50001 DROP TABLE `v1`*/;
...@@ -3246,7 +3246,7 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqldump_views` /*!40100 DEFAULT CHAR ...@@ -3246,7 +3246,7 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqldump_views` /*!40100 DEFAULT CHAR
USE `mysqldump_views`; USE `mysqldump_views`;
/*!50001 CREATE TABLE `nasishnasifu` ( /*!50001 CREATE TABLE `nasishnasifu` (
`id` bigint(20) unsigned `id` bigint(20) unsigned
) */; ) ENGINE=MyISAM */;
USE `mysqldump_tables`; USE `mysqldump_tables`;
......
...@@ -76,4 +76,13 @@ FROM t2 ORDER BY a; ...@@ -76,4 +76,13 @@ FROM t2 ORDER BY a;
DROP TABLE t1,t2; DROP TABLE t1,t2;
#
# Bug #39353: Multiple conditions on timestamp column crashes server
#
CREATE TABLE t1 (a TIMESTAMP);
INSERT INTO t1 VALUES (NOW()),(NOW()),(NOW());
SELECT * FROM t1 WHERE a > '2008-01-01' AND a = '0000-00-00';
DROP TABLE t1;
--echo End of 5.0 tests --echo End of 5.0 tests
...@@ -4220,7 +4220,12 @@ Item *Item_field::equal_fields_propagator(byte *arg) ...@@ -4220,7 +4220,12 @@ Item *Item_field::equal_fields_propagator(byte *arg)
item= this; item= this;
else if (field && (field->flags & ZEROFILL_FLAG) && IS_NUM(field->type())) else if (field && (field->flags & ZEROFILL_FLAG) && IS_NUM(field->type()))
{ {
if (item && cmp_context != INT_RESULT) /*
We don't need to zero-fill timestamp columns here because they will be
first converted to a string (in date/time format) and compared as such if
compared with another string.
*/
if (item && field->type() != FIELD_TYPE_TIMESTAMP && cmp_context != INT_RESULT)
convert_zerofill_number_to_string(&item, (Field_num *)field); convert_zerofill_number_to_string(&item, (Field_num *)field);
else else
item= this; item= this;
......
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