Add functions to do timestamptz arithmetic in a non-default timezone.
Tom Lane <tgl@sss.pgh.pa.us>
Add functions to do timestamptz arithmetic in a non-default timezone. Add versions of timestamptz + interval, timestamptz - interval, and generate_series(timestamptz, ...) in which a timezone can be specified explicitly instead of defaulting to the TimeZone GUC setting. The new functions for the first two are named date_add and date_subtract. This might seem too generic, but we could use overloading to add additional variants if that seems useful. Along the way, improve the docs' pretty inadequate explanation of how timestamptz +- interval works. Przemysław Sztoch and Gurjeet Singh; cosmetic changes and most of the docs work by me Discussion: https://postgr.es/m/01a84551-48dd-1359-bf7e-f6b0203a6bd0@sztoch.pl
Files
| Path | Change | +/− |
|---|---|---|
| doc/src/sgml/func.sgml | modified | +85 −8 |
| src/backend/utils/adt/timestamp.c | modified | +111 −35 |
| src/include/catalog/catversion.h | modified | +1 −1 |
| src/include/catalog/pg_proc.dat | modified | +21 −0 |
| src/test/regress/expected/timestamptz.out | modified | +54 −0 |
| src/test/regress/sql/timestamptz.sql | modified | +19 −0 |
Documentation touched
Discussion
- generate_series for timestamptz and time zone problem 20 messages · 2022-05-31 → 2023-03-18