Re: Time problem again?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Time problem again?
Дата
Msg-id 2729.1064864305@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Time problem again?  (Bjørn T Johansen <btj@havleik.no>)
Ответы Re: Time problem again?  (Bjørn T Johansen <btj@havleik.no>)
Список pgsql-general
=?ISO-8859-1?Q?Bj=F8rn?= T Johansen <btj@havleik.no> writes:
> But that was my initial question, "As far as I can tell, there is no way
> to solve this without also supplying a date or am I missing something?"

You could possibly do it without, using some logic like this:
1. compute MAX(time) - MIN(time)
2. if less than 12 hours, assume no midnight wraparound, sort by
   straight time.
3. if more than 12 hours, assume a wraparound, sort accordingly.

But it seems a heck of a lot easier and less error-prone to store
a full timestamp instead.  What's your motivation for storing only
time, anyway?  Not space savings --- the time and timestamp types
are both 8 bytes in PG.

            regards, tom lane

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

Предыдущее
От: Bjørn T Johansen
Дата:
Сообщение: Re: Time problem again?
Следующее
От: "scott.marlowe"
Дата:
Сообщение: Re: [SQL] Result set granularity..