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 2016/03/01 01:59:18 UTC

[jira] [Commented] (TRAFODION-1858) RI predicate generating string should not contain _SALT_ column

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

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

Github user sureshsubbiah commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/347#discussion_r54507489
  
    --- Diff: core/sql/optimizer/BindRI.cpp ---
    @@ -408,6 +408,39 @@ void RefConstraint::getMatchOptionPredicateText(NAString &text,
       text += ")";
     }
     
    +//helper function to check if the given column name is reserved hidden coloum
    +static NABoolean isHiddenColumn(const char *colname)
    +{
    +  int len = strlen(colname);
    +  if(strcmp(colname , "_SALT_") ==0) 
    +    return TRUE;
    +  //check for DIVISION column
    +  //pattern _DIVISION_%d_
    +  //must longer than 12
    +  if(len >= 12) {
    +    //must end with _
    +    if(colname[len] == '_')
    --- End diff --
    
    Second Dave's comment. I suppose a column with name DIVISION_1_ will still show the problem? Maybe adding a regression test also a good idea though certainly not a requirement.


> RI predicate generating string should not contain _SALT_ column
> ---------------------------------------------------------------
>
>                 Key: TRAFODION-1858
>                 URL: https://issues.apache.org/jira/browse/TRAFODION-1858
>             Project: Apache Trafodion
>          Issue Type: Bug
>            Reporter: liu ming
>            Assignee: liu ming
>
> When table created with SALT, it cannot be used in a foreign key reference.
> To reproduce:
> >>CREATE TABLE a ( id int not null, PRIMARY KEY (id))SALT USING 9 PARTITIONS;
> --- SQL operation complete.
> >>CREATE TABLE b ( id int not null, val int,
> +>  PRIMARY KEY (id),
> +>  CONSTRAINT FK FOREIGN KEY (val) REFERENCES a (id))
> +>SALT USING 9 PARTITIONS;
> --- SQL operation complete.
> >>INSERT INTO a values(1);
> --- 1 row(s) inserted.
> >>INSERT INTO b values(1,1);
> *** ERROR[15001] A syntax error occurred at or before: 
> ("NEW@".VAL)=(TRAFODION.SEABASE.A."_SALT_",TRAFODION.SEABASE.A.ID);
>                                           ^ (43 characters from start of SQL statement)
> *** ERROR[8822] The statement was not prepared.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)