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 02:55:46 GMT
Repository: incubator-hawq
Updated Branches:
  refs/heads/HAWQ-369 609c586de -> 272abf7e3


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

Branch: refs/heads/HAWQ-369
Commit: 272abf7e3171b0bfeb7e2c29e77cc371969bc5e4
Parents: 609c586
Author: Oleksandr Diachenko <odiachenko@pivotal.io>
Authored: Fri Jan 29 18:55:42 2016 -0800
Committer: Oleksandr Diachenko <odiachenko@pivotal.io>
Committed: Fri Jan 29 18:55:42 2016 -0800

----------------------------------------------------------------------
 src/backend/commands/dbcommands.c              |  8 ++++++++
 src/test/regress/input/hcatalog_lookup.source  | 18 +++++++++++++++++-
 src/test/regress/output/hcatalog_lookup.source | 19 ++++++++++++++++++-
 3 files changed, 43 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/272abf7e/src/backend/commands/dbcommands.c
----------------------------------------------------------------------
diff --git a/src/backend/commands/dbcommands.c b/src/backend/commands/dbcommands.c
index aa16cee..e7d56da 100644
--- a/src/backend/commands/dbcommands.c
+++ b/src/backend/commands/dbcommands.c
@@ -1540,6 +1540,7 @@ RenameDatabase(const char *oldname, const char *newname)
 	cqContext	cqc;
 	cqContext  *pcqCtx;
 
+
 	/*
 	 * Make sure "hcatalog" is not used as new name, because it's reserved for
 	 * hcatalog feature integration*/
@@ -1569,6 +1570,13 @@ RenameDatabase(const char *oldname, const char *newname)
 		ereport(ERROR,
 				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
 				 errmsg("current database may not be renamed")));
+	/*
+	 * "hcatalog" database cannot be renamed
+	 * */
+	if (db_id == HcatalogDbOid)
+		ereport(ERROR,
+				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("permission denied to ALTER DATABASE hcatalog is reserved for system use")));
 
 	/*
 	 * Make sure the database does not have active sessions.  This is the same

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/272abf7e/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 164c7ae..372e5bb 100644
--- a/src/test/regress/input/hcatalog_lookup.source
+++ b/src/test/regress/input/hcatalog_lookup.source
@@ -144,9 +144,25 @@ CREATE DATABASE hcatalog;
 --negative test: cannot create schema named "hcatalog"
 CREATE SCHEMA hcatalog;
 
---negative test: cannot rename exiting database to "hcatalog"
+--allow renaming schemas and databases
 SET gp_called_by_pgdump = true;
+
+--negative test: cannot rename exiting database to "hcatalog"
 ALTER DATABASE regression RENAME TO hcatalog;
+
+--negative test: cannot rename exiting schema to "hcatalog"
+ALTER SCHEMA regression RENAME TO hcatalog;
+
+--negative test: cannot rename exiting schema to "hcatalog"
+ALTER DATABASE hcatalog RENAME to hcatalog1;
+
+--negative test: cannot connect to "hcatalog" database
+\connect hcatalog;
+
+--negative test: cannot create a database using "hcatalog" as a template
+CREATE DATABASE hcatalog2 TEMPLATE hcatalog;
+
+--restrict renaming schemas and databases
 SET gp_called_by_pgdump = false;
 
 -- cleanup

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/272abf7e/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 2f45e17..c545b07 100644
--- a/src/test/regress/output/hcatalog_lookup.source
+++ b/src/test/regress/output/hcatalog_lookup.source
@@ -269,10 +269,27 @@ 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
---negative test: cannot rename exiting database to "hcatalog"
+--negative test: cannot create schema named "hcatalog"
+CREATE SCHEMA hcatalog;
+ERROR:  hcatalog is a reserved name for hcatalog feature integration
+--allow renaming schemas and databases
 SET gp_called_by_pgdump = true;
+--negative test: cannot rename exiting database to "hcatalog"
 ALTER DATABASE regression RENAME TO hcatalog;
 ERROR:  hcatalog is a reserved name for hcatalog feature integration
+--negative test: cannot rename exiting schema to "hcatalog"
+ALTER SCHEMA regression RENAME TO hcatalog;
+ERROR:  hcatalog is a reserved name for hcatalog feature integration
+--negative test: cannot rename exiting schema to "hcatalog"
+ALTER DATABASE hcatalog RENAME to hcatalog1;
+ERROR:  permission denied to ALTER DATABASE hcatalog is reserved for system use
+--negative test: cannot connect to "hcatalog" database
+\connect hcatalog;
+ERROR:  hcatalog database is only for system use
+--negative test: cannot create a database using "hcatalog" as a template
+CREATE DATABASE hcatalog2 TEMPLATE hcatalog;
+ERROR: hcatalog database is only for system use and cannot be used as template
+--restrict renaming schemas and databases
 SET gp_called_by_pgdump = false;
 -- cleanup
 DROP schema test_schema cascade;


Mime
View raw message