mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Fixed bug #16069.
The function agg_cmp_type in item_cmpfunc.cc neglected the fact that the first argument in a BETWEEN/IN predicate could be a field of a view. As a result in the case when the retrieved table was hidden by a view over it and the arguments in the BETWEEN/IN predicates are of the date/time type the function did not perform conversion of the constant arguments to the same format as the first field argument. If formats of the arguments differed it caused wrong a evaluation of the predicates. mysql-test/r/view.result: Added a test case for bug #16069. mysql-test/t/view.test: Added a test case for bug #16069.
This commit is contained in:
@ -2579,3 +2579,24 @@ COUNT(*)
|
||||
2
|
||||
DROP VIEW v2;
|
||||
DROP TABLE t1, t2;
|
||||
CREATE TABLE t1 (id int NOT NULL PRIMARY KEY,
|
||||
td date DEFAULT NULL, KEY idx(td));
|
||||
INSERT INTO t1 VALUES
|
||||
(1, '2005-01-01'), (2, '2005-01-02'), (3, '2005-01-02'),
|
||||
(4, '2005-01-03'), (5, '2005-01-04'), (6, '2005-01-05'),
|
||||
(7, '2005-01-05'), (8, '2005-01-05'), (9, '2005-01-06');
|
||||
CREATE VIEW v1 AS SELECT * FROM t1;
|
||||
SELECT * FROM t1 WHERE td BETWEEN '2005.01.02' AND '2005.01.04';
|
||||
id td
|
||||
2 2005-01-02
|
||||
3 2005-01-02
|
||||
4 2005-01-03
|
||||
5 2005-01-04
|
||||
SELECT * FROM v1 WHERE td BETWEEN '2005.01.02' AND '2005.01.04';
|
||||
id td
|
||||
2 2005-01-02
|
||||
3 2005-01-02
|
||||
4 2005-01-03
|
||||
5 2005-01-04
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
|
Reference in New Issue
Block a user