Re: interval type additional option

From: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: interval type additional option
Date: 2019-01-31 14:33:31
Message-ID: 87lg30aopg.fsf@news-spur.riddles.org.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>>>>> "Pavel" == Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> writes:

Pavel> Hi
Pavel> I have a value '400 days 30 sec':: interval

Pavel> I don't understand why cast

Pavel> postgres=# select '400days 30sec'::interval minute to second;

...

Pavel> What is sense of this feature?

As far as I know it only exists because of the sql spec, and the
implementation has never been complete or working. I think it does
affect some input parsing cases, there are some nasty hacks here and
there to support it, but given that our intervals don't behave like the
spec's ones anyway, there seems to be little motivation to make it work
fully.

These work, for example:

select interval '4' year to month; -- 4 months
select interval '4' hour; -- 4 hours
select interval '4' hour to second; -- 4 seconds
select '4'::interval year to month; -- 4 months
etc.

--
Andrew (irc:RhodiumToad)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2019-01-31 14:44:27 Re: interval type additional option
Previous Message Yugo Nagata 2019-01-31 14:20:32 Re: Implementing Incremental View Maintenance