pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Add functions to do timestamptz arithmetic in a non-default time
Date: Sat, 18 Mar 2023 18:12:30 +0000
Message-ID: <E1pdb2c-004BMU-7K@gemulon.postgresql.org> (raw)

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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/75bd846b68b09f33a57d9de96064ded4d392ca05

Modified Files
--------------
doc/src/sgml/func.sgml                    |  93 +++++++++++++++++--
src/backend/utils/adt/timestamp.c         | 146 +++++++++++++++++++++++-------
src/include/catalog/catversion.h          |   2 +-
src/include/catalog/pg_proc.dat           |  21 +++++
src/test/regress/expected/timestamptz.out |  54 +++++++++++
src/test/regress/sql/timestamptz.sql      |  19 ++++
6 files changed, 291 insertions(+), 44 deletions(-)



Message-ID: <E1pdb2c-004BMU-7K@gemulon.postgresql.org>
Permalink:  ../E1pdb2c-004BMU-7K@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1pdb2c-004BMU-7K@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Add functions to do timestamptz arithmetic in a non-default time
  In-Reply-To: <E1pdb2c-004BMU-7K@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox