aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/schemacmds.c
diff options
context:
space:
mode:
authorStephen Frost <sfrost@snowman.net>2016-04-08 16:56:27 -0400
committerStephen Frost <sfrost@snowman.net>2016-04-08 16:56:27 -0400
commit293007898d3fa5a815c1c5814df53627553f114d (patch)
tree462f41b12ee37a4f0de5b6707bd49b734cb24668 /src/backend/commands/schemacmds.c
parentfa6075e5515c6878b2c1fe1c6435dd7ed847857d (diff)
downloadpostgresql-293007898d3fa5a815c1c5814df53627553f114d.tar.gz
postgresql-293007898d3fa5a815c1c5814df53627553f114d.zip
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/schemacmds.c')
-rw-r--r--src/backend/commands/schemacmds.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/backend/commands/schemacmds.c b/src/backend/commands/schemacmds.c
index a60ceb8eba7..dea3299ced5 100644
--- a/src/backend/commands/schemacmds.c
+++ b/src/backend/commands/schemacmds.c
@@ -65,6 +65,10 @@ CreateSchemaCommand(CreateSchemaStmt *stmt, const char *queryString)
else
owner_uid = saved_uid;
+ /* Additional check to protect reserved role names */
+ check_rolespec_name(stmt->authrole,
+ "Cannot specify reserved role as owner.");
+
/* fill schema name with the user name if not specified */
if (!schemaName)
{