hawq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From odiache...@apache.org
Subject incubator-hawq git commit: HAWQ-369. Hcatalog as reserved name need regression tests. [Forced Update!]
Date Mon, 01 Feb 2016 23:14:24 GMT
Repository: incubator-hawq
Updated Branches:
  refs/heads/HAWQ-369 94d1701ee -> 988c5a252 (forced update)


HAWQ-369. Hcatalog as reserved name need regression tests.


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

Branch: refs/heads/HAWQ-369
Commit: 988c5a252249ddb037e58aca214c43c515c1108f
Parents: 00001b8
Author: Oleksandr Diachenko <odiachenko@pivotal.io>
Authored: Mon Feb 1 13:09:53 2016 -0800
Committer: Oleksandr Diachenko <odiachenko@pivotal.io>
Committed: Mon Feb 1 15:14:20 2016 -0800

----------------------------------------------------------------------
 src/backend/commands/dbcommands.c |  4 ++--
 src/backend/commands/schemacmds.c | 19 -------------------
 src/backend/utils/init/postinit.c | 16 ++++++++++++++++
 src/include/utils/errcodes.h      |  1 -
 4 files changed, 18 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/988c5a25/src/backend/commands/dbcommands.c
----------------------------------------------------------------------
diff --git a/src/backend/commands/dbcommands.c b/src/backend/commands/dbcommands.c
index d20accb..6047c3c 100644
--- a/src/backend/commands/dbcommands.c
+++ b/src/backend/commands/dbcommands.c
@@ -852,10 +852,10 @@ createdb(CreatedbStmt *stmt)
 	 * because it's already reserved for hcatalog feature integration.
 	 */
 	if (OidIsValid(get_database_oid(dbname)))
-			if (strcmp(dbname, "hcatalog") == 0)
+			if (strcmp(dbname, HcatalogDbName) == 0)
 				ereport(ERROR,
 						(errcode(ERRCODE_RESERVED_HCATALOG_NAME),
-						 errmsg("hcatalog is a reserved name for hcatalog feature integration")));
+						 errmsg("\"%s\" is a reserved name for hcatalog feature integration", HcatalogDbName)));
 			else
 				ereport(ERROR,
 						(errcode(ERRCODE_DUPLICATE_DATABASE),

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/988c5a25/src/backend/commands/schemacmds.c
----------------------------------------------------------------------
diff --git a/src/backend/commands/schemacmds.c b/src/backend/commands/schemacmds.c
index 45efafd..4ce2fe1 100644
--- a/src/backend/commands/schemacmds.c
+++ b/src/backend/commands/schemacmds.c
@@ -92,15 +92,6 @@ CreateSchemaCommand(CreateSchemaStmt *stmt, const char *queryString)
 		owner_uid = saved_uid;
 
 	/* 
-	 * Make sure schema name is not "hcatalog"
-	 */
-	if (strcmp(schemaName, "hcatalog") == 0)
-	{
-		ereport(ERROR,
-				(errcode(ERRCODE_RESERVED_HCATALOG_NAME),
-				 errmsg("hcatalog is a reserved name for hcatalog feature integration")));
-	}
-	/*
 	 * If we are creating a temporary schema then we can skip a 
 	 * bunch of checks that we would otherwise make.
 	 */
@@ -397,16 +388,6 @@ RenameSchema(const char *oldname, const char *newname)
 				 errdetail("Schema %s is reserved for system use.", oldname)));
 	}
 
-	/*
-	* Make sure new schema name is not "hcatalog"
-	*/
-	if (strcmp(newname, "hcatalog") == 0)
-	{
-		ereport(ERROR,
-				(errcode(ERRCODE_RESERVED_HCATALOG_NAME),
-				errmsg("hcatalog is a reserved name for hcatalog feature integration")));
-	}
-
 	if (!allowSystemTableModsDDL &&
 		(IsReservedName(newname) || strcmp(newname, "madlib") == 0))
 	{

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/988c5a25/src/backend/utils/init/postinit.c
----------------------------------------------------------------------
diff --git a/src/backend/utils/init/postinit.c b/src/backend/utils/init/postinit.c
index e4d0752..3d93f3f 100644
--- a/src/backend/utils/init/postinit.c
+++ b/src/backend/utils/init/postinit.c
@@ -368,6 +368,22 @@ InitPostgres(const char *in_dbname, Oid dboid, const char *username,
 	char		dbname[NAMEDATALEN];
 
 	/*
+	 * User is not supposed to connect to hcatalog database,
+	 * because it's reserved for hcatalog feature integration
+	 */
+	if (!bootstrap)
+	{
+		if (strcmp(dbname, HcatalogDbName) == 0)
+		{
+			ereport(ERROR,
+					(errcode(ERRCODE_UNDEFINED_DATABASE),
+					errmsg("\"%s\" database is only for system use",
+					HcatalogDbName)));
+		}
+	}
+
+
+	/*
 	 * Set up the global variables holding database id and path.  But note we
 	 * won't actually try to touch the database just yet.
 	 *

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/988c5a25/src/include/utils/errcodes.h
----------------------------------------------------------------------
diff --git a/src/include/utils/errcodes.h b/src/include/utils/errcodes.h
index 2be7ee4..b13cf02 100644
--- a/src/include/utils/errcodes.h
+++ b/src/include/utils/errcodes.h
@@ -294,7 +294,6 @@
 #define ERRCODE_INVALID_NAME				MAKE_SQLSTATE('4','2', '6','0','2')
 #define ERRCODE_NAME_TOO_LONG				MAKE_SQLSTATE('4','2', '6','2','2')
 #define ERRCODE_RESERVED_NAME				MAKE_SQLSTATE('4','2', '9','3','9')
-#define ERRCODE_RESERVED_HCATALOG_NAME		MAKE_SQLSTATE('4','2', '9','4','0')
 #define ERRCODE_DATATYPE_MISMATCH			MAKE_SQLSTATE('4','2', '8','0','4')
 #define ERRCODE_INDETERMINATE_DATATYPE		MAKE_SQLSTATE('4','2', 'P','1','8')
 #define ERRCODE_WRONG_OBJECT_TYPE			MAKE_SQLSTATE('4','2', '8','0','9')


Mime
View raw message