Re: [HACKERS] Dead code in Create/RenameRole() after RoleSpec changes related to CURRENT/SESSION_USER

2015-07-20 Thread Alvaro Herrera
Jeevan Chalke wrote:

> I found some dead code in CREATE/RENAME ROLE code path.
> 
> We have introduced RoleSpec and handled public and none role names in
> grammar
> itself. We do have these handling in CreateRole() and RenameRole()
> which is NO more valid now.

Right.


> Attached patch to remove those.

Pushed.

-- 
Álvaro Herrerahttp://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


[HACKERS] Dead code in Create/RenameRole() after RoleSpec changes related to CURRENT/SESSION_USER

2015-06-09 Thread Jeevan Chalke
Hi,

I found some dead code in CREATE/RENAME ROLE code path.
Attached patch to remove those.

We have introduced RoleSpec and handled public and none role names in
grammar
itself. We do have these handling in CreateRole() and RenameRole() which is
NO more valid now.

Here is the related commit:
commit 31eae6028eca4365e7165f5f33fee1ed0486aee0
Author: Alvaro Herrera 
Date:   Mon Mar 9 15:41:54 2015 -0300

Allow CURRENT/SESSION_USER to be used in certain commands ...


Thanks

-- 
Jeevan B Chalke
Principal Software Engineer, Product Development
EnterpriseDB Corporation
The Enterprise PostgreSQL Company
diff --git a/src/backend/commands/user.c b/src/backend/commands/user.c
index 3b381c5..d232f52 100644
--- a/src/backend/commands/user.c
+++ b/src/backend/commands/user.c
@@ -311,13 +311,6 @@ CreateRole(CreateRoleStmt *stmt)
 	 errmsg("permission denied to create role")));
 	}
 
-	if (strcmp(stmt->role, "public") == 0 ||
-		strcmp(stmt->role, "none") == 0)
-		ereport(ERROR,
-(errcode(ERRCODE_RESERVED_NAME),
- errmsg("role name \"%s\" is reserved",
-		stmt->role)));
-
 	/*
 	 * Check the pg_authid relation to be certain the role doesn't already
 	 * exist.
@@ -1159,13 +1152,6 @@ RenameRole(const char *oldname, const char *newname)
 (errcode(ERRCODE_DUPLICATE_OBJECT),
  errmsg("role \"%s\" already exists", newname)));
 
-	if (strcmp(newname, "public") == 0 ||
-		strcmp(newname, "none") == 0)
-		ereport(ERROR,
-(errcode(ERRCODE_RESERVED_NAME),
- errmsg("role name \"%s\" is reserved",
-		newname)));
-
 	/*
 	 * createrole is enough privilege unless you want to mess with a superuser
 	 */

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers