diff --git a/CHANGELOG.md b/CHANGELOG.md index b473e497b44265663f7aa1cc203e9d9f5ac7ae07..2173c48d169d9e5c04b1acca19108fe8afb5e073 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Deprecated ### + ### Removed ### * unused procedures: @@ -46,6 +47,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed ### +* Fixed the `>=` and `<=` operators for comparisons in POV query filters with + stored DATE values. The fix makes the implementation consistent + However, the current definition and implementation of the + `>=` and `<=` operators for date and datetime is unintuitive and the operators + should have another name. Something like "overlap with or smaller/greater + than". * Semi-fix in `retrieveEntityParents`. The old implementation was buggy and would return no parent name or even a wrong one for old entity versions in some cases. The semi-fix will allways return the current name of the parent diff --git a/procedures/query/getDateTimeWhereClause.sql b/procedures/query/getDateTimeWhereClause.sql index e6edae6840ab5148de2c170822e35c26bfa92500..7fb9c7708b7689b8ad83c77c5f901f5bc20da4e9 100644 --- a/procedures/query/getDateTimeWhereClause.sql +++ b/procedures/query/getDateTimeWhereClause.sql @@ -85,7 +85,14 @@ BEGIN RETURN CONCAT(" ", seconds_col, operator, vDateTimeSecLow, IF(vDateTimeNSLow IS NULL, '', CONCAT(' OR (',seconds_col,'=', vDateTimeSecLow, ' AND ',nanos_col, operator, vDateTimeNSLow, ')'))); ELSEIF operator = '>=' or operator = '<=' THEN - RETURN CONCAT(" ",seconds_col, operator, vDateTimeSecLow, IF(vDateTimeNSLow IS NULL, '', CONCAT(' AND (',seconds_col, operator_prefix, vDateTimeSecLow, ' OR ',nanos_col, operator, vDateTimeNSLow, ')'))); + RETURN CONCAT( + " ", seconds_col, operator, vDateTimeSecLow, + IF(vDateTimeNSLow IS NULL, + '', + CONCAT( + ' AND (', seconds_col, operator_prefix, vDateTimeSecLow, + ' OR ', nanos_col, operator, vDateTimeNSLow, + ' OR ', nanos_col, ' IS NULL)'))); ELSEIF operator = "(" THEN RETURN IF(vDateTimeNSLow IS NULL,CONCAT(" ",seconds_col,"=", vDateTimeSecLow),CONCAT(" ",seconds_col,"=",vDateTimeSecLow," AND ",nanos_col,"=",vDateTimeNSLow)); ELSEIF operator = "!(" THEN