Thread: pgsql: Refactor timestamp2timestamptz_opt_error()

pgsql: Refactor timestamp2timestamptz_opt_error()

From
Alexander Korotkov
Date:
Refactor timestamp2timestamptz_opt_error()

While casting from timestamp to timestamptz we do timestamp2tm() then
tm2timestamp().  This commit eliminates call to tm2timestamp().  Instead, it
directly applies timezone offset to the original timestamp value.  That makes
upcoming datetime overflow handling in jsonpath easier.  That should also save
us some CPU cycles.

Discussion: https://postgr.es/m/CAPpHfdvRPRh_mTGar5WmDeRZ%3DU5dOXHdxspYYD%3D76m3knNGjXA%40mail.gmail.com
Author: Alexander Korotkov
Reviewed-by: Tom Lane

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/a6888fde7f0dbe865559b31ba2ce01ac1150debe

Modified Files
--------------
src/backend/utils/adt/timestamp.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)