Merge [TRAFODION 3091] Unnamed Dynamic parameter doesn't work in WITH stateā€¦ PR-1585
diff --git a/core/conn/odbc/src/odbc/nsksrvrcore/srvrothers.cpp b/core/conn/odbc/src/odbc/nsksrvrcore/srvrothers.cpp
index 423b0a6..b4ca5c4 100644
--- a/core/conn/odbc/src/odbc/nsksrvrcore/srvrothers.cpp
+++ b/core/conn/odbc/src/odbc/nsksrvrcore/srvrothers.cpp
@@ -5242,6 +5242,8 @@
                  if (retcode == SQL_ERROR)
                  {
                     ERROR_DESC_def *p_buffer = QryCatalogSrvrStmt->sqlError.errorList._buffer;
+                    char             errNumStr[128] = {0};
+                    sprintf(errNumStr, "%d", (int)p_buffer->sqlcode);
                     strncpy(RequestError, p_buffer->errorText,sizeof(RequestError) -1);
                     RequestError[sizeof(RequestError) - 1] = '\0';
 
@@ -5251,7 +5253,7 @@
                                  ODBCMX_SERVER,
                                  srvrGlobal->srvrObjRef,
                                  2,
-                                 p_buffer->sqlcode,
+                                 errNumStr,
                                  RequestError);
 
                     exception_->exception_nr = odbc_SQLSvc_GetSQLCatalogs_ParamError_exn_;
@@ -6533,6 +6535,8 @@
         if (retcode == SQL_ERROR)
         {
             ERROR_DESC_def *p_buffer = QryLobExtractSrvrStmt->sqlError.errorList._buffer;
+            char            errNumStr[128] = {0};
+            sprintf(errNumStr, "%d", (int)p_buffer->sqlcode);
             strncpy(RequestError, p_buffer->errorText, sizeof(RequestError) - 1);
 
             SendEventMsg(MSG_SQL_ERROR,
@@ -6541,7 +6545,7 @@
                          ODBCMX_SERVER,
                          srvrGlobal->srvrObjRef,
                          2,
-                         p_buffer->sqlcode,
+                         errNumStr,
                          RequestError);
 
             exception_->exception_nr = odbc_SQLsrvr_ExtractLob_ParamError_exn_;
@@ -6616,6 +6620,9 @@
         if (retcode == SQL_ERROR)
         {
             ERROR_DESC_def * p_buffer = QryLobUpdateSrvrStmt->sqlError.errorList._buffer;
+            char             errNumStr[128] = {0};
+            sprintf(errNumStr, "%d", (int)p_buffer->sqlcode);
+
             strncpy(RequestError, p_buffer->errorText, sizeof(RequestError) - 1);
 
             SendEventMsg(MSG_SQL_ERROR,
@@ -6624,7 +6631,7 @@
                          ODBCMX_SERVER,
                          srvrGlobal->srvrObjRef,
                          2,
-                         p_buffer->sqlcode,
+                         errNumStr,
                          RequestError);
             exception_->exception_nr = odbc_SQLSvc_UpdateLob_ParamError_exn_;
             exception_->u.SQLError.errorList._length = QryLobUpdateSrvrStmt->sqlError.errorList._length;
diff --git a/core/sqf/export/include/seabed/int/thread.inl b/core/sqf/export/include/seabed/int/thread.inl
index 476881d..12bda5a 100644
--- a/core/sqf/export/include/seabed/int/thread.inl
+++ b/core/sqf/export/include/seabed/int/thread.inl
@@ -68,6 +68,9 @@
 
 SB_INLINE void *SB_Thread::Sthr::specific_get(int pv_key) {
     void *lp_data = pthread_getspecific(pv_key);
+    //a temp solution for Trafodion to running on CentOS 7
+    //Not understanding why lp_data will become 0x01
+    if(lp_data == (void *)0x01) return NULL;
 #ifdef SB_THREAD_PRINT_PTHREAD_CALLS
     if (gv_sb_trace_pthread)
         trace_printf("pthread_getspecific(%d) EXIT, ret=%p\n", pv_key, lp_data);
diff --git a/core/sqf/src/seatrans/hbase-trx/pom.xml.cdh54 b/core/sqf/src/seatrans/hbase-trx/pom.xml.cdh54
index d97d3b1..2d54caf 100755
--- a/core/sqf/src/seatrans/hbase-trx/pom.xml.cdh54
+++ b/core/sqf/src/seatrans/hbase-trx/pom.xml.cdh54
@@ -299,6 +299,7 @@
           <plugin>
             <groupId>org.apache.hadoop</groupId>
             <artifactId>hadoop-maven-plugins</artifactId>
+            <version>2.6.0</version>
             <executions>
               <execution>
                 <id>compile-protoc</id>
diff --git a/core/sqf/src/seatrans/hbase-trx/pom.xml.cdh55 b/core/sqf/src/seatrans/hbase-trx/pom.xml.cdh55
index c8fa48f..0f2429e 100755
--- a/core/sqf/src/seatrans/hbase-trx/pom.xml.cdh55
+++ b/core/sqf/src/seatrans/hbase-trx/pom.xml.cdh55
@@ -299,6 +299,7 @@
           <plugin>
             <groupId>org.apache.hadoop</groupId>
             <artifactId>hadoop-maven-plugins</artifactId>
+            <version>2.6.0</version>
             <executions>
               <execution>
                 <id>compile-protoc</id>
diff --git a/core/sqf/src/seatrans/hbase-trx/pom.xml.cdh57 b/core/sqf/src/seatrans/hbase-trx/pom.xml.cdh57
index c659805..e5e5272 100644
--- a/core/sqf/src/seatrans/hbase-trx/pom.xml.cdh57
+++ b/core/sqf/src/seatrans/hbase-trx/pom.xml.cdh57
@@ -299,6 +299,7 @@
           <plugin>
             <groupId>org.apache.hadoop</groupId>
             <artifactId>hadoop-maven-plugins</artifactId>
+            <version>2.6.0</version>
             <executions>
               <execution>
                 <id>compile-protoc</id>
diff --git a/core/sqf/src/trafconf/Makefile b/core/sqf/src/trafconf/Makefile
index f4704f7..507e296 100644
--- a/core/sqf/src/trafconf/Makefile
+++ b/core/sqf/src/trafconf/Makefile
@@ -46,6 +46,9 @@
 # need -lsqlite3 for SQLite
 LIBSX	+=  -lsqlite3
 
+# need -lpthread starting on CentOS7
+LIBSX	+=  -lpthread  
+
 PROGS		= $(TRAFCONF)
 
 OBJTRAFCONFIG		= $(OUTDIR)/trafconfig.o \
diff --git a/core/sql/bin/SqlciErrors.txt b/core/sql/bin/SqlciErrors.txt
index 8146be4..23279fb 100644
--- a/core/sql/bin/SqlciErrors.txt
+++ b/core/sql/bin/SqlciErrors.txt
@@ -1242,7 +1242,7 @@
 4179 0A000 99999 BEGINNER MAJOR DBADMIN SEQUENCE BY is not supported for stream expressions.
 4180 0A000 99999 BEGINNER MAJOR DBADMIN Stream expression is not supported for top level DELETE statement. 
 4181 ZZZZZ 99999 BEGINNER MAJOR DBADMIN --- unused as of 03/17/04 ---
-4182 ZZZZZ 99999 BEGINNER MAJOR DBADMIN --- unused as of 03/17/04 ---
+4182 42000 99999 BEGINNER MAJOR DBADMIN Function $0~String0 operand $0~Int0 must be of type $1~String1.
 4183 0A000 99999 BEGINNER MAJOR DBADMIN Embedded DELETE statements are not allowed on referenced tables.
 4184 0A000 99999 BEGINNER MAJOR DBADMIN Columns that are part of a referential constraint cannot be updated using embedded UPDATE statements. 
 4185 42000 99999 BEGINNER MAJOR DBADMIN Select list index is not allowed to be specified in the GROUP BY clause for this query.
diff --git a/core/sql/comexe/ComTdbExeUtil.h b/core/sql/comexe/ComTdbExeUtil.h
index 4716460..ef48954 100644
--- a/core/sql/comexe/ComTdbExeUtil.h
+++ b/core/sql/comexe/ComTdbExeUtil.h
@@ -2522,6 +2522,7 @@
     PRIVILEGES_ON_TABLE_,
     PRIVILEGES_ON_MV_,
     PRIVILEGES_ON_VIEW_,
+    PRIVILEGES_ON_SEQUENCE_,
     SYNONYMS_ON_TABLE_,
 
     OBJECTS_ON_TABLE_,
@@ -2559,6 +2560,9 @@
     PROCEDURES_FOR_LIBRARY_,
     FUNCTIONS_FOR_LIBRARY_,
     TABLE_FUNCTIONS_FOR_LIBRARY_,
+    PRIVILEGES_ON_LIBRARY_,
+    PRIVILEGES_ON_PROCEDURE_,
+    PRIVILEGES_ON_ROUTINE_,
 
     COMPONENTS_,
     COMPONENT_OPERATIONS_,
diff --git a/core/sql/executor/ExExeUtilGet.cpp b/core/sql/executor/ExExeUtilGet.cpp
index 33865fa..163b190 100644
--- a/core/sql/executor/ExExeUtilGet.cpp
+++ b/core/sql/executor/ExExeUtilGet.cpp
@@ -558,8 +558,7 @@
   {"   case when bitextract(privileges_bitmap,58,1) = 1 then 'R' else '-' end || "},
   {"   case when bitextract(privileges_bitmap,57,1) = 1 then 'E' else '-' end as privs "},
   {" from %s.\"%s\".%s "},
-  {" where grantor_id <> -2 "},
-  {"  and object_uid = "},
+  {" where object_uid = "},
   {"  (select object_uid from %s.\"%s\".%s "},
   {"   where catalog_name = '%s' and schema_name = '%s' and object_name = '%s' "},
   {"     and object_type = '%s') %s "},
@@ -573,11 +572,11 @@
   {"  case when bitextract(privileges_bitmap,58,1) = 1 then 'R' else '-' end || "},
   {"  case when bitextract(privileges_bitmap,57,1) = 1 then 'E' else '-' end as privs "},
   {" from %s.\"%s\".%s "},
-  {" where grantor_id <> -2 "},
-  {"  and object_uid = "},
+  {" where object_uid = "},
   {"  (select object_uid from %s.\"%s\".%s "},
   {"   where catalog_name = '%s' and schema_name = '%s' and object_name = '%s' "},
   {"     and object_type = '%s') %s )"},
+  {" order by 1 "},
   {" ; "}
 };
 
@@ -599,9 +598,9 @@
   {"  (select object_type, case when object_type = 'SS' "      },
   {"   then lower(trim(catalog_name) || '.' || trim(schema_name)) "},
   {"   else lower(trim(catalog_name) || '.' || "               },
-  {"    trim(schema_name) || '.' || trim(object_name)) end "       },
+  {"    trim(schema_name) || '.' || trim(object_name)) end "   },
   {"   from %s.\"%s\".%s where catalog_name = 'HIVE' and "     },
-  {"                           %s) O(t, a) "                   },
+  {"                           %s %s) O(t, a) "                },
   {"  left join "                                              },
   {"   (select '%s' || '.' || trim(y) from "                   },
   {"    (get %s in catalog %s, no header) x(y)) G(b)"          },
@@ -617,7 +616,7 @@
   {" from "                                                    },
   {"  (select trim(schema_name), trim(object_name)            "},
   {"   from %s.\"%s\".%s where catalog_name = 'HBASE'     "    },
-  {"      and object_type = 'BT') O(s, o) "                    },
+  {"      and object_type = 'BT' %s) O(s, o) "                 },
   {"  left join "                                              },
   {"   (select trim(y) from "                                  },
   {"    (get external hbase objects) x(y)) G(b)"               },
@@ -636,7 +635,7 @@
   {"                char_length(schema_name)-5))) "            },
   {"    || '.' || lower(trim(object_name)) "                   },
   {"   from %s.\"%s\".%s where object_type = '%s' "            },
-  {"    and schema_name like '|_HV|_%%|_' escape '|') O(a)   " },
+  {"    and schema_name like '|_HV|_%%|_' escape '|' %s) O(a)" },
   {"  left join "                                              },
   {"   (select '%s' || '.' || trim(y) from "                   },
   {"    (get %s in catalog %s, no header) x(y)) G(b) "         },
@@ -1013,6 +1012,12 @@
       }
     break;
 
+    case ComTdbExeUtilGetMetadataInfo::HBASE_OBJECTS_:
+      {
+	str_sprintf(headingBuf_, "External HBase objects");
+      }
+    break;
+
     case ComTdbExeUtilGetMetadataInfo::HIVE_REG_VIEWS_IN_CATALOG_:
       {
 	str_sprintf(headingBuf_, "Hive Registered Views in Catalog %s",
@@ -1160,6 +1165,27 @@
       }
     break;
 
+    case ComTdbExeUtilGetMetadataInfo::PRIVILEGES_ON_SEQUENCE_:
+      {
+        str_sprintf(headingBuf_, "Privileges on Sequence %s.%s",
+                    getMItdb().getSch(), getMItdb().getObj());
+      }
+    break;
+
+    case ComTdbExeUtilGetMetadataInfo::PRIVILEGES_ON_LIBRARY_:
+      {
+        str_sprintf(headingBuf_, "Privileges on Sequence %s.%s",
+                    getMItdb().getSch(), getMItdb().getObj());
+      }
+    break;
+
+    case ComTdbExeUtilGetMetadataInfo::PRIVILEGES_ON_ROUTINE_:
+      {
+        str_sprintf(headingBuf_, "Privileges on Routine %s.%s",
+                    getMItdb().getSch(), getMItdb().getObj());
+      }
+    break;
+
     case ComTdbExeUtilGetMetadataInfo::SYNONYMS_ON_TABLE_:
       {
 	str_sprintf(headingBuf_, "Synonyms on Table %s.%s",
@@ -1954,7 +1980,9 @@
               ||getMItdb().queryType_ == ComTdbExeUtilGetMetadataInfo::PRIVILEGES_FOR_ROLE_
               ||getMItdb().queryType_ == ComTdbExeUtilGetMetadataInfo::PRIVILEGES_FOR_USER_
               ||getMItdb().queryType_ == ComTdbExeUtilGetMetadataInfo::PRIVILEGES_ON_TABLE_
-              ||getMItdb().queryType_ == ComTdbExeUtilGetMetadataInfo::PRIVILEGES_ON_VIEW_)
+              ||getMItdb().queryType_ == ComTdbExeUtilGetMetadataInfo::PRIVILEGES_ON_SEQUENCE_
+              ||getMItdb().queryType_ == ComTdbExeUtilGetMetadataInfo::PRIVILEGES_ON_LIBRARY_
+              ||getMItdb().queryType_ == ComTdbExeUtilGetMetadataInfo::PRIVILEGES_ON_ROUTINE_)
 	    {
                if (!CmpCommon::context()->isAuthorizationEnabled())
                {
@@ -2028,22 +2056,22 @@
 		}
 	      break;
 	      
-	      case ComTdbExeUtilGetMetadataInfo::HIVE_REG_TABLES_IN_CATALOG_:
-	      case ComTdbExeUtilGetMetadataInfo::HIVE_REG_VIEWS_IN_CATALOG_:
-	      case ComTdbExeUtilGetMetadataInfo::HIVE_REG_SCHEMAS_IN_CATALOG_:
-	      case ComTdbExeUtilGetMetadataInfo::HIVE_REG_OBJECTS_IN_CATALOG_:
-		{
-		  qs = getHiveRegObjectsInCatalogQuery;
-		  sizeOfqs = sizeof(getHiveRegObjectsInCatalogQuery);
+              case ComTdbExeUtilGetMetadataInfo::HIVE_REG_TABLES_IN_CATALOG_:
+              case ComTdbExeUtilGetMetadataInfo::HIVE_REG_VIEWS_IN_CATALOG_:
+              case ComTdbExeUtilGetMetadataInfo::HIVE_REG_SCHEMAS_IN_CATALOG_:
+              case ComTdbExeUtilGetMetadataInfo::HIVE_REG_OBJECTS_IN_CATALOG_:
+              {
+                qs = getHiveRegObjectsInCatalogQuery;
+                sizeOfqs = sizeof(getHiveRegObjectsInCatalogQuery);
 
-                  if (getMItdb().queryType_ == ComTdbExeUtilGetMetadataInfo::HIVE_REG_TABLES_IN_CATALOG_)
-                    {
-                      strcpy(hiveGetType, "tables");
-                      str_sprintf(hiveObjType, " (object_type = '%s') ",
-                                  COM_BASE_TABLE_OBJECT_LIT);
+                if (getMItdb().queryType_ == ComTdbExeUtilGetMetadataInfo::HIVE_REG_TABLES_IN_CATALOG_)
+                {
+                   strcpy(hiveGetType, "tables");
+                   str_sprintf(hiveObjType, " (object_type = '%s') ",
+                                COM_BASE_TABLE_OBJECT_LIT);
                     }
                   else if (getMItdb().queryType_ == ComTdbExeUtilGetMetadataInfo::HIVE_REG_VIEWS_IN_CATALOG_)
-                    {
+                   {
                       strcpy(hiveGetType, "views");
                       str_sprintf(hiveObjType, " (object_type = '%s') ",
                                   COM_VIEW_OBJECT_LIT);
@@ -2063,46 +2091,57 @@
                                   COM_SHARED_SCHEMA_OBJECT_LIT);
                     }
                     
-		  param_[0] = cat;
-		  param_[1] = sch;
-		  param_[2] = tab;
-		  param_[3] = hiveObjType;
-		  param_[4] = hiveSysCat;
-                  param_[5] = hiveGetType, 
-		  param_[6] = hiveSysCat;
+                  if (doPrivCheck)
+                    privWhereClause = getGrantedPrivCmd(authList, cat);
+
+                param_[0] = cat;
+                param_[1] = sch;
+                param_[2] = tab;
+                param_[3] = hiveObjType;
+                param_[4] = (char *)privWhereClause.data();
+                param_[5] = hiveSysCat;
+                param_[6] = hiveGetType, 
+                param_[7] = hiveSysCat;
 		}
 	      break;
 
-	      case ComTdbExeUtilGetMetadataInfo::HBASE_REG_TABLES_IN_CATALOG_:
-		{
-		  qs = getHBaseRegTablesInCatalogQuery;
-		  sizeOfqs = sizeof(getHBaseRegTablesInCatalogQuery);
+	     case ComTdbExeUtilGetMetadataInfo::HBASE_REG_TABLES_IN_CATALOG_:
+               {
+                 qs = getHBaseRegTablesInCatalogQuery;
+                 sizeOfqs = sizeof(getHBaseRegTablesInCatalogQuery);
 
-		  param_[0] = cat;
-		  param_[1] = sch;
-		  param_[2] = tab;
-		}
+                 if (doPrivCheck)
+                   privWhereClause = getGrantedPrivCmd(authList, cat);
+
+                 param_[0] = cat;
+                 param_[1] = sch;
+                 param_[2] = tab;
+                 param_[3] = (char *)privWhereClause.data();
+               }
 	      break;
 	      
-	      case ComTdbExeUtilGetMetadataInfo::HIVE_EXT_TABLES_IN_CATALOG_:
-		{
-		  qs = getHiveExtTablesInCatalogQuery;
-		  sizeOfqs = sizeof(getHiveExtTablesInCatalogQuery);
+              case ComTdbExeUtilGetMetadataInfo::HIVE_EXT_TABLES_IN_CATALOG_:
+                {
+                  qs = getHiveExtTablesInCatalogQuery;
+                  sizeOfqs = sizeof(getHiveExtTablesInCatalogQuery);
+
+                  if (doPrivCheck)
+                    privWhereClause = getGrantedPrivCmd(authList, cat);
 
                   strcpy(hiveObjType, COM_BASE_TABLE_OBJECT_LIT);
                   strcpy(hiveGetType, "tables");
 
-		  param_[0] = hiveSysCat;
-		  param_[1] = cat;
-		  param_[2] = sch;
-		  param_[3] = tab;
-		  param_[4] = hiveObjType;
-		  param_[5] = hiveSysCat;
-                  param_[6] = hiveGetType, 
-		  param_[7] = hiveSysCat;
-
-		}
-	      break;
+                  param_[0] = hiveSysCat;
+                  param_[1] = cat;
+                  param_[2] = sch;
+                  param_[3] = tab;
+                  param_[4] = hiveObjType;
+                  param_[5] = (char *)privWhereClause.data();
+                  param_[6] = hiveSysCat;
+                  param_[7] = hiveGetType, 
+                  param_[8] = hiveSysCat;
+                }
+              break;
 	      
 	      case ComTdbExeUtilGetMetadataInfo::VIEWS_IN_SCHEMA_:
 		{
@@ -2560,22 +2599,58 @@
 
               case ComTdbExeUtilGetMetadataInfo::PRIVILEGES_ON_TABLE_:
               case ComTdbExeUtilGetMetadataInfo::PRIVILEGES_ON_VIEW_:
+              case ComTdbExeUtilGetMetadataInfo::PRIVILEGES_ON_SEQUENCE_:
+              case ComTdbExeUtilGetMetadataInfo::PRIVILEGES_ON_LIBRARY_:
+              case ComTdbExeUtilGetMetadataInfo::PRIVILEGES_ON_ROUTINE_:
               {
                 qs = getTrafPrivsOnObject;
                 sizeOfqs = sizeof(getTrafPrivsOnObject);
 
+                // Determine the type of object
                 NAString objType;
                 if (getMItdb().queryType_ == ComTdbExeUtilGetMetadataInfo::PRIVILEGES_ON_TABLE_)
                   objType = COM_BASE_TABLE_OBJECT_LIT;
-                else
+                else if (getMItdb().queryType_ == ComTdbExeUtilGetMetadataInfo::PRIVILEGES_ON_VIEW_)
                   objType = COM_VIEW_OBJECT_LIT;
+                else if (getMItdb().queryType_ == ComTdbExeUtilGetMetadataInfo::PRIVILEGES_ON_SEQUENCE_)
+                  objType = COM_SEQUENCE_GENERATOR_OBJECT_LIT;
+                else if (getMItdb().queryType_ == ComTdbExeUtilGetMetadataInfo::PRIVILEGES_ON_LIBRARY_)
+                  objType = COM_LIBRARY_OBJECT_LIT;
+                else
+                  objType = COM_USER_DEFINED_ROUTINE_OBJECT_LIT;
 
+                char buf[authList.length() + 100];
                 if (doPrivCheck)
-                {
-                   char buf[authList.length() + 100];
-                   str_sprintf(buf, "and grantee_id in %s ", authList.data());
-                   privWhereClause = buf;
-                }
+                  {
+                    if (getMItdb().getParam1() && 
+                        (strcmp(getMItdb().getParam1(), currContext->getDatabaseUserName()) != 0))
+                          str_sprintf(buf, "and grantee_id = -2 ");
+                    else
+                        str_sprintf(buf, " and grantee_id in %s ", authList.data());
+                    privWhereClause = buf;
+                  }
+                else
+                  {
+                    if (getMItdb().getParam1())
+                      {
+                        if (strcmp(getMItdb().getParam1(), currContext->getDatabaseUserName()) == 0)
+                          str_sprintf(buf, " and grantee_id in %s ", authList.data());
+                        else
+                          {
+                            Int32 authID = getAuthID(getMItdb().getParam1(), cat, sch, auths);
+                            char *userRoleList = getRoleList(authID, cat, pmsch, role_usage);
+                            if (userRoleList)
+                              {
+                                str_sprintf(buf, " and grantee_id in %s ", userRoleList);
+                                NADELETEBASIC(userRoleList, getHeap());
+                              }
+                            else
+                              str_sprintf(buf, " = %d ", authID);
+                          }
+                        privWhereClause = buf;
+                      }
+                  }
+
                 param_[0] = cat;
                 param_[1] = pmsch;
                 param_[2] = objPrivs;
@@ -2956,7 +3031,7 @@
 		step_ = HANDLE_ERROR_;
 		break;
 	      }
-
+ 
 	    if (fetchAllRows(infoList_, queryBuf_, numOutputEntries_,
 			     FALSE, retcode) < 0)
 	      {
@@ -2992,7 +3067,10 @@
             if ((getMItdb().queryType_ == ComTdbExeUtilGetMetadataInfo::PRIVILEGES_FOR_USER_) ||
                 (getMItdb().queryType_ == ComTdbExeUtilGetMetadataInfo::PRIVILEGES_FOR_ROLE_) ||
                 (getMItdb().queryType_ == ComTdbExeUtilGetMetadataInfo::PRIVILEGES_ON_VIEW_) ||
-                (getMItdb().queryType_ == ComTdbExeUtilGetMetadataInfo::PRIVILEGES_ON_TABLE_))
+                (getMItdb().queryType_ == ComTdbExeUtilGetMetadataInfo::PRIVILEGES_ON_TABLE_) || 
+                (getMItdb().queryType_ == ComTdbExeUtilGetMetadataInfo::PRIVILEGES_ON_SEQUENCE_) || 
+                (getMItdb().queryType_ == ComTdbExeUtilGetMetadataInfo::PRIVILEGES_ON_LIBRARY_) || 
+                (getMItdb().queryType_ == ComTdbExeUtilGetMetadataInfo::PRIVILEGES_ON_ROUTINE_))
 
             {
               // output:  privileges<4spaces>object name
@@ -3909,6 +3987,16 @@
 
         case SETUP_HBASE_QUERY_:
           {
+            // Since HBase tables are native and Trafodion does not manage them
+            // limit who can view these objects
+            if (((currContext->getSqlParserFlags() & 0x20000) == 0) &&
+                !ComUser::isRootUserID() && 
+                !ComUser::currentUserHasRole(ROOT_ROLE_ID) &&
+                !ComUser::currentUserHasRole(HBASE_ROLE_ID))
+              {
+                step_ = DONE_;
+                break;
+              }
             hbaseTables_ = ehi_->listAll("");
             if (! hbaseTables_)
               {
@@ -3918,10 +4006,33 @@
 
             currIndex_ = 0;
 
-            step_ = PROCESS_NEXT_ROW_;
+            if (currIndex_ == hbaseTables_->entries())
+              {
+                step_ = DONE_;
+                break;
+              }
+
+            step_ = DISPLAY_HEADING_;
           }
           break;
 
+        case DISPLAY_HEADING_:
+          {
+            retcode = displayHeading();
+            if (retcode == 1)
+              return WORK_OK;
+            else if (retcode < 0)
+              {
+                step_ = HANDLE_ERROR_;
+                break;
+              }
+
+            headingReturned_ = TRUE;
+
+            step_ = PROCESS_NEXT_ROW_;
+          }
+        break;
+
         case PROCESS_NEXT_ROW_:
           {
             if (currIndex_ == hbaseTables_->entries())
@@ -4545,6 +4656,17 @@
 		break;
 	      }
 	    
+            // Since Hive tables are native and Trafodion does not manage them
+            // limit the users that can see the data.
+            if (((currContext->getSqlParserFlags() & 0x20000) == 0) &&
+                !ComUser::isRootUserID() && 
+                !ComUser::currentUserHasRole(ROOT_ROLE_ID) &&
+                !ComUser::currentUserHasRole(HIVE_ROLE_ID))
+              {
+                step_ = DONE_;
+                break;
+              }
+
 	    short rc = 0;
 	    retcode = fetchAllHiveRows(infoList_, 1, rc);
 	    if (retcode < 0)
diff --git a/core/sql/exp/exp_bignum.cpp b/core/sql/exp/exp_bignum.cpp
index c0f0f69..957edf6 100644
--- a/core/sql/exp/exp_bignum.cpp
+++ b/core/sql/exp/exp_bignum.cpp
@@ -657,8 +657,15 @@
       Lng32 scaleBy = getScale() + exponent;
       if (scaleBy < 0)
 	{
+          Int8 roundMe= 0;
 	  for (i = 0; i < -scaleBy; i++)
+	  {
+	    roundMe = ( mantissa %10 ) > 4? 1:0;
 	    mantissa /= 10;
+	  }
+
+	  if(roundMe == 1) //round it
+	    mantissa++;
 
 	  scaleBy = 0;
 	}
@@ -761,8 +768,15 @@
       Lng32 scaleBy = getScale() + exponent;
       if (scaleBy < 0)
 	{
+	  Int8 roundMe = 0;
 	  for (i = 0; i < -scaleBy; i++)
+	  {
+	    roundMe = ( mantissa %10 ) > 4? 1:0;
 	    mantissa /= 10;
+	  }
+
+	  if(roundMe == 1)
+	    mantissa++;
 
 	  scaleBy = 0;
 	}
diff --git a/core/sql/generator/GenRelExeUtil.cpp b/core/sql/generator/GenRelExeUtil.cpp
index 570c3e5..1b0adb4 100644
--- a/core/sql/generator/GenRelExeUtil.cpp
+++ b/core/sql/generator/GenRelExeUtil.cpp
@@ -1615,8 +1615,10 @@
     {  "SYSTEM", "TABLES",    "IN",    "SCHEMA",   1,      2,        0,      0,      ComTdbExeUtilGetMetadataInfo::TABLES_IN_SCHEMA_ },
     {  "ALL",    "TABLES",    "IN",    "SCHEMA",   1,      2,        0,      0,      ComTdbExeUtilGetMetadataInfo::TABLES_IN_SCHEMA_ },
 
-    {  "ALL",    "SEQUENCES",    "IN",    "SCHEMA",   1,      2,        0,      0,      ComTdbExeUtilGetMetadataInfo::SEQUENCES_IN_SCHEMA_ },
-    {  "USER",   "SEQUENCES",    "IN",    "SCHEMA",   1,      2,        0,      0,      ComTdbExeUtilGetMetadataInfo::SEQUENCES_IN_SCHEMA_ },
+    {  "ALL",    "SEQUENCES",    "IN", "SCHEMA",   1,      2,        0,      0,      ComTdbExeUtilGetMetadataInfo::SEQUENCES_IN_SCHEMA_ },
+    {  "ALL",    "PRIVILEGES",   "ON", "SEQUENCE", 1,      3,        0,      0,      ComTdbExeUtilGetMetadataInfo::PRIVILEGES_ON_SEQUENCE_  },
+    {  "USER",   "SEQUENCES",    "IN", "SCHEMA",   1,      2,        0,      0,      ComTdbExeUtilGetMetadataInfo::SEQUENCES_IN_SCHEMA_ },
+    {  "USER",   "PRIVILEGES",   "ON", "SEQUENCE", 1,      3,        0,      0,      ComTdbExeUtilGetMetadataInfo::PRIVILEGES_ON_SEQUENCE_  },
 
     {  "USER",   "OBJECTS",   "IN",    "SCHEMA",   1,      2,        0,      0,      ComTdbExeUtilGetMetadataInfo::OBJECTS_IN_SCHEMA_ },
     {  "SYSTEM", "OBJECTS",   "IN",    "SCHEMA",   1,      2,        0,      0,      ComTdbExeUtilGetMetadataInfo::OBJECTS_IN_SCHEMA_ },
@@ -1639,7 +1641,10 @@
     {  "ALL",    "LIBRARIES", "IN",    "SCHEMA",   1,      2,        0,      0,      ComTdbExeUtilGetMetadataInfo::LIBRARIES_IN_SCHEMA_ },
     {  "ALL",    "PROCEDURES","IN",    "SCHEMA",   1,      2,        0,      0,      ComTdbExeUtilGetMetadataInfo::PROCEDURES_IN_SCHEMA_ },
     {  "ALL",    "FUNCTIONS", "IN",    "SCHEMA",   1,      2,        0,      0,      ComTdbExeUtilGetMetadataInfo::FUNCTIONS_IN_SCHEMA_ },
-    {  "ALL",    "TABLE_FUNCTIONS", "IN","SCHEMA",  1,     2,        0,      0,      ComTdbExeUtilGetMetadataInfo::TABLE_FUNCTIONS_IN_SCHEMA_ },
+    {  "ALL",    "TABLE_FUNCTIONS", "IN","SCHEMA", 1,      2,        0,      0,      ComTdbExeUtilGetMetadataInfo::TABLE_FUNCTIONS_IN_SCHEMA_ },
+    {  "ALL",    "PRIVILEGES", "ON", "LIBRARY",    1,      3,        0,      0,      ComTdbExeUtilGetMetadataInfo::PRIVILEGES_ON_LIBRARY_ },
+    {  "ALL",    "PRIVILEGES", "ON", "PROCEDURE",  1,      3,        0,      0,      ComTdbExeUtilGetMetadataInfo::PRIVILEGES_ON_ROUTINE_ },
+    {  "ALL",    "PRIVILEGES", "ON", "ROUTINE",    1,      3,        0,      0,      ComTdbExeUtilGetMetadataInfo::PRIVILEGES_ON_ROUTINE_ },
 //    {  "ALL",    "MVS",       "IN",    "SCHEMA",   1,      2,        0,      0,      ComTdbExeUtilGetMetadataInfo::MVS_IN_SCHEMA_ },
 //    {  "ALL",    "MVGROUPS",  "IN",    "SCHEMA",   0,      2,        0,      0,      ComTdbExeUtilGetMetadataInfo::MVGROUPS_IN_SCHEMA_ },
 //    {  "ALL",    "SYNONYMS",  "IN",    "SCHEMA",   1,      2,        0,      0,      ComTdbExeUtilGetMetadataInfo::SYNONYMS_IN_SCHEMA_ },
@@ -1650,12 +1655,9 @@
     {  "USER",   "INDEXES",   "ON",    "TABLE",    0,      3,        0,      0,      ComTdbExeUtilGetMetadataInfo::INDEXES_ON_TABLE_ },
     {  "USER",   "VIEWS",     "ON",    "TABLE",    0,      3,        0,      0,      ComTdbExeUtilGetMetadataInfo::VIEWS_ON_TABLE_ },
     {  "USER",   "OBJECTS",   "ON",    "TABLE",    0,      3,        0,      0,      ComTdbExeUtilGetMetadataInfo::OBJECTS_ON_TABLE_ },
-    {  "USER",   "PRIVILEGES","ON",    "TABLE",    0,      3,        0,      0,      ComTdbExeUtilGetMetadataInfo::PRIVILEGES_ON_TABLE_ },
-    {  "USER",   "PRIVILEGES","ON",    "VIEW",     0,      3,        0,      0,      ComTdbExeUtilGetMetadataInfo::PRIVILEGES_ON_VIEW_ },
 //    {  "USER",   "INDEXES",   "ON",    "MV",       0,      3,        0,      0,      ComTdbExeUtilGetMetadataInfo::INDEXES_ON_MV_ },
 //    {  "USER",   "MVS",       "ON",    "TABLE",    0,      3,        0,      0,      ComTdbExeUtilGetMetadataInfo::MVS_ON_TABLE_ },
 //    {  "USER",   "MVGROUPS",  "ON",    "TABLE",    0,      3,        0,      0,      ComTdbExeUtilGetMetadataInfo::MVGROUPS_ON_TABLE_ },
-//    {  "USER",   "PRIVILEGES","ON",    "MV",       0,      3,        0,      0,      ComTdbExeUtilGetMetadataInfo::PRIVILEGES_ON_MV_ },
 //    {  "USER",   "SYNONYMS",  "ON",    "TABLE",    0,      3,        0,      0,      ComTdbExeUtilGetMetadataInfo::SYNONYMS_ON_TABLE_ },
 
     {  "ALL",    "INDEXES",   "ON",    "TABLE",    0,      3,        0,      0,      ComTdbExeUtilGetMetadataInfo::INDEXES_ON_TABLE_ },
diff --git a/core/sql/optimizer/BindItemExpr.cpp b/core/sql/optimizer/BindItemExpr.cpp
index 6835c6c..67c7471 100644
--- a/core/sql/optimizer/BindItemExpr.cpp
+++ b/core/sql/optimizer/BindItemExpr.cpp
@@ -10805,6 +10805,9 @@
     {
     case ITM_DATE_TRUNC_YEAR:
       {
+        if (enforceDateOrTimestampDatatype(bindWA,0,2))
+          return this;
+
         //Cast to DATETIME YEAR first to pick up only the year.
         strcpy(buf, "CAST(CAST(@A1 AS DATETIME YEAR) AS TIMESTAMP) ;");
       }
@@ -10812,6 +10815,9 @@
 
     case ITM_DATE_TRUNC_MONTH:
       {
+        if (enforceDateOrTimestampDatatype(bindWA,0,2))
+          return this;
+
         //Get first day of year and then add in the months.
         strcpy(buf, "CAST(CAST(@A1 AS DATETIME YEAR) AS TIMESTAMP) + "
                     "CAST(MONTH(@A1)-1 AS INTERVAL MONTH);");
@@ -10820,6 +10826,9 @@
 
     case ITM_DATE_TRUNC_DAY:
       {
+        if (enforceDateOrTimestampDatatype(bindWA,0,2))
+          return this;
+
         //Note: Cast to DATE first to zero out all time fields
         strcpy(buf, "CAST(CAST(@A1 AS DATE) AS TIMESTAMP);");
       }
@@ -10827,6 +10836,9 @@
 
     case ITM_DATE_TRUNC_HOUR:
       {
+        if (enforceDateOrTimestampDatatype(bindWA,0,2))
+          return this;
+
         //Note: Cast to DATE to zero out all time fields.  Cast to TIMESTAMP in case DATE was supplied.
         strcpy(buf,
                "CAST( CAST(@A1 AS DATE) AS TIMESTAMP) + "
@@ -10836,6 +10848,9 @@
 
     case ITM_DATE_TRUNC_MINUTE:
       {
+        if (enforceDateOrTimestampDatatype(bindWA,0,2))
+          return this;
+
         strcpy(buf, "DATE_TRUNC('HOUR',@A1) + "
                     "CAST(MINUTE(CAST(@A1 AS TIMESTAMP)) AS INTERVAL MINUTE);");
       }
@@ -10843,6 +10858,9 @@
 
     case ITM_DATE_TRUNC_SECOND:
       {
+        if (enforceDateOrTimestampDatatype(bindWA,0,2))
+          return this;
+
         strcpy(buf, "DATE_TRUNC('MINUTE',@A1) + "
                     "CAST( CAST( SECOND(CAST(@A1 AS TIMESTAMP)) AS SMALLINT) "
                     "AS INTERVAL SECOND);");
@@ -10851,6 +10869,9 @@
 
     case ITM_DATE_TRUNC_CENTURY:
       {
+        if (enforceDateOrTimestampDatatype(bindWA,0,2)) 
+          return this;
+
         strcpy(buf, "CAST( CAST(@A1 AS DATETIME YEAR) AS TIMESTAMP ) - "
                     "CAST( MOD(YEAR(@A1),100) AS INTERVAL YEAR(4)  );");
       }
@@ -10858,6 +10879,9 @@
 
     case ITM_DATE_TRUNC_DECADE:
       {
+        if (enforceDateOrTimestampDatatype(bindWA,0,2)) 
+          return this;
+
         strcpy(buf, "CAST( CAST(@A1 AS DATETIME YEAR) AS TIMESTAMP ) - "
                     "CAST( MOD(YEAR(@A1),10) AS INTERVAL YEAR(4)   );");
       }
@@ -10866,6 +10890,10 @@
     case ITM_DATEDIFF_YEAR:
     case ITM_TSI_YEAR:
       {
+        if (enforceDateOrTimestampDatatype(bindWA,0,2))
+          return this;
+        if (enforceDateOrTimestampDatatype(bindWA,1,3))
+          return this;
         strcpy(buf, "CAST( YEAR(@A2) - YEAR(@A1) AS INT) ;");
       }
       break;
@@ -10873,6 +10901,10 @@
     case ITM_DATEDIFF_MONTH:
     case ITM_TSI_MONTH:
       {
+        if (enforceDateOrTimestampDatatype(bindWA,0,2))
+          return this;
+        if (enforceDateOrTimestampDatatype(bindWA,1,3))
+          return this;
         strcpy(buf, "CAST( (YEAR(@A2)*12 + MONTH(@A2)) - "
                           "(YEAR(@A1)*12 + MONTH(@A1)) AS INT) ;");
       }
@@ -10880,6 +10912,10 @@
 
     case ITM_MONTHS_BETWEEN:
       {
+        if (enforceDateOrTimestampDatatype(bindWA,0,1))
+          return this;
+        if (enforceDateOrTimestampDatatype(bindWA,1,2))
+          return this;
 	strcpy(buf, "CASE WHEN DAY (@A1) = DAY (@A2) THEN (YEAR(@A1)*12 + MONTH(@A1) - (YEAR(@A2)*12 + MONTH(@A2))) ELSE CAST((CAST(@A1 AS DATE) - CAST(@A2 AS DATE)) AS NUMERIC(18,6))/31 END");
       }
       break;
@@ -10887,6 +10923,10 @@
     case ITM_DATEDIFF_DAY:
     case ITM_TSI_DAY:
       {
+        if (enforceDateOrTimestampDatatype(bindWA,0,2))
+          return this;
+        if (enforceDateOrTimestampDatatype(bindWA,1,3))
+          return this;
         strcpy(buf, "CAST( CAST(@A2 AS DATE) - CAST(@A1 AS DATE) AS INT );");
       }
       break;
@@ -10894,6 +10934,10 @@
     case ITM_DATEDIFF_HOUR:
     case ITM_TSI_HOUR:
       {
+        if (enforceDateOrTimestampDatatype(bindWA,0,2))
+          return this;
+        if (enforceDateOrTimestampDatatype(bindWA,1,3))
+          return this;
         strcpy(buf,
               "CAST( (JULIANTIMESTAMP(DATE_TRUNC('HOUR',@A2)) - "
                     " JULIANTIMESTAMP(DATE_TRUNC('HOUR',@A1))) / (1000000*3600) "
@@ -10904,6 +10948,10 @@
     case ITM_DATEDIFF_MINUTE:
     case ITM_TSI_MINUTE:
       {
+        if (enforceDateOrTimestampDatatype(bindWA,0,2))
+          return this;
+        if (enforceDateOrTimestampDatatype(bindWA,1,3))
+          return this;
         strcpy(buf,
                "CAST( (JULIANTIMESTAMP(DATE_TRUNC('MINUTE',@A2)) - "
                      " JULIANTIMESTAMP(DATE_TRUNC('MINUTE',@A1))) / (1000000*60)"
@@ -10914,6 +10962,10 @@
     case ITM_DATEDIFF_SECOND:
     case ITM_TSI_SECOND:
       {
+        if (enforceDateOrTimestampDatatype(bindWA,0,2))
+          return this;
+        if (enforceDateOrTimestampDatatype(bindWA,1,3))
+          return this;
         strcpy(buf, "CAST( "
                     "(JULIANTIMESTAMP(DATE_TRUNC('SECOND',@A2)) - "
                     " JULIANTIMESTAMP(DATE_TRUNC('SECOND',@A1))) / 1000000"
@@ -10924,6 +10976,10 @@
     case ITM_DATEDIFF_QUARTER:
     case ITM_TSI_QUARTER:
       {
+        if (enforceDateOrTimestampDatatype(bindWA,0,2))
+          return this;
+        if (enforceDateOrTimestampDatatype(bindWA,1,3))
+          return this;
         strcpy(buf, "CAST( ("
                     "((YEAR(@A2)*12) + ((QUARTER(@A2)-1)*3)) - "
                     "((YEAR(@A1)*12) + ((QUARTER(@A1)-1)*3)) ) / 3 AS INT);");
@@ -10933,6 +10989,10 @@
     case ITM_DATEDIFF_WEEK:
     case ITM_TSI_WEEK:
       {
+        if (enforceDateOrTimestampDatatype(bindWA,0,2))
+          return this;
+        if (enforceDateOrTimestampDatatype(bindWA,1,3))
+          return this;
         strcpy(buf, "CAST(("
                     "(CAST(@A2 AS DATE) - CAST(DAYOFWEEK(@A2)-1 AS INTERVAL DAY)) - "
                     "(CAST(@A1 AS DATE) - CAST(DAYOFWEEK(@A1)-1 AS INTERVAL DAY))"
@@ -10942,32 +11002,8 @@
 
     case ITM_LAST_DAY:
       {
-	// Make sure that the child is of date datatype.
-	ItemExpr * tempBoundTree =
-	  child(0)->castToItemExpr()->bindNode(bindWA);
-	if (bindWA->errStatus()) return this;
-
-	if (tempBoundTree->getValueId().getType().getTypeQualifier() !=
-	    NA_DATETIME_TYPE)
-	  {
-	    // 4071 The operand of a LAST_DAY function must be a datetime.
-	    *CmpCommon::diags() << DgSqlCode(-4071) << DgString0(getTextUpper());
-	    bindWA->setErrStatus();
-	    return this;
-	  }
-
-	DatetimeType *dtOper = 
-	  &(DatetimeType&)tempBoundTree->getValueId().getType();
-	if ((dtOper->getPrecision() != SQLDTCODE_TIMESTAMP) &&
-	    (dtOper->getPrecision() != SQLDTCODE_DATE))
-	  {
-	    // 4071 The operand of a LAST_DAY function must be a datetime.
-	    *CmpCommon::diags() << DgSqlCode(-4071) << DgString0(getTextUpper());
-	    bindWA->setErrStatus();
-	    return this;
-	  }
-
-	setChild(0, tempBoundTree);
+        if (enforceDateOrTimestampDatatype(bindWA,0,1))
+          return this;
 
         strcpy(buf, "@A1 - CAST( DAY(@A1) -1 AS INTERVAL DAY) + INTERVAL '1' MONTH - INTERVAL '1' DAY;");
       }
@@ -10975,36 +11011,12 @@
 
     case ITM_NEXT_DAY:
       {
-	// Make sure that the child is of date datatype.
-	ItemExpr * tempBoundTree =
-	  child(0)->castToItemExpr()->bindNode(bindWA);
-	if (bindWA->errStatus()) 
-	  return this;
-
-	if (tempBoundTree->getValueId().getType().getTypeQualifier() !=
-	    NA_DATETIME_TYPE)
-	  {
-	    // 4071 The operand of a NEXT_DAY function must be a datetime.
-	    *CmpCommon::diags() << DgSqlCode(-4071) << DgString0(getTextUpper());
-	    bindWA->setErrStatus();
-	    return this;
-	  }
-
-	DatetimeType *dtOper = 
-	  &(DatetimeType&)tempBoundTree->getValueId().getType();
-	if ((dtOper->getPrecision() != SQLDTCODE_DATE) &&
-	    (dtOper->getPrecision() != SQLDTCODE_TIMESTAMP))
-	  {
-	    // 4071 The operand of a LAST_DAY function must be a datetime.
-	    *CmpCommon::diags() << DgSqlCode(-4071) << DgString0(getTextUpper());
-	    bindWA->setErrStatus();
-	    return this;
-	  }
-
-	setChild(0, tempBoundTree);
+	// Make sure that child(0) is of date or timestamp datatype.
+        if (enforceDateOrTimestampDatatype(bindWA,0,1))
+          return this;
 
 	// make sure child(1) is of string type
-	tempBoundTree =
+	ItemExpr * tempBoundTree =
 	  child(1)->castToItemExpr()->bindNode(bindWA);
 	if (bindWA->errStatus()) 
 	  return this;
@@ -11914,6 +11926,9 @@
 	//Processing of first operand.
 	ItemExpr * tempBoundTree = child(0)->castToItemExpr()->bindNode(bindWA);
 	if (bindWA->errStatus()) return this;
+
+	if (tempBoundTree->getValueId().getType().getTypeQualifier() == NA_UNKNOWN_TYPE)
+	  child(0)->getValueId().coerceType(NA_NUMERIC_TYPE);
 	
 	if (tempBoundTree->getValueId().getType().getTypeQualifier() != NA_NUMERIC_TYPE)
 	  {
@@ -12584,6 +12599,40 @@
   return result;  
 }
 
+// returns true if there is an error
+bool ZZZBinderFunction::enforceDateOrTimestampDatatype(BindWA * bindWA, CollIndex childIndex, int operand)
+{
+  // Make sure that the child is of date or timestamp datatype.
+  ItemExpr * tempBoundTree =
+    child(childIndex)->castToItemExpr()->bindNode(bindWA);
+  if (bindWA->errStatus()) 
+    return true;
+
+  bool error = (tempBoundTree->getValueId().getType().getTypeQualifier() !=
+                NA_DATETIME_TYPE);
+  if (!error)
+    {
+      DatetimeType *dtOper = 
+	  &(DatetimeType&)tempBoundTree->getValueId().getType();
+      error = ((dtOper->getPrecision() != SQLDTCODE_TIMESTAMP) &&
+	       (dtOper->getPrecision() != SQLDTCODE_DATE));
+    }
+
+  if (error)
+    {
+      // 4182 Function $0~String0 operand $0~Int0 must be of type $1~String1.
+      *CmpCommon::diags() << DgSqlCode(-4182) 
+                          << DgString0(getTextUpper())
+                          << DgInt0(operand)
+                          << DgString1("DATE or TIMESTAMP");
+      bindWA->setErrStatus();
+      return true;
+    }
+
+  setChild(childIndex, tempBoundTree);
+  return false;  // no error
+}
+
 //-------------------------------------------------------------------------
 //
 // member functions for class ItmSequenceFunction
diff --git a/core/sql/optimizer/ItemFunc.h b/core/sql/optimizer/ItemFunc.h
index 7d6aa79..2062919 100644
--- a/core/sql/optimizer/ItemFunc.h
+++ b/core/sql/optimizer/ItemFunc.h
@@ -4681,6 +4681,9 @@
 
   // a virtual function for performing name binding within the query tree
   virtual ItemExpr * bindNode(BindWA *bindWA);
+  
+  // helper function used by bindNode; returns true if there is an error
+  bool enforceDateOrTimestampDatatype(BindWA *bindWA, CollIndex child, int operand);
 
   // the synthesizeType method is needed only when we process an item
   // expression at DDL time, for DML the function gets transformed into
diff --git a/core/sql/optimizer/ValueDesc.cpp b/core/sql/optimizer/ValueDesc.cpp
index 45f92e1..0e12ffb 100644
--- a/core/sql/optimizer/ValueDesc.cpp
+++ b/core/sql/optimizer/ValueDesc.cpp
@@ -6382,7 +6382,32 @@
 	 {
            short vLen = val.length();
 
-	   if ((constType->getTypeQualifier()  == NA_NUMERIC_TYPE) &&
+	   if (constType->getTypeQualifier() == NA_INTERVAL_TYPE)
+	     {
+	       // In some code paths, the text may have "INTERVAL 'xxx' <qualifier>"
+	       // junk around it so we have to strip that off. (Example: An equality
+	       // predicate when query caching has been turned off via 
+	       // CQD QUERY_CACHE '0'. Another example happens with BETWEEN, whether 
+	       // or not query caching is turned off. See JIRA TRAFODION-3088 for
+	       // that example.)
+	       Lng32 start = val.index("'");
+	       Lng32 minus = val.index("-");
+	       if (start > 0)
+	         {
+	           Lng32 end = val.index("'", start+1);
+	           if (end > 0)
+	             {
+	               val = val(start+1, (end-start-1));
+	               if ((minus > 0) && (minus < start))  // '-' before the string part
+	                 {
+	                   // prepend '-' to the output
+	                   val.prepend('-', 1);
+	                 }
+	               vLen = val.length();		         
+	             }
+	         }             
+	     }
+	   else if ((constType->getTypeQualifier()  == NA_NUMERIC_TYPE) &&
 	       (((NumericType*)constType)->isExact()) &&
                (NOT ((NumericType*)constType)->isBigNum()) &&
 	       (constType->getScale() > 0))
diff --git a/core/sql/parser/ParKeyWords.cpp b/core/sql/parser/ParKeyWords.cpp
index a213458..0a152ce 100644
--- a/core/sql/parser/ParKeyWords.cpp
+++ b/core/sql/parser/ParKeyWords.cpp
@@ -988,8 +988,6 @@
   ParKeyWord("SHOW",               TOK_SHOW,        NONRESTOKEN_),
   ParKeyWord("SHOWCONTROL",        TOK_SHOWCONTROL, NONRESTOKEN_),
   ParKeyWord("SHOWDDL",            TOK_SHOWDDL,     NONRESTOKEN_|FIRST_),
-  ParKeyWord("SHOWLABEL",          TOK_SHOWLABEL,   NONRESTOKEN_),
-  ParKeyWord("SHOWLEAKS",          TOK_SHOWLEAKS,   NONRESTOKEN_),
   ParKeyWord("SHOWPLAN",           TOK_SHOWPLAN,    NONRESTOKEN_),
   ParKeyWord("SHOWSET",            TOK_SHOWSET,     NONRESTOKEN_),
   ParKeyWord("SHOWSHAPE",          TOK_SHOWSHAPE,   NONRESTOKEN_),
diff --git a/core/sql/parser/sqlparser.y b/core/sql/parser/sqlparser.y
index 455447e..e3f534f 100755
--- a/core/sql/parser/sqlparser.y
+++ b/core/sql/parser/sqlparser.y
@@ -1046,8 +1046,6 @@
 %token <tokval> TOK_SHOWDDL_LIBRARY
 %token <tokval> TOK_SHOWDDL_SEQUENCE
 %token <tokval> TOK_SHOWDDL             /* Tandem extension non-reserved word */
-%token <tokval> TOK_SHOWLABEL           /* Tandem extension     reserved word */
-%token <tokval> TOK_SHOWLEAKS           /* Tandem extension non-reserved word*/
 %token <tokval> TOK_SYSDATE
 %token <tokval> TOK_SYSTIMESTAMP
 %token <tokval> TOK_TARGET
@@ -1908,8 +1906,6 @@
 %type <tokval>    		sign
 %type <corrName>  		table_name
 %type <corrName>		special_table_name
-%type <corrName>  		label_name
-%type <corrName>  		extended_label_name
 %type <corrName>  		actual_table_name
 %type <corrName>  		actual_table_name2
 %type <corrName>		exception_table_name
@@ -2223,10 +2219,7 @@
 %type <corrName>                optional_showddl_action_name_clause
 %type <longint>                 showddl_options_list
 %type <longint>                 showddl_options
-%type <longint>                 showlabel_options
 %type <describeType>            showcontrol_type
-%type <uint>                    showleaks_process
-%type <uint>                    showleaks_session
 //%type <uint>      		returning_clause
 %type <item>      		input_hostvar_expression
 %type <item>      		hostvar_expression
@@ -5533,34 +5526,6 @@
 		     $$->getQualifiedNameObj().setObjectNameSpace(COM_UUDF_ACTION_NAME);
 		  }
 
-/* type corrName */
-label_name : qualified_name
-		  {
-		     //
-		     // note that corrNameFromStrings()
-		     // contains code that deletes $1
-		     //
-		     $$ = corrNameFromStrings($1);
-		     if ($$ == NULL) YYABORT;
-		  }
-              | guardian_location_name
-	          {
-		    ComLocationName locName(*$1,
-		      ComLocationName::GUARDIAN_LOCATION_NAME_FORMAT);
-		    if (NOT locName.isValid())
-		      {
-			// The format of the specified location name
-			// $0~string0 is invalid.
-			*SqlParser_Diags << DgSqlCode(-3061)
-			  << DgString0($1->data());
-		      }
-		    delete $1;
-		    CorrName *result = new (PARSERHEAP()) CorrName();
-		    result->setLocationName(locName.
-		      getGuardianFullyQualifiedName());
-		    $$ = result;
-		  }
-
 /* 100% identical to "actual_table_name", actual_table_name2 is provided only
  * for use in the "select_list_item" productions.  By doing so, it
  * provides a way to get around a reduce/reduce problem that would
@@ -15448,68 +15413,82 @@
             $$ = gmi;
           }
 
-user_or_role : TOK_USER | TOK_ROLE
-
-exe_util_get_metadata_info :   
-          TOK_GET get_info_aus_clause 
-          TOK_PRIVILEGES TOK_ON object_identifier table_name 
-          optional_for_user_clause 
+        | TOK_GET get_info_aus_clause TOK_PRIVILEGES TOK_ON object_identifier 
+          table_name optional_for_user_clause 
           optional_no_header_and_match_pattern_clause
           {
-				 if ((*$5 != "TABLE") && (*$5 != "SCHEMA") &&
-				     (*$5 != "VIEW" ) && (*$5 != "MV") &&
-                                     (*$5 != "USER" ) && (*$5 != "ROLE"))
-				   {
-				     YYERROR;
-				   }
+            NAString aus("ALL");
 
-				 NAString aus(*$2);
-				 if (*$2 == "ALL")
-				   aus = "ALL";
-				 else if (*$2 == "USER")
-				   aus = "USER";
-                                 else if (*$2 == "NONE")
-                                   aus = "USER";
-				 else
-				   YYERROR;
+            NAString infoType("PRIVILEGES");
+            NABoolean getVersion = FALSE;
+            PtrPlaceHolder * pph = $8;
+            NAString * noHeader = (NAString *)pph->ptr1_;
+            NAString * pattern = (NAString *)pph->ptr2_;
+            NAString * fullyQualNames = (NAString *)pph->ptr3_;
 
-				 NAString infoType("PRIVILEGES");
-				 NABoolean getVersion = FALSE;
-				 PtrPlaceHolder * pph = $8;
-				 NAString * noHeader =
-				   (NAString *)pph->ptr1_;
-				 NAString * pattern =
-				   (NAString *)pph->ptr2_;
-				 NAString * fullyQualNames =
-				   (NAString *)pph->ptr3_;
+            NAString iof("ON");
+            NAString nas("");
+            ExeUtilGetMetadataInfo * gmi =
+              new (PARSERHEAP ()) ExeUtilGetMetadataInfo
+              (aus, infoType, iof, *$5, 
+               *$6, pattern,
+               (fullyQualNames ? TRUE : FALSE),
+               getVersion,
+               $7,
+               PARSERHEAP ());
+		 
+            if (noHeader)
+              gmi->setNoHeader(TRUE);
+            else if (NOT ((CmpCommon::getDefault(IS_SQLCI) == DF_ON) ||
+                 (CmpCommon::getDefault(NVCI_PROCESS) == DF_ON)))
+              {
+               gmi->setNoHeader(TRUE);
+              }
 
-				 NAString iof("ON");
-				 NAString nas("");
-				 ExeUtilGetMetadataInfo * gmi =
-				   new (PARSERHEAP ()) ExeUtilGetMetadataInfo
-				   (aus, infoType, iof, *$5, 
-				    *$6, pattern,
-				    (fullyQualNames ? TRUE : FALSE),
-				    getVersion,
-				    $7,
-				    PARSERHEAP ());
-				 
-				 if (noHeader)
-				   gmi->setNoHeader(TRUE);
-				 else if (NOT ((CmpCommon::getDefault(IS_SQLCI) == DF_ON) ||
-					       (CmpCommon::getDefault(NVCI_PROCESS) == DF_ON)))
-				   {
-				     gmi->setNoHeader(TRUE);
-				   }
+            $$ = gmi;
+          }
+    
+      // Created a special production for getting privileges on procedures
+      // TOK_PROCEDURE as an object_identifier causes lots of parser conflicts
+      | TOK_GET get_info_aus_clause TOK_PRIVILEGES TOK_ON TOK_PROCEDURE
+        table_name optional_for_user_clause
+        optional_no_header_and_match_pattern_clause
+        {
+          NAString aus("ALL");
+          NAString infoType("PRIVILEGES");
+          NABoolean getVersion = FALSE;
+          PtrPlaceHolder * pph = $8;
+          NAString * noHeader = (NAString *)pph->ptr1_;
+          NAString * pattern = (NAString *)pph->ptr2_;
+          NAString * fullyQualNames = (NAString *)pph->ptr3_;
 
-				 $$ = gmi;
-			       }
-     
+          NAString iof("ON");
+          NAString nas("");
+          NAString ptype("PROCEDURE");
+          ExeUtilGetMetadataInfo * gmi =
+            new (PARSERHEAP ()) ExeUtilGetMetadataInfo
+            (aus, infoType, iof, ptype,
+             *$6, pattern,
+             (fullyQualNames ? TRUE : FALSE),
+             getVersion,
+             $7,
+             PARSERHEAP ());
+
+          if (noHeader)
+            gmi->setNoHeader(TRUE);
+          else if (NOT ((CmpCommon::getDefault(IS_SQLCI) == DF_ON) ||
+                        (CmpCommon::getDefault(NVCI_PROCESS) == DF_ON)))
+            {
+              gmi->setNoHeader(TRUE);
+            }
+
+          $$ = gmi;
+        }
+
       | TOK_GET get_info_aus_clause TOK_COMPONENTS 
           optional_no_header_and_match_pattern_clause
           // GET COMPONENTS
           {
-            // exe_util_get_metadata_info ::= TOK_GET TOK_COMPONENTS
             NAString aus(*$2);
             if (*$2 == "ALL")
               aus = "ALL";
@@ -15551,8 +15530,6 @@
         | TOK_GET get_info_aus_clause TOK_COMPONENT TOK_PRIVILEGES 
           TOK_ON component_name optional_authid_clause 
           optional_drop_behavior optional_no_header_and_match_pattern_clause 
-          // GET [CURRENT_USER] COMPONENT PRIVILEGES ON <name> or
-          // GET [CURRENT_USER] COMPONENT PRIVILEGES ON <name> FOR <authid>
           {
             NAString aus(*$2);
             if (*$2 == "ALL")
@@ -15711,10 +15688,16 @@
            $$ = gmi;
          }
 
+user_or_role : TOK_USER | TOK_ROLE
+
 optional_for_user_clause : empty { $$ = NULL; }
+                         | TOK_FOR authorization_identifier
+                         {
+                           $$ = new(PARSERHEAP()) NAString(*$2);
+                         }
                          | TOK_FOR TOK_USER authorization_identifier
                          {
-			                  $$ = new(PARSERHEAP()) NAString(*$3);
+                           $$ = new(PARSERHEAP()) NAString(*$3);
                          }
 
 optional_authid_clause : empty { $$ = NULL; }
@@ -15732,16 +15715,14 @@
                      | TOK_TEMP_TABLE   { $$ = new (PARSERHEAP()) NAString("TRIGTEMP");}
                      | TOK_SYSTEM { $$ = new (PARSERHEAP()) NAString("SYSTEM"); }
                      | TOK_EXTERNAL { $$ = new (PARSERHEAP()) NAString("EXTERNAL"); }
-                     | TOK_VERSION TOK_OF { $$ = new (PARSERHEAP()) NAString("VERSION_USER"); }
-                     | TOK_VERSION TOK_OF TOK_ALL { $$ = new (PARSERHEAP()) NAString("VERSION_ALL"); }
-                     | TOK_VERSION TOK_OF TOK_USER { $$ = new (PARSERHEAP()) NAString("VERSION_USER"); }
-                     | TOK_VERSION TOK_OF TOK_SYSTEM { $$ = new (PARSERHEAP()) NAString("VERSION_SYSTEM"); }
 
 object_identifier : 
                     TOK_CATALOG  { $$ = new (PARSERHEAP()) NAString("CATALOG"); }
                   | TOK_CONSTRAINT{ $$ = new (PARSERHEAP()) NAString("CONSTRAINT"); }
                   | TOK_INDEX    { $$ = new (PARSERHEAP()) NAString("INDEX"); }
                   | TOK_LIBRARY  { $$ = new (PARSERHEAP()) NAString("LIBRARY"); }
+                  | TOK_TABLE_MAPPING TOK_FUNCTION  { $$ = new (PARSERHEAP()) NAString("ROUTINE"); }
+                  | TOK_FUNCTION  { $$ = new (PARSERHEAP()) NAString("ROUTINE"); }
                   | TOK_MV       { $$ = new (PARSERHEAP()) NAString("MV"); }
                   | TOK_SCHEMA   { $$ = new (PARSERHEAP()) NAString("SCHEMA"); }
                   | TOK_SYNONYM  { $$ = new (PARSERHEAP()) NAString("SYNONYM"); }
@@ -22559,19 +22540,6 @@
           | TOK_TABLE			{ $$ = Describe::CONTROL_TABLE_; }
           | TOK_SESSION			{ $$ = Describe::CONTROL_SESSION_; }
 
-/*showleaks process*/
-showleaks_process:
-	    TOK_ARKCMP                  { $$ = LeakDescribe::FLAG_ARKCMP; }
-          | TOK_BOTH                    { $$ = LeakDescribe::FLAG_BOTH; }
-          |                             { $$ = LeakDescribe::FLAG_SQLCI; }  
-
-/*session control*/
-showleaks_session:
-	    TOK_CONTINUE                { $$ = LeakDescribe::FLAG_CONTINUE; }
-          | TOK_OFF                     { $$ = LeakDescribe::FLAG_OFF; }
-          | TOK_PROMPT                  { $$ = LeakDescribe::FLAG_PROMPT; }
-	  |                             { $$ = 0; }
-	  
 /* type relx */
 show_statement:
 	     TOK_SHOWCONTROL showcontrol_type 
@@ -22831,72 +22799,6 @@
                delete $3; // CorrName * actual_routine_name of UDF or UUDF
                delete $4; // CorrName * actual_routine_name of routine action
              }
-         | TOK_SHOWLABEL extended_label_name showlabel_options
-             {
-               // Determine the ANSI namespace.
-               ExtendedQualName::SpecialTableType stt = $2->getSpecialType();
-               ComAnsiNameSpace labelAnsiNameSpace = COM_UNKNOWN_NAME;
-               switch (stt) 
-               {
-               case ExtendedQualName::NORMAL_TABLE:
-                 labelAnsiNameSpace = COM_TABLE_NAME;
-                 break;
-               case ExtendedQualName::INDEX_TABLE:
-                 labelAnsiNameSpace = COM_INDEX_NAME;
-                 break;
-               case ExtendedQualName::GHOST_TABLE:
-                 labelAnsiNameSpace = COM_GHOST_TABLE_NAME;
-                 break;
-               case ExtendedQualName::GHOST_INDEX_TABLE:
-                 labelAnsiNameSpace = COM_GHOST_INDEX_NAME;
-                 break;
-               case ExtendedQualName::ISP_TABLE:
-                 labelAnsiNameSpace = COM_TABLE_NAME;
-                 break;
-               case ExtendedQualName::IUD_LOG_TABLE:
-                 labelAnsiNameSpace = COM_IUD_LOG_TABLE_NAME;
-                 break;
-               case ExtendedQualName::RANGE_LOG_TABLE:
-                 labelAnsiNameSpace = COM_RANGE_LOG_TABLE_NAME;
-                 break;
-               case ExtendedQualName::TRIGTEMP_TABLE:
-                 labelAnsiNameSpace = COM_TRIGTEMP_TABLE_NAME;
-                 break;
-               default :
-                 // There should be a case for every special type that
-                 // is specified by the production extended_label_name.
-                 ABORT("internal logic error");
-                 break;
-               }
-
-	       $$ = new (PARSERHEAP())
-		 RelRoot(new (PARSERHEAP())
-			 Describe(SQLTEXT(),
-				  *$2/*label_name*/,
-				  Describe::LABEL_,
-				  labelAnsiNameSpace,
-				  $3 /*showlabel_options*/),
-			 REL_ROOT,	
-			 new (PARSERHEAP())
-			 ColReference(new (PARSERHEAP()) ColRefName(TRUE, PARSERHEAP())));
-	     }
-  //ACH        TOK_SHOWLIBRARY label_name 
-             
-	  | TOK_SHOWLEAKS showleaks_process showleaks_session
-	     {
-	       HEAPLOG_CONTROL(LOG_DELETE_ONLY);  
-	       CorrName c;
-	       $$ = new (PARSERHEAP())
-		 RelRoot(new (PARSERHEAP())
-			 Describe(SQLTEXT(),
-				  c,
-				  Describe::LEAKS_,
-				  COM_TABLE_NAME,
-				  ($2 | $3)),
-			 REL_ROOT,	
-			 new (PARSERHEAP())
-			 ColReference(new (PARSERHEAP()) ColRefName(TRUE, PARSERHEAP())));
-	     }  
 	   | TOK_INVOKE table_name
 	     {
 	       $$ = new (PARSERHEAP())
@@ -23845,105 +23747,6 @@
              $$ = 16;
            }
 
-/* type longint */
-showlabel_options : empty
-           {
-              $$ = 0;
-           }
-     |  ',' TOK_DETAIL
-           {
-             $$ = 1;
-           }
-     |  ',' TOK_DETAIL ',' TOK_PRIVILEGES
-           {
-             $$ = 17;
-           }
-     |  ',' TOK_PRIVILEGES ',' TOK_DETAIL
-           {
-             $$ = 17;
-           }
-     |  ',' TOK_PRIVILEGES
-           {
-             $$ = 16;
-           }
-
-/* type corrName */
-// With the introduction of ghost objects we now use extended_label_name 
-// where we used to use two productions: optional_ansi_name_space label_name
-// Two productions is neater, but we do this to avoid introducing a 
-// shift/reduce conflict.
-extended_label_name : label_name
-           {
-             $$ = $1 /* label_name */;
-             $$->setSpecialType(ExtendedQualName::NORMAL_TABLE);
-           }
-
-     |  TOK_INDEX label_name
-           {
-             $$ = $2 /* label_name */;
-             $$->setSpecialType(ExtendedQualName::INDEX_TABLE);
-           }
-
-     |  TOK_TABLE label_name
-           {
-             $$ = $2 /* label_name */;
-             $$->setSpecialType(ExtendedQualName::NORMAL_TABLE);
-           }
-
-     |  ghost TOK_INDEX label_name
-           {
-             $$ = $3 /* label_name */;
-             $$->setSpecialType(ExtendedQualName::GHOST_INDEX_TABLE);
-           }
-  
-     |  ghost TOK_TABLE label_name
-           {
-             $$ = $3 /* label_name */;
-             $$->setSpecialType(ExtendedQualName::GHOST_TABLE);
-           }
-  
-     |  TOK_PROCEDURE label_name
-           {
-             $$ = $2 /* label_name */;
-             $$->setSpecialType(ExtendedQualName::ISP_TABLE);
-           }
-     |  TOK_IUDLOG TOK_TABLE label_name
-           {
-              if (Get_SqlParser_Flags(ALLOW_SPECIALTABLETYPE))
-              {
-                 $$ = $3 /* label_name */;
-                 $$->setSpecialType(ExtendedQualName::IUD_LOG_TABLE);
-              }
-              else
-              { 
-                 yyerror(""); YYERROR; /*internal syntax only!*/
-              }
-           }
-     |  TOK_RANGELOG TOK_TABLE label_name
-           {
-              if (Get_SqlParser_Flags(ALLOW_SPECIALTABLETYPE))
-              {
-                 $$ = $3 /* label_name */;
-                 $$->setSpecialType(ExtendedQualName::RANGE_LOG_TABLE);
-              }
-              else
-              { 
-                 yyerror(""); YYERROR; /*internal syntax only!*/
-              }
-           }
-     |  TOK_TEMP_TABLE TOK_TABLE label_name
-           {
-              if (Get_SqlParser_Flags(ALLOW_SPECIALTABLETYPE))
-              {
-                 $$ = $3 /* label_name */;
-                 $$->setSpecialType(ExtendedQualName::TRIGTEMP_TABLE);
-              }
-              else
-              { 
-                 yyerror(""); YYERROR; /*internal syntax only!*/
-              }
-           }
-
 /* type pStmtDDL */
 
 schema_definition : TOK_CREATE schema_class TOK_SCHEMA schema_name_clause char_set collation_option
@@ -34046,7 +33849,6 @@
                       | TOK_SHAPE
                       | TOK_SHARE
                       | TOK_SHARED
-	              | TOK_SHOWLEAKS                  
                       | TOK_SIGNED
 		      | TOK_SINGLEDELTA // MV
 //                      | TOK_SIZE
@@ -34132,7 +33934,6 @@
                       | TOK_INVOKE
 		      | TOK_SHOWCONTROL
 		      | TOK_SHOWDDL
-		      | TOK_SHOWLABEL
 		      | TOK_SHOWPLAN
 		      | TOK_SHOWSHAPE
                       | TOK_SHOWSET 		      
@@ -34246,6 +34047,7 @@
                       | TOK_CONVERTTOHX_INTN
                       | TOK_COS
                       | TOK_COSH
+                      | TOK_CRC32
                       | TOK_CURDATE
                       | TOK_CURTIME
                       | TOK_D_RANK 
@@ -34295,6 +34097,7 @@
                       | TOK_LTRIM
                       | TOK_MAVG
                       | TOK_MCOUNT
+                      | TOK_MD5
                       | TOK_MMAX
                       | TOK_MMIN
                       | TOK_MOD
@@ -34339,6 +34142,9 @@
                       | TOK_RTRIM
                       | TOK_RVARIANCE
                       | TOK_SEQNUM
+                      | TOK_SHA
+                      | TOK_SHA1
+                      | TOK_SHA2
                       | TOK_SIGN
                       | TOK_SIN
                       | TOK_SINH
diff --git a/core/sql/regress/compGeneral/DIFF006.KNOWN.SB.OS b/core/sql/regress/compGeneral/DIFF006.KNOWN.SB.OS
deleted file mode 100644
index 871164d..0000000
--- a/core/sql/regress/compGeneral/DIFF006.KNOWN.SB.OS
+++ /dev/null
@@ -1,12 +0,0 @@
-63c63,65
-< *** ERROR[1002] Catalog TRAFODION does not exist or has not been registered on node @system@.
----
-> *** ERROR[4222] The DDL feature is not supported in this software version.
-> 
-> *** ERROR[8822] The statement was not prepared.
-65d66
-< --- SQL operation failed with errors.
-692c693
-< *** ERROR[4312] HP_SYSTEM_CATALOG.MXCS_SCHEMA.ASSOC2DS is an MXCS metadata table and cannot be directly updated.
----
-> *** ERROR[1002] Catalog HP_SYSTEM_CATALOG does not exist or has not been registered on node .
diff --git a/core/sql/regress/compGeneral/EXPECTED006.SB b/core/sql/regress/compGeneral/EXPECTED006.SB
index 945d64d..5f80db5 100644
--- a/core/sql/regress/compGeneral/EXPECTED006.SB
+++ b/core/sql/regress/compGeneral/EXPECTED006.SB
@@ -595,7 +595,7 @@
 >>-- Error 4071
 >>prepare xx from select * from t006t1 where last_day(A) = A;
 
-*** ERROR[4071] The first operand of function LAST_DAY must be a datetime.
+*** ERROR[4182] Function LAST_DAY operand 1 must be of type DATE or TIMESTAMP.
 
 *** ERROR[8822] The statement was not prepared.
 
@@ -740,31 +740,64 @@
 >>
 >>prepare xx from select date_trunc('YEAR',a) from t006t1;
 
---- SQL command prepared.
+*** ERROR[4182] Function DATE_TRUNC operand 2 must be of type DATE or TIMESTAMP.
+
+*** ERROR[8822] The statement was not prepared.
+
 >>prepare xx from select date_trunc('YEAR',a) from t006t1;
 
---- SQL command prepared.
+*** ERROR[4182] Function DATE_TRUNC operand 2 must be of type DATE or TIMESTAMP.
+
+*** ERROR[8822] The statement was not prepared.
+
 >>prepare xx from select date_trunc('month',a) from t006t1;
 
---- SQL command prepared.
+*** ERROR[4182] Function DATE_TRUNC operand 2 must be of type DATE or TIMESTAMP.
+
+*** ERROR[8822] The statement was not prepared.
+
 >>prepare xx from select date_trunc('century',a) from t006t1;
 
---- SQL command prepared.
+*** ERROR[4182] Function DATE_TRUNC operand 2 must be of type DATE or TIMESTAMP.
+
+*** ERROR[8822] The statement was not prepared.
+
 >>prepare xx from select datediff(year,a, a) from t006t1;
 
---- SQL command prepared.
+*** ERROR[4182] Function DATEDIFF operand 2 must be of type DATE or TIMESTAMP.
+
+*** ERROR[8822] The statement was not prepared.
+
 >>prepare xx from select datediff(month,a, a) from t006t1;
 
---- SQL command prepared.
+*** ERROR[4182] Function DATEDIFF operand 2 must be of type DATE or TIMESTAMP.
+
+*** ERROR[8822] The statement was not prepared.
+
+>>prepare xx from select datediff(day,current_timestamp,a) from t006t1;
+
+*** ERROR[4182] Function DATEDIFF operand 3 must be of type DATE or TIMESTAMP.
+
+*** ERROR[8822] The statement was not prepared.
+
 >>prepare xx from select datediff(hour,a, a) from t006t1;
 
---- SQL command prepared.
+*** ERROR[4182] Function DATEDIFF operand 2 must be of type DATE or TIMESTAMP.
+
+*** ERROR[8822] The statement was not prepared.
+
 >>prepare xx from select datediff(minute,a, a) from t006t1;
 
---- SQL command prepared.
+*** ERROR[4182] Function DATEDIFF operand 2 must be of type DATE or TIMESTAMP.
+
+*** ERROR[8822] The statement was not prepared.
+
 >>prepare xx from select datediff(second,a, a) from t006t1;
 
---- SQL command prepared.
+*** ERROR[4182] Function DATEDIFF operand 2 must be of type DATE or TIMESTAMP.
+
+*** ERROR[8822] The statement was not prepared.
+
 >>prepare xx from select datediff(quarter,c, c) from t006t5;
 
 --- SQL command prepared.
diff --git a/core/sql/regress/compGeneral/EXPECTEDTOK b/core/sql/regress/compGeneral/EXPECTEDTOK
index 87d8497..9c3aa03 100644
--- a/core/sql/regress/compGeneral/EXPECTEDTOK
+++ b/core/sql/regress/compGeneral/EXPECTEDTOK
@@ -1,4 +1,4 @@
-sqlparser.y: warning: 62 shift/reduce conflicts [-Wconflicts-sr]
+sqlparser.y: warning: 61 shift/reduce conflicts [-Wconflicts-sr]
 sqlparser.y: warning: 12 reduce/reduce conflicts [-Wconflicts-rr]
  
 nnnn conflicts: 1 shift/reduce nnnn olap_sequence_function: set_function_specification . TOK_OVER '(' opt_olap_part_clause opt_olap_order_clause ')'
@@ -9,7 +9,6 @@
 nnnn conflicts: 1 reduce/reduce nnnn row_subquery: rel_subquery .
 nnnn conflicts: 1 reduce/reduce nnnn transaction_statement: TOK_BEGIN .
 nnnn conflicts: 1 shift/reduce nnnn show_statement: TOK_SHOWCONTROL showcontrol_type . optional_control_identifier optional_comma_match_clause
-nnnn conflicts: 1 shift/reduce nnnn extended_label_name: TOK_INDEX . label_name
 nnnn conflicts: 1 shift/reduce nnnn table_as_stream_any: table_as_stream .
 nnnn conflicts: 1 shift/reduce nnnn row_subquery: '(' row_subquery . ')'
 nnnn conflicts: 1 shift/reduce nnnn input_hostvar_expression: HOSTVAR .
diff --git a/core/sql/regress/compGeneral/EXPECTEDTOK2 b/core/sql/regress/compGeneral/EXPECTEDTOK2
index 87d8497..9c3aa03 100644
--- a/core/sql/regress/compGeneral/EXPECTEDTOK2
+++ b/core/sql/regress/compGeneral/EXPECTEDTOK2
@@ -1,4 +1,4 @@
-sqlparser.y: warning: 62 shift/reduce conflicts [-Wconflicts-sr]
+sqlparser.y: warning: 61 shift/reduce conflicts [-Wconflicts-sr]
 sqlparser.y: warning: 12 reduce/reduce conflicts [-Wconflicts-rr]
  
 nnnn conflicts: 1 shift/reduce nnnn olap_sequence_function: set_function_specification . TOK_OVER '(' opt_olap_part_clause opt_olap_order_clause ')'
@@ -9,7 +9,6 @@
 nnnn conflicts: 1 reduce/reduce nnnn row_subquery: rel_subquery .
 nnnn conflicts: 1 reduce/reduce nnnn transaction_statement: TOK_BEGIN .
 nnnn conflicts: 1 shift/reduce nnnn show_statement: TOK_SHOWCONTROL showcontrol_type . optional_control_identifier optional_comma_match_clause
-nnnn conflicts: 1 shift/reduce nnnn extended_label_name: TOK_INDEX . label_name
 nnnn conflicts: 1 shift/reduce nnnn table_as_stream_any: table_as_stream .
 nnnn conflicts: 1 shift/reduce nnnn row_subquery: '(' row_subquery . ')'
 nnnn conflicts: 1 shift/reduce nnnn input_hostvar_expression: HOSTVAR .
diff --git a/core/sql/regress/compGeneral/TEST006 b/core/sql/regress/compGeneral/TEST006
index 9fcfd2e..6697c3f 100644
--- a/core/sql/regress/compGeneral/TEST006
+++ b/core/sql/regress/compGeneral/TEST006
@@ -366,6 +366,7 @@
 prepare xx from select date_trunc('century',a) from t006t1;
 prepare xx from select datediff(year,a, a) from t006t1;
 prepare xx from select datediff(month,a, a) from t006t1;
+prepare xx from select datediff(day,current_timestamp,a) from t006t1;
 prepare xx from select datediff(hour,a, a) from t006t1;
 prepare xx from select datediff(minute,a, a) from t006t1;
 prepare xx from select datediff(second,a, a) from t006t1;
diff --git a/core/sql/regress/core/EXPECTED037.SB b/core/sql/regress/core/EXPECTED037.SB
index c5c1e28..a414e94 100755
--- a/core/sql/regress/core/EXPECTED037.SB
+++ b/core/sql/regress/core/EXPECTED037.SB
@@ -38,6 +38,7 @@
 +>, CONSTRAINT_SCHEMA int not null 
 +>, CONTROL int not null 
 +>, CURSOR_NAME int not null 
++>, CRC32 int not null
 +>, DATA int not null 
 +>--,DATETIME int not null 
 +>, DATETIME_CODE int not null 
@@ -75,7 +76,7 @@
 >>invoke table_name;
 
 -- Definition of Trafodion table TRAFODION.SCH.TABLE_NAME
--- Definition current  Thu Dec  7 05:50:27 2017
+-- Definition current  Tue May 22 16:42:26 2018
 
   (
     SYSKEY                           LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -115,6 +116,7 @@
   , CONSTRAINT_SCHEMA                INT NO DEFAULT NOT NULL NOT DROPPABLE
   , CONTROL                          INT NO DEFAULT NOT NULL NOT DROPPABLE
   , CURSOR_NAME                      INT NO DEFAULT NOT NULL NOT DROPPABLE
+  , CRC32                            INT NO DEFAULT NOT NULL NOT DROPPABLE
   , DATA                             INT NO DEFAULT NOT NULL NOT DROPPABLE
   , DATETIME_CODE                    INT NO DEFAULT NOT NULL NOT DROPPABLE
   , DCOMPRESS                        INT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -160,6 +162,7 @@
 +>, LOW_VALUE int not null 
 +>, MAXSIZE int not null 
 +>, MBYTES int not null 
++>, MD5 int not null
 +>, MESSAGE_LEN int not null 
 +>, MESSAGE_OCTET_LEN int not null 
 +>, MESSAGE_TEXT int not null 
@@ -192,6 +195,9 @@
 +>, SERIALIZABLE int not null 
 +>, SERIALWRITES int not null 
 +>, SERVER_NAME int not null 
++>, SHA int not null
++>, SHA1 int not null
++>, SHA2 int not null
 +>, SHAPE int not null 
 +>, SHARE int not null 
 +>, SIDEINSERTS int not null 
@@ -224,7 +230,7 @@
 >>invoke system_name;
 
 -- Definition of Trafodion table TRAFODION.SCH.SYSTEM_NAME
--- Definition current  Thu Dec  7 05:50:32 2017
+-- Definition current  Tue May 22 16:42:31 2018
 
   (
     SYSKEY                           LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -240,6 +246,7 @@
   , LOW_VALUE                        INT NO DEFAULT NOT NULL NOT DROPPABLE
   , MAXSIZE                          INT NO DEFAULT NOT NULL NOT DROPPABLE
   , MBYTES                           INT NO DEFAULT NOT NULL NOT DROPPABLE
+  , MD5                              INT NO DEFAULT NOT NULL NOT DROPPABLE
   , MESSAGE_LEN                      INT NO DEFAULT NOT NULL NOT DROPPABLE
   , MESSAGE_OCTET_LEN                INT NO DEFAULT NOT NULL NOT DROPPABLE
   , MESSAGE_TEXT                     INT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -272,6 +279,9 @@
   , SERIALIZABLE                     INT NO DEFAULT NOT NULL NOT DROPPABLE
   , SERIALWRITES                     INT NO DEFAULT NOT NULL NOT DROPPABLE
   , SERVER_NAME                      INT NO DEFAULT NOT NULL NOT DROPPABLE
+  , SHA                              INT NO DEFAULT NOT NULL NOT DROPPABLE
+  , SHA1                             INT NO DEFAULT NOT NULL NOT DROPPABLE
+  , SHA2                             INT NO DEFAULT NOT NULL NOT DROPPABLE
   , SHAPE                            INT NO DEFAULT NOT NULL NOT DROPPABLE
   , SHARE                            INT NO DEFAULT NOT NULL NOT DROPPABLE
   , SIDEINSERTS                      INT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -3241,6 +3251,11 @@
 --- SQL command prepared.
 >>
 >>-- Expect success
+>>prepare s1 from SELECT CRC32 CRC32 from (values(0)) CRC32(CRC32);
+
+--- SQL command prepared.
+>>
+>>-- Expect success
 >>prepare s1 from SELECT CURDATE CURDATE from (values(0)) CURDATE(CURDATE);
 
 --- SQL command prepared.
@@ -3676,6 +3691,11 @@
 --- SQL command prepared.
 >>
 >>-- Expect success
+>>prepare s1 from SELECT MD5 MD5 from (values(0)) MD5(MD5);
+
+--- SQL command prepared.
+>>
+>>-- Expect success
 >>prepare s1 from SELECT MAXSIZE MAXSIZE from (values(0)) MAXSIZE(MAXSIZE);
 
 --- SQL command prepared.
@@ -4076,6 +4096,21 @@
 --- SQL command prepared.
 >>
 >>-- Expect success
+>>prepare s1 from SELECT SHA SHA from (values(0)) SHA(SHA);
+
+--- SQL command prepared.
+>>
+>>-- Expect success
+>>prepare s1 from SELECT SHA1 SHA1 from (values(0)) SHA1(SHA1);
+
+--- SQL command prepared.
+>>
+>>-- Expect success
+>>prepare s1 from SELECT SHA2 SHA2 from (values(0)) SHA2(SHA2);
+
+--- SQL command prepared.
+>>
+>>-- Expect success
 >>prepare s1 from SELECT SHAPE SHAPE from (values(0)) SHAPE(SHAPE);
 
 --- SQL command prepared.
diff --git a/core/sql/regress/core/EXPECTED116 b/core/sql/regress/core/EXPECTED116
index 0d65c19..a67e957 100644
--- a/core/sql/regress/core/EXPECTED116
+++ b/core/sql/regress/core/EXPECTED116
@@ -15,11 +15,17 @@
 --- SQL operation complete.
 >>get user hbase objects, match 'TRAFODION.SCH.T116T1';
 
+External HBase objects
+======================
+
 TRAFODION.SCH.T116T1
 
 --- SQL operation complete.
 >>get user hbase objects, match 'TRAFODION.SCH.T116T2';
 
+External HBase objects
+======================
+
 TRAFODION.SCH.T116T2
 
 --- SQL operation complete.
@@ -29,9 +35,17 @@
 --- SQL operation complete.
 >>get user hbase objects, match 'TRAFODION.SCH.T116T1';
 
+External HBase objects
+======================
+
+
 --- SQL operation complete.
 >>get user hbase objects, match 'TRAFODION.SCH.T116T2';
 
+External HBase objects
+======================
+
+
 --- SQL operation complete.
 >>
 >>--repeat the same tables again
@@ -47,11 +61,17 @@
 --- SQL operation complete.
 >>get user hbase objects, match 'TRAFODION.SCH.T116T1';
 
+External HBase objects
+======================
+
 TRAFODION.SCH.T116T1
 
 --- SQL operation complete.
 >>get user hbase objects, match 'TRAFODION.SCH.T116T2';
 
+External HBase objects
+======================
+
 TRAFODION.SCH.T116T2
 
 --- SQL operation complete.
@@ -60,9 +80,17 @@
 --- SQL operation complete.
 >>get user hbase objects, match 'TRAFODION.SCH.T116T1';
 
+External HBase objects
+======================
+
+
 --- SQL operation complete.
 >>get user hbase objects, match 'TRAFODION.SCH.T116T2';
 
+External HBase objects
+======================
+
+
 --- SQL operation complete.
 >>
 >>-- unique constraint
@@ -78,11 +106,17 @@
 --- SQL operation complete.
 >>get user hbase objects, match 'TRAFODION.SCH.T116T1';
 
+External HBase objects
+======================
+
 TRAFODION.SCH.T116T1
 
 --- SQL operation complete.
 >>get user hbase objects, match 'TRAFODION.SCH.TC1';
 
+External HBase objects
+======================
+
 TRAFODION.SCH.TC1
 
 --- SQL operation complete.
@@ -91,9 +125,17 @@
 --- SQL operation complete.
 >>get user hbase objects, match 'TRAFODION.SCH.T116T1';
 
+External HBase objects
+======================
+
+
 --- SQL operation complete.
 >>get user hbase objects, match 'TRAFODION.SCH.TC1';
 
+External HBase objects
+======================
+
+
 --- SQL operation complete.
 >>
 >>--setup two tables
@@ -121,6 +163,9 @@
 >>--------------------------
 >>get user hbase objects, match 'TRAFODION.SCH.T116T1';
 
+External HBase objects
+======================
+
 TRAFODION.SCH.T116T1
 
 --- SQL operation complete.
@@ -135,6 +180,10 @@
 --- SQL operation complete.
 >>get user hbase objects, match 'TRAFODION.SCH.T116T1';
 
+External HBase objects
+======================
+
+
 --- SQL operation complete.
 >>
 >>--drop table with rollback
@@ -142,6 +191,9 @@
 >>--sh `echo "exists '$TEST_SCHEMA.T116T2'" | regrhbase.ksh >> LOG116`;
 >>get user hbase objects, match 'TRAFODION.SCH.T116T2';
 
+External HBase objects
+======================
+
 TRAFODION.SCH.T116T2
 
 --- SQL operation complete.
@@ -177,6 +229,9 @@
 
 >>get user hbase objects, match 'TRAFODION.SCH.T116T2';
 
+External HBase objects
+======================
+
 TRAFODION.SCH.T116T2
 
 --- SQL operation complete.
@@ -185,6 +240,9 @@
 --- SQL operation complete.
 >>get user hbase objects, match 'TRAFODION.SCH.T116T2';
 
+External HBase objects
+======================
+
 TRAFODION.SCH.T116T2
 
 --- SQL operation complete.
@@ -213,11 +271,18 @@
 >>-------------------------------------
 >>get user hbase objects, match 'TRAFODION.SCH.T116T2';
 
+External HBase objects
+======================
+
 TRAFODION.SCH.T116T2
 
 --- SQL operation complete.
 >>get user hbase objects, match 'TRAFODION.SCH.T116T3';
 
+External HBase objects
+======================
+
+
 --- SQL operation complete.
 >>begin work;
 
@@ -230,11 +295,17 @@
 --- 1 row(s) inserted.
 >>get user hbase objects, match 'TRAFODION.SCH.T116T2';
 
+External HBase objects
+======================
+
 TRAFODION.SCH.T116T2
 
 --- SQL operation complete.
 >>get user hbase objects, match 'TRAFODION.SCH.T116T3';
 
+External HBase objects
+======================
+
 TRAFODION.SCH.T116T3
 
 --- SQL operation complete.
@@ -246,9 +317,16 @@
 --- SQL operation complete.
 >>get user hbase objects, match 'TRAFODION.SCH.T116T2';
 
+External HBase objects
+======================
+
+
 --- SQL operation complete.
 >>get user hbase objects, match 'TRAFODION.SCH.T116T3';
 
+External HBase objects
+======================
+
 TRAFODION.SCH.T116T3
 
 --- SQL operation complete.
@@ -257,11 +335,18 @@
 >>---------------------------------------------------
 >>get user hbase objects, match 'TRAFODION.SCH.T116T3';
 
+External HBase objects
+======================
+
 TRAFODION.SCH.T116T3
 
 --- SQL operation complete.
 >>get user hbase objects, match 'TRAFODION.SCH.T116T4';
 
+External HBase objects
+======================
+
+
 --- SQL operation complete.
 >>begin work;
 
@@ -274,11 +359,17 @@
 --- 1 row(s) inserted.
 >>get user hbase objects, match 'TRAFODION.SCH.T116T3';
 
+External HBase objects
+======================
+
 TRAFODION.SCH.T116T3
 
 --- SQL operation complete.
 >>get user hbase objects, match 'TRAFODION.SCH.T116T4';
 
+External HBase objects
+======================
+
 TRAFODION.SCH.T116T4
 
 --- SQL operation complete.
@@ -301,6 +392,9 @@
 
 >>get user hbase objects, match 'TRAFODION.SCH.T116T3';
 
+External HBase objects
+======================
+
 TRAFODION.SCH.T116T3
 
 --- SQL operation complete.
@@ -309,11 +403,18 @@
 --- SQL operation complete.
 >>get user hbase objects, match 'TRAFODION.SCH.T116T3';
 
+External HBase objects
+======================
+
 TRAFODION.SCH.T116T3
 
 --- SQL operation complete.
 >>get user hbase objects, match 'TRAFODION.SCH.T116T4';
 
+External HBase objects
+======================
+
+
 --- SQL operation complete.
 >>select * from t116t3;
 
@@ -341,7 +442,7 @@
 >>invoke t116t1;
 
 -- Definition of Trafodion table TRAFODION.SCH.T116T1
--- Definition current  Wed Dec 21 21:00:30 2016
+-- Definition current  Wed May 16 06:17:20 2018
 
   (
     SYSKEY                           LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -359,7 +460,7 @@
 >>invoke t116t1;
 
 -- Definition of Trafodion table TRAFODION.SCH.T116T1
--- Definition current  Wed Dec 21 21:00:30 2016
+-- Definition current  Wed May 16 06:17:20 2018
 
   (
     SYSKEY                           LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -374,7 +475,7 @@
 >>invoke t116v1;
 
 -- Definition of Trafodion view TRAFODION.SCH.T116V1
--- Definition current  Wed Dec 21 21:00:31 2016
+-- Definition current  Wed May 16 06:17:22 2018
 
   (
     A                                INT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -391,7 +492,7 @@
 >>invoke t116t1;
 
 -- Definition of Trafodion table TRAFODION.SCH.T116T1
--- Definition current  Wed Dec 21 21:00:43 2016
+-- Definition current  Wed May 16 06:17:36 2018
 
   (
     SYSKEY                           LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -406,7 +507,7 @@
 >>invoke t116v1;
 
 -- Definition of Trafodion view TRAFODION.SCH.T116V1
--- Definition current  Wed Dec 21 21:00:44 2016
+-- Definition current  Wed May 16 06:17:37 2018
 
   (
     A                                INT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -423,7 +524,7 @@
 >>invoke t116t1;
 
 -- Definition of Trafodion table TRAFODION.SCH.T116T1
--- Definition current  Wed Dec 21 21:00:47 2016
+-- Definition current  Wed May 16 06:17:42 2018
 
   (
     SYSKEY                           LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -438,7 +539,7 @@
 >>invoke t116v1;
 
 -- Definition of Trafodion view TRAFODION.SCH.T116V1
--- Definition current  Wed Dec 21 21:00:48 2016
+-- Definition current  Wed May 16 06:17:43 2018
 
   (
     A                                INT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -456,7 +557,7 @@
 >>invoke t116t1;
 
 -- Definition of Trafodion table TRAFODION.SCH.T116T1
--- Definition current  Wed Dec 21 21:00:48 2016
+-- Definition current  Wed May 16 06:17:43 2018
 
   (
     SYSKEY                           LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -471,7 +572,7 @@
 >>invoke t116v1;
 
 -- Definition of Trafodion view TRAFODION.SCH.T116V1
--- Definition current  Wed Dec 21 21:00:48 2016
+-- Definition current  Wed May 16 06:17:43 2018
 
   (
     A                                INT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -488,7 +589,7 @@
 >>invoke t116t1;
 
 -- Definition of Trafodion table TRAFODION.SCH.T116T1
--- Definition current  Wed Dec 21 21:01:00 2016
+-- Definition current  Wed May 16 06:17:58 2018
 
   (
     SYSKEY                           LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -503,7 +604,7 @@
 >>invoke t116v1;
 
 -- Definition of Trafodion view TRAFODION.SCH.T116V1
--- Definition current  Wed Dec 21 21:01:01 2016
+-- Definition current  Wed May 16 06:17:59 2018
 
   (
     A                                INT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -521,7 +622,7 @@
 >>invoke t116t1;
 
 -- Definition of Trafodion table TRAFODION.SCH.T116T1
--- Definition current  Wed Dec 21 21:01:07 2016
+-- Definition current  Wed May 16 06:18:04 2018
 
   (
     SYSKEY                           LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -536,7 +637,7 @@
 >>invoke t116v1;
 
 -- Definition of Trafodion view TRAFODION.SCH.T116V1
--- Definition current  Wed Dec 21 21:01:08 2016
+-- Definition current  Wed May 16 06:18:05 2018
 
   (
     A                                INT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -560,8 +661,8 @@
 --- SQL operation complete.
 >>
 >>sh sqlci -iTEST116\(concurrent_ddl\) >> LOG116;
-Apache Trafodion Conversational Interface 2.1.0
-Copyright (c) 2015-2016 Apache Software Foundation
+Apache Trafodion Conversational Interface 2.3.0
+Copyright (c) 2015-2017 Apache Software Foundation
 >>?section concurrent_ddl
 >>cqd ddl_transactions 'ON';
 
@@ -595,7 +696,7 @@
 >>invoke t116t1;
 
 -- Definition of Trafodion table TRAFODION.SCH.T116T1
--- Definition current  Wed Dec 21 21:01:31 2016
+-- Definition current  Wed May 16 06:18:30 2018
 
   (
     SYSKEY                           LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -718,7 +819,7 @@
 >>invoke t116t2;
 
 -- Definition of Trafodion table TRAFODION.SCH.T116T2
--- Definition current  Wed Dec 21 21:02:32 2016
+-- Definition current  Wed May 16 06:19:38 2018
 
   (
     SYSKEY                           LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -744,7 +845,7 @@
 >>invoke t116t2;
 
 -- Definition of Trafodion table TRAFODION.SCH.T116T2
--- Definition current  Wed Dec 21 21:02:51 2016
+-- Definition current  Wed May 16 06:19:49 2018
 
   (
     SYSKEY                           LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -872,8 +973,8 @@
 >>
 >>-- insert a row using a concurrent hbase xn
 >>sh sqlci -iTEST116\(concurrent_hbase_xn_ins\) >> LOG116;
-Apache Trafodion Conversational Interface 2.1.0
-Copyright (c) 2015-2016 Apache Software Foundation
+Apache Trafodion Conversational Interface 2.3.0
+Copyright (c) 2015-2017 Apache Software Foundation
 >>?section concurrent_hbase_xn_ins
 >>cqd traf_use_region_xn 'OFF';
 
@@ -925,8 +1026,8 @@
 >>
 >>-- insert a row using a concurrent region xn
 >>sh sqlci -iTEST116\(concurrent_region_xn_ins\) >> LOG116;
-Apache Trafodion Conversational Interface 2.1.0
-Copyright (c) 2015-2016 Apache Software Foundation
+Apache Trafodion Conversational Interface 2.3.0
+Copyright (c) 2015-2017 Apache Software Foundation
 >>?section concurrent_region_xn_ins
 >>cqd traf_use_region_xn 'ON';
 
@@ -955,8 +1056,8 @@
 >>-- should show conflict
 >>commit work;
 
-*** ERROR[8616] A conflict was detected during commit processing. Transaction has been aborted. Detail :org.trafodion.dtm.TransactionManagerException: org.apache.hadoop.hbase.coprocessor.transactional.CommitConflictException: java.io.IOException: Transaction [[transactionId: 16975 regionTX: false status: PENDING scan Size: 2 write Size: 1 startSQ: 2]] has scan which conflicts with [[transactionId: 1554361158723058 regionTX: true status: COMMITED scan Size: 2 write Size: 1 startSQ: 2 commitedSQ:2]]: region [TRAFODION.SCH.T116T6,,1482354300713.03a05b08f387a4eb4ef6323976d73e36.], scanRange[startRow: \x80\x00\x00\x01, endRow: \x80\x00\x00\x01], inserted row[\x80\x00\x00\x01]
-org.trafodion.dtm.HBaseTxClient.prepareCommit(HBaseTxClient.java:513)
+*** ERROR[8616] A conflict was detected during commit processing. Transaction has been aborted. Detail :org.trafodion.dtm.TransactionManagerException: org.apache.hadoop.hbase.coprocessor.transactional.CommitConflictException: java.io.IOException: This Transaction [[transactionId: 4642 regionTX: false status: PENDING neverReadOnly: false scan Size: 2 write Size: 1 startSQ: 2 prepareEditSize: 0 endEditSize: 0 editSize: 1]] has a scan, scanRange[startRow: \x80\x00\x00\x01, endRow: \x80\x00\x00\x01] that conflicts with a committed Transaction [[transactionId: 1600600654243836 regionTX: true status: COMMITED neverReadOnly: false scan Size: 2 write Size: 1 startSQ: 2 prepareEditSize: 1 endEditSize: 1 editSize: 1 commitedSQ:2]] which , inserted a row with key[\x80\x00\x00\x01], in the region [TRAFODION.SCH.T116T6,,1526451716937.fa9bf89e5ceeac7ed4ee428544f09af0.]
+org.trafodion.dtm.HBaseTxClient.prepareCommit(HBaseTxClient.java:525)
 
 --- SQL operation failed with errors.
 >>select * from t116t6;
@@ -981,8 +1082,8 @@
 >>
 >>-- upsert a row using a concurrent hbase xn
 >>sh sqlci -iTEST116\(concurrent_hbase_xn_ups\) >> LOG116;
-Apache Trafodion Conversational Interface 2.1.0
-Copyright (c) 2015-2016 Apache Software Foundation
+Apache Trafodion Conversational Interface 2.3.0
+Copyright (c) 2015-2017 Apache Software Foundation
 >>?section concurrent_hbase_xn_ups
 >>cqd traf_use_region_xn 'OFF';
 
@@ -1034,8 +1135,8 @@
 >>
 >>-- insert a row using a concurrent region xn
 >>sh sqlci -iTEST116\(concurrent_region_xn_ups\) >> LOG116;
-Apache Trafodion Conversational Interface 2.1.0
-Copyright (c) 2015-2016 Apache Software Foundation
+Apache Trafodion Conversational Interface 2.3.0
+Copyright (c) 2015-2017 Apache Software Foundation
 >>?section concurrent_region_xn_ups
 >>cqd traf_use_region_xn 'ON';
 
@@ -1064,8 +1165,8 @@
 >>-- should show conflict
 >>commit work;
 
-*** ERROR[8616] A conflict was detected during commit processing. Transaction has been aborted. Detail :org.trafodion.dtm.TransactionManagerException: org.apache.hadoop.hbase.coprocessor.transactional.CommitConflictException: java.io.IOException: Transaction [[transactionId: 16979 regionTX: false status: PENDING scan Size: 1 write Size: 1 startSQ: 6]] has scan which conflicts with [[transactionId: 1554361174452391 regionTX: true status: COMMITED scan Size: 1 write Size: 1 startSQ: 6 commitedSQ:6]]: region [TRAFODION.SCH.T116T6,,1482354300713.03a05b08f387a4eb4ef6323976d73e36.], scanRange[startRow: \x80\x00\x00\x01, endRow: \x80\x00\x00\x01], inserted row[\x80\x00\x00\x01]
-org.trafodion.dtm.HBaseTxClient.prepareCommit(HBaseTxClient.java:513)iona
+*** ERROR[8616] A conflict was detected during commit processing. Transaction has been aborted. Detail :org.trafodion.dtm.TransactionManagerException: org.apache.hadoop.hbase.coprocessor.transactional.CommitConflictException: java.io.IOException: This Transaction [[transactionId: 4646 regionTX: false status: PENDING neverReadOnly: false scan Size: 1 write Size: 1 startSQ: 6 prepareEditSize: 0 endEditSize: 0 editSize: 1]] has a scan, scanRange[startRow: \x80\x00\x00\x01, endRow: \x80\x00\x00\x01] that conflicts with a committed Transaction [[transactionId: 1600600673118601 regionTX: true status: COMMITED neverReadOnly: false scan Size: 1 write Size: 1 startSQ: 6 prepareEditSize: 1 endEditSize: 1 editSize: 1 commitedSQ:6]] which , inserted a row with key[\x80\x00\x00\x01], in the region [TRAFODION.SCH.T116T6,,1526451716937.fa9bf89e5ceeac7ed4ee428544f09af0.]
+org.trafodion.dtm.HBaseTxClient.prepareCommit(HBaseTxClient.java:525)
 
 --- SQL operation failed with errors.
 >>select * from t116t6;
@@ -1093,8 +1194,8 @@
 >>
 >>-- delete a row using a concurrent hbase xn
 >>sh sqlci -iTEST116\(concurrent_hbase_xn_del\) >> LOG116;
-Apache Trafodion Conversational Interface 2.1.0
-Copyright (c) 2015-2016 Apache Software Foundation
+Apache Trafodion Conversational Interface 2.3.0
+Copyright (c) 2015-2017 Apache Software Foundation
 >>?section concurrent_hbase_xn_del
 >>cqd traf_use_region_xn 'OFF';
 
@@ -1144,8 +1245,8 @@
 >>
 >>-- delete a row using a concurrent region xn
 >>sh sqlci -iTEST116\(concurrent_region_xn_del\) >> LOG116;
-Apache Trafodion Conversational Interface 2.1.0
-Copyright (c) 2015-2016 Apache Software Foundation
+Apache Trafodion Conversational Interface 2.3.0
+Copyright (c) 2015-2017 Apache Software Foundation
 >>?section concurrent_region_xn_del
 >>cqd traf_use_region_xn 'ON';
 
@@ -1174,8 +1275,8 @@
 >>-- should show conflict
 >>commit work;
 
-*** ERROR[8616] A conflict was detected during commit processing. Transaction has been aborted. Detail :org.trafodion.dtm.TransactionManagerException: org.apache.hadoop.hbase.coprocessor.transactional.CommitConflictException: java.io.IOException: Transaction [[transactionId: 16985 regionTX: false status: PENDING scan Size: 1 write Size: 1 startSQ: 11]] has scan which conflicts with [[transactionId: 1554361190181566 regionTX: true status: COMMITED scan Size: 0 write Size: 1 startSQ: 11 commitedSQ:11]]: region [TRAFODION.SCH.T116T6,,1482354300713.03a05b08f387a4eb4ef6323976d73e36.], scanRange[startRow: \x80\x00\x00\x01, endRow: \x80\x00\x00\x01], deleted row[\x80\x00\x00\x01]
-org.trafodion.dtm.HBaseTxClient.prepareCommit(HBaseTxClient.java:513)
+*** ERROR[8616] A conflict was detected during commit processing. Transaction has been aborted. Detail :org.trafodion.dtm.TransactionManagerException: org.apache.hadoop.hbase.coprocessor.transactional.CommitConflictException: java.io.IOException: This Transaction [[transactionId: 4652 regionTX: false status: PENDING neverReadOnly: false scan Size: 1 write Size: 1 startSQ: 11 prepareEditSize: 0 endEditSize: 0 editSize: 1]] has a scan, scanRange[startRow: \x80\x00\x00\x01, endRow: \x80\x00\x00\x01] that conflicts with a committed Transaction [[transactionId: 1600600691993433 regionTX: true status: COMMITED neverReadOnly: false scan Size: 0 write Size: 1 startSQ: 11 prepareEditSize: 1 endEditSize: 1 editSize: 1 commitedSQ:11]] which , deleted a row with key[\x80\x00\x00\x01], in the region [TRAFODION.SCH.T116T6,,1526451716937.fa9bf89e5ceeac7ed4ee428544f09af0.]
+org.trafodion.dtm.HBaseTxClient.prepareCommit(HBaseTxClient.java:525)
 
 --- SQL operation failed with errors.
 >>select * from t116t6;
@@ -1198,8 +1299,8 @@
 >>
 >>-- delete a row using a concurrent hbase xn
 >>sh sqlci -iTEST116\(concurrent_hbase_xn_checkanddel\) >> LOG116;
-Apache Trafodion Conversational Interface 2.1.0
-Copyright (c) 2015-2016 Apache Software Foundation
+Apache Trafodion Conversational Interface 2.3.0
+Copyright (c) 2015-2017 Apache Software Foundation
 >>?section concurrent_hbase_xn_checkanddel
 >>cqd traf_use_region_xn 'OFF';
 
@@ -1249,8 +1350,8 @@
 >>
 >>-- delete a row using a concurrent region xn
 >>sh sqlci -iTEST116\(concurrent_region_xn_checkanddel\) >> LOG116;
-Apache Trafodion Conversational Interface 2.1.0
-Copyright (c) 2015-2016 Apache Software Foundation
+Apache Trafodion Conversational Interface 2.3.0
+Copyright (c) 2015-2017 Apache Software Foundation
 >>?section concurrent_region_xn_checkanddel
 >>cqd traf_use_region_xn 'ON';
 
@@ -1279,8 +1380,8 @@
 >>-- should show conflict
 >>commit work;
 
-*** ERROR[8616] A conflict was detected during commit processing. Transaction has been aborted. Detail :org.trafodion.dtm.TransactionManagerException: org.apache.hadoop.hbase.coprocessor.transactional.CommitConflictException: java.io.IOException: Transaction [[transactionId: 16991 regionTX: false status: PENDING scan Size: 1 write Size: 1 startSQ: 15]] has scan which conflicts with [[transactionId: 1554361202764668 regionTX: true status: COMMITED scan Size: 0 write Size: 1 startSQ: 15 commitedSQ:15]]: region [TRAFODION.SCH.T116T6,,1482354300713.03a05b08f387a4eb4ef6323976d73e36.], scanRange[startRow: \x80\x00\x00\x01, endRow: \x80\x00\x00\x01], deleted row[\x80\x00\x00\x01]
-org.trafodion.dtm.HBaseTxClient.prepareCommit(HBaseTxClient.java:513)Za
+*** ERROR[8616] A conflict was detected during commit processing. Transaction has been aborted. Detail :org.trafodion.dtm.TransactionManagerException: org.apache.hadoop.hbase.coprocessor.transactional.CommitConflictException: java.io.IOException: This Transaction [[transactionId: 4658 regionTX: false status: PENDING neverReadOnly: false scan Size: 1 write Size: 1 startSQ: 15 prepareEditSize: 0 endEditSize: 0 editSize: 1]] has a scan, scanRange[startRow: \x80\x00\x00\x01, endRow: \x80\x00\x00\x01] that conflicts with a committed Transaction [[transactionId: 1600600710868339 regionTX: true status: COMMITED neverReadOnly: false scan Size: 0 write Size: 1 startSQ: 15 prepareEditSize: 1 endEditSize: 1 editSize: 1 commitedSQ:15]] which , deleted a row with key[\x80\x00\x00\x01], in the region [TRAFODION.SCH.T116T6,,1526451716937.fa9bf89e5ceeac7ed4ee428544f09af0.]
+org.trafodion.dtm.HBaseTxClient.prepareCommit(HBaseTxClient.java:525)
 
 --- SQL operation failed with errors.
 >>select * from t116t6;
@@ -1303,8 +1404,8 @@
 >>
 >>-- update row using a concurrent hbase xn
 >>sh sqlci -iTEST116\(concurrent_hbase_xn_checkandupd\) >> LOG116;
-Apache Trafodion Conversational Interface 2.1.0
-Copyright (c) 2015-2016 Apache Software Foundation
+Apache Trafodion Conversational Interface 2.3.0
+Copyright (c) 2015-2017 Apache Software Foundation
 >>?section concurrent_hbase_xn_checkandupd
 >>cqd traf_use_region_xn 'OFF';
 
@@ -1359,8 +1460,8 @@
 >>
 >>-- update row using a concurrent region xn
 >>sh sqlci -iTEST116\(concurrent_region_xn_checkandupd\) >> LOG116;
-Apache Trafodion Conversational Interface 2.1.0
-Copyright (c) 2015-2016 Apache Software Foundation
+Apache Trafodion Conversational Interface 2.3.0
+Copyright (c) 2015-2017 Apache Software Foundation
 >>?section concurrent_region_xn_checkandupd
 >>cqd traf_use_region_xn 'ON';
 
@@ -1389,8 +1490,8 @@
 >>-- should show conflict
 >>commit work;
 
-*** ERROR[8616] A conflict was detected during commit processing. Transaction has been aborted. Detail :org.trafodion.dtm.TransactionManagerException: org.apache.hadoop.hbase.coprocessor.transactional.CommitConflictException: java.io.IOException: Transaction [[transactionId: 16997 regionTX: false status: PENDING scan Size: 2 write Size: 1 startSQ: 20]] has scan which conflicts with [[transactionId: 1554361218493621 regionTX: true status: COMMITED scan Size: 1 write Size: 1 startSQ: 20 commitedSQ:20]]: region [TRAFODION.SCH.T116T6,,1482354300713.03a05b08f387a4eb4ef6323976d73e36.], scanRange[startRow: \x80\x00\x00\x01, endRow: \x80\x00\x00\x01], inserted row[\x80\x00\x00\x01]
-org.trafodion.dtm.HBaseTxClient.prepareCommit(HBaseTxClient.java:513)1
+*** ERROR[8616] A conflict was detected during commit processing. Transaction has been aborted. Detail :org.trafodion.dtm.TransactionManagerException: org.apache.hadoop.hbase.coprocessor.transactional.CommitConflictException: java.io.IOException: This Transaction [[transactionId: 4664 regionTX: false status: PENDING neverReadOnly: false scan Size: 2 write Size: 1 startSQ: 20 prepareEditSize: 0 endEditSize: 0 editSize: 1]] has a scan, scanRange[startRow: \x80\x00\x00\x01, endRow: \x80\x00\x00\x01] that conflicts with a committed Transaction [[transactionId: 1600600729743055 regionTX: true status: COMMITED neverReadOnly: false scan Size: 1 write Size: 1 startSQ: 20 prepareEditSize: 1 endEditSize: 1 editSize: 1 commitedSQ:20]] which , inserted a row with key[\x80\x00\x00\x01], in the region [TRAFODION.SCH.T116T6,,1526451716937.fa9bf89e5ceeac7ed4ee428544f09af0.]
+org.trafodion.dtm.HBaseTxClient.prepareCommit(HBaseTxClient.java:525)
 
 --- SQL operation failed with errors.
 >>select * from t116t6;
diff --git a/core/sql/regress/core/TEST037 b/core/sql/regress/core/TEST037
index c7c51c5..370554c 100755
--- a/core/sql/regress/core/TEST037
+++ b/core/sql/regress/core/TEST037
@@ -80,6 +80,7 @@
 , CONSTRAINT_SCHEMA int not null 
 , CONTROL int not null 
 , CURSOR_NAME int not null 
+, CRC32 int not null
 , DATA int not null 
 --,DATETIME int not null 
 , DATETIME_CODE int not null 
@@ -126,6 +127,7 @@
 , LOW_VALUE int not null 
 , MAXSIZE int not null 
 , MBYTES int not null 
+, MD5 int not null
 , MESSAGE_LEN int not null 
 , MESSAGE_OCTET_LEN int not null 
 , MESSAGE_TEXT int not null 
@@ -158,6 +160,9 @@
 , SERIALIZABLE int not null 
 , SERIALWRITES int not null 
 , SERVER_NAME int not null 
+, SHA int not null
+, SHA1 int not null
+, SHA2 int not null
 , SHAPE int not null 
 , SHARE int not null 
 , SIDEINSERTS int not null 
@@ -1301,6 +1306,9 @@
 prepare s1 from SELECT COST COST from (values(0)) COST(COST);
 
 -- Expect success
+prepare s1 from SELECT CRC32 CRC32 from (values(0)) CRC32(CRC32);
+
+-- Expect success
 prepare s1 from SELECT CURDATE CURDATE from (values(0)) CURDATE(CURDATE);
 
 -- Expect success
@@ -1559,6 +1567,9 @@
 prepare s1 from SELECT M M from (values(0)) M(M);
 
 -- Expect success
+prepare s1 from SELECT MD5 MD5 from (values(0)) MD5(MD5);
+
+-- Expect success
 prepare s1 from SELECT MAXSIZE MAXSIZE from (values(0)) MAXSIZE(MAXSIZE);
 
 -- Expect success
@@ -1799,6 +1810,15 @@
 prepare s1 from SELECT SERVER_NAME SERVER_NAME from (values(0)) SERVER_NAME(SERVER_NAME);
 
 -- Expect success
+prepare s1 from SELECT SHA SHA from (values(0)) SHA(SHA);
+
+-- Expect success
+prepare s1 from SELECT SHA1 SHA1 from (values(0)) SHA1(SHA1);
+
+-- Expect success
+prepare s1 from SELECT SHA2 SHA2 from (values(0)) SHA2(SHA2);
+
+-- Expect success
 prepare s1 from SELECT SHAPE SHAPE from (values(0)) SHAPE(SHAPE);
 
 -- Expect success
diff --git a/core/sql/regress/executor/EXPECTED016.SB b/core/sql/regress/executor/EXPECTED016.SB
index 2ef3ea6..effb523 100644
--- a/core/sql/regress/executor/EXPECTED016.SB
+++ b/core/sql/regress/executor/EXPECTED016.SB
@@ -30,7 +30,9 @@
 +>;
 
 --- SQL operation complete.
->>
+>>create table t3015 (a1 NUMERIC(19,0), a2 int);
+
+--- SQL operation complete.
 >>-- MVs not support on seabase
 >>#ifndef SEABASE_REGRESS
 >>create MVGroup MVG_016;
@@ -216,6 +218,9 @@
 >>insert into t016t2 values (11, 22, null);
 
 --- 1 row(s) inserted.
+>>insert into t3015 values(27380468,27380468);
+
+--- 1 row(s) inserted.
 >>
 >>select * from t016t2;
 
@@ -869,12 +874,23 @@
 >>select * from t016_2535_3 where (c1,c2) <= (1234567.3, 0);
 
 --- 0 row(s) selected.
->>
+>>--JIRA TRAFODION-3015
+>>select * from t3015 where a1='27380468';
+
+A1 A2
+----------
+
+ 27380468 27380468
+
+--- 1 row(s) selected.
 >>drop table t016_2535_2;
 
 --- SQL operation complete.
 >>drop table t016_2535_3;
 
 --- SQL operation complete.
+>>drop table t3015;
+
+--- SQL operation complete.
 >>
 >>log;
diff --git a/core/sql/regress/executor/TEST016 b/core/sql/regress/executor/TEST016
index 0d314dd..e3723ff 100644
--- a/core/sql/regress/executor/TEST016
+++ b/core/sql/regress/executor/TEST016
@@ -80,7 +80,7 @@
 #ifNT
 attribute all mvs allowed
 ;
-
+create table t3015 (a1 NUMERIC(19,0), a2 int);
 -- MVs not support on seabase
 #ifndef SEABASE_REGRESS
 create MVGroup MVG_016;
@@ -151,6 +151,7 @@
 insert into t016t2 values (-1234567890123456789012345.123456789012, 22345678901234567890, .000000000000000000001);
 insert into t016t2 values (10, 20, .30);
 insert into t016t2 values (11, 22, null);
+insert into t3015 values(27380468,27380468);
 
 select * from t016t2;
 
@@ -313,9 +314,11 @@
 select * from t016_2535_3 where (c1,c2) < (1234568.3, 2);
 select * from t016_2535_3 where (c1,c2) <= (1234568.3, 2);
 select * from t016_2535_3 where (c1,c2) <= (1234567.3, 0);
-
+--JIRA TRAFODION-3015
+select * from t3015 where a1='27380468';
 drop table t016_2535_2;
 drop table t016_2535_3;
+drop table t3015;
 
 log;
 
diff --git a/core/sql/regress/privs1/EXPECTED125 b/core/sql/regress/privs1/EXPECTED125
index 8473a1c..d464042 100644
--- a/core/sql/regress/privs1/EXPECTED125
+++ b/core/sql/regress/privs1/EXPECTED125
@@ -98,6 +98,9 @@
 >>create library t125_l1 file $$QUOTE$$ $$REGRRUNDIR$$/$$DLL$$ $$QUOTE$$ ;
 
 --- SQL operation complete.
+>>grant usage on library t125_l1 to t125_role1;
+
+--- SQL operation complete.
 >>create function translateBitmap(bitmap largeint) returns (bitmap_string char (20))
 +>language c parameter style sql external name 'translateBitmap'
 +>library t125_l1
@@ -127,6 +130,9 @@
 +>   file $$QUOTE$$ $$REGRRUNDIR$$/$$JARF$$ $$QUOTE$$;
 
 --- SQL operation complete.
+>>grant all on library t125_l2 to sql_user8;
+
+--- SQL operation complete.
 >>
 >>create procedure TestHive(
 +>  IN operation char(20),
@@ -230,6 +236,9 @@
 >>create library t125_l1 file $$QUOTE$$ $$REGRRUNDIR$$/$$DLL$$ $$QUOTE$$ ;
 
 --- SQL operation complete.
+>>grant usage on library t125_l1 to t125_role1;
+
+--- SQL operation complete.
 >>create function translateBitmap(bitmap largeint) returns (bitmap_string char (20))
 +>language c parameter style sql external name 'translateBitmap'
 +>library t125_l1
@@ -259,6 +268,9 @@
 +>   file $$QUOTE$$ $$REGRRUNDIR$$/$$JARF$$ $$QUOTE$$;
 
 --- SQL operation complete.
+>>grant all on library t125_l2 to sql_user8;
+
+--- SQL operation complete.
 >>
 >>create procedure TestHive(
 +>  IN operation char(20),
@@ -362,6 +374,9 @@
 >>create library t125_l1 file $$QUOTE$$ $$REGRRUNDIR$$/$$DLL$$ $$QUOTE$$ ;
 
 --- SQL operation complete.
+>>grant usage on library t125_l1 to t125_role1;
+
+--- SQL operation complete.
 >>create function translateBitmap(bitmap largeint) returns (bitmap_string char (20))
 +>language c parameter style sql external name 'translateBitmap'
 +>library t125_l1
@@ -391,6 +406,9 @@
 +>   file $$QUOTE$$ $$REGRRUNDIR$$/$$JARF$$ $$QUOTE$$;
 
 --- SQL operation complete.
+>>grant all on library t125_l2 to sql_user8;
+
+--- SQL operation complete.
 >>
 >>create procedure TestHive(
 +>  IN operation char(20),
@@ -471,9 +489,12 @@
 Privileges for Role T125_ROLE1
 ==============================
 
+----G--    TRAFODION.T125SCH1.T125_L1
 S------    TRAFODION.T125SCH2.GAMES <Column> GAME_NUMBER
+----G--    TRAFODION.T125SCH2.T125_L1
 S------    TRAFODION.T125SCH2.TEAMS <Column> TEAM_NUMBER
 SIDU-R-    TRAFODION.T125SCH3.PLAYERS
+----G--    TRAFODION.T125SCH3.T125_L1
 ------E    TRAFODION.T125SCH3.TRANSLATEBITMAP
 
 --- SQL operation complete.
@@ -500,13 +521,16 @@
 ------E    TRAFODION."_LIBMGR_".JDBC
 SIDU-R-    TRAFODION.T125SCH1.GAMES
 S------    TRAFODION.T125SCH1.GAMES_BY_PLAYER
+----G--    TRAFODION.T125SCH1.T125_L1
 SIDU-R-    TRAFODION.T125SCH2.GAMES
 S------    TRAFODION.T125SCH2.GAMES <Column> GAME_NUMBER
 S------    TRAFODION.T125SCH2.GAMES_BY_PLAYER
+----G--    TRAFODION.T125SCH2.T125_L1
 S------    TRAFODION.T125SCH2.TEAMS <Column> TEAM_NUMBER
 SIDU-R-    TRAFODION.T125SCH3.GAMES
 S------    TRAFODION.T125SCH3.GAMES_BY_PLAYER
 SIDU-R-    TRAFODION.T125SCH3.PLAYERS
+----G--    TRAFODION.T125SCH3.T125_L1
 ------E    TRAFODION.T125SCH3.TRANSLATEBITMAP
 
 --- SQL operation complete.
@@ -517,9 +541,12 @@
 
 ------E    TRAFODION."_LIBMGR_".EVENT_LOG_READER
 ------E    TRAFODION."_LIBMGR_".JDBC
+----G--    TRAFODION.T125SCH1.T125_L1
 S------    TRAFODION.T125SCH2.GAMES <Column> GAME_NUMBER
+----G--    TRAFODION.T125SCH2.T125_L1
 S------    TRAFODION.T125SCH2.TEAMS <Column> TEAM_NUMBER
 SIDU-R-    TRAFODION.T125SCH3.PLAYERS
+----G--    TRAFODION.T125SCH3.T125_L1
 ------E    TRAFODION.T125SCH3.TRANSLATEBITMAP
 
 --- SQL operation complete.
@@ -530,6 +557,8 @@
 
 ------E    TRAFODION."_LIBMGR_".EVENT_LOG_READER
 ------E    TRAFODION."_LIBMGR_".JDBC
+---UG--    TRAFODION.T125SCH1.T125_L2
+---UG--    TRAFODION.T125SCH2.T125_L2
 SIDU-R-    TRAFODION.T125SCH3.GAMES
 S----R-    TRAFODION.T125SCH3.GAMES_BY_PLAYER
 S----R-    TRAFODION.T125SCH3.HOME_TEAMS_GAMES
@@ -547,6 +576,488 @@
 
 --- SQL operation complete.
 >>
+>>set schema t125sch1;
+
+--- SQL operation complete.
+>>obey TEST125(get_privs);
+>>get privileges on table games;
+
+Privileges on Table T125SCH1.GAMES
+==================================
+
+SIDU-R-    DB__ROOT
+SIDU-R-    SQL_USER2
+
+--- SQL operation complete.
+>>get privileges on table games for sql_user1;
+
+--- SQL operation complete.
+>>get privileges on table games for sql_user2;
+
+Privileges on Table T125SCH1.GAMES
+==================================
+
+SIDU-R-    SQL_USER2
+
+--- SQL operation complete.
+>>get privileges on table games for sql_user7;
+
+--- SQL operation complete.
+>>get privileges on table games for sql_user8;
+
+--- SQL operation complete.
+>>get privileges on table games for t125_role1;
+
+--- SQL operation complete.
+>>get privileges on table games for t125_adminrole;
+
+--- SQL operation complete.
+>>get privileges on view games_by_player;
+
+Privileges on View T125SCH1.GAMES_BY_PLAYER
+===========================================
+
+S----R-    DB__ROOT
+S------    SQL_USER2
+
+--- SQL operation complete.
+>>get privileges on view games_by_player for sql_user1;
+
+--- SQL operation complete.
+>>get privileges on view games_by_player for sql_user2;
+
+Privileges on View T125SCH1.GAMES_BY_PLAYER
+===========================================
+
+S------    SQL_USER2
+
+--- SQL operation complete.
+>>get privileges on view games_by_player for sql_user7;
+
+--- SQL operation complete.
+>>get privileges on view games_by_player for sql_user8;
+
+--- SQL operation complete.
+>>get privileges on view games_by_player for t125_role1;
+
+--- SQL operation complete.
+>>get privileges on view games_by_player for t125_adminrole;
+
+--- SQL operation complete.
+>>get privileges on library t125_l1;
+
+Privileges on Sequence T125SCH1.T125_L1
+=======================================
+
+---UG--    DB__ROOT
+----G--    T125_ROLE1
+
+--- SQL operation complete.
+>>get privileges on library t125_l1 for sql_user1;
+
+--- SQL operation complete.
+>>get privileges on library t125_l1 for sql_user2;
+
+Privileges on Sequence T125SCH1.T125_L1
+=======================================
+
+----G--    T125_ROLE1
+
+--- SQL operation complete.
+>>get privileges on library t125_l1 for sql_user7;
+
+Privileges on Sequence T125SCH1.T125_L1
+=======================================
+
+----G--    T125_ROLE1
+
+--- SQL operation complete.
+>>get privileges on library t125_l1 for sql_user8;
+
+--- SQL operation complete.
+>>get privileges on library t125_l1 for t125_role1;
+
+Privileges on Sequence T125SCH1.T125_L1
+=======================================
+
+----G--    T125_ROLE1
+
+--- SQL operation complete.
+>>get privileges on library t125_l1 for t125_adminrole;
+
+--- SQL operation complete.
+>>get privileges on sequence players_sequence;
+
+Privileges on Sequence T125SCH1.PLAYERS_SEQUENCE
+================================================
+
+----G--    DB__ROOT
+
+--- SQL operation complete.
+>>get privileges on sequence players_sequence for sql_user1;
+
+--- SQL operation complete.
+>>get privileges on sequence players_sequence for sql_user2;
+
+--- SQL operation complete.
+>>get privileges on sequence players_sequence for sql_user7;
+
+--- SQL operation complete.
+>>get privileges on sequence players_sequence for sql_user8;
+
+--- SQL operation complete.
+>>get privileges on sequence players_sequence for t125_role1;
+
+--- SQL operation complete.
+>>get privileges on sequence players_sequence for t125_adminrole;
+
+--- SQL operation complete.
+>>
+>>set schema t125sch2;
+
+--- SQL operation complete.
+>>obey TEST125(get_privs);
+>>get privileges on table games;
+
+Privileges on Table T125SCH2.GAMES
+==================================
+
+SIDU-R-    DB__ROOT
+SIDU-R-    SQL_USER2
+S------    T125_ROLE1
+
+--- SQL operation complete.
+>>get privileges on table games for sql_user1;
+
+--- SQL operation complete.
+>>get privileges on table games for sql_user2;
+
+Privileges on Table T125SCH2.GAMES
+==================================
+
+SIDU-R-    SQL_USER2
+S------    T125_ROLE1
+
+--- SQL operation complete.
+>>get privileges on table games for sql_user7;
+
+Privileges on Table T125SCH2.GAMES
+==================================
+
+S------    T125_ROLE1
+
+--- SQL operation complete.
+>>get privileges on table games for sql_user8;
+
+--- SQL operation complete.
+>>get privileges on table games for t125_role1;
+
+Privileges on Table T125SCH2.GAMES
+==================================
+
+S------    T125_ROLE1
+
+--- SQL operation complete.
+>>get privileges on table games for t125_adminrole;
+
+--- SQL operation complete.
+>>get privileges on view games_by_player;
+
+Privileges on View T125SCH2.GAMES_BY_PLAYER
+===========================================
+
+S----R-    DB__ROOT
+S------    SQL_USER2
+
+--- SQL operation complete.
+>>get privileges on view games_by_player for sql_user1;
+
+--- SQL operation complete.
+>>get privileges on view games_by_player for sql_user2;
+
+Privileges on View T125SCH2.GAMES_BY_PLAYER
+===========================================
+
+S------    SQL_USER2
+
+--- SQL operation complete.
+>>get privileges on view games_by_player for sql_user7;
+
+--- SQL operation complete.
+>>get privileges on view games_by_player for sql_user8;
+
+--- SQL operation complete.
+>>get privileges on view games_by_player for t125_role1;
+
+--- SQL operation complete.
+>>get privileges on view games_by_player for t125_adminrole;
+
+--- SQL operation complete.
+>>get privileges on library t125_l1;
+
+Privileges on Sequence T125SCH2.T125_L1
+=======================================
+
+---UG--    DB__ROOT
+----G--    T125_ROLE1
+
+--- SQL operation complete.
+>>get privileges on library t125_l1 for sql_user1;
+
+--- SQL operation complete.
+>>get privileges on library t125_l1 for sql_user2;
+
+Privileges on Sequence T125SCH2.T125_L1
+=======================================
+
+----G--    T125_ROLE1
+
+--- SQL operation complete.
+>>get privileges on library t125_l1 for sql_user7;
+
+Privileges on Sequence T125SCH2.T125_L1
+=======================================
+
+----G--    T125_ROLE1
+
+--- SQL operation complete.
+>>get privileges on library t125_l1 for sql_user8;
+
+--- SQL operation complete.
+>>get privileges on library t125_l1 for t125_role1;
+
+Privileges on Sequence T125SCH2.T125_L1
+=======================================
+
+----G--    T125_ROLE1
+
+--- SQL operation complete.
+>>get privileges on library t125_l1 for t125_adminrole;
+
+--- SQL operation complete.
+>>get privileges on sequence players_sequence;
+
+Privileges on Sequence T125SCH2.PLAYERS_SEQUENCE
+================================================
+
+----G--    DB__ROOT
+----G--    SQL_USER1
+
+--- SQL operation complete.
+>>get privileges on sequence players_sequence for sql_user1;
+
+Privileges on Sequence T125SCH2.PLAYERS_SEQUENCE
+================================================
+
+----G--    SQL_USER1
+
+--- SQL operation complete.
+>>get privileges on sequence players_sequence for sql_user2;
+
+--- SQL operation complete.
+>>get privileges on sequence players_sequence for sql_user7;
+
+--- SQL operation complete.
+>>get privileges on sequence players_sequence for sql_user8;
+
+--- SQL operation complete.
+>>get privileges on sequence players_sequence for t125_role1;
+
+--- SQL operation complete.
+>>get privileges on sequence players_sequence for t125_adminrole;
+
+--- SQL operation complete.
+>>
+>>set schema t125sch3;
+
+--- SQL operation complete.
+>>obey TEST125(get_privs);
+>>get privileges on table games;
+
+Privileges on Table T125SCH3.GAMES
+==================================
+
+-I-----    SQL_USER1
+SIDU-R-    SQL_USER2
+SIDU-R-    T125_ADMINROLE
+
+--- SQL operation complete.
+>>get privileges on table games for sql_user1;
+
+Privileges on Table T125SCH3.GAMES
+==================================
+
+-I-----    SQL_USER1
+
+--- SQL operation complete.
+>>get privileges on table games for sql_user2;
+
+Privileges on Table T125SCH3.GAMES
+==================================
+
+SIDU-R-    SQL_USER2
+
+--- SQL operation complete.
+>>get privileges on table games for sql_user7;
+
+--- SQL operation complete.
+>>get privileges on table games for sql_user8;
+
+Privileges on Table T125SCH3.GAMES
+==================================
+
+SIDU-R-    T125_ADMINROLE
+
+--- SQL operation complete.
+>>get privileges on table games for t125_role1;
+
+--- SQL operation complete.
+>>get privileges on table games for t125_adminrole;
+
+Privileges on Table T125SCH3.GAMES
+==================================
+
+SIDU-R-    T125_ADMINROLE
+
+--- SQL operation complete.
+>>get privileges on view games_by_player;
+
+Privileges on View T125SCH3.GAMES_BY_PLAYER
+===========================================
+
+S------    SQL_USER1
+S------    SQL_USER2
+S----R-    T125_ADMINROLE
+
+--- SQL operation complete.
+>>get privileges on view games_by_player for sql_user1;
+
+Privileges on View T125SCH3.GAMES_BY_PLAYER
+===========================================
+
+S------    SQL_USER1
+
+--- SQL operation complete.
+>>get privileges on view games_by_player for sql_user2;
+
+Privileges on View T125SCH3.GAMES_BY_PLAYER
+===========================================
+
+S------    SQL_USER2
+
+--- SQL operation complete.
+>>get privileges on view games_by_player for sql_user7;
+
+--- SQL operation complete.
+>>get privileges on view games_by_player for sql_user8;
+
+Privileges on View T125SCH3.GAMES_BY_PLAYER
+===========================================
+
+S----R-    T125_ADMINROLE
+
+--- SQL operation complete.
+>>get privileges on view games_by_player for t125_role1;
+
+--- SQL operation complete.
+>>get privileges on view games_by_player for t125_adminrole;
+
+Privileges on View T125SCH3.GAMES_BY_PLAYER
+===========================================
+
+S----R-    T125_ADMINROLE
+
+--- SQL operation complete.
+>>get privileges on library t125_l1;
+
+Privileges on Sequence T125SCH3.T125_L1
+=======================================
+
+---UG--    T125_ADMINROLE
+----G--    T125_ROLE1
+
+--- SQL operation complete.
+>>get privileges on library t125_l1 for sql_user1;
+
+--- SQL operation complete.
+>>get privileges on library t125_l1 for sql_user2;
+
+Privileges on Sequence T125SCH3.T125_L1
+=======================================
+
+----G--    T125_ROLE1
+
+--- SQL operation complete.
+>>get privileges on library t125_l1 for sql_user7;
+
+Privileges on Sequence T125SCH3.T125_L1
+=======================================
+
+----G--    T125_ROLE1
+
+--- SQL operation complete.
+>>get privileges on library t125_l1 for sql_user8;
+
+Privileges on Sequence T125SCH3.T125_L1
+=======================================
+
+---UG--    T125_ADMINROLE
+
+--- SQL operation complete.
+>>get privileges on library t125_l1 for t125_role1;
+
+Privileges on Sequence T125SCH3.T125_L1
+=======================================
+
+----G--    T125_ROLE1
+
+--- SQL operation complete.
+>>get privileges on library t125_l1 for t125_adminrole;
+
+Privileges on Sequence T125SCH3.T125_L1
+=======================================
+
+---UG--    T125_ADMINROLE
+
+--- SQL operation complete.
+>>get privileges on sequence players_sequence;
+
+Privileges on Sequence T125SCH3.PLAYERS_SEQUENCE
+================================================
+
+----G--    T125_ADMINROLE
+
+--- SQL operation complete.
+>>get privileges on sequence players_sequence for sql_user1;
+
+--- SQL operation complete.
+>>get privileges on sequence players_sequence for sql_user2;
+
+--- SQL operation complete.
+>>get privileges on sequence players_sequence for sql_user7;
+
+--- SQL operation complete.
+>>get privileges on sequence players_sequence for sql_user8;
+
+Privileges on Sequence T125SCH3.PLAYERS_SEQUENCE
+================================================
+
+----G--    T125_ADMINROLE
+
+--- SQL operation complete.
+>>get privileges on sequence players_sequence for t125_role1;
+
+--- SQL operation complete.
+>>get privileges on sequence players_sequence for t125_adminrole;
+
+Privileges on Sequence T125SCH3.PLAYERS_SEQUENCE
+================================================
+
+----G--    T125_ADMINROLE
+
+--- SQL operation complete.
+>>
+>>
 >>obey TEST125(get_tests);
 >>log LOG125;
 >>cqd SHOWDDL_DISPLAY_PRIVILEGE_GRANTS 'ON';
@@ -779,6 +1290,19 @@
 TEAMS
 
 --- SQL operation complete.
+>>get privileges on table games;
+
+Privileges on Table T125SCH3.GAMES
+==================================
+
+-I-----    SQL_USER1
+SIDU-R-    SQL_USER2
+SIDU-R-    T125_ADMINROLE
+
+--- SQL operation complete.
+>>get privileges on table games for t125_role1;
+
+--- SQL operation complete.
 >>get views in catalog trafodion, match 'T125SCH%';
 
 Views in Catalog TRAFODION
@@ -795,6 +1319,24 @@
 T125SCH3.PLAYERS_ON_TEAM
 
 --- SQL operation complete.
+>>get privileges on view games_by_player;
+
+Privileges on View T125SCH3.GAMES_BY_PLAYER
+===========================================
+
+S------    SQL_USER1
+S------    SQL_USER2
+S----R-    T125_ADMINROLE
+
+--- SQL operation complete.
+>>get privileges on view games_by_player for user sql_user8;
+
+Privileges on View T125SCH3.GAMES_BY_PLAYER
+===========================================
+
+S----R-    T125_ADMINROLE
+
+--- SQL operation complete.
 >>get indexes in schema t125sch3;
 
 Indexes in Schema TRAFODION.T125SCH3
@@ -813,6 +1355,17 @@
 T125SCH3.PLAYERS_SEQUENCE
 
 --- SQL operation complete.
+>>get privileges on sequence players_sequence;
+
+Privileges on Sequence T125SCH3.PLAYERS_SEQUENCE
+================================================
+
+----G--    T125_ADMINROLE
+
+--- SQL operation complete.
+>>get privileges on sequence players_sequence for t125_role1;
+
+--- SQL operation complete.
 >>get libraries, match 'T125%';
 
 Libraries in Schema TRAFODION.T125SCH3
@@ -822,6 +1375,23 @@
 T125_L2
 
 --- SQL operation complete.
+>>get privileges on library t125_l1;
+
+Privileges on Sequence T125SCH3.T125_L1
+=======================================
+
+---UG--    T125_ADMINROLE
+----G--    T125_ROLE1
+
+--- SQL operation complete.
+>>get privileges on library t125_l1 for user sql_user8;
+
+Privileges on Sequence T125SCH3.T125_L1
+=======================================
+
+---UG--    T125_ADMINROLE
+
+--- SQL operation complete.
 >>get functions in schema t125sch3;
 
 Functions in Schema TRAFODION.T125SCH3
@@ -880,6 +1450,8 @@
 Schemas in Catalog TRAFODION
 ============================
 
+T125SCH1
+T125SCH2
 T125SCH3
 
 --- SQL operation complete.
@@ -975,6 +1547,17 @@
 TEAMS
 
 --- SQL operation complete.
+>>get privileges on table games;
+
+Privileges on Table T125SCH3.GAMES
+==================================
+
+SIDU-R-    T125_ADMINROLE
+
+--- SQL operation complete.
+>>get privileges on table games for t125_role1;
+
+--- SQL operation complete.
 >>get views in catalog trafodion, match 'T125SCH%';
 
 Views in Catalog TRAFODION
@@ -985,6 +1568,22 @@
 T125SCH3.PLAYERS_ON_TEAM
 
 --- SQL operation complete.
+>>get privileges on view games_by_player;
+
+Privileges on View T125SCH3.GAMES_BY_PLAYER
+===========================================
+
+S----R-    T125_ADMINROLE
+
+--- SQL operation complete.
+>>get privileges on view games_by_player for user sql_user8;
+
+Privileges on View T125SCH3.GAMES_BY_PLAYER
+===========================================
+
+S----R-    T125_ADMINROLE
+
+--- SQL operation complete.
 >>get indexes in schema t125sch3;
 
 --- SQL operation complete.
@@ -996,6 +1595,17 @@
 T125SCH3.PLAYERS_SEQUENCE
 
 --- SQL operation complete.
+>>get privileges on sequence players_sequence;
+
+Privileges on Sequence T125SCH3.PLAYERS_SEQUENCE
+================================================
+
+----G--    T125_ADMINROLE
+
+--- SQL operation complete.
+>>get privileges on sequence players_sequence for t125_role1;
+
+--- SQL operation complete.
 >>get libraries, match 'T125%';
 
 Libraries in Schema TRAFODION.T125SCH3
@@ -1005,6 +1615,22 @@
 T125_L2
 
 --- SQL operation complete.
+>>get privileges on library t125_l1;
+
+Privileges on Sequence T125SCH3.T125_L1
+=======================================
+
+---UG--    T125_ADMINROLE
+
+--- SQL operation complete.
+>>get privileges on library t125_l1 for user sql_user8;
+
+Privileges on Sequence T125SCH3.T125_L1
+=======================================
+
+---UG--    T125_ADMINROLE
+
+--- SQL operation complete.
 >>get functions in schema t125sch3;
 
 Functions in Schema TRAFODION.T125SCH3
@@ -1169,6 +1795,17 @@
 GAMES
 
 --- SQL operation complete.
+>>get privileges on table games;
+
+Privileges on Table T125SCH3.GAMES
+==================================
+
+-I-----    SQL_USER1
+
+--- SQL operation complete.
+>>get privileges on table games for t125_role1;
+
+--- SQL operation complete.
 >>get views in catalog trafodion, match 'T125SCH%';
 
 Views in Catalog TRAFODION
@@ -1177,6 +1814,17 @@
 T125SCH3.GAMES_BY_PLAYER
 
 --- SQL operation complete.
+>>get privileges on view games_by_player;
+
+Privileges on View T125SCH3.GAMES_BY_PLAYER
+===========================================
+
+S------    SQL_USER1
+
+--- SQL operation complete.
+>>get privileges on view games_by_player for user sql_user8;
+
+--- SQL operation complete.
 >>get indexes in schema t125sch3;
 
 --- SQL operation complete.
@@ -1188,9 +1836,21 @@
 T125SCH2.PLAYERS_SEQUENCE
 
 --- SQL operation complete.
+>>get privileges on sequence players_sequence;
+
+--- SQL operation complete.
+>>get privileges on sequence players_sequence for t125_role1;
+
+--- SQL operation complete.
 >>get libraries, match 'T125%';
 
 --- SQL operation complete.
+>>get privileges on library t125_l1;
+
+--- SQL operation complete.
+>>get privileges on library t125_l1 for user sql_user8;
+
+--- SQL operation complete.
 >>get functions in schema t125sch3;
 
 --- SQL operation complete.
@@ -1356,6 +2016,17 @@
 PLAYERS
 
 --- SQL operation complete.
+>>get privileges on table games;
+
+Privileges on Table T125SCH3.GAMES
+==================================
+
+SIDU-R-    SQL_USER2
+
+--- SQL operation complete.
+>>get privileges on table games for t125_role1;
+
+--- SQL operation complete.
 >>get views in catalog trafodion, match 'T125SCH%';
 
 Views in Catalog TRAFODION
@@ -1366,12 +2037,29 @@
 T125SCH3.GAMES_BY_PLAYER
 
 --- SQL operation complete.
+>>get privileges on view games_by_player;
+
+Privileges on View T125SCH3.GAMES_BY_PLAYER
+===========================================
+
+S------    SQL_USER2
+
+--- SQL operation complete.
+>>get privileges on view games_by_player for user sql_user8;
+
+--- SQL operation complete.
 >>get indexes in schema t125sch3;
 
 --- SQL operation complete.
 >>get sequences in catalog trafodion, match 'T125SCH%';
 
 --- SQL operation complete.
+>>get privileges on sequence players_sequence;
+
+--- SQL operation complete.
+>>get privileges on sequence players_sequence for t125_role1;
+
+--- SQL operation complete.
 >>get libraries, match 'T125%';
 
 Libraries in Schema TRAFODION.T125SCH3
@@ -1380,6 +2068,17 @@
 T125_L1
 
 --- SQL operation complete.
+>>get privileges on library t125_l1;
+
+Privileges on Sequence T125SCH3.T125_L1
+=======================================
+
+----G--    T125_ROLE1
+
+--- SQL operation complete.
+>>get privileges on library t125_l1 for user sql_user8;
+
+--- SQL operation complete.
 >>get functions in schema t125sch3;
 
 Functions in Schema TRAFODION.T125SCH3
@@ -1429,6 +2128,7 @@
 Schemas in Catalog TRAFODION
 ============================
 
+T125SCH1
 T125SCH2
 T125SCH3
 
@@ -1521,15 +2221,33 @@
 PLAYERS
 
 --- SQL operation complete.
+>>get privileges on table games;
+
+--- SQL operation complete.
+>>get privileges on table games for t125_role1;
+
+--- SQL operation complete.
 >>get views in catalog trafodion, match 'T125SCH%';
 
 --- SQL operation complete.
+>>get privileges on view games_by_player;
+
+--- SQL operation complete.
+>>get privileges on view games_by_player for user sql_user8;
+
+--- SQL operation complete.
 >>get indexes in schema t125sch3;
 
 --- SQL operation complete.
 >>get sequences in catalog trafodion, match 'T125SCH%';
 
 --- SQL operation complete.
+>>get privileges on sequence players_sequence;
+
+--- SQL operation complete.
+>>get privileges on sequence players_sequence for t125_role1;
+
+--- SQL operation complete.
 >>get libraries, match 'T125%';
 
 Libraries in Schema TRAFODION.T125SCH3
@@ -1538,6 +2256,17 @@
 T125_L1
 
 --- SQL operation complete.
+>>get privileges on library t125_l1;
+
+Privileges on Sequence T125SCH3.T125_L1
+=======================================
+
+----G--    T125_ROLE1
+
+--- SQL operation complete.
+>>get privileges on library t125_l1 for user sql_user8;
+
+--- SQL operation complete.
 >>get functions in schema t125sch3;
 
 Functions in Schema TRAFODION.T125SCH3
diff --git a/core/sql/regress/privs1/TEST125 b/core/sql/regress/privs1/TEST125
index de667ea..c29eb36 100644
--- a/core/sql/regress/privs1/TEST125
+++ b/core/sql/regress/privs1/TEST125
@@ -33,6 +33,10 @@
 --  get functions, procedures, table mapping functions, libraries (in schema)
 --  get privileges on table
 --  get privileges on view
+--  get privileges on sequence
+--  get privileges on library
+--  (tests for get privileges on functions, table_mapping functions, and
+--   procedures is part of privs2/TEST144)
 --
 -- ============================================================================
 cqd SHOWDDL_DISPLAY_PRIVILEGE_GRANTS 'ON';
@@ -104,6 +108,13 @@
 get privileges for user sql_user7;
 get privileges for user sql_user8;
 
+set schema t125sch1;
+obey TEST125(get_privs);
+set schema t125sch2;
+obey TEST125(get_privs);
+set schema t125sch3;
+obey TEST125(get_privs);
+
 obey TEST125(get_tests);
 
 ?section create_db
@@ -167,6 +178,7 @@
 set pattern $$QUOTE$$ '''';
 
 create library t125_l1 file $$QUOTE$$ $$REGRRUNDIR$$/$$DLL$$ $$QUOTE$$ ;
+grant usage on library t125_l1 to t125_role1;
 create function translateBitmap(bitmap largeint) returns (bitmap_string char (20))
 language c parameter style sql external name 'translateBitmap'
 library t125_l1
@@ -179,6 +191,7 @@
 
 create library t125_l2
    file $$QUOTE$$ $$REGRRUNDIR$$/$$JARF$$ $$QUOTE$$;
+grant all on library t125_l2 to sql_user8; 
 
 create procedure TestHive(
   IN operation char(20),
@@ -192,6 +205,36 @@
   ISOLATE
   ;
 
+?section get_privs
+get privileges on table games;
+get privileges on table games for sql_user1;
+get privileges on table games for sql_user2;
+get privileges on table games for sql_user7;
+get privileges on table games for sql_user8;
+get privileges on table games for t125_role1;
+get privileges on table games for t125_adminrole;
+get privileges on view games_by_player;
+get privileges on view games_by_player for sql_user1;
+get privileges on view games_by_player for sql_user2;
+get privileges on view games_by_player for sql_user7;
+get privileges on view games_by_player for sql_user8;
+get privileges on view games_by_player for t125_role1;
+get privileges on view games_by_player for t125_adminrole;
+get privileges on library t125_l1;
+get privileges on library t125_l1 for sql_user1;
+get privileges on library t125_l1 for sql_user2;
+get privileges on library t125_l1 for sql_user7;
+get privileges on library t125_l1 for sql_user8;
+get privileges on library t125_l1 for t125_role1;
+get privileges on library t125_l1 for t125_adminrole;
+get privileges on sequence players_sequence;
+get privileges on sequence players_sequence for sql_user1;
+get privileges on sequence players_sequence for sql_user2;
+get privileges on sequence players_sequence for sql_user7;
+get privileges on sequence players_sequence for sql_user8;
+get privileges on sequence players_sequence for t125_role1;
+get privileges on sequence players_sequence for t125_adminrole;
+
 ?section clean_up
 drop schema t125sch1 cascade;
 drop schema t125sch2 cascade;
@@ -243,10 +286,18 @@
 
 set schema t125sch3;
 get tables;
+get privileges on table games;
+get privileges on table games for t125_role1;
 get views in catalog trafodion, match 'T125SCH%';
+get privileges on view games_by_player;
+get privileges on view games_by_player for user sql_user8;
 get indexes in schema t125sch3;
 get sequences in catalog trafodion, match 'T125SCH%';
+get privileges on sequence players_sequence;
+get privileges on sequence players_sequence for t125_role1;
 get libraries, match 'T125%';
+get privileges on library t125_l1;
+get privileges on library t125_l1 for user sql_user8;
 get functions in schema t125sch3;
 get procedures;
  
diff --git a/core/sql/regress/privs2/EXPECTED144 b/core/sql/regress/privs2/EXPECTED144
index 6beefa1..d25b4a8 100644
--- a/core/sql/regress/privs2/EXPECTED144
+++ b/core/sql/regress/privs2/EXPECTED144
Binary files differ
diff --git a/core/sql/regress/privs2/EXPECTED146 b/core/sql/regress/privs2/EXPECTED146
index 2baa2f8..7bf43b0 100644
--- a/core/sql/regress/privs2/EXPECTED146
+++ b/core/sql/regress/privs2/EXPECTED146
@@ -50,6 +50,10 @@
 
 --- SQL operation complete.
 >>
+>>create hbase table t146t3 ( column family 'cf');
+
+--- SQL operation complete.
+>>
 >>-- These operations are not allowed on hbase tables
 >>update hbase."_CELL_".t146t1 set col_value = '4' where row_id = '2' and col_name = 'visitor_team';
 
@@ -87,7 +91,7 @@
 CREATE HBASE TABLE T146T1 ( COLUMN FAMILY '#1')
 
 REGISTER /*INTERNAL*/ HBASE TABLE T146T1;
-/* ObjectUID = 2009891765934276385 */
+/* ObjectUID = 7181713655023564985 */
 
 -- GRANT SELECT, INSERT, DELETE, UPDATE, REFERENCES ON HBASE."_CELL_".T146T1 TO DB__HBASEROLE WITH GRANT OPTION;
 
@@ -110,7 +114,7 @@
 CREATE HBASE TABLE T146T1 ( COLUMN FAMILY '#1')
 
 REGISTER /*INTERNAL*/ HBASE TABLE T146T1;
-/* ObjectUID = 2009891765934276410 */
+/* ObjectUID = 7181713655023565067 */
 
 -- GRANT SELECT, INSERT, DELETE, UPDATE, REFERENCES ON HBASE."_ROW_".T146T1 TO DB__HBASEROLE WITH GRANT OPTION;
 
@@ -138,7 +142,9 @@
 ============================================
 
 "_CELL_".T146T1
+"_CELL_".T146T3
 "_ROW_".T146T1
+"_ROW_".T146T3
 
 --- SQL operation complete.
 >>
@@ -163,6 +169,15 @@
 CREATE_SCHEMA
 
 --- SQL operation complete.
+>>get external hbase objects, match '%T146%';
+
+External HBase objects
+======================
+
+T146T1
+T146T3
+
+--- SQL operation complete.
 >>
 >>obey TEST146(test_grants);
 >>-- =================================================================
@@ -291,7 +306,7 @@
 CREATE HBASE TABLE T146T1 ( COLUMN FAMILY '#1')
 
 REGISTER /*INTERNAL*/ HBASE TABLE T146T1;
-/* ObjectUID = 2009891765934276385 */
+/* ObjectUID = 7181713655023564985 */
 
 -- GRANT SELECT, INSERT, DELETE, UPDATE, REFERENCES ON HBASE."_CELL_".T146T1 TO DB__HBASEROLE WITH GRANT OPTION;
   GRANT SELECT ON HBASE."_CELL_".T146T1 TO SQL_USER3 GRANTED BY DB__HBASEROLE;
@@ -319,7 +334,7 @@
 CREATE HBASE TABLE T146T1 ( COLUMN FAMILY '#1')
 
 REGISTER /*INTERNAL*/ HBASE TABLE T146T1;
-/* ObjectUID = 2009891765934276410 */
+/* ObjectUID = 7181713655023565067 */
 
 -- GRANT SELECT, INSERT, DELETE, UPDATE, REFERENCES ON HBASE."_ROW_".T146T1 TO DB__HBASEROLE WITH GRANT OPTION;
   GRANT SELECT ON HBASE."_ROW_".T146T1 TO SQL_USER3 GRANTED BY DB__HBASEROLE;
@@ -492,6 +507,18 @@
 
 --- 6 row(s) selected.
 >>
+>>get external hbase objects, match '%T146%';
+
+--- SQL operation complete.
+>>get hbase registered tables in catalog trafodion, match '%T146%';
+
+HBase Registered Tables in Catalog TRAFODION
+============================================
+
+"_CELL_".T146T1
+"_ROW_".T146T1
+
+--- SQL operation complete.
 >>exit;
 
 End of MXCI Session
@@ -630,6 +657,18 @@
 
 --- 6 row(s) selected.
 >>
+>>get external hbase objects, match '%T146%';
+
+--- SQL operation complete.
+>>get hbase registered tables in catalog trafodion, match '%T146%';
+
+HBase Registered Tables in Catalog TRAFODION
+============================================
+
+"_CELL_".T146T1
+"_ROW_".T146T1
+
+--- SQL operation complete.
 >>exit;
 
 End of MXCI Session
@@ -773,6 +812,18 @@
 
 --- 6 row(s) selected.
 >>
+>>get external hbase objects, match '%T146%';
+
+--- SQL operation complete.
+>>get hbase registered tables in catalog trafodion, match '%T146%';
+
+HBase Registered Tables in Catalog TRAFODION
+============================================
+
+"_CELL_".T146T1
+"_ROW_".T146T1
+
+--- SQL operation complete.
 >>exit;
 
 End of MXCI Session
@@ -877,6 +928,12 @@
 *** ERROR[15017] Statement S1 was not found.
 
 >>
+>>get external hbase objects, match '%T146%';
+
+--- SQL operation complete.
+>>get hbase registered tables in catalog trafodion, match '%T146%';
+
+--- SQL operation complete.
 >>exit;
 
 End of MXCI Session
@@ -1018,6 +1075,26 @@
 
 --- 6 row(s) selected.
 >>
+>>get external hbase objects, match '%T146%';
+
+External HBase objects
+======================
+
+T146T1
+T146T3
+
+--- SQL operation complete.
+>>get hbase registered tables in catalog trafodion, match '%T146%';
+
+HBase Registered Tables in Catalog TRAFODION
+============================================
+
+"_CELL_".T146T1
+"_CELL_".T146T3
+"_ROW_".T146T1
+"_ROW_".T146T3
+
+--- SQL operation complete.
 >>exit;
 
 End of MXCI Session
@@ -1172,6 +1249,18 @@
 
 --- 6 row(s) selected.
 >>
+>>get external hbase objects, match '%T146%';
+
+--- SQL operation complete.
+>>get hbase registered tables in catalog trafodion, match '%T146%';
+
+HBase Registered Tables in Catalog TRAFODION
+============================================
+
+"_CELL_".T146T1
+"_ROW_".T146T1
+
+--- SQL operation complete.
 >>exit;
 
 End of MXCI Session
@@ -1279,6 +1368,12 @@
 *** ERROR[15017] Statement S1 was not found.
 
 >>
+>>get external hbase objects, match '%T146%';
+
+--- SQL operation complete.
+>>get hbase registered tables in catalog trafodion, match '%T146%';
+
+--- SQL operation complete.
 >>exit;
 
 End of MXCI Session
@@ -1419,6 +1514,17 @@
 
 --- 6 row(s) selected.
 >>
+>>get external hbase objects, match '%T146%';
+
+--- SQL operation complete.
+>>get hbase registered tables in catalog trafodion, match '%T146%';
+
+HBase Registered Tables in Catalog TRAFODION
+============================================
+
+"_CELL_".T146T1
+
+--- SQL operation complete.
 >>exit;
 
 End of MXCI Session
@@ -1473,8 +1579,10 @@
 
 SIDU-R-    HBASE._CELL_.T146T1
 SIDU-R-    HBASE._CELL_.T146T2
+SIDU-R-    HBASE._CELL_.T146T3
 SIDU-R-    HBASE._ROW_.T146T1
 SIDU-R-    HBASE._ROW_.T146T2
+SIDU-R-    HBASE._ROW_.T146T3
 SIDU-R-    TRAFODION._HB_MAP_.T146T1
 SIDU-R-    TRAFODION._HB_MAP_.T146T2
 
@@ -1489,7 +1597,9 @@
 =================================
 
 SIDU-R-    HBASE._CELL_.T146T1
+SIDU-R-    HBASE._CELL_.T146T3
 SIDU-R-    HBASE._ROW_.T146T1
+SIDU-R-    HBASE._ROW_.T146T3
 SIDU-R-    TRAFODION._HB_MAP_.T146T1
 
 --- SQL operation complete.
@@ -1605,8 +1715,10 @@
 
 SIDU-R-    HBASE._CELL_.T146T1
 SIDU-R-    HBASE._CELL_.T146T2
+SIDU-R-    HBASE._CELL_.T146T3
 SIDU-R-    HBASE._ROW_.T146T1
 SIDU-R-    HBASE._ROW_.T146T2
+SIDU-R-    HBASE._ROW_.T146T3
 SIDU-R-    TRAFODION._HB_MAP_.T146T1
 SIDU-R-    TRAFODION._HB_MAP_.T146T2
 
@@ -1621,7 +1733,9 @@
 =================================
 
 SIDU-R-    HBASE._CELL_.T146T1
+SIDU-R-    HBASE._CELL_.T146T3
 SIDU-R-    HBASE._ROW_.T146T1
+SIDU-R-    HBASE._ROW_.T146T3
 SIDU-R-    TRAFODION._HB_MAP_.T146T1
 
 --- SQL operation complete.
@@ -1652,5 +1766,8 @@
 *** WARNING[1004] Object T146T2 does not exist or object type is invalid for the current operation.
 
 --- SQL operation complete.
+>>drop hbase table t146t3;
+
+--- SQL operation complete.
 >>
 >>log;
diff --git a/core/sql/regress/privs2/TEST144 b/core/sql/regress/privs2/TEST144
index fd971cf..910e120 100755
--- a/core/sql/regress/privs2/TEST144
+++ b/core/sql/regress/privs2/TEST144
@@ -48,6 +48,7 @@
 revoke execute on procedure "_LIBMGR_".help from sql_user3 by sql_user2;
 revoke execute on procedure "_LIBMGR_".help from sql_user2;
 
+grant component privilege "SHOW" on sql_operations to "PUBLIC";
 ?section create_db
 create schema t144user1 authorization sql_user1;
 set schema t144user1;
@@ -114,6 +115,9 @@
 showddl customers;
 create role t144role1;
 
+revoke component privilege "SHOW" on sql_operations from "PUBLIC";
+get privileges on component sql_operations for "PUBLIC";
+
 ?section set_up
 set schema "_PRIVMGR_MD_";
 prepare get_privs from
@@ -138,8 +142,17 @@
 -- =================================================================
 set schema t144user1;
 execute get_privs;
+get privileges on function gen_phone;
+get privileges on function gen_random;
+get privileges on function gen_time;
+get privileges on procedure "_LIBMGR_".help;
+get privileges on table_mapping function "_LIBMGR_".event_log_reader;
 
--- user1 owns the udfs but does not have execute on procedure help
+-- user1 can execute udfs (as owner), but cannot execute procedure help,
+-- can execute table_mapping function event_log_reader through public grant
+get privileges on function gen_phone for sql_user1;
+get privileges on procedure "_LIBMGR_".help for sql_user1;
+get privileges on table_mapping function "_LIBMGR_".event_log_reader for sql_user1;
 sh sqlci -i "TEST144(cmds)" -u sql_user1;
 
 -- no other user or role has privileges
@@ -152,8 +165,13 @@
 grant execute on function gen_random to sql_user2 with grant option;
 grant execute on function gen_time to sql_user2;
 grant execute on procedure "_LIBMGR_".help to sql_user2 with grant option;
+get privileges on function gen_phone for sql_user2;
+get privileges on function gen_random for sql_user2;
+get privileges on function gen_time for user sql_user2;
+get privileges on procedure "_LIBMGR_".help for user sql_user2;
 execute get_privs;
 
+
 -- user2 can execute
 sh sqlci -i "TEST144(cmds)" -u sql_user2;
 
@@ -167,6 +185,10 @@
 
 -- user2 does not have WGO on gen_time
 grant execute on function gen_time to sql_user3 by sql_user2;
+get privileges on function gen_phone for user sql_user3;
+get privileges on function gen_random for user sql_user3;
+get privileges on function gen_time for user sql_user3;
+get privileges on procedure "_LIBMGR_".help for user sql_user3;
 execute get_privs;
 
 -- user 3 can execute gen_phone, gen_random, and help but not gen_time
@@ -179,11 +201,20 @@
 grant execute on function gen_time to t144role1;
 grant execute on procedure "_LIBMGR_".help to t144role1;
 grant role t144role1 to sql_user4;
+get privileges on function gen_phone for user sql_user4;
+get privileges on function gen_random for user sql_user4;
+get privileges on function gen_time for user sql_user4;
+get privileges on procedure "_LIBMGR_".help for user sql_user4;
+get privileges on function gen_random for t144role1;
 execute get_privs;
 
 -- user4 can execute through role t144role1
 sh sqlci -i "TEST144(cmds)" -u sql_user4;
 
+get privileges on function gen_phone;
+get privileges on function gen_random;
+get privileges on function gen_time;
+get privileges on procedure "_LIBMGR_".help;
 ?section test_revokes
 -- ============================================================================
 -- verify that revoking privileges handle EXECUTE privilege correctly
@@ -223,6 +254,10 @@
 log LOG144;
 values (user);
 set schema t144user1;
+-- should return privileges only for users that have execute privilege
+get privileges on function gen_time;
+-- should return no rows for users other than sql_user1
+get privileges on function gen_random for sql_user1;
 select customer_id, 
        'PHONE: ' || gen_phone(customer_id, customer_areacode) as phone,
        customer_areacode 
diff --git a/core/sql/regress/privs2/TEST146 b/core/sql/regress/privs2/TEST146
index 9f3f6d0..124aa9f 100755
--- a/core/sql/regress/privs2/TEST146
+++ b/core/sql/regress/privs2/TEST146
@@ -59,6 +59,7 @@
 
 drop hbase table t146t1;
 drop hbase table t146t2;
+drop hbase table t146t3;
 
 drop role t146_role1;
 revoke role db__hbaserole from sql_user5;
@@ -87,6 +88,8 @@
  attribute default column family 'cf'
  map to hbase table t146t1;
 
+create hbase table t146t3 ( column family 'cf');
+
 -- These operations are not allowed on hbase tables
 update hbase."_CELL_".t146t1 set col_value = '4' where row_id = '2' and col_name = 'visitor_team';
 delete from hbase."_CELL_".t146t1 where row_id = '3';
@@ -102,6 +105,7 @@
 
 revoke component privilege "SHOW" on sql_operations from "PUBLIC";
 get privileges on component sql_operations for "PUBLIC";
+get external hbase objects, match '%T146%';
 
 ?section test_grants
 -- =================================================================
@@ -168,6 +172,7 @@
 
 drop hbase table t146t2;
 drop hbase table t146t2;
+drop hbase table t146t3;
 
 ?section perform_ddl
 -- ============================================================================
@@ -246,3 +251,5 @@
 delete from hbase."_ROW_".t146t1 where row_id = '3';
 execute s1;
 
+get external hbase objects, match '%T146%';
+get hbase registered tables in catalog trafodion, match '%T146%';
diff --git a/core/sql/sqlci/sqlci_lex.ll b/core/sql/sqlci/sqlci_lex.ll
index 40d891a..ac4376d 100755
--- a/core/sql/sqlci/sqlci_lex.ll
+++ b/core/sql/sqlci/sqlci_lex.ll
@@ -271,8 +271,6 @@
 [Ss][Hh][Oo][Ww]                       return_IDENT_or_TOKEN(SHOW, 0);
 [Ss][Hh][Oo][Ww][Cc][Oo][Nn][Tt][Rr][Oo][Ll]           return_IDENT_or_TOKEN(SHOWCONTROL, 0);
 [Ss][Hh][Oo][Ww][Dd][Dd][Ll]           return_IDENT_or_TOKEN(SHOWDDL, 0);
-[Ss][Hh][Oo][Ww][Ll][Aa][Bb][Ee][Ll]   return_IDENT_or_TOKEN(SHOWLABEL, 0);
-[Ss][Hh][Oo][Ww][Ll][Ee][Aa][Kk][Ss]   return_IDENT_or_TOKEN(SHOWLEAKS, 0);
 [Ss][Hh][Oo][Ww][Pp][Ll][Aa][Nn]       return_IDENT_or_TOKEN(SHOWPLAN, 0);
 [Ss][Hh][Oo][Ww][Ss][Hh][Aa][Pp][Ee]   return_IDENT_or_TOKEN(SHOWSHAPE, 0);
 [Ss][Hh][Oo][Ww][Ss][Ee][Tt]           return_IDENT_or_TOKEN(SHOWSET, 0);
diff --git a/core/sql/sqlci/sqlci_yacc.y b/core/sql/sqlci/sqlci_yacc.y
index 33e926a..dc97892 100644
--- a/core/sql/sqlci/sqlci_yacc.y
+++ b/core/sql/sqlci/sqlci_yacc.y
@@ -460,8 +460,6 @@
 %token SHOW
 %token SHOWCONTROL
 %token SHOWDDL
-%token SHOWLABEL
-%token SHOWLEAKS
 %token SHOWPLAN
 %token SHOWSHAPE
 %token SHOWSET
@@ -1247,14 +1245,6 @@
                           $$ = new DML(SqlciParse_OriginalStr, $1, NULL);
                           REPOSITION_SqlciParse_InputPos;
 			}
-        |       SHOWLEAKS
-                        { // not ready to log.
-			  HEAPLOG_CONTROL(LOG_DELETE_ONLY); 
-			  $$ = new DML(SqlciParse_OriginalStr, 
-				       DML_DESCRIBE_TYPE,
-				       "__SQLCI_DML_SHOWLEAKS__");
-			  REPOSITION_SqlciParse_InputPos;
-			}
 
         |       DECLAREtoken IDENTIFIER 
 			{
@@ -1916,7 +1906,6 @@
         |       UNREGISTER              {$$ = DML_DDL_TYPE;}
 	|       SHOWCONTROL 		{$$ = DML_DESCRIBE_TYPE;}
 	|       SHOWDDL 		{$$ = DML_DESCRIBE_TYPE;}
-	|       SHOWLABEL		{$$ = DML_DESCRIBE_TYPE;}
 	|	SHOWSTATS               {$$ = DML_DESCRIBE_TYPE;}
         |	SHOWTRANSACTION         {$$ = DML_DESCRIBE_TYPE;}
 	|	INVOKE  		{$$ = DML_DESCRIBE_TYPE;}
diff --git a/core/sql/sqlcomp/CmpSeabaseDDLauth.cpp b/core/sql/sqlcomp/CmpSeabaseDDLauth.cpp
index 18b1865..3c9939d 100644
--- a/core/sql/sqlcomp/CmpSeabaseDDLauth.cpp
+++ b/core/sql/sqlcomp/CmpSeabaseDDLauth.cpp
@@ -358,7 +358,7 @@
   Int32 len = snprintf(buf, 300,
                        "SELECT [FIRST 1] auth_id FROM (SELECT auth_id, "
                        "LEAD(auth_id) OVER (ORDER BY auth_id) L FROM %s.%s ) "
-                       "WHERE L - auth_id > 1 and auth_id >= %d ",
+                       "WHERE (L - auth_id > 1 or L is null) and auth_id >= %d ",
                        MDSchema_.data(),SEABASE_AUTHS, minValue);
   assert (len <= 300);
   
@@ -1207,20 +1207,22 @@
       return;
     }
     
-    // User does not own any roles, but may have been granted roles.
     NAString privMgrMDLoc;
-
     CONCAT_CATSCH(privMgrMDLoc,systemCatalog_.data(),SEABASE_PRIVMGR_SCHEMA);
-    
-    PrivMgrRoles role(std::string(MDSchema_.data()),
-                      std::string(privMgrMDLoc.data()),
-                      CmpCommon::diags());
-    
-    if (CmpCommon::context()->isAuthorizationEnabled() &&
-        role.isUserGrantedAnyRole(getAuthID()))
+
+    // User does not own any roles, but may have been granted roles.
+    if (CmpCommon::context()->isAuthorizationEnabled())
     {
-       *CmpCommon::diags() << DgSqlCode(-CAT_NO_UNREG_USER_GRANTED_ROLES);
-       return;
+    
+      PrivMgrRoles role(std::string(MDSchema_.data()),
+                        std::string(privMgrMDLoc.data()),
+                        CmpCommon::diags());
+    
+      if (role.isUserGrantedAnyRole(getAuthID()))
+      {
+         *CmpCommon::diags() << DgSqlCode(-CAT_NO_UNREG_USER_GRANTED_ROLES);
+         return;
+      }
     }
     
     // Does user own any objects?
@@ -1249,32 +1251,39 @@
        return;
     }
                 
-    PrivMgr privMgr(std::string(privMgrMDLoc),CmpCommon::diags());
-    std::vector<PrivClass> privClasses;
-    
-    privClasses.push_back(PrivClass::ALL);
-    
-    std::vector<int64_t> objectUIDs;
-    if (privMgr.isAuthIDGrantedPrivs(getAuthID(),privClasses, objectUIDs))
+    // Is user granted any privileges?
+    if (CmpCommon::context()->isAuthorizationEnabled())
     {
-       NAString objectName = getObjectName(objectUIDs);
-       if (objectName.length() > 0)
-       {
-          *CmpCommon::diags() << DgSqlCode(-CAT_NO_UNREG_USER_HAS_PRIVS)
-                              << DgString0(dbUserName.data())
-                              << DgString1(objectName.data());
+      PrivMgr privMgr(std::string(privMgrMDLoc),CmpCommon::diags());
+      std::vector<PrivClass> privClasses;
+    
+      privClasses.push_back(PrivClass::ALL);
+    
+      std::vector<int64_t> objectUIDs;
+      if (privMgr.isAuthIDGrantedPrivs(getAuthID(),privClasses, objectUIDs))
+      {
+         NAString objectName = getObjectName(objectUIDs);
+         if (objectName.length() > 0)
+         {
+            *CmpCommon::diags() << DgSqlCode(-CAT_NO_UNREG_USER_HAS_PRIVS)
+                                << DgString0(dbUserName.data())
+                                << DgString1(objectName.data());
 
-          return;
-       }
+            return;
+         }
+      }
     }
     
     // remove any component privileges granted to this user
-    PrivMgrComponentPrivileges componentPrivileges(privMgrMDLoc.data(),CmpCommon::diags());
-    std::string componentUIDString = "1";
-    if (!componentPrivileges.dropAllForGrantee(getAuthID()))
+    if (CmpCommon::context()->isAuthorizationEnabled())
     {
-      UserException excp (NULL, 0);
-      throw excp;
+      PrivMgrComponentPrivileges componentPrivileges(privMgrMDLoc.data(),CmpCommon::diags());
+      std::string componentUIDString = "1";
+      if (!componentPrivileges.dropAllForGrantee(getAuthID()))
+      {
+        UserException excp (NULL, 0);
+        throw excp;
+      }
     }
 
     // delete the row
diff --git a/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp b/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp
index 46c92b3..234d2d1 100644
--- a/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp
+++ b/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp
@@ -10246,6 +10246,7 @@
   // or granted the DB__HBASEROLE
   if (isAuthorizationEnabled() && 
       !ComUser::isRootUserID() && 
+      !ComUser::currentUserHasRole(ROOT_ROLE_ID) &&
       !ComUser::currentUserHasRole(HBASE_ROLE_ID))
     {
       *CmpCommon::diags() << DgSqlCode (-CAT_NOT_AUTHORIZED);
@@ -10336,6 +10337,7 @@
   // or granted the DB__HBASEROLE
   if (isAuthorizationEnabled() && 
       !ComUser::isRootUserID() &&
+      !ComUser::currentUserHasRole(ROOT_ROLE_ID) &&
       !ComUser::currentUserHasRole(HBASE_ROLE_ID))
     {
       *CmpCommon::diags() << DgSqlCode (-CAT_NOT_AUTHORIZED);
diff --git a/docs/messages_guide/src/asciidoc/_chapters/binder_msgs.adoc b/docs/messages_guide/src/asciidoc/_chapters/binder_msgs.adoc
index 3d866e3..42b8509 100644
--- a/docs/messages_guide/src/asciidoc/_chapters/binder_msgs.adoc
+++ b/docs/messages_guide/src/asciidoc/_chapters/binder_msgs.adoc
@@ -2404,6 +2404,23 @@
 
 *Recovery:* Modify the statement and resubmit.
 
+[[SQL-4182]]
+== SQL 4182
+
+```
+Function <function-name> operand <operand-position> must be of type <data-type>.
+```
+
+*Cause:* The expression given for the indicated operand of the indicated function
+has the wrong data type. 
+
+*Effect:* {project-name} is unable to compile the statement.
+
+*Recovery:* Modify the statement and resubmit. If the expression in question
+is a dynamic parameter and the required
+data type is DATE, TIME, TIMESTAMP or INTERVAL, you must use a CAST expression to force
+the dynamic parameter to the required data type.
+
 [[SQL-4183]]
 == SQL 4183
 
diff --git a/docs/sql_reference/src/asciidoc/_chapters/sql_statements.adoc b/docs/sql_reference/src/asciidoc/_chapters/sql_statements.adoc
index 5a76ffb..26c2240 100644
--- a/docs/sql_reference/src/asciidoc/_chapters/sql_statements.adoc
+++ b/docs/sql_reference/src/asciidoc/_chapters/sql_statements.adoc
@@ -1707,12 +1707,17 @@
 AUTOCOMMIT must be turned ON (the default) for the session.

 

 ```

-CREATE [VOLATILE | UNIQUE] INDEX index ON table

+CREATE [VOLATILE | UNIQUE] INDEX index-name ON table

    (column-name [ASC[ENDING] | DESC[ENDING]]

    [,column-name [ASC[ENDING] | DESC[ENDING]]]...)

+   [populate-option]

    [HBASE_OPTIONS (hbase-options-list)]

    [SALT LIKE TABLE]

 

+populate-option is:

+  POPULATE

+| NO POPULATE

+

 hbase-options-list is:

    hbase-option = 'value'[, hbase-option = 'value']...

 ```

@@ -1733,7 +1738,7 @@
 +

 NOTE: Multiple NULL values are treated as duplicate values for a column which can contain only one NULL value.

 

-* `_index_`

+* `_index-name_`

 +

 is an SQL identifier that specifies the simple name for the new index. You cannot qualify _index_ with its schema

 name. Indexes have their own name space within a schema, so an index name might be the same as a table or constraint

@@ -1755,6 +1760,25 @@
 rows occur in a non-unique index, their order is based on the sequence specified for the columns of the key of the

 underlying table. For ordering (but not for other purposes), nulls are greater than other values.

 

+* `populate-option`

+

+** `NO POPULATE`

++

+specifies that the index is not to be populated when it is created. 

++

+The index’s partition(s) are created, but no data is written to the index, and it is marked “offline”. You can drop an offline index with the DROP INDEX statement. 

+The DROP TABLE statement also drops offline indexes of the specified table. 

+DML statements have no effect on offline indexes. 

++

+If an index is created with the intention of using it for a constraint, it must be populated before creating the constraint. 

+You can populate an offline index and remove its offline designation by using the POPULATE INDEX utility.

+

+** `POPULATE`

++

+specifies that the index is to be created and populated. 

++

+The default is `POPULATE`.

+

 * `HBASE_OPTIONS (_hbase-option_ = '_value_'[, _hbase-option_ = '_value_']&#8230;)`

 +

 a list of HBase options to set for the index. These options are applied independently of any HBase options set for

@@ -1936,6 +1960,14 @@
 *** ERROR[1053] Unique index TRAFODION.SEABASE.IDX_T25 could not be created because the specified column(s) contain duplicate data. [2017-01-12 17:17:51]

 ```

 

+* This exmaple creates the index _index_test_ which is not to be populated on the column _c1_ of the table _test_.

++

+```

+SQL>create index index_test on test (c1) no populate;

+

+--- SQL operation complete.

+```

+

 <<<

 [[create_library_statement]]

 == CREATE LIBRARY Statement

@@ -1972,7 +2004,7 @@
 +

 specifies the full path of a deployed library file, which either an SPJ's jar file or a UDF's library file.

 +

-note: make sure to upload the library file to the trafodion cluster and then copy the library file to the

+NOTE: Make sure to upload the library file to the trafodion cluster and then copy the library file to the

 same directory on all the nodes in the cluster before running the create library statement. otherwise, you

 will see an error message indicating that the jar or dll file was not found.

 

diff --git a/docs/sql_reference/src/asciidoc/_chapters/sql_utilities.adoc b/docs/sql_reference/src/asciidoc/_chapters/sql_utilities.adoc
index 992b955..5bcde53 100644
--- a/docs/sql_reference/src/asciidoc/_chapters/sql_utilities.adoc
+++ b/docs/sql_reference/src/asciidoc/_chapters/sql_utilities.adoc
@@ -2141,7 +2141,7 @@
 random sample in it. This table can then be used later for updating statistics

 incrementally.

 

-**** `PERIODIC _size_ ROWS EVERY _period_ ROW`

+**** `PERIODIC _size_ ROWS EVERY _period_ ROWS`

 +

 directs {project-name} SQL to choose the first _size_ number of rows from

 each _period_ of rows. The value _size_ must be an integer that is

diff --git a/install/python-installer/configs/version.json b/install/python-installer/configs/version.json
index 9d0da44..efec2c7 100644
--- a/install/python-installer/configs/version.json
+++ b/install/python-installer/configs/version.json
@@ -2,8 +2,8 @@
     "linux":  ["centos", "redhat"],
     "hadoop": ["cloudera", "hortonworks", "apache"],
     "java":   ["1.7", "1.8"],
-    "centos": ["6"],
-    "redhat": ["6"],
+    "centos": ["6","7"],
+    "redhat": ["6","7"],
     "cdh":    ["5.4", "5.5", "5.6", "5.7"],
     "hdp":    ["2.3", "2.4"],
     "hbase":  ["1.0", "1.1", "1.2"]