下面是Postgres的查詢結果:爲什麼來自Ruby續集和Postgres psql的時區信息有所不同?
$ psql ... -c 'select the_date from foo where foo_id in (998,999)'
the_date
------------------------
2012-03-07 09:34:47.98
2012-03-16 11:31:25.336
the_date是 「無時區的時間戳」。
下面是一個Ruby程序:
#!/usr/bin/env ruby
require 'sequel'
@DB = Sequel.connect({...})
query = "select the_date from foo where foo_id in (998,999)"
@DB[query].each do |row|
warn row
end
和一些輸出:
{:the_date=>2012-03-07 09:34:47 -0600}
{:the_date=>2012-03-16 11:31:25 -0500}
在什麼地方來自-0500和-0600?這是服務器和客戶機(US/Central)的「Olson timezone」,但爲什麼Ruby添加它並且psql不?
我一直在讀the docs,我很困惑。
服務器是Postgres 9.0.4,客戶端是psql 9.1.4,續集是3.33.0。
您可能會發現在這[密切相關的問題](http://stackoverflow.com/q/9571392/939860)信息有用。 – 2012-08-01 23:24:59