[
https://issues.apache.org/jira/browse/IGNITE-25811?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Pavel Pereslegin updated IGNITE-25811:
--------------------------------------
Labels: ignite-3 (was: )
> Sql. Forbid use of an expression as interval string
> ---------------------------------------------------
>
> Key: IGNITE-25811
> URL: https://issues.apache.org/jira/browse/IGNITE-25811
> Project: Ignite
> Issue Type: Improvement
> Components: sql, sql ai3
> Reporter: Pavel Pereslegin
> Priority: Major
> Labels: ignite-3
>
> SQL defines an interval literal as follows:
> {code:sql}
> <interval literal> ::=
> INTERVAL [ <sign> ] <interval string> <interval qualifier>
> <interval string> ::=
> <quote> <unquoted interval string> <quote>
> {code}
> However, calcite does allow expression as the "interval string".
> This allows for example use column value as the interval string, e.g.
> {code:sql}
> CREATE TABLE t(id INT PRIMARY KEY);
> INSERT INTO t VALUES (1), (2), (3);
> SELECT INTERVAL id YEAR FROM t; -- returns P3Y, P2Y, P1Y
> {code}
> But it also leads to:
> # inconsistency ({{INTERVAL '2' DAYS}} vs {{INTERVAL 2 DAYS}})
> # hidden errors (example: https://issues.apache.org/jira/browse/CALCITE-6114 )
> The solution is to forbid the use of an expression as the interval string
> during the validation phase.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)