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.
Date Sat, 30 Jan 2016 01:46:45 GMT
Repository: incubator-hawq
Updated Branches:
  refs/heads/HAWQ-369 cafee60ec -> 609c586de


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/609c586d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/609c586d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/609c586d

Branch: refs/heads/HAWQ-369
Commit: 609c586de1dd69a3265395af11dfd2e1aa714022
Parents: cafee60
Author: Oleksandr Diachenko <odiachenko@pivotal.io>
Authored: Fri Jan 29 17:46:35 2016 -0800
Committer: Oleksandr Diachenko <odiachenko@pivotal.io>
Committed: Fri Jan 29 17:46:35 2016 -0800

----------------------------------------------------------------------
 src/backend/commands/schemacmds.c              | 19 +++++++++++++++++++
 src/test/regress/input/hcatalog_lookup.source  |  3 +++
 src/test/regress/output/hcatalog_lookup.source |  4 +---
 3 files changed, 23 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/609c586d/src/backend/commands/schemacmds.c
----------------------------------------------------------------------
diff --git a/src/backend/commands/schemacmds.c b/src/backend/commands/schemacmds.c
index 4ce2fe1..45efafd 100644
--- a/src/backend/commands/schemacmds.c
+++ b/src/backend/commands/schemacmds.c
@@ -92,6 +92,15 @@ 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.
 	 */
@@ -388,6 +397,16 @@ 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/609c586d/src/test/regress/input/hcatalog_lookup.source
----------------------------------------------------------------------
diff --git a/src/test/regress/input/hcatalog_lookup.source b/src/test/regress/input/hcatalog_lookup.source
index 04585d1..164c7ae 100644
--- a/src/test/regress/input/hcatalog_lookup.source
+++ b/src/test/regress/input/hcatalog_lookup.source
@@ -141,6 +141,9 @@ select pg_catalog.pg_database_size(6120);
 --negative test: cannot create database named "hcatalog"
 CREATE DATABASE hcatalog;
 
+--negative test: cannot create schema named "hcatalog"
+CREATE SCHEMA hcatalog;
+
 --negative test: cannot rename exiting database to "hcatalog"
 SET gp_called_by_pgdump = true;
 ALTER DATABASE regression RENAME TO hcatalog;

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/609c586d/src/test/regress/output/hcatalog_lookup.source
----------------------------------------------------------------------
diff --git a/src/test/regress/output/hcatalog_lookup.source b/src/test/regress/output/hcatalog_lookup.source
index d980d77..2f45e17 100644
--- a/src/test/regress/output/hcatalog_lookup.source
+++ b/src/test/regress/output/hcatalog_lookup.source
@@ -268,14 +268,12 @@ select pg_catalog.pg_database_size(6120);
 ERROR:  database hcatalog (OID 6120) is reserved (SOMEFILE:SOMEFUNC)
 --negative test: cannot create database named "hcatalog"
 CREATE DATABASE hcatalog;
-ERROR:  hcatalog is a reserved name for hcatalog feature integration 
+ERROR:  hcatalog is a reserved name for hcatalog feature integration
 --negative test: cannot rename exiting database to "hcatalog"
 SET gp_called_by_pgdump = true;
-SET
 ALTER DATABASE regression RENAME TO hcatalog;
 ERROR:  hcatalog is a reserved name for hcatalog feature integration
 SET gp_called_by_pgdump = false;
-SET
 -- cleanup
 DROP schema test_schema cascade;
 NOTICE:  drop cascades to append only table test_schema.r


Mime
View raw message