hawq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From esp...@apache.org
Subject [15/35] incubator-hawq git commit: HAWQ-1329. pg_catalog view fallback failed.
Date Sun, 19 Feb 2017 23:07:50 GMT
HAWQ-1329. pg_catalog view fallback failed.


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

Branch: refs/heads/2.1.0.0-incubating
Commit: 17a9dc1e570fdbb3dc550b46c96c3b57c4df7013
Parents: 492b1a7
Author: stanlyxiang <stanly.sxiang@gmail.com>
Authored: Tue Feb 14 16:13:52 2017 +0800
Committer: Wen Lin <wlin@pivotal.io>
Committed: Tue Feb 14 16:52:28 2017 +0800

----------------------------------------------------------------------
 src/backend/catalog/aclchk.c | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/17a9dc1e/src/backend/catalog/aclchk.c
----------------------------------------------------------------------
diff --git a/src/backend/catalog/aclchk.c b/src/backend/catalog/aclchk.c
index 416e0c4..6712cc8 100644
--- a/src/backend/catalog/aclchk.c
+++ b/src/backend/catalog/aclchk.c
@@ -2707,6 +2707,8 @@ List *getActionName(AclMode mask)
   return actions;
 }
 
+#define FALLBACK_IS_TRUE(x)        x == PG_CATALOG_NAMESPACE || x == information_schema_namespcace_oid
\
+                                || x == PG_AOSEGMENT_NAMESPACE || x == PG_TOAST_NAMESPACE
|| x == PG_BITMAPINDEX_NAMESPACE
 
 bool fallBackToNativeCheck(AclObjectKind objkind, Oid obj_oid, Oid roleid)
 {
@@ -2720,20 +2722,18 @@ bool fallBackToNativeCheck(AclObjectKind objkind, Oid obj_oid, Oid
roleid)
   /* for heap table, we fall back to native check. */
   if (objkind == ACL_KIND_CLASS)
   {
-    char relstorage = get_rel_relstorage(obj_oid);
-    if (relstorage == 'h')
-    {
-      return true;
-    }
+      Oid namespaceid = get_rel_namespace(obj_oid);
+      if(FALLBACK_IS_TRUE(namespaceid))
+      {
+          return true;
+      }
   }
   else if (objkind == ACL_KIND_NAMESPACE)
   {
     /* native check build-in schemas. */
-    if (obj_oid == PG_CATALOG_NAMESPACE || obj_oid == information_schema_namespcace_oid
-            || obj_oid == PG_AOSEGMENT_NAMESPACE || obj_oid == PG_TOAST_NAMESPACE
-            || obj_oid == PG_BITMAPINDEX_NAMESPACE)
+    if(FALLBACK_IS_TRUE(obj_oid))
     {
-      return true;
+        return true;
     }
     else if (obj_oid == PG_PUBLIC_NAMESPACE && superuser())
     {
@@ -2745,9 +2745,7 @@ bool fallBackToNativeCheck(AclObjectKind objkind, Oid obj_oid, Oid roleid)
   {
     /* native check functions under build-in schemas. */
     Oid namespaceid = get_func_namespace(obj_oid);
-    if (namespaceid == PG_CATALOG_NAMESPACE || namespaceid == information_schema_namespcace_oid
-            || namespaceid == PG_AOSEGMENT_NAMESPACE || namespaceid == PG_TOAST_NAMESPACE
-            || namespaceid == PG_BITMAPINDEX_NAMESPACE)
+    if (FALLBACK_IS_TRUE(namespaceid))
     {
       return true;
     }


Mime
View raw message