Skip to content

Conversation

@jsilvela
Copy link

Closes #167

Avoid the trailing Z in RFC3339 / ISO 8601 in UTC zone, which does not play as a recovery target time.

@jsilvela jsilvela requested a review from a team as a code owner October 29, 2025 16:25
@jsilvela jsilvela changed the title fix: avoid trailing Z when converting RFC3339 timestamps for postgres fix: avoid trailing Z when converting RFC3339 timestamps in UTC for postgres Oct 29, 2025
// to avoid problems when used for recovery_target_time
func ConvertToPostgresFormat(timestamp string) string {
formatWithoutZ := func(t time.Time) string {
formatted := t.Format("2006-01-02 15:04:05.000000Z07:00")
Copy link
Author

@jsilvela jsilvela Oct 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here, questions. In the ParseTargetTime function in pkg/types/time.go , we make use of pq.ParseTimestamp().

Why not use pq.FormatTimestamp() here, regardless of input formats?
Moreover, why not validate the input in this function? We validated RFC3339 and RFC3339Micro, but standalone, this function, given "foo", will assume it's a valid timestamp and just return it.

@jsilvela
Copy link
Author

There is an E2E test exercising the conversion function: cloudnative-pg/cloudnative-pg#8981

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.

[BUG]: timestamp conversion for recovery target is not valid for UTC times

2 participants