You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hawq.apache.org by sh...@apache.org on 2016/02/10 22:43:16 UTC
incubator-hawq git commit: HAWQ-405. Fix for handling of pg_temp
schema
Repository: incubator-hawq
Updated Branches:
refs/heads/HAWQ-405 [created] d431585ec
HAWQ-405. Fix for handling of pg_temp schema
Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/d431585e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/d431585e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/d431585e
Branch: refs/heads/HAWQ-405
Commit: d431585ecd451549419081316eab7308249e4284
Parents: 3426cb0
Author: Shivram Mani <sh...@gmail.com>
Authored: Wed Feb 10 13:43:04 2016 -0800
Committer: Shivram Mani <sh...@gmail.com>
Committed: Wed Feb 10 13:43:04 2016 -0800
----------------------------------------------------------------------
src/backend/catalog/namespace.c | 39 ++++++++++++++++++------------------
1 file changed, 20 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/d431585e/src/backend/catalog/namespace.c
----------------------------------------------------------------------
diff --git a/src/backend/catalog/namespace.c b/src/backend/catalog/namespace.c
index 401218c..3ca640c 100644
--- a/src/backend/catalog/namespace.c
+++ b/src/backend/catalog/namespace.c
@@ -1495,18 +1495,34 @@ LookupInternalNamespaceId(const char *nspname)
Oid
LookupNamespaceId(const char *nspname, Oid dboid)
{
- if(gp_upgrade_mode){
+
+ /* check for pg_temp alias */
+ if (NSPDBOID_CURRENT == dboid && strcmp(nspname, "pg_temp") == 0)
+ {
+ if (TempNamespaceValid(true))
+ return myTempNamespace;
+ /*
+ * Since this is used only for looking up existing objects, there
+ * is no point in trying to initialize the temp namespace here;
+ * and doing so might create problems for some callers.
+ * Just fall through and give the "does not exist" error.
+ */
+ }
+
+ if(gp_upgrade_mode)
+ {
// This code is only need at hawq2.0 upgrade, in this case the old pg_namespace doesn't
// have column nspdboid, so we report error in else clause
- if(ObjectIdGetDatum(dboid)==NSPDBOID_CURRENT){
+ if(ObjectIdGetDatum(dboid)==NSPDBOID_CURRENT)
+ {
return caql_getoid(
NULL,
cql("SELECT oid FROM pg_namespace "
" WHERE nspname = :1",
CStringGetDatum((char *) nspname)));
- }else{
- elog(ERROR, "Upgrade cann't process the namespace: %s in dbid: %i", nspname, dboid);
}
+ else
+ elog(ERROR, "Upgrade cann't process the namespace: %s in dbid: %i", nspname, dboid);
}
return caql_getoid(
NULL,
@@ -1530,21 +1546,6 @@ LookupExplicitNamespace(const char *nspname, Oid dboid)
Oid namespaceId;
AclResult aclresult;
- /* check for pg_temp alias */
- if (NSPDBOID_CURRENT == dboid && strcmp(nspname, "pg_temp") == 0)
- {
- if (TempNamespaceValid(true))
- {
- return myTempNamespace;
- }
- /*
- * Since this is used only for looking up existing objects, there
- * is no point in trying to initialize the temp namespace here;
- * and doing so might create problems for some callers.
- * Just fall through and give the "does not exist" error.
- */
- }
-
namespaceId = LookupNamespaceId(nspname, dboid);
if (!OidIsValid(namespaceId))