From 5266f747b9f5143b39164cff40b1a3f180ef6f37 Mon Sep 17 00:00:00 2001 From: Marcus Gartner Date: Tue, 12 May 2020 15:47:48 -0700 Subject: [PATCH] sql: mark timezone(string, string) as VolatilityStable The `timezone(string, string)` function overload was incorrectly marked as `VolatilityImmutable`. When the second argument a special string, like 'now', 'today', 'tomorrow', or 'yesterday', the function is non-immutable because those strings are cast to timestamps which are dependent on the current clock time. This commit correctly marks it as `VolatilityStable`. Release note: None --- pkg/sql/sem/builtins/builtins.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/sql/sem/builtins/builtins.go b/pkg/sql/sem/builtins/builtins.go index 82f2ddd7cdc1..aeb332447b40 100644 --- a/pkg/sql/sem/builtins/builtins.go +++ b/pkg/sql/sem/builtins/builtins.go @@ -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{