pgsql: Add a timezone-specific variant of date_trunc().

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Add a timezone-specific variant of date_trunc().
Date: 2018-11-14 20:41:14
Message-ID: E1gN1yM-0004ex-Md@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Add a timezone-specific variant of date_trunc().

date_trunc(field, timestamptz, zone_name) performs truncation using
the named time zone as reference, rather than working in the session
time zone as is the default behavior. It's equivalent to

date_trunc(field, timestamptz at time zone zone_name) at time zone zone_name

but it's faster, easier to type, and arguably easier to understand.

Vik Fearing and Tom Lane

Discussion: https://postgr.es/m/6249ffc4-2b22-4c1b-4e7d-7af84fedd7c6@2ndquadrant.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/600b04d6b5ef6c9ad3ea684aad40260bd60d5872

Modified Files
--------------
doc/src/sgml/func.sgml | 53 ++++++++++++++---
src/backend/utils/adt/timestamp.c | 97 +++++++++++++++++++++++++++----
src/include/catalog/catversion.h | 2 +-
src/include/catalog/pg_proc.dat | 19 +++---
src/test/regress/expected/timestamptz.out | 18 ++++++
src/test/regress/sql/timestamptz.sql | 4 ++
6 files changed, 166 insertions(+), 27 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2018-11-14 21:40:10 pgsql: Doc: remove claim that all \pset format options are unique in 1
Previous Message Tom Lane 2018-11-14 16:28:06 pgsql: Second try at fixing numeric data passed through an ECPG SQLDA.