Re: Time problem again?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bjørn T Johansen <btj(at)havleik(dot)no>
Cc: Richard Huxton <dev(at)archonet(dot)com>, Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Time problem again?
Date: 2003-09-29 19:38:25
Message-ID: 2729.1064864305@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

=?ISO-8859-1?Q?Bj=F8rn?= T Johansen <btj(at)havleik(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Molly Gibson 2003-09-29 19:42:20 Re: mod_auth_pgsql & encryption
Previous Message scott.marlowe 2003-09-29 19:33:24 Re: [SQL] Result set granularity..