Wrong provolatile value for to_timestamp (1 argument)

Поиск
Список
Период
Сортировка
От Tatsuo Ishii
Тема Wrong provolatile value for to_timestamp (1 argument)
Дата
Msg-id 20220705.172957.2068967435108479827.t-ishii@sranhm.sra.co.jp
обсуждение исходный текст
Ответы Re: Wrong provolatile value for to_timestamp (1 argument)  (Laurenz Albe <laurenz.albe@cybertec.at>)
Список pgsql-hackers
I found that provolatile attribute of to_timestamp in pg_proc is
wrong:

test=# select provolatile, proargtypes from pg_proc where proname = 'to_timestamp' and proargtypes[0] = 701;
 provolatile | proargtypes 
-------------+-------------
 i           | 701
(1 row)

'i' (immutable) is clearly wrong since the function's return value can
be changed depending on the time zone settings.

Actually the manual says functions depending on time zone settings
should be labeled STABLE.

https://www.postgresql.org/docs/14/xfunc-volatility.html

"A common error is to label a function IMMUTABLE when its results
depend on a configuration parameter. For example, a function that
manipulates timestamps might well have results that depend on the
TimeZone setting. For safety, such functions should be labeled STABLE
instead."

It's intersting that two arguments form of to_timestamp has correct
attribute value ('s': stable) for provolatile in pg_proc.

Do we want to fix this for PG16? I think it's too late for 15.

Best reagards,
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese:http://www.sraoss.co.jp



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Amit Kapila
Дата:
Сообщение: Re: Handle infinite recursion in logical replication setup
Следующее
От: Dilip Kumar
Дата:
Сообщение: Re: making relfilenodes 56 bits