Skip to content

Cherry-pick: Encode duration as bigint for pgx simple protocol (#10529)#10557

Open
fretz12 wants to merge 2 commits into
release/v1.31.xfrom
fredtzeng/cherry-10529
Open

Cherry-pick: Encode duration as bigint for pgx simple protocol (#10529)#10557
fretz12 wants to merge 2 commits into
release/v1.31.xfrom
fredtzeng/cherry-10529

Conversation

@fretz12
Copy link
Copy Markdown
Contributor

@fretz12 fretz12 commented Jun 5, 2026

Backport of #10529 to release/v1.31.x for the v1.31.1 patch.

## What changed?
Remap `time.Duration` to Postgres int8 (bigint) on pgx connections.

## Why?
See #10514. By default pgx
encodes time.Duration as an interval (e.g. 00:00:05). Currently, there
is a single Duration column VisibilityRow execution_duration which is
written as a BigInt. Under the simple query protocol (PgBouncer
transaction pooling) the write is rejected with invalid input syntax for
type bigint. int8 sends the underlying int64 nanosecond count instead.

## How did you test it?
- [X] built
- [X] run locally and tested manually
- [ ] covered by existing tests
- [ ] added new unit test(s)
- [X] added new functional test(s)

## Potential risks
The time.Duration → int8 mapping is changed for pgx driver, so not
scoped to simple protocol. This should be fine, as tests exercise it
with existing asserts and new `s.Equal(req.ExecutionDuration,
resp.GetExecutionDuration().AsDuration())`

---------

Co-authored-by: rodrigozhou <rodrigo.zhou@temporal.io>
(cherry picked from commit 3c7e505)
@fretz12 fretz12 requested review from a team June 5, 2026 18:10
@fretz12 fretz12 requested review from a team as code owners June 5, 2026 18:10
@fretz12 fretz12 requested a review from simvlad June 5, 2026 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants