merging fix

parent 2fcebef3
...@@ -459,6 +459,7 @@ id c counter ...@@ -459,6 +459,7 @@ id c counter
3 b 2 3 b 2
4 a 2 4 a 2
drop table t1; drop table t1;
End of 5.0 tests
CREATE TABLE t1 (a int, b int); CREATE TABLE t1 (a int, b int);
insert into t1 values (1,1),(1,2); insert into t1 values (1,1),(1,2);
CREATE TABLE t2 (primary key (a)) select * from t1; CREATE TABLE t2 (primary key (a)) select * from t1;
......
...@@ -847,19 +847,4 @@ select '^^: The above should be ~= 20 + cost(select * from t1). Value less than ...@@ -847,19 +847,4 @@ select '^^: The above should be ~= 20 + cost(select * from t1). Value less than
Z Z
^^: The above should be ~= 20 + cost(select * from t1). Value less than 20 is an error ^^: The above should be ~= 20 + cost(select * from t1). Value less than 20 is an error
drop table t1, t2; drop table t1, t2;
CREATE TABLE t1 (ID INTEGER, Name VARCHAR(50));
CREATE TABLE t2 (Test_ID INTEGER);
CREATE VIEW v1 (Test_ID, Description) AS SELECT ID, Name FROM t1;
CREATE TABLE tv1 SELECT Description AS Name FROM v1 JOIN t2
USING (Test_ID);
DESCRIBE tv1;
Field Type Null Key Default Extra
Name varchar(50) YES NULL
CREATE TABLE tv2 SELECT Description AS Name FROM v1 JOIN t2
ON v1.Test_ID = t2.Test_ID;
DESCRIBE tv2;
Field Type Null Key Default Extra
Name varchar(50) YES NULL
DROP VIEW v1;
DROP TABLE t1,t2,tv1,tv2;
End of 5.0 tests. End of 5.0 tests.
...@@ -4035,6 +4035,29 @@ FROM t1; ...@@ -4035,6 +4035,29 @@ FROM t1;
ERROR HY000: Invalid use of group function ERROR HY000: Invalid use of group function
DROP TABLE t1,t2; DROP TABLE t1,t2;
End of 5.0 tests. End of 5.0 tests.
CREATE TABLE t1 (a int, b int);
INSERT INTO t1 VALUES (2,22),(1,11),(2,22);
SELECT a FROM t1 WHERE (SELECT COUNT(b) FROM DUAL) > 0 GROUP BY a;
a
1
2
SELECT a FROM t1 WHERE (SELECT COUNT(b) FROM DUAL) > 1 GROUP BY a;
a
SELECT a FROM t1 t0
WHERE (SELECT COUNT(t0.b) FROM t1 t WHERE t.b>20) GROUP BY a;
a
1
2
SET @@sql_mode='ansi';
SELECT a FROM t1 WHERE (SELECT COUNT(b) FROM DUAL) > 0 GROUP BY a;
ERROR HY000: Invalid use of group function
SELECT a FROM t1 WHERE (SELECT COUNT(b) FROM DUAL) > 1 GROUP BY a;
ERROR HY000: Invalid use of group function
SELECT a FROM t1 t0
WHERE (SELECT COUNT(t0.b) FROM t1 t WHERE t.b>20) GROUP BY a;
ERROR HY000: Invalid use of group function
SET @@sql_mode=default;
DROP TABLE t1;
CREATE TABLE t1 (s1 char(1)); CREATE TABLE t1 (s1 char(1));
INSERT INTO t1 VALUES ('a'); INSERT INTO t1 VALUES ('a');
SELECT * FROM t1 WHERE _utf8'a' = ANY (SELECT s1 FROM t1); SELECT * FROM t1 WHERE _utf8'a' = ANY (SELECT s1 FROM t1);
......
...@@ -619,8 +619,9 @@ get_date_from_str(THD *thd, String *str, timestamp_type warn_type, ...@@ -619,8 +619,9 @@ get_date_from_str(THD *thd, String *str, timestamp_type warn_type,
if (error || *error_arg) if (error || *error_arg)
{ {
make_truncated_value_warning(thd, str->ptr(), str->length(), warn_type, make_truncated_value_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
warn_name); str->ptr(), str->length(),
warn_type, warn_name);
*error_arg= TRUE; *error_arg= TRUE;
} }
return value; return value;
......
...@@ -2056,7 +2056,30 @@ bool Item_date_add_interval::get_date(MYSQL_TIME *ltime, uint fuzzy_date) ...@@ -2056,7 +2056,30 @@ bool Item_date_add_interval::get_date(MYSQL_TIME *ltime, uint fuzzy_date)
if (date_sub_interval) if (date_sub_interval)
interval.neg = !interval.neg; interval.neg = !interval.neg;
return (null_value= date_add_interval(ltime, int_type, interval)); if ((null_value= date_add_interval(ltime, int_type, interval)))
return 1;
/* Adjust cached_field_type according to the detected type. */
if (cached_field_type == MYSQL_TYPE_STRING)
{
switch (ltime->time_type)
{
case MYSQL_TIMESTAMP_DATE:
cached_field_type= MYSQL_TYPE_DATE;
break;
case MYSQL_TIMESTAMP_DATETIME:
cached_field_type= MYSQL_TYPE_DATETIME;
break;
case MYSQL_TIMESTAMP_TIME:
cached_field_type= MYSQL_TYPE_TIME;
break;
default:
/* Shouldn't get here. */
DBUG_ASSERT(0);
break;
}
}
return 0;
} }
......
...@@ -860,8 +860,9 @@ bool date_add_interval(MYSQL_TIME *ltime, interval_type int_type, INTERVAL inter ...@@ -860,8 +860,9 @@ bool date_add_interval(MYSQL_TIME *ltime, interval_type int_type, INTERVAL inter
} }
break; break;
default: default:
return 1; goto null_date;
} }
return 0; // Ok return 0; // Ok
invalid_date: invalid_date:
...@@ -869,6 +870,7 @@ invalid_date: ...@@ -869,6 +870,7 @@ invalid_date:
ER_DATETIME_FUNCTION_OVERFLOW, ER_DATETIME_FUNCTION_OVERFLOW,
ER(ER_DATETIME_FUNCTION_OVERFLOW), ER(ER_DATETIME_FUNCTION_OVERFLOW),
"datetime"); "datetime");
null_date:
return 1; return 1;
} }
......
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