Commit 7cd9af69 authored by Olivier Bertrand's avatar Olivier Bertrand

Fix MDEV-8926

  modified:   storage/connect/ha_connect.cc
  modified:   storage/connect/mysql-test/connect/r/datest.result
  modified:   storage/connect/mysql-test/connect/t/datest.test
parent 100be0b6
......@@ -2529,6 +2529,17 @@ PFIL ha_connect::CondFilter(PGLOBAL g, Item *cond)
!(colp[i]= tdbp->ColDB(g, (PSZ)pField->field->field_name, 0)))
return NULL; // Column does not belong to this table
// These are not yet implemented (buggy)
switch (pField->field->type()) {
case MYSQL_TYPE_TIMESTAMP:
case MYSQL_TYPE_DATE:
case MYSQL_TYPE_TIME:
case MYSQL_TYPE_DATETIME:
case MYSQL_TYPE_YEAR:
case MYSQL_TYPE_NEWDATE:
return NULL;
} // endswitch type
if (trace) {
htrc("Field index=%d\n", pField->field->field_index);
htrc("Field name=%s\n", pField->field->field_name);
......
......@@ -30,3 +30,30 @@ SELECT id, TIME(tim) FROM t1 LIMIT 1;
id TIME(tim)
1 09:35:08.000000
DROP TABLE t1;
#
# Testing use of dates in where clause (MDEV-8926)
#
CREATE TABLE t1 (col1 DATE) ENGINE=CONNECT TABLE_TYPE=CSV;
Warnings:
Warning 1105 No file name. Table will use t1.csv
INSERT INTO t1 VALUES('2015-01-01'),('2015-02-01'),('2015-03-01'),('2015-04-01');
SELECT * FROM t1 WHERE col1 = '2015-02-01';
col1
2015-02-01
SELECT * FROM t1 WHERE col1 > '2015-02-01';
col1
2015-03-01
2015-04-01
SELECT * FROM t1 WHERE col1 >= '2015-02-01';
col1
2015-02-01
2015-03-01
2015-04-01
SELECT * FROM t1 WHERE col1 < '2015-02-01';
col1
2015-01-01
SELECT * FROM t1 WHERE col1 <= '2015-02-01';
col1
2015-01-01
2015-02-01
DROP TABLE t1;
......@@ -14,3 +14,15 @@ SELECT id, DAYNAME(dat) FROM t1;
SELECT id, DAYNAME(datim) FROM t1 LIMIT 1;
SELECT id, TIME(tim) FROM t1 LIMIT 1;
DROP TABLE t1;
--echo #
--echo # Testing use of dates in where clause (MDEV-8926)
--echo #
CREATE TABLE t1 (col1 DATE) ENGINE=CONNECT TABLE_TYPE=CSV;
INSERT INTO t1 VALUES('2015-01-01'),('2015-02-01'),('2015-03-01'),('2015-04-01');
SELECT * FROM t1 WHERE col1 = '2015-02-01';
SELECT * FROM t1 WHERE col1 > '2015-02-01';
SELECT * FROM t1 WHERE col1 >= '2015-02-01';
SELECT * FROM t1 WHERE col1 < '2015-02-01';
SELECT * FROM t1 WHERE col1 <= '2015-02-01';
DROP TABLE t1;
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