summaryrefslogtreecommitdiff
path: root/src/backend/commands/tablespace.c
diff options
context:
space:
mode:
authorStephen Frost2016-04-08 20:56:27 +0000
committerStephen Frost2016-04-08 20:56:27 +0000
commit293007898d3fa5a815c1c5814df53627553f114d (patch)
tree462f41b12ee37a4f0de5b6707bd49b734cb24668 /src/backend/commands/tablespace.c
parentfa6075e5515c6878b2c1fe1c6435dd7ed847857d (diff)
Reserve the "pg_" namespace for roles
This will prevent users from creating roles which begin with "pg_" and will check for those roles before allowing an upgrade using pg_upgrade. This will allow for default roles to be provided at initdb time. Reviews by José Luis Tallón and Robert Haas
Diffstat (limited to 'src/backend/commands/tablespace.c')
-rw-r--r--src/backend/commands/tablespace.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/backend/commands/tablespace.c b/src/backend/commands/tablespace.c
index 7902d433d55..fe7f25337dc 100644
--- a/src/backend/commands/tablespace.c
+++ b/src/backend/commands/tablespace.c
@@ -256,6 +256,10 @@ CreateTableSpace(CreateTableSpaceStmt *stmt)
else
ownerId = GetUserId();
+ /* Additional check to protect reserved role names */
+ check_rolespec_name(stmt->owner,
+ "Cannot specify reserved role as owner.");
+
/* Unix-ify the offered path, and strip any trailing slashes */
location = pstrdup(stmt->location);
canonicalize_path(location);