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

    https://github.com/apache/incubator-trafodion/pull/420#discussion_r59069398
  
    --- Diff: core/sql/generator/GenExpGenerator.cpp ---
    @@ -753,12 +752,42 @@ void ExpGenerator::copyDefaultValues(
     
           if (srcAttr->getDefaultValue())
        {
    -     char * tgtDefVal =
    -       new(generator->getSpace()) 
char[srcAttr->getDefaultValueStorageLength()];
    -     
    -     str_cpy_all(tgtDefVal, 
    -                 srcAttr->getDefaultValue(), 
    -                 srcAttr->getDefaultValueStorageLength());
    +          Lng32 tgtDefLen = tgtAttr->getDefaultValueStorageLength();
    +          Lng32 srcDefLen = srcAttr->getDefaultValueStorageLength();
    +          char* srcDefVal = srcAttr->getDefaultValue();
    +     char * tgtDefVal = new(generator->getSpace()) char[tgtDefLen];
    +          // if source and target def storage lengths dont match, then
    +          // need to move each part (null, vclen, data) separately.
    +          if (tgtDefLen != srcDefLen) 
    --- End diff --
    
    Might we be fooled into thinking the tgtDefLen is equal to the srcDefLen, 
but src is nullable varchar(n-2) while tgt is non-nullable varchar(n)?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to