[
https://issues.apache.org/jira/browse/CALCITE-5244?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17585031#comment-17585031
]
Julian Hyde commented on CALCITE-5244:
--------------------------------------
I have no objections to supporting this feature in the Postgres dialect, but
note that Calcite has a different model for intervals than Postgres. In
Calcite, every interval is either a year-month interval or a day-second
interval. Calcite can represent '3 years, 2 months' and '720 days' but it can't
represent '3 years, 2 months and 1 day'. For hybrid intervals (that contain
year or month units and also day/hour/minute/second units) we are going to have
to approximate, for example by expanding each year to 365 days and each month
to 30 days.
> Postgres dialect should support traditional postgres interval format
> --------------------------------------------------------------------
>
> Key: CALCITE-5244
> URL: https://issues.apache.org/jira/browse/CALCITE-5244
> Project: Calcite
> Issue Type: Bug
> Components: babel
> Reporter: Dmitry Sysolyatin
> Priority: Major
>
> Postgres dialect should support "Traditional Postgres format" for interval.
> https://www.postgresql.org/docs/current/datatype-datetime.html#DATATYPE-INTERVAL-INPUT
> Query {code}select interval '1 year 3 hours 20 minutes 10 seconds 5
> milliseconds'{code} throws exception:
> {code}Caused by: java.lang.RuntimeException:
> org.apache.calcite.sql.parser.SqlParseException: Encountered "\'1 year 3
> hours 20 minutes 10 seconds 5 milliseconds\' <EOF>" at line 1, column
> 17.{code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)