Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pgwire: only show TZ minutes offset if non-zero #65063

Merged
merged 2 commits into from
May 17, 2021

Conversation

rafiss
Copy link
Collaborator

@rafiss rafiss commented May 12, 2021

Similar to #57265, this commit matches the PG behavior to
only show the minutes offset if it is non-zero.

Release note (bug fix): Minute timezone offsets are only displayed in
the wire protocol if they are non-zero for TimestampTZ and TimeTZ values.
Previously, they would always display.

Release note (bug fix): Binary TimeTZ values were not being decoded
correctly when being sent as a parameter in the wire protocol. This
is now fixed.

Release note (cli change): The SQL shell now formats times with time
zones so that the minutes and seconds offsets are only shown if they are
non-zero. Also, infinite floating point values are formatted as
Infinity rather than Inf now.

@rafiss rafiss requested review from otan and a team May 12, 2021 15:19
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@rafiss
Copy link
Collaborator Author

rafiss commented May 12, 2021

Next question -- should we also update the timestamptz->string and timetz->string casts so that they only show the minutes offset if non-zero? That is the Postgres behavior and also that's how we treat the seconds offset already. Downside is that maybe it's too backwards-incompatible. @otan curious on your thoughts

Copy link
Contributor

@otan otan left a comment

Choose a reason for hiding this comment

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

yeah backwards compatibility is hard - you could do this with a cluster setting, off by default in v21.1 -> v21.2 but on by default for new v21.2 clusters.

the change would have to be made here:

ctx.WriteString(d.Time.Format(timestampTZOutputFormat))

does this work correctly on the CLI side? I think you also need to do something with lib/pq a la #62310

Copy link
Contributor

@otan otan left a comment

Choose a reason for hiding this comment

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

change as is LGTM

Similar to cockroachdb#57265, this commit matches the PG behavior to
only show the minutes offset if it is non-zero.

Release note (bug fix): Minute timezone offsets are only displayed in
the wire protocol if they are non-zero for TimestampTZ and TimeTZ values.
Previously, they would always display.

Release note (bug fix): Binary TimeTZ values were not being decoded
correctly when being sent as a parameter in the wire protocol. This
is now fixed.
@rafiss
Copy link
Collaborator Author

rafiss commented May 12, 2021

yeah backwards compatibility is hard - you could do this with a cluster setting, off by default in v21.1 -> v21.2 but on by default for new v21.2 clusters.
the change would have to be made here:

yeah i already had the change ready to go, but just wasn't sure about compatibility. i'll look into the cluster setting idea in a different PR -- is there already a thing we do to control default values for upgrades versus new clusters?

does this work correctly on the CLI side? I think you also need to do something with lib/pq a la #62310

it doesn't show correctly in CLI, i was wondering about that. thanks for the pointer, i will add that to this PR

@otan
Copy link
Contributor

otan commented May 12, 2021

yeah i already had the change ready to go, but just wasn't sure about compatibility. i'll look into the cluster setting idea in a different PR -- is there already a thing we do to control default values for upgrades versus new clusters?

i don't know unfortunately. it's tricky to fix, and i think why i avoided it.

@rafiss rafiss requested a review from a team as a code owner May 13, 2021 00:14
@rafiss rafiss requested a review from otan May 13, 2021 00:14
@rafiss
Copy link
Collaborator Author

rafiss commented May 13, 2021

RFAL on the cli change. i made it also account for #64760

@rafiss
Copy link
Collaborator Author

rafiss commented May 13, 2021

tftr!

bors r=otan

@craig
Copy link
Contributor

craig bot commented May 13, 2021

Build failed:

Release note (cli change): The SQL shell now formats times with time
zones so that the minutes and seconds offsets are only shown if they are
non-zero. Also, infinite floating point values are formatted as
`Infinity` rather than `Inf` now.
@rafiss
Copy link
Collaborator Author

rafiss commented May 17, 2021

bors r=otan

@craig
Copy link
Contributor

craig bot commented May 17, 2021

Build succeeded:

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.

3 participants