Commit 1f5b00e0 authored by igor@rurik.mysql.com's avatar igor@rurik.mysql.com

Merge rurik.mysql.com:/home/igor/mysql-5.0

into  rurik.mysql.com:/home/igor/dev/mysql-5.0-2
parents 842f31ab 90f22704
...@@ -2649,3 +2649,14 @@ ldt ...@@ -2649,3 +2649,14 @@ ldt
2006-01-01 03:00:00 2006-01-01 03:00:00
drop view v1, v2; drop view v1, v2;
drop table t1; drop table t1;
CREATE TABLE t1 (id int NOT NULL PRIMARY KEY, d datetime);
CREATE VIEW v1 AS
SELECT id, date(d) + INTERVAL TIME_TO_SEC(d) SECOND AS t, COUNT(*)
FROM t1 GROUP BY id, t;
SHOW CREATE VIEW v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`id` AS `id`,(cast(`t1`.`d` as date) + interval time_to_sec(`t1`.`d`) second) AS `t`,count(0) AS `COUNT(*)` from `t1` group by `t1`.`id`,(cast(`t1`.`d` as date) + interval time_to_sec(`t1`.`d`) second)
SELECT * FROM v1;
id t COUNT(*)
DROP VIEW v1;
DROP TABLE t1;
...@@ -2512,3 +2512,19 @@ create view v2 as select convert_tz(dt, 'UTC', 'Europe/Moscow') as ldt from v1; ...@@ -2512,3 +2512,19 @@ create view v2 as select convert_tz(dt, 'UTC', 'Europe/Moscow') as ldt from v1;
select * from v2; select * from v2;
drop view v1, v2; drop view v1, v2;
drop table t1; drop table t1;
#
# Bug #19490: usage of view specified by a query with GROUP BY
# an expression containing non-constant interval
CREATE TABLE t1 (id int NOT NULL PRIMARY KEY, d datetime);
CREATE VIEW v1 AS
SELECT id, date(d) + INTERVAL TIME_TO_SEC(d) SECOND AS t, COUNT(*)
FROM t1 GROUP BY id, t;
SHOW CREATE VIEW v1;
SELECT * FROM v1;
DROP VIEW v1;
DROP TABLE t1;
...@@ -2144,8 +2144,13 @@ bool Item_date_add_interval::eq(const Item *item, bool binary_cmp) const ...@@ -2144,8 +2144,13 @@ bool Item_date_add_interval::eq(const Item *item, bool binary_cmp) const
Item_date_add_interval *other= (Item_date_add_interval*) item; Item_date_add_interval *other= (Item_date_add_interval*) item;
if ((int_type != other->int_type) || if ((int_type != other->int_type) ||
(!args[0]->eq(other->args[0], binary_cmp)) || (!args[0]->eq(other->args[0], binary_cmp)))
(get_interval_value(args[1], int_type, &val, &interval))) return FALSE;
if (!args[1]->const_item() || !other->args[1]->const_item())
return (args[1]->eq(other->args[1], binary_cmp));
if (get_interval_value(args[1], int_type, &val, &interval))
return FALSE; return FALSE;
val= other->value; val= other->value;
......
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