I've just updated Sequel from 5.21.0 to 5.30.0 and now can't read a row
that includes a timestamp value when application_timezone is set to :local.
Here's an illustration using this test table:
Table "public.test_time"
Column | Type | Modifiers
-----------+--------------------------+--------------------------------------------------------
id | integer | not null default
nextval('test_time_id_seq'::regclass)
some_text | character varying(255) | not null
some_time | timestamp with time zone | not null
Indexes:
"test_time_pkey" PRIMARY KEY, btree (id)
$ pry
[1] pry(main)> require 'sequel'
=> true
[2] pry(main)> require 'pg'
=> true
[3] pry(main)> DB = Sequel.connect(db_path)
=> #<Sequel::Postgres::Database: "xxx">
[4] pry(main)> DB[:test_time].insert(some_text: 'first', some_time:
Time.now)
=> 1
[5] pry(main)> DB[:test_time].all
=> [{:id=>1, :some_text=>"first", :some_time=>2020-03-22 08:24:22 +0200}]
[6] pry(main)> Sequel.application_timezone = :local
=> :local
[7] pry(main)> Sequel.database_timezone = :utc
=> :utc
[8] pry(main)> DB[:test_time].insert(some_text: 'second', some_time:
Time.now)
=> 2
[9] pry(main)> DB[:test_time].where(id: 2).first
NoMethodError: undefined method `local' for 2020-03-22 08:25:22 +0200:Time
Did you mean? localtime
from
/home/james/.gem/ruby/2.5.5/gems/sequel-5.30.0/lib/sequel/adapters/postgres.rb:614:in
`yield_hash_rows'
Using Sequel 5.30.0, pg 1.2.3, ruby 2.5.5, postgresql 9.5.19, Ubuntu
16.04, timezone SAST (+2hr).
$ timedatectl
Local time: Sun 2020-03-22 08:44:14 SAST
Universal time: Sun 2020-03-22 06:44:14 UTC
RTC time: Sun 2020-03-22 06:44:14
Time zone: Africa/Johannesburg (SAST, +0200)
Network time on: yes
NTP synchronized: yes
RTC in local TZ: no
Any insight would be appreciated.
James
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/sequel-talk/3b133576-d9ba-1a26-cbda-a30390adc991%40telkomsa.net.