Skip to content

Drop the timestamptz session TimeZone patch - #3

Merged
d-bytebase merged 1 commit into
masterfrom
drop-timezone-patch
Nov 2, 2026
Merged

d-bytebase merged 1 commit into
masterfrom
drop-timezone-patch

Conversation

@d-bytebase

Copy link
Copy Markdown

The patch converted timestamptz values into the session TimeZone, calling time.LoadLocation on the name PostgreSQL reports and returning the error when that failed.

PostgreSQL accepts TimeZone settings that are not IANA names. Measured against PostgreSQL 17, every POSIX offset spec it accepts made a timestamptz read fail:

SET TimeZone     pg reports     timestamptz
+08:00           +08:00         ERR unknown time zone +08:00
-7               <-07>+07       ERR unknown time zone <-07>+07
GMT+8            GMT+8          ERR unknown time zone GMT+8
UTC+5            UTC+5          ERR unknown time zone UTC+5
8                <+08>-08       ERR unknown time zone <+08>-08
+5:30            +5:30          ERR unknown time zone +5:30
-03:30           -03:30         ERR unknown time zone -03:30

Every IANA name and tzdata alias worked, and timestamp and date were unaffected. The same matrix is identical on the pre-rebase fork, so this is not a regression from the v5.12.0 rebase.

The decoded instant was never wrong, only the location it was displayed in, so the conversion belongs in the caller, where a name Go cannot load can fall back to the offset the server reports. Those zones are fixed offsets with no DST, so a fixed zone is exact rather than an approximation. Bytebase does that in backend/plugin/db/pg/query.go and its redshift and cockroachdb siblings.

git diff v5.12.0 is now the two-line ColumnTypePrecisionScale patch and nothing else. go test ./stdlib/ passes against PostgreSQL 17.

🤖 Generated with Claude Code

The patch converted timestamptz values into the session TimeZone, calling
time.LoadLocation on the name PostgreSQL reports and returning the error when
that failed. PostgreSQL accepts TimeZone settings that are not IANA names --
'+08:00', 'GMT+8', '-7', reported back as POSIX specs such as '<-07>+07' -- so
for those sessions every timestamptz read failed with "unknown time zone"
instead of returning a row.

The decoded instant was never wrong, only the location it was displayed in, so
the conversion belongs in the caller, where a name Go cannot load can fall back
to the offset the server reports. Those zones are fixed offsets with no DST, so
a fixed zone is exact rather than an approximation.

ColumnTypePrecisionScale is now the fork's only patch.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@d-bytebase
d-bytebase merged commit a6d159d into master Nov 2, 2026
22 checks passed
d-bytebase added a commit to bytebase/bytebase that referenced this pull request Nov 2, 2026
bytebase/pgx#3 merged with a merge commit rather than a fast-forward, so the
fork's master moved past the commit this branch pinned. The trees are identical,
so the compiled code does not change; this only makes the pin name master's tip
instead of a commit on a merged feature branch.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant