Red Hat Bugzilla – Bug 1001883
Searching datetime fields with the 'is' operator does not return expected results
Last modified: 2018-02-05 19:41:31 EST
Description of problem:
Using the searchbar and searching for things via a datetime and using the 'is' operator does not return the expected results.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Search for something with a datetime (i.e System/LastInventoried)
2. use the 'is' operator
The systems that were inventoried on that date
I replicated this problem with MariaDB 5.5.31.
The problem is with comparing datetime values as strings.
This is the crucial part of the query:
system.date_lastcheckin >= "2013-08-28 00:00:00" AND system.date_lastcheckin <= "2013-08-29 23:59:99"
Specifically, the '<=' doesn't seem to work as we expect. Replacing it with the following, fixes the problem:
system.date_lastcheckin >= "2013-08-28 00:00:00" AND system.date_lastcheckin <= STR_TO_DATE('2013-08-28 23:59:59', '%Y-%m-%d %H:%i:%s')
This issue was fixed by the patch for bug 989902.
Verified that bug is fixed in beaker-server-0.15.0-0.rc1.git.8.85dcb9c.fc18.noarch.
- Prior to the bug being fixed, searching for 'SystemAdded' with the 'is' operator
returns nothing even though there is a system with that date.
- After the patch, the search works fine.
Beaker 0.15 has been released.