You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafodion.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2017/09/19 23:04:00 UTC

[jira] [Commented] (TRAFODION-2749) UPDATE STATS mc histogram failure when column has reserved word name

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

ASF GitHub Bot commented on TRAFODION-2749:
-------------------------------------------

GitHub user DaveBirdsall opened a pull request:

    https://github.com/apache/incubator-trafodion/pull/1239

    [TRAFODION-2749] Fix issue with reserved words as column names

    The code path in UPDATE STATISTICS where it creates multi-column histograms did not handle column names that happen to be reserved words correctly. These need to be double-quoted as delimited identifiers. (Oddly, vanilla delimited identifiers worked just fine.)

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/DaveBirdsall/incubator-trafodion Trafodion2749

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-trafodion/pull/1239.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 #1239
    
----
commit fc575b11679862d5820584c95dc665260f42c1a9
Author: Dave Birdsall <db...@apache.org>
Date:   2017-09-19T22:58:31Z

    [TRAFODION-2749] Fix issue with reserved words as column names

----


> UPDATE STATS mc histogram failure when column has reserved word name
> --------------------------------------------------------------------
>
>                 Key: TRAFODION-2749
>                 URL: https://issues.apache.org/jira/browse/TRAFODION-2749
>             Project: Apache Trafodion
>          Issue Type: Bug
>          Components: sql-cmp
>    Affects Versions: 2.3-incubating
>         Environment: All
>            Reporter: David Wayne Birdsall
>            Assignee: David Wayne Birdsall
>
> When UPDATE STATISTICS tries to create a multi-column histogram, and one or more of the columns has a name which happens to be a SQL reserved word, the command fails with a syntax error on an internal statement.
> The following script reproduces the problem (here, the failure occurs when UPDATE STATS tries to create a multi-column histogram on the two key columns):
> ?section setup
> create table ExampleTable 
> ( a smallint not null,
>   "YEAR" smallint not null,
>   primary key (a, "YEAR") );
> insert into ExampleTable values (1,1996),(2,1997),(3,1998);
> ?section doit
> update statistics for table ExampleTable on every column;
> Below is the execution output:
> >>obey repro.sql;
> >>?section setup
> >>
> >>create table ExampleTable 
> +>( a smallint not null,
> +>  "YEAR" smallint not null,
> +>  primary key (a, "YEAR") );
> --- SQL operation complete.
> >>
> >>insert into ExampleTable values (1,1996),(2,1997),(3,1998);
> --- 3 row(s) inserted.
> >>
> >>?section doit
> >>
> >>update statistics for table ExampleTable on every column;
> *** ERROR[9200] UPDATE STATISTICS for table TRAFODION.SCH.EXAMPLETABLE encountered an error (15001) from statement FETCH_BOUNDARY_ROWSET.
> *** ERROR[15001] A syntax error occurred at or before: 
> SELECT FMTVAL, SUMVAL FROM (SELECT "A","YEAR", _ucs2'unused', COUNT(*) FROM TRA
> FODION.SCH.EXAMPLETABLE <<+ cardinality 3.000000e+00 >>  GROUP BY A, YEAR FOR R
> EAD UNCOMMITTED ACCESS) T(A, YEAR, FMTVAL, SUMVAL);
>    ^ (162 characters from start of SQL statement)
> *** ERROR[8822] The statement was not prepared.
> --- SQL operation failed with errors.
> >>
> >>



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)