You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by su...@apache.org on 2015/09/17 22:04:05 UTC
[3/5] incubator-trafodion git commit: Add a small change to disable
this feature if it causes problems. cqd MERGE_WITH_UNIQUE_INDEX 'OFF' will
disable this feature. ON by default.
Add a small change to disable this feature if it causes problems.
cqd MERGE_WITH_UNIQUE_INDEX 'OFF' will disable this feature.
ON by 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/225d2e49
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/225d2e49
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/225d2e49
Branch: refs/heads/master
Commit: 225d2e49fd44ace2a9d42859b159ecaae7caba65
Parents: 7de5f86
Author: Suresh Subbiah <su...@apache.org>
Authored: Thu Sep 17 02:00:59 2015 +0000
Committer: Suresh Subbiah <su...@apache.org>
Committed: Thu Sep 17 02:00:59 2015 +0000
----------------------------------------------------------------------
core/sql/optimizer/BindRelExpr.cpp | 11 ++++++++++-
core/sql/sqlcomp/DefaultConstants.h | 1 +
core/sql/sqlcomp/nadefaults.cpp | 3 +++
3 files changed, 14 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/225d2e49/core/sql/optimizer/BindRelExpr.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/BindRelExpr.cpp b/core/sql/optimizer/BindRelExpr.cpp
index 75f13c0..b7ecb41 100644
--- a/core/sql/optimizer/BindRelExpr.cpp
+++ b/core/sql/optimizer/BindRelExpr.cpp
@@ -12709,7 +12709,16 @@ NABoolean GenericUpdate::checkForMergeRestrictions(BindWA *bindWA)
return TRUE;
}
-
+
+ if (getTableDesc()->hasUniqueIndexes() &&
+ (CmpCommon::getDefault(MERGE_WITH_UNIQUE_INDEX) == DF_OFF))
+ {
+ *CmpCommon::diags() << DgSqlCode(-3241)
+ << DgString0(" unique indexes not allowed.");
+ bindWA->setErrStatus();
+ return TRUE;
+ }
+
if ((accessOptions().accessType() == SKIP_CONFLICT_) ||
(getGroupAttr()->isStream()) ||
(newRecBeforeExprArray().entries() > 0)) // set on rollback
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/225d2e49/core/sql/sqlcomp/DefaultConstants.h
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/DefaultConstants.h b/core/sql/sqlcomp/DefaultConstants.h
index 9d61b40..bb5c4f4 100644
--- a/core/sql/sqlcomp/DefaultConstants.h
+++ b/core/sql/sqlcomp/DefaultConstants.h
@@ -3756,6 +3756,7 @@ enum DefaultConstants
TRAF_LOAD_ALLOW_RISKY_INDEX_MAINTENANCE,
HBASE_RANGE_PARTITIONING_PARTIAL_COLS,
+ MERGE_WITH_UNIQUE_INDEX,
// 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)!
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/225d2e49/core/sql/sqlcomp/nadefaults.cpp
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/nadefaults.cpp b/core/sql/sqlcomp/nadefaults.cpp
index 72929ec..4e7a765 100644
--- a/core/sql/sqlcomp/nadefaults.cpp
+++ b/core/sql/sqlcomp/nadefaults.cpp
@@ -2214,6 +2214,9 @@ SDDkwd__(ISO_MAPPING, (char *)SQLCHARSETSTRING_ISO88591),
DDkwd__(MERGE_JOIN_CONTROL, "OFF"),
DDkwd__(MERGE_JOIN_WITH_POSSIBLE_DEADLOCK, "OFF"),
+ // controls if merge/upsert is supported on table with a unique index
+ DDkwd__(MERGE_WITH_UNIQUE_INDEX, "ON"),
+
SDDui___(METADATA_CACHE_SIZE, "20"),
DDkwd__(METADATA_STABLE_ACCESS, "OFF"),
//-------------------------------------------------------------------