Add functions to do timestamptz arithmetic in a non-default timezone.
authorTom Lane <tgl@sss.pgh.pa.us>
Sat, 18 Mar 2023 18:12:14 +0000 (14:12 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Sat, 18 Mar 2023 18:12:16 +0000 (14:12 -0400)
commit75bd846b68b09f33a57d9de96064ded4d392ca05
tree3d5d6df0256c26817c96a0ce6102625523aef6f2
parent0e681cf0390ddd720424cd134a2c42dffc2934fd
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
doc/src/sgml/func.sgml
src/backend/utils/adt/timestamp.c
src/include/catalog/catversion.h
src/include/catalog/pg_proc.dat
src/test/regress/expected/timestamptz.out
src/test/regress/sql/timestamptz.sql