-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Conversation
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 |
There was a problem hiding this 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:
cockroach/pkg/sql/sem/tree/datum.go
Line 2569 in 695a2d6
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
There was a problem hiding this 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.
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?
it doesn't show correctly in CLI, i was wondering about that. thanks for the pointer, i will add that to this PR |
i don't know unfortunately. it's tricky to fix, and i think why i avoided it. |
RFAL on the cli change. i made it also account for #64760 |
tftr! bors r=otan |
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.
bors r=otan |
Build succeeded: |
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 thanInf
now.