*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/catalog/aclchk.c,v 1.140 2007/08/21 01:11:13 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/aclchk.c,v 1.141 2007/10/12 18:55:11 tgl Exp $
*
* NOTES
* See acl.h.
Acl *acl;
Oid ownerId;
- /*
- * Only shared relations can be stored in global space; don't let even
- * superusers override this
- */
- if (spc_oid == GLOBALTABLESPACE_OID && !IsBootstrapProcessingMode())
- return 0;
-
- /* Otherwise, superusers bypass all permission checking. */
+ /* Superusers bypass all permission checking. */
if (superuser_arg(roleid))
return mask;
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/catalog/heap.c,v 1.323 2007/09/08 20:31:14 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/heap.c,v 1.324 2007/10/12 18:55:11 tgl Exp $
*
*
* INTERFACE ROUTINES
#include "catalog/pg_inherits.h"
#include "catalog/pg_namespace.h"
#include "catalog/pg_statistic.h"
+#include "catalog/pg_tablespace.h"
#include "catalog/pg_type.h"
#include "commands/tablecmds.h"
#include "commands/typecmds.h"
"with any existing type.")));
}
+ /*
+ * Validate shared/non-shared tablespace (must check this before doing
+ * GetNewRelFileNode, to prevent Assert therein)
+ */
+ if (shared_relation)
+ {
+ if (reltablespace != GLOBALTABLESPACE_OID)
+ /* elog since this is not a user-facing error */
+ elog(ERROR,
+ "shared relations must be placed in pg_global tablespace");
+ }
+ else
+ {
+ if (reltablespace == GLOBALTABLESPACE_OID)
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+ errmsg("only shared relations can be placed in pg_global tablespace")));
+ }
+
/*
* Allocate an OID for the relation, unless we were told what to use.
*
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/catalog/index.c,v 1.285 2007/09/20 17:56:30 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/index.c,v 1.286 2007/10/12 18:55:12 tgl Exp $
*
*
* INTERFACE ROUTINES
#include "catalog/pg_constraint.h"
#include "catalog/pg_operator.h"
#include "catalog/pg_opclass.h"
+#include "catalog/pg_tablespace.h"
#include "catalog/pg_type.h"
#include "executor/executor.h"
#include "miscadmin.h"
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
errmsg("shared indexes cannot be created after initdb")));
+ /*
+ * Validate shared/non-shared tablespace (must check this before doing
+ * GetNewRelFileNode, to prevent Assert therein)
+ */
+ if (shared_relation)
+ {
+ if (tableSpaceId != GLOBALTABLESPACE_OID)
+ /* elog since this is not a user-facing error */
+ elog(ERROR,
+ "shared relations must be placed in pg_global tablespace");
+ }
+ else
+ {
+ if (tableSpaceId == GLOBALTABLESPACE_OID)
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+ errmsg("only shared relations can be placed in pg_global tablespace")));
+ }
+
if (get_relname_relid(indexRelationName, namespaceId))
ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_TABLE),
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
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
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
#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"
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.