Why timestamptz_pl_interval and timestamptz_mi_interval are not immutable? - Mailing list pgsql-hackers

From Alexander Pyhalov
Subject Why timestamptz_pl_interval and timestamptz_mi_interval are not immutable?
Date
Msg-id 46f5dae9b946cbe807dd80b20b90fa21@postgrespro.ru
Whole thread Raw
Responses RE: Why timestamptz_pl_interval and timestamptz_mi_interval are not immutable?  (Floris Van Nee <florisvannee@Optiver.com>)
List pgsql-hackers
Hi.

I'm currently looking on pushing down SQLValue expressions to foreign 
servers and was surprised that two timestamptz-related functions are not 
immutable.
I see that this was changed in commit

commit 1ab415596d1de61561d0de8fe9da4aea207adca4
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date:   Mon Oct 4 22:13:14 2004 +0000

     Correct the volatility labeling of ten timestamp-related functions,
     per discussion from Friday.  initdb not forced in this commit but I 
intend
     to do that later.

I'm not sure, why  timestamptz_pl_interval and timestamptz_mi_interval 
are not immutable. Even if we change timezone during transaction, 
addition of the same interval to the same timestamps with time zone 
gives the same result.

postgres=# begin ;
BEGIN
postgres=*# select current_timestamp;
        current_timestamp
-------------------------------
  2021-08-16 13:26:59.366452+03
(1 row)

postgres=*# select timestamptz '2021-08-16 13:26:59.366452+03';
           timestamptz
-------------------------------
  2021-08-16 13:26:59.366452+03
(1 row)

postgres=*# select timestamptz '2021-08-16 13:26:59.366452+03' + '2 
days'::interval;
            ?column?
-------------------------------
  2021-08-18 13:26:59.366452+03
(1 row)

postgres=*# set timezone to UTC;
SET
postgres=*# select timestamptz '2021-08-16 13:26:59.366452+03' + '2 
days'::interval;
            ?column?
-------------------------------
  2021-08-18 10:26:59.366452+00
(1 row)

postgres=*# select timestamptz '2021-08-18 13:26:59.366452+03' = 
timestamptz '2021-08-18 10:26:59.366452+00';
  ?column?
----------
  t
(1 row)

What do I miss?

-- 
Best regards,
Alexander Pyhalov,
Postgres Professional



pgsql-hackers by date:

Previous
From: David Rowley
Date:
Subject: Re: Window Function "Run Conditions"
Next
From: Floris Van Nee
Date:
Subject: RE: Why timestamptz_pl_interval and timestamptz_mi_interval are not immutable?