[ 
https://issues.apache.org/jira/browse/CALCITE-6536?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17875087#comment-17875087
 ] 

Stamatis Zampetakis commented on CALCITE-6536:
----------------------------------------------

 

Below some extracts from the SQL standard 2011 with respect to Datetimes 
datatypes.
{noformat}
4.6.2 Datetimes
The <primary datetime field>s other than SECOND contain non-negative integer 
values, constrained by the natural rules for dates using the Gregorian 
calendar. SECOND, however, can be defined to have a <time fractional seconds 
precision> that indicates the number of decimal digits maintained following the 
decimal point in the seconds value, a non-negative exact numeric value.

4.6.4 Operations involving datetimes and intervals
Arithmetic operations involving values of type datetime or interval obey the 
natural rules associated with dates
and times and yield valid datetime or interval results according to the 
Gregorian calendar.
{noformat}
According to the standard dates should always be valid and follow the rules of 
Gregorian calendar. There are certainly DBMS who derive from standard and have 
more flexible rules and/or support other calendars.

Ideally this kind of investigation should be done from the reporter of the bug. 

 

> Dates before BC cannot be used as arguments to date functions
> -------------------------------------------------------------
>
>                 Key: CALCITE-6536
>                 URL: https://issues.apache.org/jira/browse/CALCITE-6536
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.37.0
>            Reporter: Caican Cai
>            Priority: Major
>             Fix For: 1.38.0
>
>
> {code:java}
> f.checkScalar("date_add(date '0001-01-01', interval '-367' day)",
>         "000/-12-31",
>         "DATE NOT NULL");
> {code}
> This test is correct, but when I use 000/-12-31 as the parameter to test it 
> fails
> {code:java}
>     f.checkScalar("date_add(date '000/-12-31', interval 5 day)",
>         "000-12-31",
>         "DATE NOT NULL");
> org.apache.calcite.runtime.CalciteContextException: From line 1, column 18 to 
> line 1, column 34: Illegal DATE literal '000/-12-31': not in format 
> 'yyyy-MM-dd'
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to