You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hawq.apache.org by ml...@apache.org on 2016/10/09 02:05:59 UTC

[1/2] incubator-hawq git commit: HAWQ-1068. Fixed crash at calling get_ao_compression_ratio(null)

Repository: incubator-hawq
Updated Branches:
  refs/heads/master 90bd061ba -> 8928e88ea


HAWQ-1068. Fixed crash at calling get_ao_compression_ratio(null)


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

Branch: refs/heads/master
Commit: 883793482347c502a703481e26564a5666aa3a59
Parents: 90bd061
Author: Ming LI <ml...@apache.org>
Authored: Thu Sep 22 15:17:11 2016 +0800
Committer: Ming LI <ml...@apache.org>
Committed: Sat Oct 8 10:18:41 2016 +0800

----------------------------------------------------------------------
 src/backend/access/appendonly/aosegfiles.c | 5 +++++
 src/backend/utils/fmgr/fmgr.c              | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/88379348/src/backend/access/appendonly/aosegfiles.c
----------------------------------------------------------------------
diff --git a/src/backend/access/appendonly/aosegfiles.c b/src/backend/access/appendonly/aosegfiles.c
index 993e489..7a57d96 100644
--- a/src/backend/access/appendonly/aosegfiles.c
+++ b/src/backend/access/appendonly/aosegfiles.c
@@ -1549,6 +1549,8 @@ get_ao_compression_ratio_name(PG_FUNCTION_ARGS)
 	Oid				relid;
 
 	/* Assert(Gp_role != GP_ROLE_EXECUTE); */
+	if (NULL == relname)
+		elog(ERROR, "failed to get relname for this function.");
 
 	parentrv = makeRangeVarFromNameList(textToQualifiedNameList(relname));
 	relid = RangeVarGetRelid(parentrv, false, true /*allowHcatalog*/);
@@ -1569,6 +1571,9 @@ get_ao_compression_ratio_oid(PG_FUNCTION_ARGS)
 
 	/* Assert(Gp_role != GP_ROLE_EXECUTE); */
 
+	if (!OidIsValid(relid))
+		elog(ERROR, "failed to get valid relation id for this function.");
+
 	return ao_compression_ratio_internal(relid);
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/88379348/src/backend/utils/fmgr/fmgr.c
----------------------------------------------------------------------
diff --git a/src/backend/utils/fmgr/fmgr.c b/src/backend/utils/fmgr/fmgr.c
index fe4da74..c1480dc 100644
--- a/src/backend/utils/fmgr/fmgr.c
+++ b/src/backend/utils/fmgr/fmgr.c
@@ -2025,7 +2025,7 @@ OidSendFunctionCall(Oid functionId, Datum val)
 struct varlena *
 pg_detoast_datum(struct varlena * datum)
 {
-	if (VARATT_IS_EXTENDED(datum))
+	if (NULL!=datum && VARATT_IS_EXTENDED(datum))
 		return heap_tuple_untoast_attr(datum);
 	else
 		return datum;


[2/2] incubator-hawq git commit: HAWQ-1076. Fixed privileg check for sequence function in column DEFAULT statement

Posted by ml...@apache.org.
HAWQ-1076. Fixed privileg check for sequence function in column DEFAULT statement


Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/8928e88e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/8928e88e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/8928e88e

Branch: refs/heads/master
Commit: 8928e88ea8426950bbfda3c4b6c75b70599704cb
Parents: 8837934
Author: Ming LI <ml...@apache.org>
Authored: Mon Sep 26 14:58:23 2016 +0800
Committer: Ming LI <ml...@apache.org>
Committed: Sat Oct 8 10:19:18 2016 +0800

----------------------------------------------------------------------
 src/backend/cdb/cdbquerycontextdispatching.c | 12 +++++++++---
 src/backend/utils/cache/relcache.c           |  2 +-
 2 files changed, 10 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/8928e88e/src/backend/cdb/cdbquerycontextdispatching.c
----------------------------------------------------------------------
diff --git a/src/backend/cdb/cdbquerycontextdispatching.c b/src/backend/cdb/cdbquerycontextdispatching.c
index efc6079..88d4f44 100644
--- a/src/backend/cdb/cdbquerycontextdispatching.c
+++ b/src/backend/cdb/cdbquerycontextdispatching.c
@@ -1499,8 +1499,10 @@ prepareDispatchedCatalogSingleRelation(QueryContextInfo *cxt, Oid relid,
     prepareDispatchedCatalogAttribute(cxt, relid);
 
     /* collect pg_attrdef info */
-    prepareDispatchedCatalogAttributeDefault(cxt, relid);
-
+    /* Only INSERT statement will use column default value*/
+    if(forInsert){
+		prepareDispatchedCatalogAttributeDefault(cxt, relid);
+    }
     /* collect pg_attribute_encoding info */
     prepareDispatchedCatalogAttributeEncoding(cxt, relid);
 
@@ -1854,9 +1856,13 @@ static bool collect_func_walker(Node *node, QueryContextInfo *context)
 	if (IsA(node, FuncExpr))
 	{
 		FuncExpr *func = (FuncExpr *) node;
+		AclMode needAcl = ACL_NO_RIGHTS;
 		switch (func->funcid)
 		{
+		case SETVAL_FUNC_OID:
+			needAcl = ACL_UPDATE;
 		case NEXTVAL_FUNC_OID:
+			needAcl |= ACL_USAGE;
 		{
 			Const *arg;
 			Oid seqoid;
@@ -1872,7 +1878,7 @@ static bool collect_func_walker(Node *node, QueryContextInfo *context)
 				 * aclchecks on segments defeats the purpose.  Do the aclchecks
 				 * on the master, prior to dispatch
 				 */
-				if (pg_class_aclcheck(seqoid, GetUserId(), ACL_UPDATE) != ACLCHECK_OK)
+				if (pg_class_aclcheck(seqoid, GetUserId(), needAcl) != ACLCHECK_OK)
 					ereport(ERROR,
 							(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
 							 errmsg("permission denied for sequence %s",

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/8928e88e/src/backend/utils/cache/relcache.c
----------------------------------------------------------------------
diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c
index 1a41090..95865fc 100644
--- a/src/backend/utils/cache/relcache.c
+++ b/src/backend/utils/cache/relcache.c
@@ -3265,7 +3265,7 @@ AttrDefaultFetch(Relation relation)
 	caql_endscan(pcqCtx);
 	heap_close(adrel, AccessShareLock);
 
-	if (found != ndef)
+	if (found != ndef && AmIMaster())
 		elog(WARNING, "%d attrdef record(s) missing for rel %s",
 			 ndef - found, RelationGetRelationName(relation));
 }