postgres.git / summary / log / commit / refs
commit 7df974ee0bfd8978830b941e7af5697fd4268656
Author: Stephen Frost <sfrost@snowman.net>
Date: Sun May 08 15:55:44 2016 +0000
First released in: 9.6.0
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.
src/bin/initdb/initdb.c | 6 ++++++
1 file changed, 6 insertions(+)
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"),
[parent: 9eb7a0ac6b24]