Skip to content

Commit 7df974e

Browse files
committed
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.
1 parent 9eb7a0a commit 7df974e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/bin/initdb/initdb.c

+6
Original file line numberDiff line numberDiff line change
@@ -3562,6 +3562,12 @@ main(int argc, char *argv[])
35623562
if (strlen(username) == 0)
35633563
username = effective_user;
35643564

3565+
if (strncmp(username, "pg_", 3) == 0)
3566+
{
3567+
fprintf(stderr, _("%s: superuser name \"%s\" is reserved; role names can not begin with 'pg_'\n"), progname, username);
3568+
exit(1);
3569+
}
3570+
35653571
printf(_("The files belonging to this database system will be owned "
35663572
"by user \"%s\".\n"
35673573
"This user must also own the server process.\n\n"),

0 commit comments

Comments
 (0)