aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2007-10-12 18:55:12 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2007-10-12 18:55:12 +0000
commit6daef2bca400600b8a3d34ad8cceafd6bdaf049f (patch)
treed477ba933f812d3f7c844ca728e13c7d89c54f68 /src/backend/commands
parent2b0c86b66563cf2fd430ba47e6637846e512ee53 (diff)
downloadpostgresql-6daef2bca400600b8a3d34ad8cceafd6bdaf049f.tar.gz
postgresql-6daef2bca400600b8a3d34ad8cceafd6bdaf049f.zip
Remove hack in pg_tablespace_aclmask() that disallowed permissions
on pg_global even to superusers, and replace it with checks in various other places to complain about invalid uses of pg_global. This ends up being a bit more code but it allows a more specific error message to be given, and it un-breaks pg_tablespace_size() on pg_global. Per discussion.
Diffstat (limited to 'src/backend/commands')
-rw-r--r--src/backend/commands/dbcommands.c8
-rw-r--r--src/backend/commands/tablecmds.c9
2 files changed, 15 insertions, 2 deletions
diff --git a/src/backend/commands/dbcommands.c b/src/backend/commands/dbcommands.c
index 094f51b5cc9..434e9838947 100644
--- a/src/backend/commands/dbcommands.c
+++ b/src/backend/commands/dbcommands.c
@@ -13,7 +13,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.199 2007/09/28 22:25:49 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.200 2007/10/12 18:55:12 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -302,6 +302,12 @@ createdb(const CreatedbStmt *stmt)
aclcheck_error(aclresult, ACL_KIND_TABLESPACE,
tablespacename);
+ /* pg_global must never be the default tablespace */
+ if (dst_deftablespace == GLOBALTABLESPACE_OID)
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+ errmsg("pg_global cannot be used as default tablespace")));
+
/*
* If we are trying to change the default tablespace of the template,
* we require that the template not have any files in the new default
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index ea8d7f60898..0af90cb4ac6 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.233 2007/09/29 17:18:58 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.234 2007/10/12 18:55:12 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -29,6 +29,7 @@
#include "catalog/pg_inherits.h"
#include "catalog/pg_namespace.h"
#include "catalog/pg_opclass.h"
+#include "catalog/pg_tablespace.h"
#include "catalog/pg_trigger.h"
#include "catalog/pg_type.h"
#include "catalog/toasting.h"
@@ -5824,6 +5825,12 @@ ATExecSetTableSpace(Oid tableOid, Oid newTableSpace)
errmsg("cannot move system relation \"%s\"",
RelationGetRelationName(rel))));
+ /* Can't move a non-shared relation into pg_global */
+ if (newTableSpace == GLOBALTABLESPACE_OID)
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+ errmsg("only shared relations can be placed in pg_global tablespace")));
+
/*
* Don't allow moving temp tables of other backends ... their local buffer
* manager is not going to cope.