diff options
author | Stephen Frost | 2016-05-08 15:55:44 +0000 |
---|---|---|
committer | Stephen Frost | 2016-05-08 15:55:44 +0000 |
commit | 7df974ee0bfd8978830b941e7af5697fd4268656 (patch) | |
tree | 03e8c15ec4e64d3c4c03ddbcf78408b7be48049b | |
parent | 9eb7a0ac6b24804dcc90e42e533aa1b7b585d8e2 (diff) |
Disallow superuser names starting with 'pg_' in initdb
As with CREATE ROLE, disallow users from specifying initial
superuser names which begin with 'pg_' in initdb.
Per discussion with Tom.
-rw-r--r-- | src/bin/initdb/initdb.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c index 299ddfe86ac..7dedd8adc63 100644 --- a/src/bin/initdb/initdb.c +++ b/src/bin/initdb/initdb.c @@ -3562,6 +3562,12 @@ main(int argc, char *argv[]) if (strlen(username) == 0) username = effective_user; + if (strncmp(username, "pg_", 3) == 0) + { + fprintf(stderr, _("%s: superuser name \"%s\" is reserved; role names can not begin with 'pg_'\n"), progname, username); + exit(1); + } + printf(_("The files belonging to this database system will be owned " "by user \"%s\".\n" "This user must also own the server process.\n\n"), |