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

sql: mark timezone(string, string) as VolatilityStable #48756

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions pkg/sql/sem/builtins/builtins.go
Original file line number Diff line number Diff line change
Expand Up @@ -2416,7 +2416,7 @@ may increase either contention or retry errors, or both.`,
return ts.EvalAtTimeZone(ctx, loc)
},
Info: "Convert given time stamp with time zone to the new time zone, with no time zone designation.",
Volatility: tree.VolatilityImmutable,
Volatility: tree.VolatilityStable,
},
tree.Overload{
Types: tree.ArgTypes{
Expand Down Expand Up @@ -2484,7 +2484,9 @@ may increase either contention or retry errors, or both.`,
durationDelta := time.Duration(-beforeOffsetSecs) * time.Second
return tree.NewDTimeTZ(timetz.MakeTimeTZFromTime(tTime.In(loc).Add(durationDelta))), nil
},
Info: "Treat given time without time zone as located in the specified time zone.",
Info: "Treat given time without time zone as located in the specified time zone.",
// TODO(mgartner): This overload might be stable, not volatile.
// See: https://github.com/cockroachdb/cockroach/pull/48756#issuecomment-627672686
Copy link
Contributor

Choose a reason for hiding this comment

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

this should fail

postgresVolatility, found := findOverloadVolatility(name, overload)
and you'll need to whitelist this difference from postgres.

Copy link
Contributor

Choose a reason for hiding this comment

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

(setting IgnoreVolatilityCheck: true should do it)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good to know. Thanks for the heads-up!

Volatility: tree.VolatilityVolatile,
},
tree.Overload{
Expand All @@ -2507,7 +2509,9 @@ may increase either contention or retry errors, or both.`,
tTime := tArg.TimeTZ.ToTime()
return tree.NewDTimeTZ(timetz.MakeTimeTZFromTime(tTime.In(loc))), nil
},
Info: "Convert given time with time zone to the new time zone.",
Info: "Convert given time with time zone to the new time zone.",
// TODO(mgartner): This overload might be stable, not volatile.
// See: https://github.com/cockroachdb/cockroach/pull/48756#issuecomment-627672686
Volatility: tree.VolatilityVolatile,
},
),
Expand Down