TIME column manipulation/comparison hangups

Поиск
Список
Период
Сортировка
От Bill Moran
Тема TIME column manipulation/comparison hangups
Дата
Msg-id 20081103140118.72d55ca9.wmoran@collaborativefusion.com
обсуждение исходный текст
Ответы Re: TIME column manipulation/comparison hangups  (Raymond O'Donnell <rod@iol.ie>)
Re: TIME column manipulation/comparison hangups  ("Scott Marlowe" <scott.marlowe@gmail.com>)
Список pgsql-general
I'm trying to test the time in a time column to see if it's the same
minute as the current time.  I wouldn't have thought this would be
difficult:

WHERE TO_CHAR(now(), 'HH24MI') = TO_CHAR(time_column, 'HH24MI')

Doesn't work, though:
ERROR:  function to_char(time with time zone, unknown) does not exist

So, I tried to force it:
WHERE TO_CHAR(now(), 'HH24MI') = TO_CHAR(time_column::TIMESTAMP WITH TIME ZONE, 'HH24MI')

Which led to an invalid cast.  I also tried using date_trunc() with no
success.  It seems as if EXTRACT() will work, but it sure feels hacky
to do:

(extract(hours from now()) = extract(hours from time_column)
 AND
 (extract(minutes from now()) = extract(minutes from time_column)

Am I missing something obvious?  Anyone have any better methods for
doing this?  I'm working on 8.3.

--
Bill Moran
Collaborative Fusion Inc.
http://people.collaborativefusion.com/~wmoran/

wmoran@collaborativefusion.com
Phone: 412-422-3463x4023

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

Предыдущее
От: Jason Long
Дата:
Сообщение: Debugging infrequent pegged out CPU usage
Следующее
От: Raymond O'Donnell
Дата:
Сообщение: Re: TIME column manipulation/comparison hangups