-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sql: change volatility of timezone with TIME and TIMETZ to stable
The `timezone(STRING, TIME)` and `timezone(STRING, TIMETZ)` function overloads were originally marked as volatile to copy Postgres's volatility for the `timezone(STRING, TIMETZ)` overload (Postgres does not implement `timezone (STRING, TIME)`. Postgres's volatility settings for all overloads of `timezone` are below. Name | Argument data types | Volatility ----------+---------------------------------------+------------------ timezone | interval, time with time zone | immutable zone timezone | interval, timestamp with time zone | immutable timezone | interval, timestamp without time zone | immutable timezone | text, time with time zone | volatile zone timezone | text, timestamp with time zone | immutable timezone | text, timestamp without time zone | immutable This single overload is singled out as volatile by Postgres because it is dependent on C's `time(NULL)`. See the Postgres commit originally marking this overload volatility, and the lines of code showing the dependence: postgres/postgres@35979e6 https://github.com/postgres/postgres/blob/ac3a4866c0bf1d7a14009f18d3b42ffcb063a7e9/src/backend/utils/adt/date.c#L2816 CRDB does not have the same issue. All `timezone` overloads have the same volatility, stable. This commit marks them as such. Additional context: #48756 (comment) This commit also moves the `IgnoreVolatilityCheck` field from function definitions to overloads. This allows overloads of the same function to be ignored when asserting that the volalitity of an overload matches Postgres's assigned volatility. Release note: None
- Loading branch information
Showing
5 changed files
with
38 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters