You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As BETWEEN is simply shorthand for val >= min AND val <= max, I would expect conversion to column types to be handled similarly. That is, the two queries above should generate functionally equivalent SQL like this:
SELECT `rowid`, `time` FROM `events` AS `Foo` WHERE (`Foo`.`time` >= '1970-01-01 00:00:00.000 +00:00' AND `Foo`.`time` <= '1970-01-01 00:00:00.010 +00:00');
SELECT `rowid`, `time` FROM `events` AS `Foo` WHERE `Foo`.`time` BETWEEN '1970-01-01 00:00:00.000 +00:00' AND '1970-01-01 00:00:00.010 +00:00';
What is actually happening?
The BETWEEN query fails to convert the min/max values to Date strings, instead injecting them as raw values:
SELECT `rowid`, `time` FROM `events` AS `Foo` WHERE (`Foo`.`time` >= '1970-01-01 00:00:00.000 +00:00' AND `Foo`.`time` <= '1970-01-01 00:00:00.010 +00:00');
SELECT `rowid`, `time` FROM `events` AS `Foo` WHERE `Foo`.`time` BETWEEN 0 AND 10;
What are you doing?
Querying a DataType.DATE column using Op.between.
What do you expect to happen?
As BETWEEN is simply shorthand for
val >= min AND val <= max
, I would expect conversion to column types to be handled similarly. That is, the two queries above should generate functionally equivalent SQL like this:What is actually happening?
The BETWEEN query fails to convert the min/max values to Date strings, instead injecting them as raw values:
Dialect: sqlite
Dialect version: XXX
Database version: 3.19.3 2017-06-27 16:48:08 2b0954060fe10d6de6d479287dd88890f1bef6cc1beca11bc6cdb79f72e2377b
Sequelize version: sequelize@5.1.0
Tested with latest release: Yes (5.1.0)
The text was updated successfully, but these errors were encountered: