On 5/1/19 10:37 AM, Chuck Martin wrote:
Something like daterange would be a solution in some circumstances, but
this query is a user-generated one, and they don't have that much
control over the query. It has to be modified as needed behind the
scenes so that it produces the results they expect. In this instance,
I'm now (given the advice received here) inclined to check the value
entered when searching for a date, and if no time is entered, add
'24:00' to the date.
I should have made it clearer, my suggestion was mostly directed at
Franciso's example.
Still:
select tsrange('2019-05-01', '2019-05-02') @> '2019-05-01 9:52'::timestamp;
?column?
----------
t
If you are modifying anyway:)
For this sort of thing, I have found range types to be a time and sanity
saver. Just throwing it out there.
Chuck Martin
Avondale Software
--
Adrian Klaver
adrian.klaver@xxxxxxxxxxx