Pavel Pereslegin created IGNITE-25811:
-----------------------------------------
Summary: 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
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 an "interval string".
This allows for example use column value as 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 and hidden errors.
For example: https://issues.apache.org/jira/browse/CALCITE-6114
The solution is to forbid the use of an expression as a interval string during
the validation phase.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)