The CQD TRAF_UPSERT_WITH_INSERT_DEFAULT_SEMANTICS is replaced with 
TRAF_UPSERT_MODE.
This CQD takes 3 values

MERGE     - If the row exists, use the old values for omitted columns. This
            doesn't necessarily mean that MERGE command is used
REPLACE   - Always replace the column with default values for omitted columns
OPTIMAL   - Chooses MERGE like concept for non-aligned format table
                    REPLACE for aligned format table

MERGE is the default.


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/445f6902
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/445f6902
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/445f6902

Branch: refs/heads/master
Commit: 445f6902b632386f3b7aebedda86baea9d7267cd
Parents: 53dcf92
Author: selvaganesang <[email protected]>
Authored: Thu Mar 24 21:27:31 2016 +0000
Committer: selvaganesang <[email protected]>
Committed: Thu Mar 24 21:27:31 2016 +0000

----------------------------------------------------------------------
 core/sql/generator/GenRelUpdate.cpp  |   8 +-
 core/sql/optimizer/BindRelExpr.cpp   |  27 ++--
 core/sql/regress/seabase/EXPECTED020 | 217 ++++++++++++++++++++++++++++--
 core/sql/regress/seabase/TEST020     |  60 ++++++++-
 core/sql/sqlcomp/DefaultConstants.h  |   7 +-
 core/sql/sqlcomp/nadefaults.cpp      |  10 +-
 6 files changed, 295 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/445f6902/core/sql/generator/GenRelUpdate.cpp
----------------------------------------------------------------------
diff --git a/core/sql/generator/GenRelUpdate.cpp 
b/core/sql/generator/GenRelUpdate.cpp
index e362d2b..8b35d11 100644
--- a/core/sql/generator/GenRelUpdate.cpp
+++ b/core/sql/generator/GenRelUpdate.cpp
@@ -2025,8 +2025,9 @@ short HbaseUpdate::codeGen(Generator * generator)
               col = tgtValueId.getNAColumn( TRUE );
 
               if ((NOT isAlignedFormat) &&
-                 
(CmpCommon::getDefault(TRAF_UPSERT_WITH_INSERT_DEFAULT_SEMANTICS) == DF_OFF) && 
-                 (((Assign*)assignExpr)->canBeSkipped()) &&
+                  ((CmpCommon::getDefault(TRAF_UPSERT_MODE) == DF_MERGE) ||
+                   (CmpCommon::getDefault(TRAF_UPSERT_MODE) == DF_OPTIMAL)) && 
+                  (((Assign*)assignExpr)->canBeSkipped()) &&
                  (NOT col->isSystemColumn()) &&
                  (NOT col->isClusteringKey()) &&
                  (NOT col->isIdentityColumn()))
@@ -2342,7 +2343,8 @@ short HbaseInsert::codeGen(Generator *generator)
 
       col = tgtValueId.getNAColumn( TRUE );
       if ((NOT isAlignedFormat) &&
-         (CmpCommon::getDefault(TRAF_UPSERT_WITH_INSERT_DEFAULT_SEMANTICS) == 
DF_OFF) && 
+         ((CmpCommon::getDefault(TRAF_UPSERT_MODE) == DF_MERGE) ||
+          (CmpCommon::getDefault(TRAF_UPSERT_MODE) == DF_OPTIMAL)) && 
          (((Assign*)assignExpr)->canBeSkipped()) && 
          (NOT col->isSystemColumn()) &&
          (NOT col->isClusteringKey()) &&

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/445f6902/core/sql/optimizer/BindRelExpr.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/BindRelExpr.cpp 
b/core/sql/optimizer/BindRelExpr.cpp
index 0d764de..5a85434 100644
--- a/core/sql/optimizer/BindRelExpr.cpp
+++ b/core/sql/optimizer/BindRelExpr.cpp
@@ -10165,8 +10165,8 @@ base table then the old version of the row will have to 
be deleted from
 indexes, and a new version inserted. Upsert is being transformed to merge
 so that we can delete the old version of an updated row from the index.
 
-Upsert is also converted into merge when there are omitted cols with default 
values and 
-TRAF_UPSERT_WITH_INSERT_DEFAULT_SEMANTICS is set to  OFF in case of aligned 
format table or 
+Upsert is also converted into merge when TRAF_UPSERT_MODE is set to MERGE and 
+there are omitted cols with default values in case of aligned format table or 
 omitted current timestamp cols in case of non-aligned row format
 */
 NABoolean Insert::isUpsertThatNeedsMerge(NABoolean isAlignedRowFormat, 
NABoolean omittedDefaultCols,
@@ -10179,12 +10179,19 @@ NABoolean Insert::isUpsertThatNeedsMerge(NABoolean 
isAlignedRowFormat, NABoolean
       (NOT 
(getTableDesc()->getClusteringIndex()->getNAFileSet()->hasSyskey())) && 
         // table has secondary indexes or
         (getTableDesc()->hasSecondaryIndexes() ||
-         // CQD is set off and  
-         ((CmpCommon::getDefault(TRAF_UPSERT_WITH_INSERT_DEFAULT_SEMANTICS) == 
DF_OFF) &&
+          // CQD is set to MERGE  
+          ((CmpCommon::getDefault(TRAF_UPSERT_MODE) == DF_MERGE) &&
             // omitted current default columns with non-aligned row format 
tables
             // or omitted default columns with aligned row format tables 
-          (((NOT isAlignedRowFormat) && omittedCurrentDefaultClassCols) ||
-          (isAlignedRowFormat && omittedDefaultCols)))
+            (((NOT isAlignedRowFormat) && omittedCurrentDefaultClassCols) ||
+            (isAlignedRowFormat && omittedDefaultCols))) ||
+          // CQD is set to Optimal, for non-aligned row format with omitted 
+          // current columns, it is converted into merge though it is not
+          // optimal for performance - This is done to ensure that when the 
+          // CQD is set to optimal, non-aligned format would behave like 
+          // merge when any column is  omitted 
+          ((CmpCommon::getDefault(TRAF_UPSERT_MODE) == DF_OPTIMAL) &&
+            ((NOT isAlignedRowFormat) && omittedCurrentDefaultClassCols))
         ) 
      )
      return TRUE;
@@ -10280,12 +10287,14 @@ RelExpr* Insert::xformUpsertToMerge(BindWA *bindWA)
       {
          // We need to bind in the new = old values
          // in GenericUpdate::bindNode. So skip the columns that are not user
-         // specified
+         // specified and 
          //
          if (assignExpr->isUserSpecified())
              copySetAssign = TRUE;
-         // copy the default value if the below CQD is set to ON
-         else if 
(CmpCommon::getDefault(TRAF_UPSERT_WITH_INSERT_DEFAULT_SEMANTICS) == DF_ON)
+         // If copy the Default values in case of replace mode or optiomal 
mode with
+         // aligned row tables
+         else if ((CmpCommon::getDefault(TRAF_UPSERT_MODE) == DF_REPLACE) ||
+                (isAlignedRowFormat && CmpCommon::getDefault(TRAF_UPSERT_MODE) 
== DF_OPTIMAL))
              copySetAssign = TRUE;
          if (copySetAssign)
          { 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/445f6902/core/sql/regress/seabase/EXPECTED020
----------------------------------------------------------------------
diff --git a/core/sql/regress/seabase/EXPECTED020 
b/core/sql/regress/seabase/EXPECTED020
index 0b4827e..41c1ea1 100644
--- a/core/sql/regress/seabase/EXPECTED020
+++ b/core/sql/regress/seabase/EXPECTED020
@@ -6,7 +6,7 @@
 >>invoke test020t1;
 
 -- Definition of Trafodion table TRAFODION.SCH.TEST020T1
--- Definition current  Fri Mar 18 11:37:39 2016
+-- Definition current  Thu Mar 24 20:57:19 2016
 
   (
     C1                               INT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -49,7 +49,7 @@ C1           C2
 >>invoke test020t2;
 
 -- Definition of Trafodion table TRAFODION.SCH.TEST020T2
--- Definition current  Fri Mar 18 11:37:41 2016
+-- Definition current  Thu Mar 24 20:57:21 2016
 
   (
     C                                CHAR(15) CHARACTER SET ISO88591 COLLATE
@@ -160,7 +160,7 @@ G0
 >>invoke test020t5;
 
 -- Definition of Trafodion table TRAFODION.SCH.TEST020T5
--- Definition current  Fri Mar 18 11:37:50 2016
+-- Definition current  Thu Mar 24 20:57:29 2016
 
   (
     C                                INT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -255,7 +255,7 @@ ALTER TABLE TRAFODION.SCH.TEST020T5 ADD CONSTRAINT 
TRAFODION.SCH.TEST020T5C1
 >>invoke test020t6;
 
 -- Definition of Trafodion table TRAFODION.SCH.TEST020T6
--- Definition current  Fri Mar 18 11:38:28 2016
+-- Definition current  Thu Mar 24 20:58:14 2016
 
   (
     SYSKEY                           LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -3273,7 +3273,7 @@ C@           A
 
 --- SQL operation complete.
 >>--test for timestamp column default value
->>cqd traf_upsert_with_insert_default_semantics 'off';
+>>cqd traf_upsert_mode 'merge';
 
 --- SQL operation complete.
 >>cqd traf_aligned_row_format 'off' ;
@@ -3308,7 +3308,7 @@ A                     B           D            E
                    1  c                     ?            5
 
 --- 1 row(s) selected.
->>-- check to ensure the value for column d is retained
+>>-- check to ensure the value for column e is retained
 >>upsert into test020t41 (a,b) values (1, 'd');
 
 --- 1 row(s) inserted.
@@ -3375,7 +3375,7 @@ E@           A
           6                     5
 
 --- 5 row(s) selected.
->>-- check if the updated d column is reflected in the index
+>>-- check if the updated e column is reflected in the index
 >>upsert into test020t41 (a,b,e) values (1, 'c', 4);
 
 --- 1 row(s) inserted.
@@ -3394,7 +3394,7 @@ E@           A
 >>
 >>--  With index it will be merge anyway, but default values needs to be 
 >>--  populated
->>cqd traf_upsert_with_insert_default_semantics 'on';
+>>cqd traf_upsert_mode 'replace';
 
 --- SQL operation complete.
 >>delete from test020t41 ;
@@ -3471,11 +3471,126 @@ A                     B           D            E
 
 --- 1 row(s) selected.
 >>
+>>cqd traf_upsert_mode 'optimal' ;
+
+--- SQL operation complete.
+>>-- check if the timestamp is inserted with the recent timestamp
+>>delete from test020t41 ;
+
+--- 2 row(s) deleted.
+>>insert into test020t41 (a,b) values (1,'a'), (2,'b');
+
+--- 2 row(s) inserted.
+>>select a,b,d,e from test020t41 where current_timestamp-c < cast(10 as 
interval second);
+
+A                     B           D            E          
+--------------------  ----------  -----------  -----------
+
+                   1  a                     ?            3
+                   2  b                     ?            3
+
+--- 2 row(s) selected.
+>>-- check to ensure the timestamp column is not updated with upsert
+>>upsert into test020t41 (a,b,e) values (1, 'c', 5);
+
+--- 1 row(s) inserted.
+>>select a,b,d,e from test020t41 where a = 1 and c = (select c from test020t41 
where a = 2);
+
+A                     B           D            E          
+--------------------  ----------  -----------  -----------
+
+                   1  c                     ?            5
+
+--- 1 row(s) selected.
+>>-- check to ensure the value for column e is retained
+>>upsert into test020t41 (a,b) values (1, 'd');
+
+--- 1 row(s) inserted.
+>>select a,b,d,e from test020t41 where a = 1 and c = (select c from test020t41 
where a = 2);
+
+A                     B           D            E          
+--------------------  ----------  -----------  -----------
+
+                   1  d                     ?            5
+
+--- 1 row(s) selected.
+>>-- upsert with non-matching rows  
+>>upsert into test020t41 (a,b) values (3, 'e'), (4, 'f');
+
+--- 2 row(s) inserted.
+>>select a,b,d,e from test020t41 ;
+
+A                     B           D            E          
+--------------------  ----------  -----------  -----------
+
+                   1  d                     ?            5
+                   2  b                     ?            3
+                   3  e                     ?            3
+                   4  f                     ?            3
+
+--- 4 row(s) selected.
+>>upsert into test020t41 (a,b) values (3, 'g');
+
+--- 1 row(s) inserted.
+>>select a,b,d,e from test020t41 where a = 3 and c = (select c from test020t41 
where a = 4);
+
+A                     B           D            E          
+--------------------  ----------  -----------  -----------
+
+                   3  g                     ?            3
+
+--- 1 row(s) selected.
+>>create index test020t41ix on test020t41(e);
+
+--- SQL operation complete.
+>>select * from table(index_table test020t41ix) ;
+
+E@           A                   
+-----------  --------------------
+
+          3                     2
+          3                     3
+          3                     4
+          5                     1
+
+--- 4 row(s) selected.
+>>upsert into test020t41 (a,b,e) values (5,'h',6);
+
+--- 1 row(s) inserted.
+>>select * from table(index_table test020t41ix) ;
+
+E@           A                   
+-----------  --------------------
+
+          3                     2
+          3                     3
+          3                     4
+          5                     1
+          6                     5
+
+--- 5 row(s) selected.
+>>-- check if the updated e column is reflected in the index
+>>upsert into test020t41 (a,b,e) values (1, 'c', 4);
+
+--- 1 row(s) inserted.
+>>select * from table(index_table test020t41ix) ;
+
+E@           A                   
+-----------  --------------------
+
+          3                     2
+          3                     3
+          3                     4
+          4                     1
+          6                     5
+
+--- 5 row(s) selected.
+>>
 >>create table test020t42(a largeint not null primary key, b char(10),
 +>c timestamp(6) default current , d int , e int default 3) attribute aligned 
format;
 
 --- SQL operation complete.
->>cqd traf_upsert_with_insert_default_semantics 'off';
+>>cqd traf_upsert_mode 'merge';
 
 --- SQL operation complete.
 >>-- check if the timestamp is inserted with the recent timestamp
@@ -3589,7 +3704,7 @@ E@           A
 >>
 >>--  With index it will be merge anyway, but default values needs to be 
 >>--  populated
->>cqd traf_upsert_with_insert_default_semantics 'on';
+>>cqd traf_upsert_mode 'replace';
 
 --- SQL operation complete.
 >>delete from test020t42 ;
@@ -3666,10 +3781,90 @@ A                     B           D            E
 
 --- 1 row(s) selected.
 >>
+>>cqd traf_upsert_mode 'optimal';
+
+--- SQL operation complete.
+>>delete from test020t42 ;
+
+--- 2 row(s) deleted.
+>>create index test020t42ix on test020t42(e);
+
+--- SQL operation complete.
+>>insert into test020t42 (a,b) values (1,'a'), (2,'b');
+
+--- 2 row(s) inserted.
+>>upsert into test020t42 (a,b,e) values (1, 'c', 5);
+
+--- 1 row(s) inserted.
+>>-- Should display a row with = 1
+>>select a,b,d,e from test020t42 where c > (select c from test020t42 where a = 
2);
+
+A                     B           D            E          
+--------------------  ----------  -----------  -----------
+
+                   1  c                     ?            5
+
+--- 1 row(s) selected.
+>>upsert into test020t42 (a,b) values (1, 'd');
+
+--- 1 row(s) inserted.
+>>-- Should display a row with = 1 and e should be 3
+>>select a,b,d,e from test020t42 where c > (select c from test020t42 where a = 
2);
+
+A                     B           D            E          
+--------------------  ----------  -----------  -----------
+
+                   1  d                     ?            3
+
+--- 1 row(s) selected.
+>>select * from table(index_table test020t42ix) ;
+
+E@           A                   
+-----------  --------------------
+
+          3                     1
+          3                     2
+
+--- 2 row(s) selected.
+>>drop index test020t42ix ;
+
+--- SQL operation complete.
+>>-- Without index 
+>>delete from test020t42 ;
+
+--- 2 row(s) deleted.
+>>insert into test020t42 (a,b) values (1,'a'), (2,'b');
+
+--- 2 row(s) inserted.
+>>upsert into test020t42 (a,b,e) values (1, 'c', 5);
+
+--- 1 row(s) inserted.
+>>-- Should display a row with = 1
+>>select a,b,d,e from test020t42 where c > (select c from test020t42 where a = 
2);
+
+A                     B           D            E          
+--------------------  ----------  -----------  -----------
+
+                   1  c                     ?            5
+
+--- 1 row(s) selected.
+>>upsert into test020t42 (a,b) values (1, 'd');
+
+--- 1 row(s) inserted.
+>>-- Should display a row with = 1 and e should be 3
+>>select a,b,d,e from test020t42 where c > (select c from test020t42 where a = 
2);
+
+A                     B           D            E          
+--------------------  ----------  -----------  -----------
+
+                   1  d                     ?            3
+
+--- 1 row(s) selected.
+>>
 >>create table test020t43(c1 int, c2 int ) attribute aligned format ;
 
 --- SQL operation complete.
->>cqd traf_upsert_with_insert_default_semantics 'off';
+>>cqd traf_upsert_mode 'merge';
 
 --- SQL operation complete.
 >>upsert into test020t43 values (1,1);

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/445f6902/core/sql/regress/seabase/TEST020
----------------------------------------------------------------------
diff --git a/core/sql/regress/seabase/TEST020 b/core/sql/regress/seabase/TEST020
index 4b2f2c5..fefaf24 100755
--- a/core/sql/regress/seabase/TEST020
+++ b/core/sql/regress/seabase/TEST020
@@ -769,7 +769,7 @@ select * from table(index_table test020t40i1);
 ?section trafodion_1700_and_1847
 set parserflags 1;
 --test for timestamp column default value
-cqd traf_upsert_with_insert_default_semantics 'off';
+cqd traf_upsert_mode 'merge';
 cqd traf_aligned_row_format 'off' ;
 create table test020t41(a largeint not null primary key, b char(10),
 c timestamp(6) default current , d int , e int default 3);
@@ -779,7 +779,7 @@ select a,b,d,e from test020t41 where current_timestamp-c < 
cast(10 as interval s
 -- check to ensure the timestamp column is not updated with upsert
 upsert into test020t41 (a,b,e) values (1, 'c', 5);
 select a,b,d,e from test020t41 where a = 1 and c = (select c from test020t41 
where a = 2);
--- check to ensure the value for column d is retained
+-- check to ensure the value for column e is retained
 upsert into test020t41 (a,b) values (1, 'd');
 select a,b,d,e from test020t41 where a = 1 and c = (select c from test020t41 
where a = 2);
 -- upsert with non-matching rows  
@@ -791,13 +791,13 @@ create index test020t41ix on test020t41(e);
 select * from table(index_table test020t41ix) ;
 upsert into test020t41 (a,b,e) values (5,'h',6);
 select * from table(index_table test020t41ix) ;
--- check if the updated d column is reflected in the index
+-- check if the updated e column is reflected in the index
 upsert into test020t41 (a,b,e) values (1, 'c', 4);
 select * from table(index_table test020t41ix) ;
 
 --  With index it will be merge anyway, but default values needs to be 
 --  populated
-cqd traf_upsert_with_insert_default_semantics 'on';
+cqd traf_upsert_mode 'replace';
 delete from test020t41 ;
 insert into test020t41 (a,b) values (1,'a'), (2,'b');
 upsert into test020t41 (a,b,e) values (1, 'c', 5);
@@ -818,9 +818,33 @@ upsert into test020t41 (a,b) values (1, 'd');
 -- Should display a row with = 1 and e should be 3
 select a,b,d,e from test020t41 where c > (select c from test020t41 where a = 
2);
 
+cqd traf_upsert_mode 'optimal' ;
+-- check if the timestamp is inserted with the recent timestamp
+delete from test020t41 ;
+insert into test020t41 (a,b) values (1,'a'), (2,'b');
+select a,b,d,e from test020t41 where current_timestamp-c < cast(10 as interval 
second);
+-- check to ensure the timestamp column is not updated with upsert
+upsert into test020t41 (a,b,e) values (1, 'c', 5);
+select a,b,d,e from test020t41 where a = 1 and c = (select c from test020t41 
where a = 2);
+-- check to ensure the value for column e is retained
+upsert into test020t41 (a,b) values (1, 'd');
+select a,b,d,e from test020t41 where a = 1 and c = (select c from test020t41 
where a = 2);
+-- upsert with non-matching rows  
+upsert into test020t41 (a,b) values (3, 'e'), (4, 'f');
+select a,b,d,e from test020t41 ;
+upsert into test020t41 (a,b) values (3, 'g');
+select a,b,d,e from test020t41 where a = 3 and c = (select c from test020t41 
where a = 4);
+create index test020t41ix on test020t41(e);
+select * from table(index_table test020t41ix) ;
+upsert into test020t41 (a,b,e) values (5,'h',6);
+select * from table(index_table test020t41ix) ;
+-- check if the updated e column is reflected in the index
+upsert into test020t41 (a,b,e) values (1, 'c', 4);
+select * from table(index_table test020t41ix) ;
+
 create table test020t42(a largeint not null primary key, b char(10),
 c timestamp(6) default current , d int , e int default 3) attribute aligned 
format;
-cqd traf_upsert_with_insert_default_semantics 'off';
+cqd traf_upsert_mode 'merge';
 -- check if the timestamp is inserted with the recent timestamp
 insert into test020t42 (a,b) values (1,'a'), (2,'b');
 select a,b,d,e from test020t42 where current_timestamp-c < cast(10 as interval 
second);
@@ -845,7 +869,18 @@ select * from table(index_table test020t42ix) ;
 
 --  With index it will be merge anyway, but default values needs to be 
 --  populated
-cqd traf_upsert_with_insert_default_semantics 'on';
+cqd traf_upsert_mode 'replace';
+delete from test020t42 ;
+insert into test020t42 (a,b) values (1,'a'), (2,'b');
+upsert into test020t42 (a,b,e) values (1, 'c', 5);
+-- Should display a row with = 1
+select a,b,d,e from test020t42 where c > (select c from test020t42 where a = 
2);
+upsert into test020t42 (a,b) values (1, 'd');
+-- Should display a row with = 1 and e should be 3
+select a,b,d,e from test020t42 where c > (select c from test020t42 where a = 
2);
+select * from table(index_table test020t42ix) ;
+drop index test020t42ix ;
+-- Without index 
 delete from test020t42 ;
 insert into test020t42 (a,b) values (1,'a'), (2,'b');
 upsert into test020t42 (a,b,e) values (1, 'c', 5);
@@ -854,6 +889,17 @@ select a,b,d,e from test020t42 where c > (select c from 
test020t42 where a = 2);
 upsert into test020t42 (a,b) values (1, 'd');
 -- Should display a row with = 1 and e should be 3
 select a,b,d,e from test020t42 where c > (select c from test020t42 where a = 
2);
+
+cqd traf_upsert_mode 'optimal';
+delete from test020t42 ;
+create index test020t42ix on test020t42(e);
+insert into test020t42 (a,b) values (1,'a'), (2,'b');
+upsert into test020t42 (a,b,e) values (1, 'c', 5);
+-- Should display a row with = 1
+select a,b,d,e from test020t42 where c > (select c from test020t42 where a = 
2);
+upsert into test020t42 (a,b) values (1, 'd');
+-- Should display a row with = 1 and e should be 3
+select a,b,d,e from test020t42 where c > (select c from test020t42 where a = 
2);
 select * from table(index_table test020t42ix) ;
 drop index test020t42ix ;
 -- Without index 
@@ -867,7 +913,7 @@ upsert into test020t42 (a,b) values (1, 'd');
 select a,b,d,e from test020t42 where c > (select c from test020t42 where a = 
2);
 
 create table test020t43(c1 int, c2 int ) attribute aligned format ;
-cqd traf_upsert_with_insert_default_semantics 'off';
+cqd traf_upsert_mode 'merge';
 upsert into test020t43 values (1,1);
 upsert into test020t43 (c1) values(1);
 select * from test020t43 ; 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/445f6902/core/sql/sqlcomp/DefaultConstants.h
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/DefaultConstants.h 
b/core/sql/sqlcomp/DefaultConstants.h
index f78bfae..c212256 100644
--- a/core/sql/sqlcomp/DefaultConstants.h
+++ b/core/sql/sqlcomp/DefaultConstants.h
@@ -3801,9 +3801,7 @@ enum DefaultConstants
   // If this cqd is on, then other alters (name, datatype) are also supported.
   TRAF_ALTER_COL_ATTRS,
 
-  // if ON, upsert into the table will use the default value for the omitted 
columns
-  // with default value 
-  TRAF_UPSERT_WITH_INSERT_DEFAULT_SEMANTICS,
+  TRAF_UPSERT_MODE,
 
   // This enum constant must be the LAST one in the list; it's a count,
   // not an Attribute (it's not IN DefaultDefaults; it's the SIZE of it)!
@@ -3895,6 +3893,7 @@ enum DefaultToken {
  DF_MEASURE,
  DF_MEDIUM,
  DF_MEDIUM_LOW,
+ DF_MERGE,
  DF_MINIMUM,
  DF_MMAP,
  DF_MULTI_NODE,
@@ -3905,6 +3904,7 @@ enum DefaultToken {
  DF_ON,
  DF_OPENS_FOR_WRITE,
  DF_OPERATOR,
+ DF_OPTIMAL,
  DF_ORDERED,
  DF_PERTABLE,
  DF_PRINT,
@@ -3916,6 +3916,7 @@ enum DefaultToken {
  DF_RELEASE,
  DF_REMOTE,
  DF_REPEATABLE_READ,
+ DF_REPLACE,
  DF_REPSEL,
  DF_RESOURCES,
  DF_RETURN,

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/445f6902/core/sql/sqlcomp/nadefaults.cpp
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/nadefaults.cpp b/core/sql/sqlcomp/nadefaults.cpp
index 49fff32..dcd4dbb 100644
--- a/core/sql/sqlcomp/nadefaults.cpp
+++ b/core/sql/sqlcomp/nadefaults.cpp
@@ -3405,8 +3405,8 @@ XDDkwd__(SUBQUERY_UNNESTING,                      "ON"),
   DDkwd__(TRAF_UNLOAD_SKIP_WRITING_TO_FILES,           "OFF"),
   DDkwd__(TRAF_UPSERT_ADJUST_PARAMS,                   "OFF"),
   DDkwd__(TRAF_UPSERT_AUTO_FLUSH,                      "OFF"),
+  DDkwd__(TRAF_UPSERT_MODE,                            "MERGE"),
   DDint__(TRAF_UPSERT_WB_SIZE,                         "2097152"),
-  DDkwd__(TRAF_UPSERT_WITH_INSERT_DEFAULT_SEMANTICS,   "OFF"),
   DDkwd__(TRAF_UPSERT_WRITE_TO_WAL,                    "OFF"),
 
   DDkwd__(TRAF_USE_RWRS_FOR_MD_INSERT,                   "ON"),
@@ -6317,6 +6317,7 @@ const char *NADefaults::keywords_[DF_lastToken] = {
   "MEASURE",
   "MEDIUM",
   "MEDIUM_LOW",
+  "MERGE",
   "MINIMUM",
   "MMAP",
   "MULTI_NODE",
@@ -6327,6 +6328,7 @@ const char *NADefaults::keywords_[DF_lastToken] = {
   "ON",
   "OPENS_FOR_WRITE",
   "OPERATOR",
+  "OPTIMAL",
   "ORDERED",
   "PERTABLE",
   "PRINT",
@@ -6338,6 +6340,7 @@ const char *NADefaults::keywords_[DF_lastToken] = {
   "RELEASE",
   "REMOTE",
   "REPEATABLE_READ",
+  "REPLACE",
   "REPSEL",
   "RESOURCES",
   "RETURN",
@@ -7000,6 +7003,11 @@ DefaultToken NADefaults::token(Int32 attrEnum,
       if (tok == DF_OFF || tok == DF_MINIMUM ||
           tok == DF_MEDIUM || tok == DF_MAXIMUM || tok == DF_ON)
         isValid = TRUE;
+      break;
+    case TRAF_UPSERT_MODE:
+      if (tok == DF_MERGE || tok == DF_REPLACE || tok == DF_OPTIMAL)
+       isValid = TRUE;
+      break;
 
     // Nothing needs to be added here for ON/OFF/SYSTEM keywords --
     // instead, add to DEFAULT_ALLOWS_SEPARATE_SYSTEM code in the ctor.

Reply via email to