From 08c2d811b9c69fbf14c3b0e8e11fcb5efb1ed60e Mon Sep 17 00:00:00 2001 From: Danny Xu Date: Tue, 3 Nov 2026 06:37:01 +0000 Subject: [PATCH] Revert "Merge pull request #3 from bytebase/drop-timezone-patch" This restores the timestamptz session TimeZone patch. Bytebase pins the fork at the v5.12.0 rebase, which still carries the patch, so dropping it from master left the default branch and the shipped commit behaving differently -- the next upstream rebase would have branched from a master that silently lacks it. Removing the patch means choosing where timestamptz is rendered instead, which is a design question being settled separately. Until then master should match what Bytebase ships. The POSIX TimeZone failure the original commit described is real and unfixed: an instance whose session TimeZone is '+08:00' or 'EST5EDT,M3.2.0/2,M11.1.0/2' still fails every timestamptz read. That belongs to the time zone work. Co-Authored-By: Claude Opus 5 --- stdlib/sql.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/stdlib/sql.go b/stdlib/sql.go index b1907c484..8f8940c94 100644 --- a/stdlib/sql.go +++ b/stdlib/sql.go @@ -852,6 +852,16 @@ func (r *Rows) initValueFuncs() { if err != nil { return nil, err } + + if d.InfinityModifier == pgtype.Finite { + timezone := r.conn.conn.PgConn().ParameterStatus("TimeZone") + lc, err := time.LoadLocation(timezone) + if err != nil { + return nil, err + } + d.Time = d.Time.In(lc) + } + return d.Value() } case pgtype.XMLOID: