-
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
sql: add a hint for timestamptz -> string error #66454
Conversation
pkg/sql/sem/tree/type_check.go
Outdated
|
||
case fromFamily == types.TimestampTZFamily && toFamily == types.StringFamily: | ||
err = errors.WithHint(err, "TIMESTAMPTZ to STRING casts depend on the current timezone; "+ | ||
"consider using (t AT TIME ZONE 'UTC')::STRING instead.") |
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.
should we add
case fromFamily == types.TimestampTZFamily && toFamily == types.TimestampFamily:
too?
c7df879
to
07c8bcc
Compare
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.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @otan)
pkg/sql/sem/tree/type_check.go, line 515 at r1 (raw file):
Previously, otan (Oliver Tan) wrote…
should we add
case fromFamily == types.TimestampTZFamily && toFamily == types.TimestampFamily:
too?
Great idea. I refactored the code a bit to make this cleaner, the hint is now stored in the cast struct.
This adds hint to the error that you get if you try to cast a TIMESTAMPTZ to TIMESTAMP or STRING in a computed column expression. Release note: None
07c8bcc
to
2defc06
Compare
bors r+ |
Build succeeded: |
This adds a hint to the error that you get if you try to cast a
TIMESTAMPTZ to STRING in a computed column expression. It mentions a
workaround where you first convert to a timestamp using a specific
timezone.
Release note: None