Hello, 

I have a model that has a field `created_at` that is of type timestamp 
without timezone in Postgres. All of the relevant timezone settings are set 
to `:local`. We are in PST (-8) and PDT (-7). 

I am running into an issue that I believe stems from `pg_sequel` that 
results in an ambiguous (during the hour where daylight savings ends) time 
value in Ruby flip-flopping between the -7 and -8 timezones. 

Observe the behaviour here:
*Model**[132639966].changed_at => 2021-11-07 01:35:44.443726 -0700 *
Model[150890643].changed_at => 2022-02-21 08:22:37.146317 -0800
*Model**[132639966].changed_at => 2021-11-07 01:35:44.443726 -0800*
Model.first.changed_at => 2021-03-23 08:36:22.655691 -0700 
*Model**[132639966].changed_at 
=> 2021-11-07 01:35:44.443726 -0700*

It appears that whether the -7 or -8 appears depends on the last 
encountered value (see the previous lines). Repeating any of the bold lines 
sequentially yields the same result, but running any of the non-bolded 
lines immediately changes the bold lines' outputs to match the timezone of 
the non-bolded lines.

I believe the source of this is pg_sequel since patching the vanilla 
`fetch_rows_set_cols` and `yield_hash_rows` results in consistent behaviour 
(always -8)
*Model[132639966].changed_at => 2021-11-07 01:35:44.443726 -0800*
Model[150890643].changed_at => 2022-02-21 08:22:37.146317 -0800
*Model**[132639966].changed_at => 2021-11-07 01:35:44.443726 -0800*
Model.first.changed_at => 2021-03-23 08:36:22.655691 -0700
*Model**[132639966].changed_at => 2021-11-07 01:35:44.443726 -0800*

 I tried looking at the source code for handling timestamp columns in the c 
code but can't figure it out.

Best,
Charlie

-- 
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/1de34cdf-8bf5-4484-b710-9e7c16bc8212n%40googlegroups.com.

Reply via email to