You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Table "public.foobars"
Column | Type | Collation | Nullable | Default
--------------------------------------------------------+-----------------------------+-----------+----------+--------------------------------------------------
id | integer | | not null | nextval('foobars_id_seq'::regclass)
created_at | timestamp without time zone | | |
updated_at | timestamp without time zone | | |
When prepared statements are turned on and a record is inserted into the database, the active record debug log shows the correct UTC timestamp with an offset of +00:00.
However the inserted record takes my current offset (MDT -6:00) and applies it to the record, saving the incorrect time.
app_development=# select * from foobars;-[ RECORD 1 ]------------------------------------------+-----------------------------------------
created_at | 2021-10-0813:13:14.411114
updated_at | 2021-10-0813:13:14.411256
Turning off prepared statements solves this problem.
The text was updated successfully, but these errors were encountered:
skunkworker
changed the title
Time zone offset being subtracted from timestamp when inserting into timestamp without time zone field while using prepared statements true
Time zone offset being subtracted from utc timestamp when inserting into column while using prepared statements
Oct 8, 2021
Looking into this more, the current timezone in my postgres instance is America/Denver. But once again, MRI does not have this issue using the pg adapter but JRuby does.
psql (13.4)
Type "help" for help.
testdb=# show timezone;
TimeZone
----------------
America/Denver
(1 row)
I suspect this isn't a commonly run into issue, because most if not all production databases would be running on a host in UTC time and postgres set to UTC.
jruby 9.2.19.0
onopenjdk8
When prepared statements are turned on and a record is inserted into the database, the active record debug log shows the correct UTC timestamp with an offset of
+00:00
.However the inserted record takes my current offset (
MDT -6:00
) and applies it to the record, saving the incorrect time.Turning off prepared statements solves this problem.
The text was updated successfully, but these errors were encountered: