[
https://issues.apache.org/jira/browse/TRAFODION-3043?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16453278#comment-16453278
]
ASF GitHub Bot commented on TRAFODION-3043:
-------------------------------------------
GitHub user DaveBirdsall opened a pull request:
https://github.com/apache/trafodion/pull/1541
[TRAFODION-3043] Add missing binder check for DATE_PART function
This change adds a check to Extract::synthesizeType
(optimizer/SynthType.cpp) to raise a 4037 error if one attempts to perform
DATE_PART on an Interval data type with an extract qualifier of YEARMONTH or
YEARQUARTER.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/DaveBirdsall/trafodion DatePartBug
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/trafodion/pull/1541.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #1541
----
commit 5c6bf2a14a9e748fa08ac5e905cb62c451257b16
Author: Dave Birdsall <dbirdsall@...>
Date: 2018-04-26T00:19:59Z
[TRAFODION-3043] Add missing binder check for DATE_PART function
----
> DATE_PART(YEARQUARTER|YEARMONTH|YEARWEEK, <interval>) should return a proper
> error
> ----------------------------------------------------------------------------------
>
> Key: TRAFODION-3043
> URL: https://issues.apache.org/jira/browse/TRAFODION-3043
> Project: Apache Trafodion
> Issue Type: Bug
> Components: sql-cmp
> Affects Versions: 2.3
> Reporter: David Wayne Birdsall
> Assignee: David Wayne Birdsall
> Priority: Major
>
> If we run the following script:
> drop table if exists t;
> create table t (c1 interval year to month, c2 interval month);
> insert into t values (interval '11-01' year to month, interval '11' month);
> select DATE_PART('YEARQUARTER', c1) from t;
> select DATE_PART('YEARQUARTER', c2) from t;
> select DATE_PART('YEARMONTH', c1) from t;
> select DATE_PART('YEARMONTH', c2) from t;
> select DATE_PART('YEARWEEK', c1) from t;
> select DATE_PART('YEARWEEK', c2) from t;
> We get correct 4037 error messages on column c2. For YEARQUARTER and
> YEARMONTH on c1 though we get an internal error 8001 at run-time instead. For
> YEARWEEK we get a compile time error 4035 on c1 instead.
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)