Re: Query not producing expected result

Поиск
Список
Период
Сортировка
От Adrian Klaver
Тема Re: Query not producing expected result
Дата
Msg-id 27a5b2e7-9e84-ab43-68a3-d5009e5815a0@aklaver.com
обсуждение исходный текст
Ответ на Re: Query not producing expected result  (Chuck Martin <clmartin@theombudsman.com>)
Ответы Re: Query not producing expected result
Список pgsql-general
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@aklaver.com



В списке pgsql-general по дате отправления:

Предыдущее
От: Francisco Olarte
Дата:
Сообщение: Re: Query not producing expected result
Следующее
От: Francisco Olarte
Дата:
Сообщение: Re: Query not producing expected result