Re: interval_scale not work as expected?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: interval_scale not work as expected?
Дата
Msg-id 2170251.1697416123@sss.pgh.pa.us
обсуждение исходный текст
Ответ на interval_scale not work as expected?  (jian he <jian.universality@gmail.com>)
Список pgsql-hackers
jian he <jian.universality@gmail.com> writes:
> I thought:
> SELECT pg_catalog.interval('1 day 01:23:45.6789'::interval, 0)
> is same as
> SELECT interval(0) '1 day 01:23:45.6789'

[ shrug ]  No, it isn't.  Interval typmods have to carry a lot
more than just the fractional precision, because of all the
weird syntactic baggage that the SQL spec has for interval
types (i.e., YEAR TO MONTH and other options).  timestamp.h
has (some of) the details about what gets packed into an
interval typmod.

Even with simpler types, there generally isn't a one-to-one
correlation between user-visible precision and the encoded
typmod.

            regards, tom lane



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

Предыдущее
От: jian he
Дата:
Сообщение: interval_scale not work as expected?
Следующее
От: Peter Smith
Дата:
Сообщение: Re: PGDOCS - add more links in the pub/sub reference pages