[
https://issues.apache.org/jira/browse/CALCITE-3987?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17104728#comment-17104728
]
Julian Hyde commented on CALCITE-3987:
--------------------------------------
Oracle too. (Interestingly, Oracle stores DATE values using its NUMBER
representation, with the fractional part representing the time within the day.
So adding 1 to a DATE is literally adding 1 to the number.)
One reason I push back is that it's much less clear what it means to add 1 to a
TIME or TIMESTAMP value. (I refuse to fall into the UNIX mindset that
everything is 'obviously' milliseconds since 1970.)
> Allow addition and subtraction operations between DATE and NUMERIC types.
> -------------------------------------------------------------------------
>
> Key: CALCITE-3987
> URL: https://issues.apache.org/jira/browse/CALCITE-3987
> Project: Calcite
> Issue Type: Improvement
> Reporter: Drew Schmitt
> Priority: Minor
>
> We should allow addition (PLUS operator) and subtraction (MINUS operator)
> between DATE and NUMERIC types to be valid during the validation phase.
> Downstream, the result of the operation can be interpreted differently
> depending on the dialect. For example, some dialects would interpret any
> arithmetic with a DATE as implying adding/subtracting a number of days.
> Example query:
> CREATE TABLE foo (bar DATE);
> SELECT bar - 1 FROM foo;
--
This message was sent by Atlassian Jira
(v8.3.4#803005)