timetz storage vs timestamptz
timetz storage vs timestamptz
От:
"Jim C. Nasby" <jim@nasby.net>
Дата:
Why is it timestamptz can store a date and time to 1 microsecond in 8 bytes but a timetz needs 12 to store just the time to 1 microsecond? -- Jim Nasby jim@nasby.net EnterpriseDB http://enterprisedb.com 512.569.9461 (cell)
Re: timetz storage vs timestamptz
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
"Jim C. Nasby" writes: > Why is it timestamptz can store a date and time to 1 microsecond in 8 > bytes but a timetz needs 12 to store just the time to 1 microsecond? It's tracking the timezone explicitly ... something that timestamptz really ought to do too. regards, tom lane
Re: timetz storage vs timestamptz
От:
Jim Nasby <jimn@enterprisedb.com>
Дата:
On Oct 3, 2006, at 5:32 PM, Tom Lane wrote: > "Jim C. Nasby" writes: >> Why is it timestamptz can store a date and time to 1 microsecond in 8 >> bytes but a timetz needs 12 to store just the time to 1 microsecond? > > It's tracking the timezone explicitly ... something that timestamptz > really ought to do too. Wow, the docs are totally unclear on that. I believe that explains bug 2661. Yes, it would be nice to store the timezone in timestamptz or an equivalent, but there's also a use for the current behavior. In many cases, you don't care what the original timezone was; you just want to make sure that everything is getting stored in UTC (and then converted to your local timezone on the way back out). I'm thinking time[stamp], time[stamp]tz (which should do what timetz does), and time[stamp]utc (doing what timestamptz does). In the meantime I'll try and clarify the docs on this. -- Jim Nasby jimn@enterprisedb.com EnterpriseDB http://enterprisedb.com 512.569.9461 (cell)